]> gitweb.factorcode.org Git - factor-unmaintained.git/commitdiff
unmaintained: New home for misfit Factor vocabularies.
authorDoug Coleman <doug.coleman@gmail.com>
Sun, 4 Jun 2017 20:42:09 +0000 (15:42 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Sun, 4 Jun 2017 20:42:09 +0000 (15:42 -0500)
509 files changed:
4DNav/4DNav-docs.factor [new file with mode: 0644]
4DNav/4DNav.factor [new file with mode: 0644]
4DNav/authors.txt [new file with mode: 0644]
4DNav/camera/authors.txt [new file with mode: 0644]
4DNav/camera/camera-docs.factor [new file with mode: 0644]
4DNav/camera/camera.factor [new file with mode: 0644]
4DNav/deep/deep-docs.factor [new file with mode: 0644]
4DNav/deep/deep.factor [new file with mode: 0644]
4DNav/deploy.factor [new file with mode: 0644]
4DNav/file-chooser/authors.txt [new file with mode: 0644]
4DNav/file-chooser/file-chooser.factor [new file with mode: 0644]
4DNav/hypercube.xml [new file with mode: 0644]
4DNav/light_test.xml [new file with mode: 0644]
4DNav/multi solids.xml [new file with mode: 0644]
4DNav/prismetriagone.xml [new file with mode: 0644]
4DNav/space-file-decoder/authors.txt [new file with mode: 0644]
4DNav/space-file-decoder/space-file-decoder-docs.factor [new file with mode: 0644]
4DNav/space-file-decoder/space-file-decoder.factor [new file with mode: 0644]
4DNav/summary.txt [new file with mode: 0644]
4DNav/tags.txt [new file with mode: 0644]
4DNav/triancube.xml [new file with mode: 0644]
4DNav/turtle/authors.txt [new file with mode: 0644]
4DNav/turtle/turtle-docs.factor [new file with mode: 0644]
4DNav/turtle/turtle.factor [new file with mode: 0644]
4DNav/window3D/authors.txt [new file with mode: 0644]
4DNav/window3D/window3D-docs.factor [new file with mode: 0644]
4DNav/window3D/window3D.factor [new file with mode: 0644]
L-system/L-system.factor [new file with mode: 0644]
L-system/models/abop-1/abop-1.factor [new file with mode: 0644]
L-system/models/abop-2/abop-2.factor [new file with mode: 0644]
L-system/models/abop-3/abop-3.factor [new file with mode: 0644]
L-system/models/abop-4/abop-4.factor [new file with mode: 0644]
L-system/models/abop-5-angular/abop-5-angular.factor [new file with mode: 0644]
L-system/models/abop-5/abop-5.factor [new file with mode: 0644]
L-system/models/abop-6/abop-6.factor [new file with mode: 0644]
L-system/models/airhorse/airhorse.factor [new file with mode: 0644]
L-system/models/tree-5/tree-5.factor [new file with mode: 0644]
LICENSE
adsoda/adsoda-docs.factor [new file with mode: 0644]
adsoda/adsoda-tests.factor [new file with mode: 0644]
adsoda/adsoda.factor [new file with mode: 0644]
adsoda/adsoda.tests [new file with mode: 0644]
adsoda/authors.txt [new file with mode: 0644]
adsoda/combinators/authors.txt [new file with mode: 0644]
adsoda/combinators/combinators-docs.factor [new file with mode: 0644]
adsoda/combinators/combinators-tests.factor [new file with mode: 0644]
adsoda/combinators/combinators.factor [new file with mode: 0644]
adsoda/solution2/solution2.factor [new file with mode: 0644]
adsoda/solution2/summary.txt [new file with mode: 0644]
adsoda/summary.txt [new file with mode: 0644]
adsoda/tags.txt [new file with mode: 0644]
adsoda/tools/authors.txt [new file with mode: 0644]
adsoda/tools/tools-docs.factor [new file with mode: 0644]
adsoda/tools/tools-tests.factor [new file with mode: 0644]
adsoda/tools/tools.factor [new file with mode: 0644]
advice/advice-docs.factor [new file with mode: 0644]
advice/advice-tests.factor [new file with mode: 0644]
advice/advice.factor [new file with mode: 0644]
advice/authors.txt [new file with mode: 0644]
advice/summary.txt [new file with mode: 0644]
advice/tags.txt [new file with mode: 0644]
alien/cxx/authors.txt [new file with mode: 0644]
alien/cxx/cxx.factor [new file with mode: 0644]
alien/cxx/parser/authors.txt [new file with mode: 0644]
alien/cxx/parser/parser.factor [new file with mode: 0644]
alien/cxx/syntax/authors.txt [new file with mode: 0644]
alien/cxx/syntax/syntax-tests.factor [new file with mode: 0644]
alien/cxx/syntax/syntax.factor [new file with mode: 0644]
alien/inline/authors.txt [new file with mode: 0644]
alien/inline/compiler/authors.txt [new file with mode: 0644]
alien/inline/compiler/compiler-docs.factor [new file with mode: 0644]
alien/inline/compiler/compiler.factor [new file with mode: 0644]
alien/inline/inline-docs.factor [new file with mode: 0644]
alien/inline/inline.factor [new file with mode: 0644]
alien/inline/syntax/authors.txt [new file with mode: 0644]
alien/inline/syntax/syntax-docs.factor [new file with mode: 0644]
alien/inline/syntax/syntax-tests.factor [new file with mode: 0644]
alien/inline/syntax/syntax.factor [new file with mode: 0644]
alien/inline/types/authors.txt [new file with mode: 0644]
alien/inline/types/types.factor [new file with mode: 0644]
alien/marshall/authors.txt [new file with mode: 0644]
alien/marshall/marshall-docs.factor [new file with mode: 0644]
alien/marshall/marshall.factor [new file with mode: 0644]
alien/marshall/private/authors.txt [new file with mode: 0644]
alien/marshall/private/private.factor [new file with mode: 0644]
alien/marshall/structs/authors.txt [new file with mode: 0644]
alien/marshall/structs/structs-docs.factor [new file with mode: 0644]
alien/marshall/structs/structs.factor [new file with mode: 0644]
alien/marshall/syntax/authors.txt [new file with mode: 0644]
alien/marshall/syntax/syntax-docs.factor [new file with mode: 0644]
alien/marshall/syntax/syntax-tests.factor [new file with mode: 0644]
alien/marshall/syntax/syntax.factor [new file with mode: 0644]
animations/animations-docs.factor [new file with mode: 0644]
animations/animations.factor [new file with mode: 0644]
animations/authors.txt [new file with mode: 0644]
arm/4/4.factor [new file with mode: 0644]
arm/4/authors.txt [new file with mode: 0644]
arm/4/summary.txt [new file with mode: 0644]
arm/allot/allot.factor [new file with mode: 0644]
arm/allot/authors.txt [new file with mode: 0644]
arm/architecture/architecture.factor [new file with mode: 0644]
arm/architecture/authors.txt [new file with mode: 0644]
arm/arm.factor [new file with mode: 0644]
arm/authors.txt [new file with mode: 0644]
arm/bootstrap.factor [new file with mode: 0644]
arm/intrinsics/authors.txt [new file with mode: 0644]
arm/intrinsics/intrinsics.factor [new file with mode: 0644]
arm/summary.txt [new file with mode: 0644]
arm/tags.txt [new file with mode: 0644]
automata/authors.txt [new file with mode: 0644]
automata/automata.factor [new file with mode: 0644]
automata/summary.txt [new file with mode: 0644]
automata/ui/authors.txt [new file with mode: 0644]
automata/ui/deploy.factor [new file with mode: 0644]
automata/ui/tags.txt [new file with mode: 0644]
automata/ui/ui.factor [new file with mode: 0644]
boolean-expr/authors.txt [new file with mode: 0644]
boolean-expr/boolean-expr.factor [new file with mode: 0644]
boolean-expr/summary.txt [new file with mode: 0644]
bubble-chamber/bubble-chamber.factor [new file with mode: 0644]
bubble-chamber/hadron-chamber/hadron-chamber.factor [new file with mode: 0644]
bubble-chamber/hadron-chamber/tags.txt [new file with mode: 0644]
bubble-chamber/large/large.factor [new file with mode: 0644]
bubble-chamber/large/tags.txt [new file with mode: 0644]
bubble-chamber/medium/medium.factor [new file with mode: 0644]
bubble-chamber/medium/tags.txt [new file with mode: 0644]
bubble-chamber/original/original.factor [new file with mode: 0644]
bubble-chamber/original/tags.txt [new file with mode: 0644]
bubble-chamber/quark-chamber/quark-chamber.factor [new file with mode: 0644]
bubble-chamber/quark-chamber/tags.txt [new file with mode: 0644]
bubble-chamber/small/small.factor [new file with mode: 0644]
bubble-chamber/small/tags.txt [new file with mode: 0644]
bubble-chamber/ten-hadrons/tags.txt [new file with mode: 0644]
bubble-chamber/ten-hadrons/ten-hadrons.factor [new file with mode: 0644]
cartesian/cartesian.factor [new file with mode: 0644]
cfdg/authors.txt [new file with mode: 0644]
cfdg/cfdg.factor [new file with mode: 0644]
cfdg/gl/authors.txt [new file with mode: 0644]
cfdg/gl/gl.factor [new file with mode: 0644]
cfdg/models/aqua-star/aqua-star.factor [new file with mode: 0644]
cfdg/models/aqua-star/authors.txt [new file with mode: 0644]
cfdg/models/aqua-star/tags.txt [new file with mode: 0644]
cfdg/models/chiaroscuro/authors.txt [new file with mode: 0644]
cfdg/models/chiaroscuro/chiaroscuro.factor [new file with mode: 0644]
cfdg/models/chiaroscuro/tags.txt [new file with mode: 0644]
cfdg/models/flower6/authors.txt [new file with mode: 0644]
cfdg/models/flower6/deploy.factor [new file with mode: 0644]
cfdg/models/flower6/flower6.factor [new file with mode: 0644]
cfdg/models/flower6/tags.txt [new file with mode: 0644]
cfdg/models/game1-turn6/authors.txt [new file with mode: 0644]
cfdg/models/game1-turn6/game1-turn6.factor [new file with mode: 0644]
cfdg/models/game1-turn6/tags.txt [new file with mode: 0644]
cfdg/models/lesson/authors.txt [new file with mode: 0644]
cfdg/models/lesson/lesson.factor [new file with mode: 0644]
cfdg/models/lesson/tags.txt [new file with mode: 0644]
cfdg/models/rules08/rules08.factor [new file with mode: 0644]
cfdg/models/rules08/tags.txt [new file with mode: 0644]
cfdg/models/sierpinski/authors.txt [new file with mode: 0644]
cfdg/models/sierpinski/sierpinski.factor [new file with mode: 0644]
cfdg/models/sierpinski/tags.txt [new file with mode: 0644]
cfdg/models/snowflake/authors.txt [new file with mode: 0644]
cfdg/models/snowflake/snowflake.factor [new file with mode: 0644]
cfdg/models/snowflake/tags.txt [new file with mode: 0644]
cfdg/models/spirales/spirales.factor [new file with mode: 0644]
cfdg/models/spirales/tags.txt [new file with mode: 0644]
cfdg/summary.txt [new file with mode: 0644]
closures/closures.factor [new file with mode: 0644]
cont-responder/callbacks-tests.factor [new file with mode: 0644]
cont-responder/callbacks.factor [new file with mode: 0644]
cryptlib/authors.txt [new file with mode: 0644]
cryptlib/cryptlib-tests.factor [new file with mode: 0644]
cryptlib/cryptlib.factor [new file with mode: 0644]
cryptlib/libcl/libcl.factor [new file with mode: 0644]
cryptlib/notes.txt [new file with mode: 0644]
cryptlib/streams/streams.factor [new file with mode: 0644]
cryptlib/streams/tags.txt [new file with mode: 0644]
cryptlib/summary.txt [new file with mode: 0644]
cryptlib/tags.txt [new file with mode: 0644]
cryptlib/test/keys.p15 [new file with mode: 0644]
cryptlib/test/large_data.txt [new file with mode: 0644]
db/mysql/ffi/ffi.factor [new file with mode: 0644]
db/mysql/lib/lib.factor [new file with mode: 0644]
db/mysql/mysql.factor [new file with mode: 0644]
dns/cache/nx/nx.factor [new file with mode: 0644]
dns/cache/rr/rr.factor [new file with mode: 0644]
dns/dns.factor [new file with mode: 0644]
dns/forwarding/forwarding.factor [new file with mode: 0644]
dns/misc/misc.factor [new file with mode: 0644]
dns/resolver/resolver.factor [new file with mode: 0644]
dns/server/server.factor [new file with mode: 0644]
dns/stub/stub.factor [new file with mode: 0644]
dns/util/util.factor [new file with mode: 0644]
dragdrop-listener/dragdrop-listener.factor [new file with mode: 0644]
dragdrop-listener/platforms.txt [new file with mode: 0644]
drills/deployed/deploy.factor [new file with mode: 0644]
drills/deployed/deployed.factor [new file with mode: 0644]
drills/deployed/tags.txt [new file with mode: 0644]
drills/drills.factor [new file with mode: 0644]
drills/tags.txt [new file with mode: 0644]
easy-help/easy-help.factor [new file with mode: 0644]
easy-help/expand-markup/expand-markup.factor [new file with mode: 0644]
fonts/syntax/authors.txt [new file with mode: 0644]
fonts/syntax/summary.txt [new file with mode: 0644]
fonts/syntax/syntax-docs.factor [new file with mode: 0644]
fonts/syntax/syntax.factor [new file with mode: 0644]
frame-buffer/frame-buffer.factor [new file with mode: 0644]
fries/authors.txt [new file with mode: 0644]
fries/fries.factor [new file with mode: 0644]
fries/summary.txt [new file with mode: 0644]
gir/samples/lowlevel/gstreamer/authors.txt [new file with mode: 0644]
gir/samples/lowlevel/gstreamer/gstreamer.factor [new file with mode: 0644]
golden-section/authors.txt [new file with mode: 0644]
golden-section/deploy.factor [new file with mode: 0644]
golden-section/golden-section.factor [new file with mode: 0644]
golden-section/summary.txt [new file with mode: 0644]
golden-section/tags.txt [new file with mode: 0644]
graph-theory/authors.txt [new file with mode: 0644]
graph-theory/graph-theory-docs.factor [new file with mode: 0644]
graph-theory/graph-theory.factor [new file with mode: 0644]
graph-theory/reversals/reversals.factor [new file with mode: 0644]
graph-theory/sparse/sparse.factor [new file with mode: 0644]
graph-theory/summary.txt [new file with mode: 0644]
graph-theory/tags.txt [new file with mode: 0644]
gstreamer/plugins/app/GstApp-0.10.gir [new file with mode: 0644]
gstreamer/plugins/app/app.factor [new file with mode: 0644]
gstreamer/plugins/app/ffi/ffi.factor [new file with mode: 0644]
gstreamer/plugins/audio/GstAudio-0.10.gir [new file with mode: 0644]
gstreamer/plugins/audio/audio.factor [new file with mode: 0644]
gstreamer/plugins/audio/ffi/ffi.factor [new file with mode: 0644]
gstreamer/plugins/fft/GstFft-0.10.gir [new file with mode: 0644]
gstreamer/plugins/fft/ffi/ffi.factor [new file with mode: 0644]
gstreamer/plugins/fft/fft.factor [new file with mode: 0644]
gstreamer/plugins/interfaces/GstInterfaces-0.10.gir [new file with mode: 0644]
gstreamer/plugins/interfaces/ffi/ffi.factor [new file with mode: 0644]
gstreamer/plugins/interfaces/interfaces.factor [new file with mode: 0644]
gstreamer/plugins/netbuffer/GstNetbuffer-0.10.gir [new file with mode: 0644]
gstreamer/plugins/netbuffer/ffi/ffi.factor [new file with mode: 0644]
gstreamer/plugins/netbuffer/netbuffer.factor [new file with mode: 0644]
gstreamer/plugins/pbutils/GstPbutils-0.10.gir [new file with mode: 0644]
gstreamer/plugins/pbutils/ffi/ffi.factor [new file with mode: 0644]
gstreamer/plugins/pbutils/pbutils.factor [new file with mode: 0644]
gstreamer/plugins/riff/GstRiff-0.10.gir [new file with mode: 0644]
gstreamer/plugins/riff/ffi/ffi.factor [new file with mode: 0644]
gstreamer/plugins/riff/riff.factor [new file with mode: 0644]
gstreamer/plugins/rtp/GstRtp-0.10.gir [new file with mode: 0644]
gstreamer/plugins/rtp/ffi/ffi.factor [new file with mode: 0644]
gstreamer/plugins/rtp/rtp.factor [new file with mode: 0644]
gstreamer/plugins/rtsp/GstRtsp-0.10.gir [new file with mode: 0644]
gstreamer/plugins/rtsp/ffi/ffi.factor [new file with mode: 0644]
gstreamer/plugins/rtsp/rtsp.factor [new file with mode: 0644]
gstreamer/plugins/sdp/GstSdp-0.10.gir [new file with mode: 0644]
gstreamer/plugins/sdp/ffi/ffi.factor [new file with mode: 0644]
gstreamer/plugins/sdp/sdp.factor [new file with mode: 0644]
gstreamer/plugins/tag/GstTag-0.10.gir [new file with mode: 0644]
gstreamer/plugins/tag/ffi/ffi.factor [new file with mode: 0644]
gstreamer/plugins/tag/tag.factor [new file with mode: 0644]
gstreamer/plugins/video/GstVideo-0.10.gir [new file with mode: 0644]
gstreamer/plugins/video/ffi/ffi.factor [new file with mode: 0644]
gstreamer/plugins/video/video.factor [new file with mode: 0644]
headers/authors.txt [new file with mode: 0644]
headers/bsd/authors.txt [new file with mode: 0644]
headers/bsd/bsd.factor [new file with mode: 0644]
headers/headers.factor [new file with mode: 0644]
images/jpeg/jpeg.factor [new file with mode: 0644]
images/processing/rotation/authors.txt [new file with mode: 0644]
images/processing/rotation/rotation-tests.factor [new file with mode: 0644]
images/processing/rotation/rotation.factor [new file with mode: 0644]
images/processing/rotation/test-bitmaps/PastedImage.bmp [new file with mode: 0644]
images/processing/rotation/test-bitmaps/PastedImage90.bmp [new file with mode: 0644]
images/processing/rotation/test-bitmaps/lake.bmp [new file with mode: 0644]
images/processing/rotation/test-bitmaps/small-rotated.bmp [new file with mode: 0644]
images/processing/rotation/test-bitmaps/small.bmp [new file with mode: 0644]
irc-ui/authors.txt [new file with mode: 0644]
irc-ui/commandparser/commandparser.factor [new file with mode: 0644]
irc-ui/commands/commands.factor [new file with mode: 0644]
irc-ui/ircui-rc [new file with mode: 0644]
irc-ui/load/load.factor [new file with mode: 0644]
irc-ui/summary.txt [new file with mode: 0644]
irc-ui/ui.factor [new file with mode: 0644]
javascriptcore/authors.txt [new file with mode: 0644]
javascriptcore/core-foundation/authors.txt [new file with mode: 0644]
javascriptcore/core-foundation/core-foundation.factor [new file with mode: 0644]
javascriptcore/core-foundation/platforms.txt [new file with mode: 0644]
javascriptcore/ffi/authors.txt [new file with mode: 0644]
javascriptcore/ffi/ffi.factor [new file with mode: 0644]
javascriptcore/ffi/hack/authors.txt [new file with mode: 0644]
javascriptcore/ffi/hack/hack.factor [new file with mode: 0644]
javascriptcore/ffi/hack/platforms.txt [new file with mode: 0644]
javascriptcore/ffi/platforms.txt [new file with mode: 0644]
javascriptcore/javascriptcore-tests.factor [new file with mode: 0644]
javascriptcore/javascriptcore.factor [new file with mode: 0644]
javascriptcore/platforms.txt [new file with mode: 0644]
jni/jni-internals.factor [new file with mode: 0644]
jni/jni.factor [new file with mode: 0644]
jni/load.factor [new file with mode: 0644]
ldap/authors.txt [new file with mode: 0644]
ldap/conf/addentry.ldif [new file with mode: 0644]
ldap/conf/createdit.ldif [new file with mode: 0644]
ldap/conf/slapd.conf [new file with mode: 0644]
ldap/ldap-tests.factor [new file with mode: 0644]
ldap/ldap.factor [new file with mode: 0644]
ldap/libldap/authors.txt [new file with mode: 0644]
ldap/libldap/libldap.factor [new file with mode: 0644]
ldap/libldap/tags.txt [new file with mode: 0644]
ldap/summary.txt [new file with mode: 0644]
ldap/tags.txt [new file with mode: 0644]
llvm/authors.txt [new file with mode: 0644]
llvm/clang/ffi/ffi.factor [new file with mode: 0644]
llvm/clang/ffi/platforms.txt [new file with mode: 0644]
llvm/core/core.factor [new file with mode: 0644]
llvm/core/tags.txt [new file with mode: 0644]
llvm/engine/engine.factor [new file with mode: 0644]
llvm/engine/tags.txt [new file with mode: 0644]
llvm/invoker/invoker-tests.factor [new file with mode: 0644]
llvm/invoker/invoker.factor [new file with mode: 0644]
llvm/invoker/tags.txt [new file with mode: 0644]
llvm/jit/jit-tests.factor [new file with mode: 0644]
llvm/jit/jit.factor [new file with mode: 0644]
llvm/jit/tags.txt [new file with mode: 0644]
llvm/reader/add.bc [new file with mode: 0644]
llvm/reader/add.ll [new file with mode: 0644]
llvm/reader/reader.factor [new file with mode: 0644]
llvm/reader/tags.txt [new file with mode: 0644]
llvm/tags.txt [new file with mode: 0644]
llvm/types/tags.txt [new file with mode: 0644]
llvm/types/types-tests.factor [new file with mode: 0644]
llvm/types/types.factor [new file with mode: 0644]
llvm/wrappers/tags.txt [new file with mode: 0644]
llvm/wrappers/wrappers-tests.factor [new file with mode: 0644]
llvm/wrappers/wrappers.factor [new file with mode: 0644]
math/derivatives/authors.txt [new file with mode: 0644]
math/derivatives/derivatives-docs.factor [new file with mode: 0644]
math/derivatives/derivatives-tests.factor [new file with mode: 0644]
math/derivatives/derivatives.factor [new file with mode: 0644]
math/newtons-method/authors.txt [new file with mode: 0644]
math/newtons-method/newtons-method.factor [new file with mode: 0644]
models/combinators/authors.txt [new file with mode: 0644]
models/combinators/combinators-docs.factor [new file with mode: 0644]
models/combinators/combinators.factor [new file with mode: 0644]
models/combinators/summary.txt [new file with mode: 0644]
models/combinators/templates/templates.factor [new file with mode: 0644]
modules/rpc-server/authors.txt [new file with mode: 0644]
modules/rpc-server/rpc-server-docs.factor [new file with mode: 0644]
modules/rpc-server/rpc-server.factor [new file with mode: 0644]
modules/rpc-server/summary.txt [new file with mode: 0644]
modules/rpc/authors.txt [new file with mode: 0644]
modules/rpc/rpc-docs.factor [new file with mode: 0644]
modules/rpc/rpc.factor [new file with mode: 0644]
modules/rpc/summary.txt [new file with mode: 0644]
modules/using/authors.txt [new file with mode: 0644]
modules/using/summary.txt [new file with mode: 0644]
modules/using/using-docs.factor [new file with mode: 0644]
modules/using/using.factor [new file with mode: 0644]
mongodb/gridfs/gridfs/gridfs.factor [new file with mode: 0644]
mongodb/gridfs/gridfs/unmaintained-reason.txt [new file with mode: 0644]
multi-method-syntax/multi-method-syntax.factor [new file with mode: 0644]
ogg/player/authors.txt [new file with mode: 0644]
ogg/player/player.factor [new file with mode: 0644]
ogg/player/summary.txt [new file with mode: 0644]
ogg/player/tags.txt [new file with mode: 0644]
opengl-gadgets/gadgets-tests.factor [new file with mode: 0644]
opengl-gadgets/gadgets.factor [new file with mode: 0644]
oracle/authors.txt [new file with mode: 0644]
oracle/liboci/authors.txt [new file with mode: 0644]
oracle/liboci/liboci.factor [new file with mode: 0644]
oracle/oracle-tests.factor [new file with mode: 0644]
oracle/oracle.factor [new file with mode: 0644]
oracle/summary.txt [new file with mode: 0644]
oracle/tags.txt [new file with mode: 0644]
ori/authors.txt [new file with mode: 0644]
ori/ori-tests.factor [new file with mode: 0644]
ori/ori.factor [new file with mode: 0644]
pdf/authors.txt [new file with mode: 0644]
pdf/libhpdf/libhpdf.factor [new file with mode: 0644]
pdf/pdf-tests.factor [new file with mode: 0644]
pdf/pdf.factor [new file with mode: 0644]
pdf/readme.txt [new file with mode: 0644]
peg-lexer/authors.txt [new file with mode: 0644]
peg-lexer/peg-lexer-docs.factor [new file with mode: 0644]
peg-lexer/peg-lexer-tests.factor [new file with mode: 0644]
peg-lexer/peg-lexer.factor [new file with mode: 0644]
peg-lexer/summary.txt [new file with mode: 0644]
peg-lexer/tags.txt [new file with mode: 0644]
peg-lexer/test-parsers/test-parsers.factor [new file with mode: 0644]
persistency/authors.txt [new file with mode: 0644]
persistency/persistency.factor [new file with mode: 0644]
physics/pos/pos.factor [new file with mode: 0644]
physics/vel/vel.factor [new file with mode: 0644]
random-weighted/authors.txt [new file with mode: 0644]
random-weighted/random-weighted.factor [new file with mode: 0644]
recipes/authors.txt [new file with mode: 0644]
recipes/icons/back.tiff [new file with mode: 0644]
recipes/icons/hate.tiff [new file with mode: 0644]
recipes/icons/love.tiff [new file with mode: 0644]
recipes/icons/more.tiff [new file with mode: 0644]
recipes/icons/submit.tiff [new file with mode: 0644]
recipes/recipes.factor [new file with mode: 0644]
recipes/summary.txt [new file with mode: 0644]
run-desc/run-desc.factor [new file with mode: 0644]
sandbox/authors.txt [new file with mode: 0644]
sandbox/sandbox-tests.factor [new file with mode: 0644]
sandbox/sandbox.factor [new file with mode: 0644]
sandbox/summary.txt [new file with mode: 0644]
sandbox/syntax/syntax.factor [new file with mode: 0644]
semantic-db/authors.txt [new file with mode: 0644]
semantic-db/semantic-db-tests.factor [new file with mode: 0644]
semantic-db/semantic-db.factor [new file with mode: 0644]
set-n/set-n.factor [new file with mode: 0644]
size-of/size-of.factor [new file with mode: 0644]
sniffer/channels/backend/backend.factor [new file with mode: 0644]
sniffer/channels/bsd/bsd.factor [new file with mode: 0644]
sniffer/channels/sniffer.factor [new file with mode: 0644]
sniffer/io/authors.txt [new file with mode: 0644]
sniffer/io/backend/authors.txt [new file with mode: 0644]
sniffer/io/backend/backend.factor [new file with mode: 0644]
sniffer/io/bsd/authors.txt [new file with mode: 0644]
sniffer/io/bsd/bsd.factor [new file with mode: 0644]
sniffer/io/filter/authors.txt [new file with mode: 0644]
sniffer/io/filter/backend/authors.txt [new file with mode: 0644]
sniffer/io/filter/backend/backend.factor [new file with mode: 0644]
sniffer/io/filter/bsd/authors.txt [new file with mode: 0644]
sniffer/io/filter/bsd/bsd.factor [new file with mode: 0644]
sniffer/io/filter/filter.factor [new file with mode: 0644]
sniffer/io/sniffer.factor [new file with mode: 0644]
specialized/specialized.factor [new file with mode: 0644]
springies/authors.txt [new file with mode: 0644]
springies/models/2snake/2snake.factor [new file with mode: 0644]
springies/models/2snake/authors.txt [new file with mode: 0644]
springies/models/2snake/tags.txt [new file with mode: 0644]
springies/models/2x2snake/2x2snake.factor [new file with mode: 0644]
springies/models/2x2snake/authors.txt [new file with mode: 0644]
springies/models/2x2snake/deploy.factor [new file with mode: 0644]
springies/models/2x2snake/tags.txt [new file with mode: 0644]
springies/models/3snake/3snake.factor [new file with mode: 0644]
springies/models/3snake/authors.txt [new file with mode: 0644]
springies/models/3snake/tags.txt [new file with mode: 0644]
springies/models/ball/authors.txt [new file with mode: 0644]
springies/models/ball/ball.factor [new file with mode: 0644]
springies/models/ball/tags.txt [new file with mode: 0644]
springies/models/belt-tire/authors.txt [new file with mode: 0644]
springies/models/belt-tire/belt-tire.factor [new file with mode: 0644]
springies/models/belt-tire/deploy.factor [new file with mode: 0644]
springies/models/belt-tire/tags.txt [new file with mode: 0644]
springies/models/nifty/authors.txt [new file with mode: 0644]
springies/models/nifty/nifty.factor [new file with mode: 0644]
springies/models/nifty/tags.txt [new file with mode: 0644]
springies/models/urchin/authors.txt [new file with mode: 0644]
springies/models/urchin/tags.txt [new file with mode: 0644]
springies/models/urchin/urchin.factor [new file with mode: 0644]
springies/springies.factor [new file with mode: 0644]
springies/summary.txt [new file with mode: 0644]
springies/tags.txt [new file with mode: 0644]
springies/ui/authors.txt [new file with mode: 0644]
springies/ui/ui.factor [new file with mode: 0644]
sto/sto.factor [new file with mode: 0644]
sudokus/authors.txt [new file with mode: 0644]
sudokus/sudokus.factor [new file with mode: 0644]
sudokus/summary.txt [new file with mode: 0644]
tabs/authors.txt [new file with mode: 0644]
tabs/summary.txt [new file with mode: 0644]
tabs/tabs.factor [new file with mode: 0644]
tangle/authors.txt [new file with mode: 0644]
tangle/html/html-tests.factor [new file with mode: 0644]
tangle/html/html.factor [new file with mode: 0644]
tangle/menu/menu.factor [new file with mode: 0644]
tangle/page/page.factor [new file with mode: 0644]
tangle/path/path.factor [new file with mode: 0644]
tangle/resources/jquery-1.2.3.min.js [new file with mode: 0644]
tangle/resources/weave.html [new file with mode: 0644]
tangle/resources/weave.js [new file with mode: 0644]
tangle/sandbox/sandbox.factor [new file with mode: 0644]
tangle/summary.txt [new file with mode: 0644]
tangle/tangle-tests.factor [new file with mode: 0644]
tangle/tangle.factor [new file with mode: 0644]
triggers/authors.txt [new file with mode: 0644]
triggers/summary.txt [new file with mode: 0644]
triggers/triggers-tests.factor [new file with mode: 0644]
triggers/triggers.factor [new file with mode: 0644]
ui/gadgets/alerts/alerts.factor [new file with mode: 0644]
ui/gadgets/alerts/authors.txt [new file with mode: 0644]
ui/gadgets/alerts/summary.txt [new file with mode: 0644]
ui/gadgets/comboboxes/authors.txt [new file with mode: 0644]
ui/gadgets/comboboxes/comboboxes.factor [new file with mode: 0644]
ui/gadgets/comboboxes/summary.txt [new file with mode: 0644]
ui/gadgets/controls/authors.txt [new file with mode: 0644]
ui/gadgets/controls/controls-docs.factor [new file with mode: 0644]
ui/gadgets/controls/controls.factor [new file with mode: 0644]
ui/gadgets/controls/summary.txt [new file with mode: 0644]
ui/gadgets/corners/authors.txt [new file with mode: 0644]
ui/gadgets/corners/corners.factor [new file with mode: 0644]
ui/gadgets/layout/authors.txt [new file with mode: 0644]
ui/gadgets/layout/layout-docs.factor [new file with mode: 0644]
ui/gadgets/layout/layout.factor [new file with mode: 0644]
ui/gadgets/layout/summary.txt [new file with mode: 0644]
ui/gadgets/plot/plot.factor [new file with mode: 0644]
ui/gadgets/poppers/authors.txt [new file with mode: 0644]
ui/gadgets/poppers/poppers.factor [new file with mode: 0644]
ui/gadgets/tiling/tiling.factor [new file with mode: 0644]
ui/offscreen/authors.txt [new file with mode: 0644]
ui/offscreen/offscreen-docs.factor [new file with mode: 0644]
ui/offscreen/offscreen.factor [new file with mode: 0644]
ui/offscreen/summary.txt [new file with mode: 0644]
ui/offscreen/tags.txt [new file with mode: 0644]
update/backup/backup.factor [new file with mode: 0644]
update/latest/latest.factor [new file with mode: 0644]
update/update.factor [new file with mode: 0644]
update/util/util.factor [new file with mode: 0644]
webapps/numbers/authors.txt [new file with mode: 0644]
webapps/numbers/numbers.factor [new file with mode: 0644]

diff --git a/4DNav/4DNav-docs.factor b/4DNav/4DNav-docs.factor
new file mode 100644 (file)
index 0000000..6f63f2e
--- /dev/null
@@ -0,0 +1,201 @@
+! Copyright (C) 2008 Jean-François Bigot.
+! See http://factorcode.org/license.txt for BSD license.
+USING: help.markup help.syntax kernel quotations strings ;
+IN: 4DNav
+
+
+HELP: menu-3D
+{ $values
+     { "gadget" "gadget" }
+}
+{ $description "The menu dedicated to 3D movements of the camera" } ;
+
+HELP: menu-4D
+{ $values
+    
+     { "gadget" "gadget" }
+}
+{ $description "The menu dedicated to 4D movements of space" } ;
+
+HELP: menu-bar
+{ $values
+    
+     { "gadget" "gadget" }
+}
+{ $description "return gadget containing menu buttons" } ;
+
+HELP: model-projection
+{ $values
+     { "x" "interger" }
+     { "space" "space" }
+}
+{ $description "Project space following coordinate x" } ;
+
+HELP: mvt-3D-1
+{ $values
+    
+     { "quot" "quotation" }
+}
+{ $description "return a quotation to orientate space to see it from first point of view" } ;
+
+HELP: mvt-3D-2
+{ $values
+    
+     { "quot" "quotation" }
+}
+{ $description "return a quotation to orientate space to see it from second point of view" } ;
+
+HELP: mvt-3D-3
+{ $values
+    
+     { "quot" "quotation" }
+}
+{ $description "return a quotation to orientate space to see it from third point of view" } ;
+
+HELP: mvt-3D-4
+{ $values
+    
+     { "quot" "quotation" }
+}
+{ $description "return a quotation to orientate space to see it from first point of view" } ;
+
+HELP: load-model-file
+{ $description "load space from file" } ;
+
+HELP: rotation-4D
+{ $values
+     { "m" "a rotation matrix" }
+}
+{ $description "Apply a 4D rotation matrix" } ;
+
+HELP: translation-4D
+{ $values
+     { "v" "vector" }
+}
+{ $description "Apply a 4D translation" } ;
+
+
+ARTICLE: "implementation details" "How 4DNav is done"
+"4DNav is build using :"
+
+{ $subsections
+    "4DNav.camera"
+    "adsoda-main-page"
+}
+;
+
+ARTICLE: "Space file" "Create a new space file"
+"To build a new space, create an XML file using " { $vocab-link "adsoda" } " model description. A solid is not caracterized by its corners but is defined as the intersection of hyperplanes."
+
+$nl
+"An example is:"
+{ $code """
+<model>
+<space>
+ <dimension>4</dimension>
+ <solid>
+     <name>4cube1</name>
+     <dimension>4</dimension>
+     <face>1,0,0,0,100</face>
+     <face>-1,0,0,0,-150</face>
+     <face>0,1,0,0,100</face>
+     <face>0,-1,0,0,-150</face>
+     <face>0,0,1,0,100</face>
+     <face>0,0,-1,0,-150</face>
+     <face>0,0,0,1,100</face>
+     <face>0,0,0,-1,-150</face>
+     <color>1,0,0</color>
+ </solid>
+ <solid>
+     <name>4triancube</name>
+     <dimension>4</dimension>
+     <face>1,0,0,0,160</face>
+     <face>-0.4999999999999998,-0.8660254037844387,0,0,-130</face>
+     <face>-0.5000000000000004,0.8660254037844384,0,0,-130</face>
+     <face>0,0,1,0,140</face>
+     <face>0,0,-1,0,-180</face>
+     <face>0,0,0,1,110</face>
+     <face>0,0,0,-1,-180</face>
+     <color>0,1,0</color>
+ </solid>
+ <solid>
+     <name>triangone</name>
+     <dimension>4</dimension>
+     <face>1,0,0,0,60</face>
+     <face>0.5,0.8660254037844386,0,0,60</face>
+     <face>-0.5,0.8660254037844387,0,0,-20</face>
+     <face>-1.0,0,0,0,-100</face>
+     <face>-0.5,-0.8660254037844384,0,0,-100</face>
+     <face>0.5,-0.8660254037844387,0,0,-20</face>
+     <face>0,0,1,0,120</face>
+     <face>0,0,-0.4999999999999998,-0.8660254037844387,-120</face>
+     <face>0,0,-0.5000000000000004,0.8660254037844384,-120</face>
+     <color>0,1,1</color>
+ </solid>
+ <light>
+     <direction>1,1,1,1</direction>
+     <color>0.2,0.2,0.6</color>
+ </light>
+ <color>0.8,0.9,0.9</color>
+</space>
+</model>""" } ;
+
+ARTICLE: "TODO" "Todo"
+{ $list 
+    "A vocab to initialize parameters"
+    "an editor mode" 
+        { $list "add a face to a solid"
+                "add a solid to the space"
+                "move a face"
+                "move a solid"
+                "select a solid in a list"
+                "select a face"
+                "display selected face"
+                "edit a solid color"
+                "add a light"
+                "edit a light color"
+                "move a light"
+                }
+    "add a tool wich give an hyperplane normal vector with enought points. Will use adsoda.intersect-hyperplanes with { { 0 } { 0 } { 1 } } "
+    "decorrelate 3D camera and activate them with select buttons"
+
+} ;
+
+
+ARTICLE: "4DNav" "The 4DNav app"
+{ $vocab-link "4DNav" }
+$nl
+{ $heading "4D Navigator" }
+"4DNav is a simple tool to visualize 4 dimensionnal objects."
+$nl
+"It uses " { $vocab-link "adsoda" } " library to display a 4D space and navigate thru it."
+$nl
+"It will display:"
+{ $list
+    { "a menu window" }
+    {  "4 visualization windows" }
+}
+"Each visualization window represents the projection of the 4D space on a particular 3D space."
+
+{ $heading "Start" }
+"type:" { $code "\"4DNav\" run" } 
+
+{ $heading "Navigation" }
+"Menu window is divided in 4 areas"
+{ $list
+    { "a space-file chooser to select the file to display" }
+    { "a parametrization area to select the projection mode" }
+    { "4D submenu to translate and rotate the 4D space" }
+    { "3D submenu to move the camera in 3D space. Cameras in every 3D spaces are manipulated as a single one" }
+    }
+
+{ $heading "Links" }
+{ $subsections
+    "Space file"
+    "TODO"
+    "implementation details"
+}
+
+;
+
+ABOUT: "4DNav"
diff --git a/4DNav/4DNav.factor b/4DNav/4DNav.factor
new file mode 100644 (file)
index 0000000..8ba0788
--- /dev/null
@@ -0,0 +1,567 @@
+! Copyright (C) 2008 Jeff Bigot
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel 
+namespaces
+accessors
+assocs
+make
+math
+math.functions
+math.trig
+math.parser
+hashtables
+sequences
+combinators
+continuations
+colors
+colors.constants
+prettyprint
+vars
+quotations
+io
+io.directories
+io.pathnames
+help.markup
+io.files
+ui.gadgets.panes
+ ui
+       ui.gadgets
+       ui.traverse
+       ui.gadgets.borders
+       ui.gadgets.frames
+       ui.gadgets.tracks
+       ui.gadgets.labels
+       ui.gadgets.labeled       
+       ui.gadgets.lists
+       ui.gadgets.buttons
+       ui.gadgets.packs
+       ui.gadgets.grids
+       ui.gadgets.corners
+       ui.gestures
+       ui.gadgets.scrollers
+splitting
+vectors
+math.vectors
+values
+4DNav.turtle
+4DNav.window3D
+4DNav.deep
+4DNav.space-file-decoder
+models
+fry
+adsoda
+adsoda.tools
+;
+QUALIFIED-WITH: ui.pens.solid s
+QUALIFIED-WITH: ui.gadgets.wrappers w
+
+
+IN: 4DNav
+VALUE: selected-file
+VALUE: translation-step
+VALUE: rotation-step
+
+3 \ translation-step set-value
+5 \ rotation-step set-value
+
+VAR: selected-file-model
+VAR: observer3d 
+VAR: view1 
+VAR: view2
+VAR: view3
+VAR: view4
+VAR: present-space
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! namespace utilities
+
+: closed-quot ( quot -- quot )
+  namestack swap '[ namestack [ _ set-namestack @ ] dip set-namestack ] ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! waiting for deep-cleave-quots
+
+: 4D-Rxy ( angle -- Rx ) deg>rad
+[ 1.0 , 0.0 , 0.0       , 0.0 ,
+  0.0 , 1.0 , 0.0       , 0.0 ,
+  0.0 , 0.0 , dup cos  , dup sin neg  ,
+  0.0 , 0.0 , dup sin  , dup cos  ,  ] 4 make-matrix nip ;
+
+: 4D-Rxz ( angle -- Ry ) deg>rad
+[ 1.0 , 0.0       , 0.0 , 0.0 ,
+  0.0 , dup cos  , 0.0 , dup sin neg  ,
+  0.0 , 0.0       , 1.0 , 0.0 ,
+  0.0 , dup sin  , 0.0 , dup cos  ,  ] 4 make-matrix nip ;
+
+: 4D-Rxw ( angle -- Rz ) deg>rad
+[ 1.0 , 0.0       , 0.0           , 0.0 ,
+  0.0 , dup cos  , dup sin neg  , 0.0 ,
+  0.0 , dup sin  , dup cos     , 0.0 ,
+  0.0 , 0.0       , 0.0           , 1.0 , ] 4 make-matrix nip ;
+
+: 4D-Ryz ( angle -- Rx ) deg>rad
+[ dup cos  , 0.0 , 0.0 , dup sin neg  ,
+  0.0       , 1.0 , 0.0 , 0.0 ,
+  0.0       , 0.0 , 1.0 , 0.0 ,
+  dup sin  , 0.0 , 0.0 , dup cos  ,   ] 4 make-matrix nip ;
+
+: 4D-Ryw ( angle -- Ry ) deg>rad
+[ dup cos  , 0.0 , dup sin neg  , 0.0 ,
+  0.0       , 1.0 , 0.0           , 0.0 ,
+  dup sin  , 0.0 , dup cos     , 0.0 ,
+  0.0       , 0.0 , 0.0        , 1.0 ,  ] 4 make-matrix nip ;
+
+: 4D-Rzw ( angle -- Rz ) deg>rad
+[ dup cos  , dup sin neg  , 0.0 , 0.0 ,
+  dup sin  , dup cos     , 0.0 , 0.0 ,
+  0.0       , 0.0           , 1.0 , 0.0 ,
+  0.0       , 0.0          , 0.0 , 1.0 ,  ] 4 make-matrix nip ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! UI
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: button* ( string quot -- button ) 
+    closed-quot <repeat-button>  ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! 
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: model-projection-chooser ( -- gadget )
+   observer3d> projection-mode>>
+   { { 1 "perspective" } { 0 "orthogonal" } } 
+   <radio-buttons> ;
+
+: collision-detection-chooser ( -- gadget )
+   observer3d> collision-mode>>
+   { { t "on" } { f "off" }  } <radio-buttons> ;
+
+: model-projection ( x -- space ) 
+    present-space>  swap space-project ;
+
+: update-observer-projections (  -- )
+    view1> relayout-1 
+    view2> relayout-1 
+    view3> relayout-1 
+    view4> relayout-1 ;
+
+: update-model-projections (  -- )
+    0 model-projection <model> view1> model<<
+    1 model-projection <model> view2> model<<
+    2 model-projection <model> view3> model<<
+    3 model-projection <model> view4> model<< ;
+
+: camera-action ( quot -- quot ) 
+    '[ drop _ observer3d>  
+    with-self update-observer-projections ] 
+    closed-quot ;
+
+: win3D ( text gadget -- ) 
+    "navigateur 4D : " rot append open-window ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! 4D object manipulation
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: (mvt-4D) ( quot -- )   
+    present-space>  
+        swap call space-ensure-solids 
+    >present-space 
+    update-model-projections 
+    update-observer-projections ; inline
+
+: rotation-4D ( m -- ) 
+    '[ _ [ [ middle-of-space dup vneg ] keep 
+        swap space-translate ] dip
+         space-transform 
+         swap space-translate
+    ] (mvt-4D) ;
+
+: translation-4D ( v -- ) '[ _ space-translate ] (mvt-4D) ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! menu
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: menu-rotations-4D ( -- gadget )
+    3 3 <frame>
+        { 1 1 } >>filled-cell
+         <pile> 1 >>fill
+          "XY +" [ drop rotation-step 4D-Rxy rotation-4D ] 
+                button* add-gadget
+          "XY -" [ drop rotation-step neg 4D-Rxy rotation-4D ] 
+                button* add-gadget 
+       @top-left grid-add    
+        <pile> 1 >>fill
+          "XZ +" [ drop rotation-step 4D-Rxz rotation-4D ] 
+                button* add-gadget
+          "XZ -" [ drop rotation-step neg 4D-Rxz rotation-4D ] 
+                button* add-gadget 
+       @top grid-add    
+        <pile> 1 >>fill
+          "YZ +" [ drop rotation-step 4D-Ryz rotation-4D ] 
+                button* add-gadget
+          "YZ -" [ drop rotation-step neg 4D-Ryz rotation-4D ] 
+                button* add-gadget 
+        @center grid-add
+         <pile> 1 >>fill
+          "XW +" [ drop rotation-step 4D-Rxw rotation-4D ] 
+                button* add-gadget
+          "XW -" [ drop rotation-step neg 4D-Rxw rotation-4D ] 
+                button* add-gadget 
+        @top-right grid-add   
+         <pile> 1 >>fill
+          "YW +" [ drop rotation-step 4D-Ryw rotation-4D ] 
+                button* add-gadget
+          "YW -" [ drop rotation-step neg 4D-Ryw rotation-4D ] 
+                button* add-gadget 
+       @right grid-add    
+         <pile> 1 >>fill
+          "ZW +" [ drop rotation-step 4D-Rzw rotation-4D ] 
+                button* add-gadget
+          "ZW -" [ drop rotation-step neg 4D-Rzw rotation-4D ] 
+                button* add-gadget 
+       @bottom-right grid-add    
+;
+
+: menu-translations-4D ( -- gadget )
+    3 3 <frame> 
+        { 1 1 } >>filled-cell
+        <pile> 1 >>fill
+            <shelf> 1 >>fill  
+                "X+" [ drop {  1 0 0 0 } translation-step v*n 
+                    translation-4D ] 
+                    button* add-gadget
+                "X-" [ drop { -1 0 0 0 } translation-step v*n 
+                    translation-4D ] 
+                    button* add-gadget 
+            add-gadget
+            "YZW" <label> add-gadget
+         @bottom-right grid-add
+         <pile> 1 >>fill
+            "XZW" <label> add-gadget
+            <shelf> 1 >>fill
+                "Y+" [ drop  { 0  1 0 0 } translation-step v*n 
+                    translation-4D ] 
+                    button* add-gadget
+                "Y-" [ drop  { 0 -1 0 0 } translation-step v*n 
+                    translation-4D ] 
+                    button* add-gadget 
+                add-gadget
+         @top-right grid-add
+         <pile> 1 >>fill
+            "XYW" <label> add-gadget
+            <shelf> 1 >>fill
+                "Z+" [ drop { 0 0  1 0 } translation-step v*n 
+                    translation-4D ] 
+                    button* add-gadget
+                "Z-" [ drop { 0 0 -1 0 } translation-step v*n 
+                    translation-4D ] 
+                    button* add-gadget 
+                add-gadget                 
+        @top-left grid-add     
+        <pile> 1 >>fill
+            <shelf> 1 >>fill
+                "W+" [ drop { 0 0 0 1  } translation-step v*n 
+                    translation-4D ] 
+                    button* add-gadget
+                "W-" [ drop { 0 0 0 -1 } translation-step v*n 
+                    translation-4D ] 
+                    button* add-gadget 
+                add-gadget
+            "XYZ" <label> add-gadget
+        @bottom-left grid-add 
+        "X" <label> @center grid-add
+;
+
+: menu-4D ( -- gadget )  
+    <shelf> 
+        "rotations" <label>     add-gadget
+        menu-rotations-4D       add-gadget
+        "translations" <label>  add-gadget
+        menu-translations-4D    add-gadget
+        0.5 >>align
+        { 0 10 } >>gap
+;
+
+
+! ------------------------------------------------------
+
+: redraw-model ( space -- )
+    >present-space 
+    update-model-projections 
+    update-observer-projections ;
+
+: load-model-file ( -- )
+  selected-file dup selected-file-model> set-model 
+  read-model-file 
+  redraw-model ;
+
+: mvt-3D-X ( turn pitch -- quot )
+    '[ turtle-pos> norm neg reset-turtle 
+        _ turn-left 
+        _ pitch-up 
+        step-turtle ] ;
+
+: mvt-3D-1 ( -- quot )      90  0 mvt-3D-X ; inline
+: mvt-3D-2 ( -- quot )      0  90 mvt-3D-X ; inline
+: mvt-3D-3 ( -- quot )      0   0 mvt-3D-X ; inline
+: mvt-3D-4 ( -- quot )      45 45 mvt-3D-X ; inline
+
+: camera-button ( string quot -- button ) 
+    [ <label>  ] dip camera-action <repeat-button> ;
+
+! ----------------------------------------------------------
+! file chooser
+! ----------------------------------------------------------
+: <run-file-button> ( file-name -- button )
+  dup '[ drop  _  \ selected-file set-value load-model-file 
+   ] 
+ closed-quot  <roll-button> { 0 0 } >>align ;
+
+: <list-runner> ( -- gadget )
+    "resource:extra/4DNav" 
+  <pile> 1 >>fill 
+    over dup directory-files  
+    [ ".xml" tail? ] filter 
+    [ append-path ] with map
+    [ <run-file-button> add-gadget ] each
+    swap <labeled-gadget> ;
+
+! -----------------------------------------------------
+
+: menu-rotations-3D ( -- gadget )
+    3 3 <frame>
+        { 1 1 } >>filled-cell
+        "Turn\n left"  [ rotation-step  turn-left  ] 
+            camera-button   @left grid-add     
+        "Turn\n right" [ rotation-step turn-right ] 
+            camera-button   @right grid-add     
+        "Pitch down"   [ rotation-step  pitch-down ] 
+            camera-button   @bottom grid-add     
+        "Pitch up"     [ rotation-step  pitch-up   ] 
+            camera-button   @top grid-add     
+        <shelf>  1 >>fill
+            "Roll left\n (ctl)"  [ rotation-step  roll-left  ] 
+                camera-button   add-gadget  
+            "Roll right\n(ctl)"  [ rotation-step  roll-right ] 
+                camera-button   add-gadget  
+        @center grid-add 
+;
+
+: menu-translations-3D ( -- gadget )
+    3 3 <frame>
+        { 1 1 } >>filled-cell
+        "left\n(alt)"        [ translation-step  strafe-left  ]
+            camera-button @left grid-add  
+        "right\n(alt)"       [ translation-step  strafe-right ]
+            camera-button @right grid-add     
+        "Strafe up \n (alt)" [ translation-step strafe-up    ] 
+            camera-button @top grid-add
+        "Strafe down\n (alt)" [ translation-step strafe-down  ]
+            camera-button @bottom grid-add    
+        <pile>  1 >>fill
+            "Forward (ctl)"  [  translation-step step-turtle ] 
+                camera-button add-gadget
+            "Backward (ctl)" 
+                [ translation-step neg step-turtle ] 
+                camera-button   add-gadget
+        @center grid-add
+;
+
+: menu-quick-views ( -- gadget )
+    <shelf>
+        "View 1 (1)" mvt-3D-1 camera-button   add-gadget
+        "View 2 (2)" mvt-3D-2 camera-button   add-gadget
+        "View 3 (3)" mvt-3D-3 camera-button   add-gadget 
+        "View 4 (4)" mvt-3D-4 camera-button   add-gadget 
+;
+
+: menu-3D ( -- gadget ) 
+    <pile>
+        <shelf>   
+            menu-rotations-3D    add-gadget
+            menu-translations-3D add-gadget
+            0.5 >>align
+            { 0 10 } >>gap
+        add-gadget
+        menu-quick-views add-gadget ; 
+
+TUPLE: handler < w:wrapper table ;
+
+: <handler> ( child -- handler ) handler w:new-wrapper ;
+
+M: handler handle-gesture ( gesture gadget -- ? )
+   tuck table>> at dup [ call( gadget -- ) f ] [ 2drop t ] if ;
+
+: add-keyboard-delegate ( obj -- obj )
+ <handler>
+H{
+        { T{ key-down f f "LEFT" }  
+            [ [ rotation-step turn-left ] camera-action ] }
+        { T{ key-down f f "RIGHT" } 
+            [ [ rotation-step turn-right ] camera-action ] }
+        { T{ key-down f f "UP" }    
+            [ [ rotation-step pitch-down ] camera-action ] }
+        { T{ key-down f f "DOWN" }  
+            [ [ rotation-step pitch-up ] camera-action ] }
+
+        { T{ key-down f { C+ } "UP" } 
+           [ [ translation-step step-turtle ] camera-action ] }
+        { T{ key-down f { C+ } "DOWN" } 
+            [ [ translation-step neg step-turtle ] 
+                    camera-action ] }
+        { T{ key-down f { C+ } "LEFT" } 
+            [ [ rotation-step roll-left ] camera-action ] }
+        { T{ key-down f { C+ } "RIGHT" } 
+            [ [ rotation-step roll-right ] camera-action ] }
+
+        { T{ key-down f { A+ } "LEFT" }  
+           [ [ translation-step strafe-left ] camera-action ] }
+        { T{ key-down f { A+ } "RIGHT" } 
+          [ [ translation-step strafe-right ] camera-action ] }
+        { T{ key-down f { A+ } "UP" }    
+            [ [ translation-step strafe-up ] camera-action ] }
+        { T{ key-down f { A+ } "DOWN" }  
+           [ [ translation-step strafe-down ] camera-action ] }
+
+
+        { T{ key-down f f "1" } [ mvt-3D-1 camera-action ] }
+        { T{ key-down f f "2" } [ mvt-3D-2 camera-action ] }
+        { T{ key-down f f "3" } [ mvt-3D-3  camera-action ] }
+        { T{ key-down f f "4" } [ mvt-3D-4  camera-action ] }
+
+    } >>table
+    ;    
+
+! --------------------------------------------
+! print elements 
+! --------------------------------------------
+! print-content
+
+GENERIC: adsoda-display-model ( x -- ) 
+
+M: light adsoda-display-model 
+"\n light : " .
+     { 
+        [ direction>> "direction : " pprint . ] 
+        [ color>> "color : " pprint . ]
+    }   cleave
+    ;
+
+M: face adsoda-display-model 
+     {
+        [ halfspace>> "halfspace : " pprint . ] 
+        [ touching-corners>> "touching corners : " pprint . ]
+    }   cleave
+    ;
+M: solid adsoda-display-model 
+     {
+        [ name>> "solid called : " pprint . ] 
+        [ color>> "color : " pprint . ]
+        [ dimension>> "dimension : " pprint . ]
+        [ faces>> "composed of faces : " pprint 
+            [ adsoda-display-model ] each ]
+    }   cleave
+    ;
+M: space adsoda-display-model 
+     {
+        [ dimension>> "dimension : " pprint . ] 
+        [ ambient-color>> "ambient-color : " pprint . ]
+        [ solids>> "composed of solids : " pprint 
+            [ adsoda-display-model ] each ]
+        [ lights>> "composed of lights : " pprint 
+            [ adsoda-display-model ] each ] 
+    }   cleave
+    ;
+
+! ----------------------------------------------
+: menu-bar ( -- gadget )
+       <shelf>
+          "reinit" [ drop load-model-file ] button* add-gadget
+          selected-file-model> <label-control> add-gadget
+    ;
+
+
+: controller-window* ( -- gadget )
+    { 0 1 } <track>
+        menu-bar f track-add
+        <list-runner>  
+            <scroller>
+        f track-add
+        <shelf>
+            "Projection mode : " <label> add-gadget
+            model-projection-chooser add-gadget
+        f track-add
+        <shelf>
+            "Collision detection (slow and buggy ) : " 
+                <label> add-gadget
+            collision-detection-chooser add-gadget
+        f track-add
+        <pile>
+            0.5 >>align    
+            menu-4D add-gadget 
+            COLOR: purple s:<solid> >>interior
+            "4D movements" <labeled-gadget>
+        f track-add
+        <pile>
+            0.5 >>align
+            { 2 2 } >>gap
+            menu-3D add-gadget
+            COLOR: purple s:<solid> >>interior
+            "Camera 3D" <labeled-gadget>
+        f track-add      
+        COLOR: gray s:<solid> >>interior
+ ;
+: viewer-windows* ( --  )
+    "YZW" view1> win3D 
+    "XZW" view2> win3D 
+    "XYW" view3> win3D 
+    "XYZ" view4> win3D   
+;
+
+: navigator-window* ( -- )
+    controller-window*
+    viewer-windows*   
+    add-keyboard-delegate
+    "navigateur 4D" open-window
+;
+
+: windows ( -- ) [ [ navigator-window* ] with-scope ] with-ui ;
+
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: init-variables ( -- )
+    "choose a file" <model> >selected-file-model  
+    <observer> >observer3d
+    [ observer3d> >self
+      reset-turtle 
+      45 turn-left 
+      45 pitch-up 
+      -300 step-turtle 
+    ] with-scope
+    
+;
+
+
+: init-models ( -- )
+    0 model-projection observer3d> <window3D> >view1
+    1 model-projection observer3d> <window3D> >view2
+    2 model-projection observer3d> <window3D> >view3
+    3 model-projection observer3d> <window3D> >view4
+;
+
+: 4DNav ( -- ) 
+    init-variables
+    selected-file read-model-file >present-space
+    init-models
+    windows
+;
+
+MAIN: 4DNav
+
+
diff --git a/4DNav/authors.txt b/4DNav/authors.txt
new file mode 100644 (file)
index 0000000..6536f34
--- /dev/null
@@ -0,0 +1 @@
+Jeff Bigot
diff --git a/4DNav/camera/authors.txt b/4DNav/camera/authors.txt
new file mode 100644 (file)
index 0000000..bbc876e
--- /dev/null
@@ -0,0 +1 @@
+Adam Wendt
diff --git a/4DNav/camera/camera-docs.factor b/4DNav/camera/camera-docs.factor
new file mode 100644 (file)
index 0000000..65afafc
--- /dev/null
@@ -0,0 +1,88 @@
+! Copyright (C) 2008 Jean-François Bigot.
+! See http://factorcode.org/license.txt for BSD license.
+USING: help.markup help.syntax kernel ;
+IN: 4DNav.camera
+
+HELP: camera-eye
+{ $values
+    
+     { "point" "position" }
+}
+{ $description "return the position of the camera" } ;
+
+HELP: camera-focus
+{ $values
+    
+     { "point" "position" }
+}
+{ $description "return the point the camera looks at" } ;
+
+HELP: camera-up
+{ $values
+    
+     { "dirvec" "upside direction" }
+}
+{ $description "In order to precise the roling position of camera give an upward vector" } ;
+
+HELP: do-look-at
+{ $values
+     { "camera" "direction" }
+}
+{ $description "Word to use in replacement of gl-look-at when using a camera" } ;
+
+ARTICLE: "4DNav.camera" "Camera"
+{ $vocab-link "4DNav.camera" }
+$nl
+"A camera is defined by:"
+{ $list
+{ "a position (" { $link camera-eye } ")" }
+{ "a focus direction (" { $link camera-focus } ")" }
+{ "an attitude information (" { $link camera-up } ")" }
+}
+"Use " { $link do-look-at } " in opengl statement in placement of gl-look-at"
+$nl
+"A camera is a " { $vocab-link "4DNav.turtle" } " object. Its a special vocab to handle mouvements of a 3D object:"
+{ $list
+{ "To define a camera"
+{
+    $unchecked-example
+    
+"VAR: my-camera"
+": init-my-camera ( -- )"
+"    <turtle> >my-camera"
+"    [ my-camera> >self"
+"      reset-turtle "
+"    ] with-scope ;"
+} }
+{ "To move it"
+{
+    $unchecked-example
+
+"    [ my-camera> >self"
+"      45 pitch-up "
+"      5 step-turtle" 
+"    ] with-scope "
+} }
+{ "or"
+{
+    $unchecked-example
+
+"    [ my-camera> >self"
+"      5 strafe-left"
+"    ] with-scope "
+}
+}
+{
+"to use it in an opengl statement"
+{
+    $unchecked-example
+  "my-camera> do-look-at"
+
+}
+}
+}
+
+
+;
+
+ABOUT: "4DNav.camera"
diff --git a/4DNav/camera/camera.factor b/4DNav/camera/camera.factor
new file mode 100644 (file)
index 0000000..0d46d73
--- /dev/null
@@ -0,0 +1,18 @@
+USING: kernel namespaces math.vectors opengl opengl.glu 4DNav.turtle  ;
+
+IN: 4DNav.camera
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: camera-eye ( -- point ) turtle-pos> ;
+
+: camera-focus ( -- point ) 
+    [ 1 step-turtle turtle-pos> ] save-self ;
+
+: camera-up ( -- dirvec )
+[ 90 pitch-up turtle-pos> 1 step-turtle turtle-pos> swap v- ] 
+    save-self ;
+
+: do-look-at ( camera -- )
+[ >self camera-eye camera-focus camera-up gl-look-at ] 
+    with-scope ;
diff --git a/4DNav/deep/deep-docs.factor b/4DNav/deep/deep-docs.factor
new file mode 100644 (file)
index 0000000..78439c6
--- /dev/null
@@ -0,0 +1,31 @@
+! Copyright (C) 2008 Jean-François Bigot.
+! See http://factorcode.org/license.txt for BSD license.
+USING: help.markup help.syntax kernel quotations sequences ;
+IN: 4DNav.deep
+
+! HELP: deep-cleave-quots
+! { $values
+!     { "seq" sequence }
+!     { "quot" quotation }
+! }
+! { $description "A word to build a soquence from a sequence of quotation" }
+! 
+! { $examples
+! "It is useful to build matrix"
+! { $example "USING: math math.trig ; "
+!     " 30 deg>rad "
+!    "  {  { [ cos ] [ sin neg ]   0 } "
+!    "     { [ sin ] [ cos ]       0 } "
+!    "     {   0       0           1 } "
+!    "  } deep-cleave-quots " 
+!     " "
+! 
+! 
+! } }
+! ;
+
+ARTICLE: "4DNav.deep" "Deep"
+{ $vocab-link "4DNav.deep" }
+;
+
+ABOUT: "4DNav.deep"
diff --git a/4DNav/deep/deep.factor b/4DNav/deep/deep.factor
new file mode 100644 (file)
index 0000000..f37bcf0
--- /dev/null
@@ -0,0 +1,13 @@
+USING: macros quotations math math.functions math.trig 
+sequences.deep kernel make fry combinators grouping ;
+IN: 4DNav.deep
+
+! USING: bake ;
+! MACRO: deep-cleave-quots ( seq -- quot )
+!    [ [ quotation? ] deep-filter ]
+!    [ [ dup quotation? [ drop , ] when ] deep-map ]
+!    bi '[ _ cleave _ bake ] ;
+
+: make-matrix ( quot width -- matrix ) 
+    [ { } make ] dip group ; inline
+
diff --git a/4DNav/deploy.factor b/4DNav/deploy.factor
new file mode 100644 (file)
index 0000000..44481f4
--- /dev/null
@@ -0,0 +1,14 @@
+USING: tools.deploy.config ;
+H{
+    { deploy-c-types? t }
+    { deploy-word-props? t }
+    { deploy-name "4DNav" }
+    { deploy-ui? t }
+    { deploy-math? t }
+    { deploy-threads? t }
+    { deploy-reflection 3 }
+    { deploy-unicode? t }
+    { deploy-io 3 }
+    { "stop-after-last-window?" t }
+    { deploy-word-defs? t }
+}
diff --git a/4DNav/file-chooser/authors.txt b/4DNav/file-chooser/authors.txt
new file mode 100644 (file)
index 0000000..6536f34
--- /dev/null
@@ -0,0 +1 @@
+Jeff Bigot
diff --git a/4DNav/file-chooser/file-chooser.factor b/4DNav/file-chooser/file-chooser.factor
new file mode 100644 (file)
index 0000000..c86ddbf
--- /dev/null
@@ -0,0 +1,154 @@
+! Copyright (C) 2008 Jeff Bigot
+! See http://factorcode.org/license.txt for BSD license.
+USING:
+kernel
+io.files
+io.backend
+io.directories
+io.files.info
+io.pathnames
+sequences
+models
+strings
+ui
+ui.operations
+ui.commands
+ui.gestures
+ui.gadgets
+ui.gadgets.buttons
+ui.gadgets.lists
+ui.gadgets.labels
+ui.gadgets.tracks
+ui.gadgets.packs
+ui.gadgets.panes
+ui.gadgets.scrollers
+prettyprint
+combinators
+accessors
+values
+tools.walker
+fry
+;
+IN: 4DNav.file-chooser
+
+TUPLE: file-chooser < track 
+    path
+    extension 
+    selected-file
+    presenter
+    hook  
+    list
+    ;
+
+: find-file-list ( gadget -- list )
+    [ file-chooser? ] find-parent list>> ;
+
+file-chooser H{
+    { T{ key-down f f "UP" } 
+        [ find-file-list select-previous ] }
+    { T{ key-down f f "DOWN" } 
+        [ find-file-list select-next ] }
+    { T{ key-down f f "PAGE_UP" } 
+        [ find-file-list list-page-up ] }
+    { T{ key-down f f "PAGE_DOWN" } 
+        [ find-file-list list-page-down ] }
+    { T{ key-down f f "RET" } 
+        [ find-file-list invoke-value-action ] }
+    { T{ button-down } 
+        request-focus }
+    { T{ button-down f 1 } 
+        [ find-file-list invoke-value-action ]  }
+} set-gestures
+
+: list-of-files ( file-chooser -- seq )
+     [ path>> value>> directory-entries ] [ extension>> ] bi
+     '[ [ name>> _ [ tail? ] with any? ] 
+     [ directory? ] bi or ]  filter
+;
+
+: update-filelist-model ( file-chooser -- )
+    [ list-of-files ] [ model>> ] bi set-model ;
+
+: init-filelist-model ( file-chooser -- file-chooser )
+    dup list-of-files <model> >>model ; 
+
+: (fc-go) ( file-chooser button quot -- )
+    [ [ file-chooser? ] find-parent dup path>> ] dip
+    call
+    normalize-path swap set-model
+    update-filelist-model
+    drop ; inline
+
+: fc-go-parent ( file-chooser button -- )
+    [ dup value>> parent-directory ] (fc-go) ;
+
+: fc-go-home ( file-chooser button -- )
+    [ home ] (fc-go) ;
+
+: fc-change-directory ( file-chooser file -- )
+    dupd [ path>> value>> normalize-path ] [ name>> ] bi* 
+    append-path over path>> set-model    
+    update-filelist-model
+;
+
+: fc-load-file ( file-chooser file -- )
+  over [ name>> ] [ selected-file>> ] bi* set-model 
+  [ [ path>> value>> ] [ selected-file>> value>> ] bi append ] [ hook>> ] bi
+  call( path -- )
+; inline
+
+! : fc-ok-action ( file-chooser -- quot )
+!  dup selected-file>> value>>  "" =
+!    [ drop [ drop ] ] [    
+!            [ path>> value>> ] 
+!            [ selected-file>> value>> append ] 
+!            [ hook>> prefix ] tri
+!        [ drop ] prepend
+!    ]  if ; 
+
+: line-selected-action ( file-chooser -- )
+     dup list>> list-value
+     dup directory? 
+     [ fc-change-directory ] [ fc-load-file ] if ;
+
+: present-dir-element ( element -- string )
+    [ name>> ] [ directory? ] bi   [ "-> " prepend ] when ;
+
+: <file-list> ( file-chooser -- list )
+  dup [ nip line-selected-action ] curry 
+  [ present-dir-element ] rot model>> <list> ;
+
+: <file-chooser> ( hook path extension -- gadget )
+    { 0 1 } file-chooser new-track
+    swap >>extension
+    swap <model> >>path
+    "" <model> >>selected-file
+    swap >>hook
+    init-filelist-model
+    dup <file-list> >>list
+    "choose a file in directory " <label> f track-add
+    dup path>> <label-control> f track-add
+    dup extension>> ", " join "limited to : " prepend 
+        <label> f track-add
+    <shelf> 
+        "selected file : " <label> add-gadget
+        over selected-file>> <label-control> add-gadget
+    f track-add
+    <shelf> 
+        over [  swap fc-go-parent ] curry  "go up" 
+            swap <border-button> add-gadget
+        over [  swap fc-go-home ] curry  "go home" 
+            swap <border-button> add-gadget
+    !    over [ swap fc-ok-action ] curry "OK" 
+    !    swap <bevel-button> add-gadget
+    !    [ drop ]  "Cancel" swap <bevel-button> add-gadget
+    f track-add
+    dup list>> <scroller> 1 track-add
+;
+
+M: file-chooser pref-dim* drop { 400 200 } ;
+
+: file-chooser-window ( -- )
+    [ . ] home { "xml" "txt" }   <file-chooser> 
+    "Choose a file" open-window ;
+
diff --git a/4DNav/hypercube.xml b/4DNav/hypercube.xml
new file mode 100644 (file)
index 0000000..0d46e3b
--- /dev/null
@@ -0,0 +1,37 @@
+<model>\r
+<space>\r
+       <name>hypercube</name>\r
+       <dimension>4</dimension>\r
+       <solid>\r
+               <name>4cube1</name>\r
+               <dimension>4</dimension>\r
+               <face>1,0,0,0,100</face>\r
+               <face>-1,0,0,0,-150</face>\r
+               <face>0,1,0,0,100</face>\r
+               <face>0,-1,0,0,-150</face>\r
+               <face>0,0,1,0,100</face>\r
+               <face>0,0,-1,0,-150</face>\r
+               <face>0,0,0,1,100</face>\r
+               <face>0,0,0,-1,-150</face>\r
+               <color>1,0,0</color>\r
+       </solid>\r
+       <solid>\r
+               <name>4cube1</name>\r
+               <dimension>4</dimension>\r
+               <face>1,0,0,0,100</face>\r
+               <face>-1,0,0,0,-150</face>\r
+               <face>0,1,0,0,100</face>\r
+               <face>0,-1,0,0,-150</face>\r
+               <face>0,0,1,0,100</face>\r
+               <face>0,0,-1,0,-150</face>\r
+               <face>0,0,0,1,100</face>\r
+               <face>0,0,0,-1,-150</face>\r
+               <color>1,0,0</color>\r
+       </solid>\r
+       <light>\r
+               <direction>1,1,1,1</direction>\r
+               <color>0.2,0.2,0.6</color>\r
+       </light>\r
+       <color>0.8,0.9,0.9</color>\r
+</space>\r
+</model>\r
diff --git a/4DNav/light_test.xml b/4DNav/light_test.xml
new file mode 100644 (file)
index 0000000..b7d750d
--- /dev/null
@@ -0,0 +1,62 @@
+<model>\r
+<space>\r
+       <name>multi solids</name>\r
+       <dimension>4</dimension>\r
+       <solid>\r
+               <name>4cube1</name>\r
+               <dimension>4</dimension>\r
+               <face>1,0,0,0,100</face>\r
+               <face>-1,0,0,0,-150</face>\r
+               <face>0,1,0,0,100</face>\r
+               <face>0,-1,0,0,-150</face>\r
+               <face>0,0,1,0,100</face>\r
+               <face>0,0,-1,0,-150</face>\r
+               <face>0,0,0,1,100</face>\r
+               <face>0,0,0,-1,-150</face>\r
+               <color>1,1,1</color>\r
+       </solid>\r
+       <solid>\r
+               <name>4triancube</name>\r
+               <dimension>4</dimension>\r
+               <face>1,0,0,0,160</face>\r
+               <face>-0.4999999999999998,-0.8660254037844387,0,0,-130</face>\r
+               <face>-0.5000000000000004,0.8660254037844384,0,0,-130</face>\r
+               <face>0,0,1,0,140</face>\r
+               <face>0,0,-1,0,-180</face>\r
+               <face>0,0,0,1,110</face>\r
+               <face>0,0,0,-1,-180</face>\r
+               <color>1,1,1</color>\r
+       </solid>\r
+       <solid>\r
+               <name>triangone</name>\r
+               <dimension>4</dimension>\r
+               <face>1,0,0,0,60</face>\r
+               <face>0.5,0.8660254037844386,0,0,60</face>\r
+               <face>-0.5,0.8660254037844387,0,0,-20</face>\r
+               <face>-1.0,0,0,0,-100</face>\r
+               <face>-0.5,-0.8660254037844384,0,0,-100</face>\r
+               <face>0.5,-0.8660254037844387,0,0,-20</face>\r
+               <face>0,0,1,0,120</face>\r
+               <face>0,0,-0.4999999999999998,-0.8660254037844387,-120</face>\r
+               <face>0,0,-0.5000000000000004,0.8660254037844384,-120</face>\r
+               <color>1,1,1</color>\r
+       </solid>\r
+       <light>\r
+               <direction>1,0,0,0</direction>\r
+               <color>0,0,0,0.6</color>\r
+       </light>\r
+       <light>\r
+               <direction>0,1,0,0</direction>\r
+               <color>0,0.6,0,0</color>\r
+       </light>\r
+       <light>\r
+               <direction>0,0,1,0</direction>\r
+               <color>0,0,0.6,0</color>\r
+       </light>\r
+       <light>\r
+               <direction>0,0,0,1</direction>\r
+               <color>0.6,0.6,0.6</color>\r
+       </light>\r
+       <color>0.99,0.99,0.99</color>\r
+</space>\r
+</model>\r
diff --git a/4DNav/multi solids.xml b/4DNav/multi solids.xml
new file mode 100644 (file)
index 0000000..b401e98
--- /dev/null
@@ -0,0 +1,50 @@
+<model>\r
+<space>\r
+       <name>multi solids</name>\r
+       <dimension>4</dimension>\r
+       <solid>\r
+               <name>4cube1</name>\r
+               <dimension>4</dimension>\r
+               <face>1,0,0,0,100</face>\r
+               <face>-1,0,0,0,-150</face>\r
+               <face>0,1,0,0,100</face>\r
+               <face>0,-1,0,0,-150</face>\r
+               <face>0,0,1,0,100</face>\r
+               <face>0,0,-1,0,-150</face>\r
+               <face>0,0,0,1,100</face>\r
+               <face>0,0,0,-1,-150</face>\r
+               <color>1,0,0</color>\r
+       </solid>\r
+       <solid>\r
+               <name>4triancube</name>\r
+               <dimension>4</dimension>\r
+               <face>1,0,0,0,160</face>\r
+               <face>-0.4999999999999998,-0.8660254037844387,0,0,-130</face>\r
+               <face>-0.5000000000000004,0.8660254037844384,0,0,-130</face>\r
+               <face>0,0,1,0,140</face>\r
+               <face>0,0,-1,0,-180</face>\r
+               <face>0,0,0,1,110</face>\r
+               <face>0,0,0,-1,-180</face>\r
+               <color>0,1,0</color>\r
+       </solid>\r
+       <solid>\r
+               <name>triangone</name>\r
+               <dimension>4</dimension>\r
+               <face>1,0,0,0,60</face>\r
+               <face>0.5,0.8660254037844386,0,0,60</face>\r
+               <face>-0.5,0.8660254037844387,0,0,-20</face>\r
+               <face>-1.0,0,0,0,-100</face>\r
+               <face>-0.5,-0.8660254037844384,0,0,-100</face>\r
+               <face>0.5,-0.8660254037844387,0,0,-20</face>\r
+               <face>0,0,1,0,120</face>\r
+               <face>0,0,-0.4999999999999998,-0.8660254037844387,-120</face>\r
+               <face>0,0,-0.5000000000000004,0.8660254037844384,-120</face>\r
+               <color>0,1,1</color>\r
+       </solid>\r
+       <light>\r
+               <direction>1,1,1,1</direction>\r
+               <color>0.2,0.2,0.6</color>\r
+       </light>\r
+       <color>0.8,0.9,0.9</color>\r
+</space>\r
+</model>\r
diff --git a/4DNav/prismetriagone.xml b/4DNav/prismetriagone.xml
new file mode 100644 (file)
index 0000000..cbdc071
--- /dev/null
@@ -0,0 +1,25 @@
+<model>\r
+<space>\r
+       <name>Prismetragone</name>              \r
+       <dimension>4</dimension>\r
+       <solid>\r
+               <name>triangone</name>\r
+               <dimension>4</dimension>\r
+               <face>1,0,0,0,60</face>\r
+               <face>0.5,0.8660254037844386,0,0,60</face>\r
+               <face>-0.5,0.8660254037844387,0,0,-20</face>\r
+               <face>-1.0,0,0,0,-100</face>\r
+               <face>-0.5,-0.8660254037844384,0,0,-100</face>\r
+               <face>0.5,-0.8660254037844387,0,0,-20</face>\r
+               <face>0,0,1,0,120</face>\r
+               <face>0,0,-0.4999999999999998,-0.8660254037844387,-120</face>\r
+               <face>0,0,-0.5000000000000004,0.8660254037844384,-120</face>\r
+               <color>0,1,1</color>\r
+       </solid>\r
+       <light>\r
+               <direction>1,1,1,1</direction>\r
+               <color>0.2,0.2,0.6</color>\r
+       </light>\r
+       <color>0.8,0.9,0.9</color>\r
+</space>\r
+</model>\r
diff --git a/4DNav/space-file-decoder/authors.txt b/4DNav/space-file-decoder/authors.txt
new file mode 100644 (file)
index 0000000..6536f34
--- /dev/null
@@ -0,0 +1 @@
+Jeff Bigot
diff --git a/4DNav/space-file-decoder/space-file-decoder-docs.factor b/4DNav/space-file-decoder/space-file-decoder-docs.factor
new file mode 100644 (file)
index 0000000..0a78166
--- /dev/null
@@ -0,0 +1,20 @@
+! Copyright (C) 2008 Jean-François Bigot.
+! See http://factorcode.org/license.txt for BSD license.
+USING: help.markup help.syntax kernel ;
+IN: 4DNav.space-file-decoder
+
+
+
+HELP: read-model-file
+{ $values
+    
+     { "path" "path to the file to read" }
+     { "x" "value" }
+}
+{ $description "Read a file containing the xml description of the model" } ;
+
+ARTICLE: "4DNav.space-file-decoder" "Space XMLfile decoder"
+{ $vocab-link "4DNav.space-file-decoder" }
+;
+
+ABOUT: "4DNav.space-file-decoder"
diff --git a/4DNav/space-file-decoder/space-file-decoder.factor b/4DNav/space-file-decoder/space-file-decoder.factor
new file mode 100644 (file)
index 0000000..92f39e2
--- /dev/null
@@ -0,0 +1,64 @@
+! Copyright (C) 2008 Jeff Bigot
+! See http://factorcode.org/license.txt for BSD license.
+USING: adsoda xml xml.traversal xml.syntax accessors 
+combinators sequences math.parser kernel splitting values 
+continuations ;
+IN: 4DNav.space-file-decoder
+
+: decode-number-array ( x -- y )  
+    "," split [ string>number ] map ;
+
+TAGS: adsoda-read-model ( tag -- model )
+
+TAG: dimension adsoda-read-model 
+    children>> first string>number ;
+TAG: direction adsoda-read-model 
+    children>> first decode-number-array ;
+TAG: color     adsoda-read-model 
+    children>> first decode-number-array ;
+TAG: name      adsoda-read-model 
+    children>> first ;
+TAG: face      adsoda-read-model 
+    children>> first decode-number-array ;
+
+TAG: solid adsoda-read-model 
+    <solid> swap  
+    { 
+        [ "dimension" tag-named adsoda-read-model >>dimension ]
+        [ "name"      tag-named adsoda-read-model >>name ] 
+        [ "color"     tag-named adsoda-read-model >>color ] 
+        [ "face"      
+            tags-named [ adsoda-read-model cut-solid ] each ] 
+    } cleave
+    ensure-adjacencies
+;
+
+TAG: light adsoda-read-model 
+   <light> swap  
+    { 
+        [ "direction" tag-named adsoda-read-model >>direction ]
+        [ "color"     tag-named adsoda-read-model >>color ] 
+    } cleave
+;
+
+TAG: space adsoda-read-model 
+    <space> swap  
+    { 
+        [ "dimension" tag-named adsoda-read-model >>dimension ]
+        [ "name"      tag-named adsoda-read-model >>name ] 
+        [ "color"     tag-named 
+            adsoda-read-model >>ambient-color ] 
+        [ "solid"     tags-named 
+            [ adsoda-read-model suffix-solids ] each ] 
+        [ "light"     tags-named 
+            [ adsoda-read-model suffix-lights ] each ]
+    } cleave
+;
+
+: read-model-file ( path -- x )
+    [
+        [ file>xml "space" tag-named adsoda-read-model ] 
+        [ 2drop <space> ] recover 
+    ] [ <space> ] if*
+;
+
diff --git a/4DNav/summary.txt b/4DNav/summary.txt
new file mode 100644 (file)
index 0000000..2598a14
--- /dev/null
@@ -0,0 +1 @@
+Simple tool to navigate through a 4D space with projections on 4 3D spaces
diff --git a/4DNav/tags.txt b/4DNav/tags.txt
new file mode 100644 (file)
index 0000000..0c63a72
--- /dev/null
@@ -0,0 +1 @@
+4D viewer
\ No newline at end of file
diff --git a/4DNav/triancube.xml b/4DNav/triancube.xml
new file mode 100644 (file)
index 0000000..8551bed
--- /dev/null
@@ -0,0 +1,23 @@
+<model>\r
+<space>\r
+       <name>triancube</name>          \r
+       <dimension>4</dimension>\r
+       <solid>\r
+               <name>triancube</name>\r
+               <dimension>4</dimension>\r
+               <face>1,0,0,0,160</face>\r
+               <face>-0.4999999999999998,-0.8660254037844387,0,0,-130</face>\r
+               <face>-0.5000000000000004,0.8660254037844384,0,0,-130</face>\r
+               <face>0,0,1,0,140</face>\r
+               <face>0,0,-1,0,-180</face>\r
+               <face>0,0,0,1,110</face>\r
+               <face>0,0,0,-1,-180</face>\r
+               <color>0,1,0</color>\r
+       </solid>\r
+       <light>\r
+               <direction>1,1,1,1</direction>\r
+               <color>0.2,0.2,0.6</color>\r
+       </light>\r
+       <color>0.8,0.9,0.9</color>\r
+</space>\r
+</model>\r
diff --git a/4DNav/turtle/authors.txt b/4DNav/turtle/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/4DNav/turtle/turtle-docs.factor b/4DNav/turtle/turtle-docs.factor
new file mode 100644 (file)
index 0000000..b94ed99
--- /dev/null
@@ -0,0 +1,11 @@
+! Copyright (C) 2008 Jean-François Bigot.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays help.markup help.syntax kernel sequences ;
+IN: 4DNav.turtle
+
+
+ARTICLE: "4DNav.turtle" "Turtle"
+{ $vocab-link "4DNav.turtle" }
+;
+
+ABOUT: "4DNav.turtle"
diff --git a/4DNav/turtle/turtle.factor b/4DNav/turtle/turtle.factor
new file mode 100644 (file)
index 0000000..4f89964
--- /dev/null
@@ -0,0 +1,159 @@
+USING: kernel math arrays math.vectors math.matrices namespaces make
+math.constants math.functions splitting grouping math.trig sequences
+accessors 4DNav.deep models vars ;
+IN: 4DNav.turtle
+
+! replacement of self
+
+VAR: self
+
+: with-self ( quot obj -- ) [ >self call ] with-scope ; inline
+
+: save-self ( quot -- ) self> [ self> clone >self call ] dip >self ; inline
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+TUPLE: turtle pos ori ;
+
+: <turtle> ( -- turtle )
+    turtle new
+    { 0 0 0 } clone >>pos
+    3 identity-matrix >>ori
+;
+
+
+TUPLE: observer < turtle projection-mode collision-mode ;
+
+: <observer> ( -- object ) 
+     observer new
+    0 <model> >>projection-mode 
+    f <model> >>collision-mode
+    ;
+
+
+: turtle-pos> ( -- val ) self> pos>> ;
+: >turtle-pos ( val -- ) self> pos<< ;
+
+: turtle-ori> ( -- val ) self> ori>> ;
+: >turtle-ori ( val -- ) self> ori<< ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! These rotation matrices are from
+! `Computer Graphics: Principles and Practice'
+
+
+! waiting for deep-cleave-quots  
+
+! : Rz ( angle -- Rx ) deg>rad
+!    {   { [ cos ] [ sin neg ]   0 }
+!        { [ sin ] [ cos ]      0  }
+!        {   0       0           1 } 
+!    } deep-cleave-quots  ;
+
+! : Ry ( angle -- Ry ) deg>rad
+!    {   { [ cos ]      0 [ sin ] }
+!        {   0          1 0       }
+!        { [  sin neg ] 0 [ cos ] }
+!    } deep-cleave-quots  ;
+  
+! : Rx ( angle -- Rz ) deg>rad
+!   {   { 1     0        0        }
+!        { 0   [ cos ] [ sin neg ] }
+!        { 0   [ sin ] [ cos ]     }
+!    } deep-cleave-quots ;
+
+: 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 -- ) 
+    turtle-ori> swap m. >turtle-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 ) turtle-ori> [ first  ] map ;
+: Y ( -- 3array ) turtle-ori> [ second ] map ;
+: Z ( -- 3array ) turtle-ori> [ third  ] map ;
+
+: set-X ( seq -- ) turtle-ori> [ set-first ] 2each ;
+: set-Y ( seq -- ) turtle-ori> [ set-second ] 2each ;
+: set-Z ( seq -- ) turtle-ori> [ set-third ] 2each ;
+
+: roll-until-horizontal ( -- )
+    V Z cross normalize set-X
+    Z X cross normalize set-Y ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: distance ( turtle turtle -- n ) 
+    pos>> swap pos>> v- [ sq ] map-sum sqrt ;
+
+: move-by ( point -- ) turtle-pos> v+ >turtle-pos ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: reset-turtle ( -- ) 
+    { 0 0 0 } clone >turtle-pos 3 identity-matrix >turtle-ori ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: step-vector ( length -- array ) { 0 0 1 } n*v ;
+
+: step-turtle ( length -- ) 
+    step-vector turtle-ori> swap m.v 
+    turtle-pos> v+ >turtle-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/4DNav/window3D/authors.txt b/4DNav/window3D/authors.txt
new file mode 100644 (file)
index 0000000..6536f34
--- /dev/null
@@ -0,0 +1 @@
+Jeff Bigot
diff --git a/4DNav/window3D/window3D-docs.factor b/4DNav/window3D/window3D-docs.factor
new file mode 100644 (file)
index 0000000..a534d2e
--- /dev/null
@@ -0,0 +1,12 @@
+! Copyright (C) 2008 Jean-François Bigot.
+! See http://factorcode.org/license.txt for BSD license.
+USING: help.markup help.syntax kernel ;
+IN: 4DNav.window3D
+
+
+
+ARTICLE: "4DNav.window3D" "Window3D"
+{ $vocab-link "4DNav.window3D" }
+;
+
+ABOUT: "4DNav.window3D"
diff --git a/4DNav/window3D/window3D.factor b/4DNav/window3D/window3D.factor
new file mode 100644 (file)
index 0000000..f995541
--- /dev/null
@@ -0,0 +1,82 @@
+! Copyright (C) 2008 Jeff Bigot
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel 
+ui.gadgets
+ui.render
+opengl
+opengl.gl
+opengl.glu
+4DNav.camera
+4DNav.turtle
+math
+values
+alien.c-types
+accessors
+namespaces
+adsoda 
+models
+prettyprint
+;
+
+IN: 4DNav.window3D
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! drawing functions 
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+TUPLE: window3D  < gadget observer ; 
+
+: <window3D>  ( model observer -- gadget )
+    window3D  new
+    swap 2dup 
+    projection-mode>> add-connection
+    2dup 
+    collision-mode>> add-connection
+    >>observer 
+    swap <model> >>model 
+    t >>root?
+;
+
+M: window3D pref-dim* ( gadget -- dim )  drop { 300 300 } ;
+
+M: window3D draw-gadget* ( gadget -- )
+
+    GL_PROJECTION glMatrixMode
+        glLoadIdentity
+        0.6 0.6 0.6 .9 glClearColor
+        dup observer>> projection-mode>> value>> 1 =    
+        [ 60.0 1.0 0.1 3000.0 gluPerspective ]
+        [ -400.0 400.0 -400.0 400.0 0.0 4000.0 glOrtho ] if
+        dup observer>> collision-mode>> value>> 
+        \ remove-hidden-solids?   
+        set-value
+        dup  observer>> do-look-at
+        GL_MODELVIEW glMatrixMode
+            glLoadIdentity  
+            0.9 0.9 0.9 1.0 glClearColor
+            1.0 glClearDepth
+            GL_LINE_SMOOTH glEnable
+            GL_BLEND glEnable
+            GL_DEPTH_TEST glEnable       
+            GL_LEQUAL glDepthFunc
+            GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA glBlendFunc
+            GL_LINE_SMOOTH_HINT GL_NICEST glHint
+            1.25 glLineWidth
+            GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT bitor 
+                glClear
+            glLoadIdentity
+            GL_LIGHTING glEnable
+            GL_LIGHT0 glEnable
+            GL_COLOR_MATERIAL glEnable
+            GL_FRONT GL_AMBIENT_AND_DIFFUSE glColorMaterial
+            ! *************************
+            
+            control-value
+            [ space->GL ] when*
+
+            ! *************************
+;
+
+M: window3D graft* drop ;
+
+M: window3D model-changed nip relayout ; 
diff --git a/L-system/L-system.factor b/L-system/L-system.factor
new file mode 100644 (file)
index 0000000..cc91042
--- /dev/null
@@ -0,0 +1,511 @@
+
+USING: accessors arrays assocs calendar colors
+combinators.short-circuit help.markup help.syntax kernel locals
+math math.functions math.matrices math.order math.parser
+math.trig math.vectors opengl opengl.demo-support opengl.gl
+sbufs sequences strings threads ui.gadgets ui.gadgets.worlds
+ui.gestures ui.render ui.tools.workspace ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+IN: L-system
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+TUPLE: <turtle> pos ori angle length thickness color vertices saved ;
+
+DEFER: default-L-parser-values
+
+: reset-turtle ( turtle -- turtle )
+  { 0 0 0 } clone   >>pos
+  3 identity-matrix >>ori
+  V{ } clone >>vertices
+  V{ } clone >>saved
+
+  default-L-parser-values ;
+
+: turtle ( -- turtle ) <turtle> new reset-turtle ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+:: step-turtle ( TURTLE LENGTH -- turtle )
+
+  TURTLE
+    TURTLE pos>>   TURTLE ori>> { 0 0 LENGTH } m.v   v+
+  >>pos ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+:: Rx ( ANGLE -- Rx )
+  
+  [let | ANGLE [ ANGLE deg>rad ] |
+
+    [let | A [ ANGLE cos     ]
+           B [ ANGLE sin neg ]
+           C [ ANGLE sin     ]
+           D [ ANGLE cos     ] |
+
+      { { 1 0 0 }
+        { 0 A B }
+        { 0 C D } }
+
+    ] ] ;
+
+:: Ry ( ANGLE -- Ry )
+  
+  [let | ANGLE [ ANGLE deg>rad ] |
+
+    [let | A [ ANGLE cos     ]
+           B [ ANGLE sin     ]
+           C [ ANGLE sin neg ]
+           D [ ANGLE cos     ] |
+
+      { { A 0 B }
+        { 0 1 0 }
+        { C 0 D } }
+
+    ] ] ;
+
+:: Rz ( ANGLE -- Rz )
+  
+  [let | ANGLE [ ANGLE deg>rad ] |
+
+    [let | A [ ANGLE cos     ]
+           B [ ANGLE sin neg ]
+           C [ ANGLE sin     ]
+           D [ ANGLE cos     ] |
+
+      { { A B 0 }
+        { C D 0 }
+        { 0 0 1 } }
+
+    ] ] ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+:: apply-rotation ( TURTLE ROTATION -- turtle )
+  
+  TURTLE  TURTLE ori>> ROTATION m.  >>ori ;
+
+: rotate-x ( turtle angle -- turtle ) Rx apply-rotation ;
+: rotate-y ( turtle angle -- turtle ) Ry apply-rotation ;
+: rotate-z ( turtle angle -- turtle ) Rz apply-rotation ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: pitch-up   ( turtle angle -- turtle ) neg rotate-x ;
+: pitch-down ( turtle angle -- turtle )     rotate-x ;
+
+: turn-left  ( turtle angle -- turtle )     rotate-y ;
+: turn-right ( turtle angle -- turtle ) neg rotate-y ;
+
+: roll-left  ( turtle angle -- turtle ) neg rotate-z ;
+: roll-right ( turtle angle -- turtle )     rotate-z ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: V ( -- V ) { 0 1 0 } ;
+
+: X ( turtle -- 3array ) ori>> [ first  ] map ;
+: Y ( turtle -- 3array ) ori>> [ second ] map ;
+: Z ( turtle -- 3array ) ori>> [ third  ] map ;
+
+: set-X ( turtle seq -- turtle ) over ori>> [ set-first  ] 2each ;
+: set-Y ( turtle seq -- turtle ) over ori>> [ set-second ] 2each ;
+: set-Z ( turtle seq -- turtle ) over ori>> [ set-third  ] 2each ;
+
+:: roll-until-horizontal ( TURTLE -- turtle )
+
+  TURTLE
+  
+    V         TURTLE Z  cross normalize  set-X
+
+    TURTLE Z  TURTLE X  cross normalize  set-Y ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+:: strafe-up ( TURTLE LENGTH -- turtle )
+  TURTLE 90 pitch-up LENGTH step-turtle 90 pitch-down ;
+
+:: strafe-down ( TURTLE LENGTH -- turtle )
+  TURTLE 90 pitch-down LENGTH step-turtle 90 pitch-up ;
+
+:: strafe-left ( TURTLE LENGTH -- turtle )
+  TURTLE 90 turn-left LENGTH step-turtle 90 turn-right ;
+
+:: strafe-right ( TURTLE LENGTH -- turtle )
+  TURTLE 90 turn-right LENGTH step-turtle 90 turn-left ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: polygon ( vertices -- ) GL_POLYGON glBegin [ first3 glVertex3d ] each glEnd ;
+
+: start-polygon ( turtle -- turtle ) dup vertices>> delete-all ;
+
+: finish-polygon ( turtle -- turtle ) dup vertices>> polygon ;
+
+: polygon-vertex ( turtle -- turtle ) dup [ pos>> ] [ vertices>> ] bi push ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: record-vertex ( turtle -- turtle ) dup pos>> first3 glVertex3d ;
+
+: draw-forward ( turtle length -- turtle )
+  GL_LINES glBegin [ record-vertex ] dip step-turtle record-vertex glEnd ;
+
+: move-forward ( turtle length -- turtle ) step-turtle polygon-vertex ;
+
+: sneak-forward ( turtle length -- turtle ) step-turtle ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: scale-length ( turtle m -- turtle ) over length>> * >>length ;
+: scale-angle  ( turtle m -- turtle ) over angle>>  * >>angle  ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: set-thickness ( turtle i -- turtle ) dup glLineWidth >>thickness ;
+
+: scale-thickness ( turtle m -- turtle )
+  over thickness>> * 0.5 max set-thickness ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: color-table ( -- colors )
+  {
+    T{ rgba f 0    0    0    1 } ! black
+    T{ rgba f 0.5  0.5  0.5  1 } ! grey
+    T{ rgba f 1    0    0    1 } ! red
+    T{ rgba f 1    1    0    1 } ! yellow
+    T{ rgba f 0    1    0    1 } ! green
+    T{ rgba f 0.25 0.88 0.82 1 } ! turquoise
+    T{ rgba f 0    0    1    1 } ! blue
+    T{ rgba f 0.63 0.13 0.94 1 } ! purple
+    T{ rgba f 0.00 0.50 0.00 1 } ! dark green
+    T{ rgba f 0.00 0.82 0.82 1 } ! dark turquoise
+    T{ rgba f 0.00 0.00 0.50 1 } ! dark blue
+    T{ rgba f 0.58 0.00 0.82 1 } ! dark purple
+    T{ rgba f 0.50 0.00 0.00 1 } ! dark red
+    T{ rgba f 0.25 0.25 0.25 1 } ! dark grey
+    T{ rgba f 0.75 0.75 0.75 1 } ! medium grey
+    T{ rgba f 1    1    1    1 } ! white
+  } ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! : material-color ( color -- )
+!   GL_FRONT_AND_BACK GL_AMBIENT_AND_DIFFUSE rot gl-material ;
+
+: material-color ( color -- )
+  GL_FRONT_AND_BACK GL_AMBIENT_AND_DIFFUSE rot color>raw 4array gl-material ;
+
+: set-color ( turtle i -- turtle )
+  dup color-table nth dup gl-color material-color >>color ;
+
+: inc-color ( turtle -- turtle ) dup color>> 1 + set-color ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: save-turtle    ( turtle -- turtle ) dup clone over saved>> push ;
+
+: restore-turtle ( turtle -- turtle ) saved>> pop dup color>> set-color ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: default-L-parser-values ( turtle -- turtle )
+  1 >>length 45 >>angle 1 >>thickness 2 >>color ;
+
+: L-parser-dialect ( -- commands )
+
+  {
+      { "+" [ dup angle>> turn-left  ] }
+      { "-" [ dup angle>> turn-right ] }
+      { "&" [ dup angle>> pitch-down ] }
+      { "^" [ dup angle>> pitch-up   ] }
+      { "<" [ dup angle>> roll-left  ] }
+      { ">" [ dup angle>> roll-right ] }
+
+      { "|" [ 180.0         rotate-y ] }
+      { "%" [ 180.0         rotate-z ] }
+      { "$" [ roll-until-horizontal  ]  }
+
+      { "F" [ dup length>>     draw-forward  ] }
+      { "Z" [ dup length>> 2 / draw-forward  ] }
+      { "f" [ dup length>>     move-forward  ] }
+      { "z" [ dup length>> 2 / move-forward  ] }
+      { "g" [ dup length>>     sneak-forward ] }
+      { "." [ polygon-vertex                 ] }
+
+      { "[" [ save-turtle      ] }
+      { "]" [ restore-turtle   ] }
+      
+      { "{" [ start-polygon    ] }
+      { "}" [ finish-polygon   ] }
+
+      { "/" [ 1.1 scale-length    ] } ! double quote command in lparser
+      { "'" [ 0.9 scale-length    ] }
+      { ";" [ 1.1 scale-angle     ] }
+      { ":" [ 0.9 scale-angle     ] }
+      { "?" [ 1.4 scale-thickness ] }
+      { "!" [ 0.7 scale-thickness ] }
+
+      { "c" [ dup color>> 1 + color-table length mod set-color ] }
+
+    }
+    ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+TUPLE: <L-system> < gadget
+  camera display-list pedestal paused
+  turtle-values
+  commands axiom rules string ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+:: iterate-system ( GADGET -- ) GADGET pedestal>> 0.5 + GADGET pedestal<< ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+:: start-rotation-thread ( GADGET -- )
+  GADGET f >>paused drop
+  [
+    [
+      GADGET paused>>
+        [ f ]
+        [ GADGET iterate-system GADGET relayout-1 25 milliseconds sleep t ]
+      if
+    ]
+    loop
+  ]
+  in-thread ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: open-paren  ( -- ch ) CHAR: ( ;
+: close-paren ( -- ch ) CHAR: ) ;
+
+: open-paren?  ( obj -- ? ) open-paren  = ;
+: close-paren? ( obj -- ? ) close-paren = ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+:: read-instruction ( STRING -- next rest )
+  
+  { [ STRING length 1 > ] [ STRING second open-paren? ] } 0&&
+    [ STRING  close-paren STRING index 1 + cut ]
+    [ STRING  1                            cut ]
+  if ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+:: iterate-string-loop ( STRING RULES ACCUM -- )
+  STRING empty? not
+    [
+      STRING read-instruction
+    
+      [let | REST [ ] NEXT [ ] |
+
+        NEXT 1 head RULES at  NEXT  or  ACCUM push-all
+
+        REST RULES ACCUM iterate-string-loop ]
+    ]
+  when ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+:: iterate-string ( STRING RULES -- string )
+
+  [let | ACCUM [ STRING length  10 *  <sbuf> ] |
+
+    STRING RULES ACCUM iterate-string-loop
+
+    ACCUM >string ] ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+:: interpret-string ( STRING COMMANDS -- )
+
+  STRING empty? not
+    [
+      STRING read-instruction
+
+      [let | REST [ ] NEXT [ ] |
+
+        [let | COMMAND [ NEXT 1 head COMMANDS at ] |
+
+          COMMAND
+            [
+              NEXT length 1 =
+                [ COMMAND call ]
+                [
+                  NEXT 2 tail 1 head* string>number
+                  COMMAND 1 tail*
+                  call
+                ]
+              if
+            ]
+          when ]
+
+        REST COMMANDS interpret-string ]
+    ]
+  when ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+:: iterate-L-system-string ( L-SYSTEM -- )
+  L-SYSTEM string>> L-SYSTEM axiom>> or
+  L-SYSTEM rules>>
+  iterate-string
+  L-SYSTEM string<< ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+:: do-camera-look-at ( CAMERA -- )
+
+  [let | EYE   [ CAMERA pos>> ]
+         FOCUS [ CAMERA clone 1 step-turtle pos>> ]
+         UP    [ CAMERA clone 90 pitch-up 1 step-turtle pos>> CAMERA pos>> v- ]
+       |
+
+    EYE FOCUS UP gl-look-at ] ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+:: generate-display-list ( L-SYSTEM -- )
+
+  L-SYSTEM find-gl-context
+
+  L-SYSTEM display-list>> GL_COMPILE glNewList
+
+    turtle
+    L-SYSTEM turtle-values>> [ ] or call
+    L-SYSTEM string>> L-SYSTEM axiom>> or
+    L-SYSTEM commands>>
+    interpret-string
+    drop
+
+  glEndList ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+M:: <L-system> draw-gadget* ( L-SYSTEM -- )
+
+  black gl-clear
+
+  GL_FLAT glShadeModel
+
+  GL_PROJECTION glMatrixMode
+  glLoadIdentity
+  -1 1 -1 1 1.5 200 glFrustum
+
+  GL_MODELVIEW glMatrixMode
+
+  glLoadIdentity
+
+  L-SYSTEM camera>> do-camera-look-at
+
+  GL_FRONT_AND_BACK GL_LINE glPolygonMode
+
+  ! draw axis
+  white gl-color GL_LINES glBegin { 0 0 0 } gl-vertex { 0 0 1 } gl-vertex glEnd
+
+  ! rotate pedestal
+
+  L-SYSTEM pedestal>> 0 0 1 glRotated
+  
+  L-SYSTEM display-list>> glCallList ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+M:: <L-system> graft* ( L-SYSTEM -- )
+
+  L-SYSTEM find-gl-context
+
+  1 glGenLists L-SYSTEM display-list<< ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+M:: <L-system> pref-dim* ( L-SYSTEM -- dim ) { 400 400 } ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+:: with-camera ( L-SYSTEM QUOT -- )
+  L-SYSTEM camera>> QUOT call drop
+  L-SYSTEM relayout-1 ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+<L-system>
+H{
+  { T{ key-down f f "LEFT"  } [ [  5 turn-left   ] with-camera ] }
+  { T{ key-down f f "RIGHT" } [ [  5 turn-right  ] with-camera ] }
+  { T{ key-down f f "UP"    } [ [  5 pitch-down  ] with-camera ] }
+  { T{ key-down f f "DOWN"  } [ [  5 pitch-up    ] with-camera ] }
+  
+  { T{ key-down f f "a"     } [ [  1 step-turtle ] with-camera ] }
+  { T{ key-down f f "z"     } [ [ -1 step-turtle ] with-camera ] }
+
+  { T{ key-down f f "q"     } [ [ 5 roll-left    ] with-camera ] }
+  { T{ key-down f f "w"     } [ [ 5 roll-right   ] with-camera ] }
+
+  { T{ key-down f { A+ } "LEFT"  } [ [ 1 strafe-left  ] with-camera ] }
+  { T{ key-down f { A+ } "RIGHT" } [ [ 1 strafe-right ] with-camera ] }
+  { T{ key-down f { A+ } "UP"    } [ [ 1 strafe-up    ] with-camera ] }
+  { T{ key-down f { A+ } "DOWN"  } [ [ 1 strafe-down  ] with-camera ] }
+
+  { T{ key-down f f "r"     } [ start-rotation-thread          ] }
+
+  {
+    T{ key-down f f "x" }
+    [
+      dup iterate-L-system-string
+      dup generate-display-list
+      dup relayout-1
+      drop
+    ]
+  }
+
+  { T{ key-down f f "F1" } [ drop "L-system" help-window ] }
+    
+}
+set-gestures
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: L-system ( -- L-system )
+
+  <L-system> new-gadget
+
+    0 >>pedestal
+  
+    ! turtle 45 turn-left 45 pitch-up 5 step-turtle 180 turn-left >>camera ;
+
+    turtle 90 pitch-down -5 step-turtle 2 strafe-up >>camera
+
+    dup start-rotation-thread
+
+  ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+ARTICLE: "L-system" "L-system"
+
+"Press 'x' to iterate the L-system." $nl
+
+"Camera control:"
+
+{ $table
+
+  { "a" "Forward" }
+  { "z" "Backward" }
+
+  { "LEFT" "Turn left" }
+  { "RIGHT" "Turn right" }
+  { "UP" "Pitch down" }
+  { "DOWN" "Pitch up" }
+
+  { "q" "Roll left" }
+  { "w" "Roll right" } } ;
+
+ABOUT: "L-system"
diff --git a/L-system/models/abop-1/abop-1.factor b/L-system/models/abop-1/abop-1.factor
new file mode 100644 (file)
index 0000000..34f1d47
--- /dev/null
@@ -0,0 +1,27 @@
+
+USING: accessors ui L-system ;
+
+IN: L-system.models.abop-1
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: abop-1 ( <L-system> -- <L-system> )
+  
+  L-parser-dialect >>commands
+
+  "c(12)FFAL" >>axiom
+
+  {
+    { "A" "F [ & '(.8) !       B L ] >(137) ' !(.9) A" }
+    { "B" "F [ - '(.8) !(.9) $ C L ]        ' !(.9) C" }
+    { "C" "F [ + '(.8) !(.9) $ B L ]        ' !(.9) B" }
+    
+    { "L" " ~ c(8) { +(30) f -(120) f -(120) f }" }
+  }
+  >>rules ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: main ( -- ) [ L-system abop-1 "L-system" open-window ] with-ui ;
+
+MAIN: main
diff --git a/L-system/models/abop-2/abop-2.factor b/L-system/models/abop-2/abop-2.factor
new file mode 100644 (file)
index 0000000..1168780
--- /dev/null
@@ -0,0 +1,31 @@
+
+USING: accessors ui L-system ;
+
+IN: L-system.models.abop-2
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: abop-2 ( <L-system> -- <L-system> )
+
+  L-parser-dialect >>commands
+
+  [ 30 >>angle ] >>turtle-values
+
+  "c(12)FAL" >>axiom
+
+  {
+    { "A" "F [&'(.7)!BL] >(137) [&'(.6)!BL] >(137) '(.9) !(.9) A" }
+    
+    { "B" "F [- '(.7) !(.9) $ C L] '(.9) !(.9) C" }
+    { "C" "F [+ '(.7) !(.9) $ B L] '(.9) !(.9) B" }
+
+    { "L" "~c(8){+f(.1)-f(.1)-f(.1)+|+f(.1)-f(.1)-f(.1)}" }
+
+  } >>rules ;
+
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: main ( -- ) [ L-system abop-2 "L-system" open-window ] with-ui ;
+
+MAIN: main
diff --git a/L-system/models/abop-3/abop-3.factor b/L-system/models/abop-3/abop-3.factor
new file mode 100644 (file)
index 0000000..f594caf
--- /dev/null
@@ -0,0 +1,27 @@
+
+USING: accessors ui L-system ;
+
+IN: L-system.models.abop-3
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: abop-3 ( <L-system> -- <L-system> )
+
+  L-parser-dialect >>commands
+
+  [ 30 >>angle ] >>turtle-values
+
+  "c(12)FA" >>axiom
+
+ {
+   { "A" "!(.9)t(.4)FB>(94)B>(132)B" }
+   { "B" "[&t(.4)F$A]" }
+   { "F" "'(1.25)F'(.8)" }
+ }
+   >>rules ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: main ( -- ) [ L-system abop-3 "L-system" open-window ] with-ui ;
+
+MAIN: main
diff --git a/L-system/models/abop-4/abop-4.factor b/L-system/models/abop-4/abop-4.factor
new file mode 100644 (file)
index 0000000..71cf32d
--- /dev/null
@@ -0,0 +1,56 @@
+
+USING: accessors ui L-system ;
+
+IN: L-system.models.abop-4
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: abop-4 ( <L-system> -- <L-system> )
+
+  L-parser-dialect >>commands
+
+  [ 18 >>angle ] >>turtle-values
+
+  "c(12)&(20)N" >>axiom
+
+  {
+    {
+      "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 ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: main ( -- ) [ L-system abop-4 "L-system" open-window ] with-ui ;
+
+MAIN: main
diff --git a/L-system/models/abop-5-angular/abop-5-angular.factor b/L-system/models/abop-5-angular/abop-5-angular.factor
new file mode 100644 (file)
index 0000000..9e78258
--- /dev/null
@@ -0,0 +1,33 @@
+
+USING: accessors ui L-system ;
+
+IN: L-system.models.abop-5-angular
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: abop-5-angular ( <L-system> -- <L-system> )
+
+  L-parser-dialect >>commands
+
+  "&(90)+(90)a" >>axiom
+
+  {
+    { "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 ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: main ( -- ) [ L-system abop-5-angular "L-system" open-window ] with-ui ;
+
+MAIN: main
+
diff --git a/L-system/models/abop-5/abop-5.factor b/L-system/models/abop-5/abop-5.factor
new file mode 100644 (file)
index 0000000..73dc13d
--- /dev/null
@@ -0,0 +1,35 @@
+
+USING: accessors ui L-system ;
+
+IN: L-system.models.abop-5
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: abop-5 ( <L-system> -- <L-system> )
+
+  L-parser-dialect >>commands
+
+  [ 5 >>angle ] >>turtle-values
+
+  "a" >>axiom
+
+  {
+    { "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 ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: main ( -- ) [ L-system abop-5 "L-system" open-window ] with-ui ;
+
+MAIN: main
+
diff --git a/L-system/models/abop-6/abop-6.factor b/L-system/models/abop-6/abop-6.factor
new file mode 100644 (file)
index 0000000..79680bd
--- /dev/null
@@ -0,0 +1,34 @@
+
+USING: accessors ui L-system ;
+
+IN: L-system.models.abop-6
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: abop-6 ( <L-system> -- <L-system> )
+
+  L-parser-dialect >>commands
+
+  [ 5 >>angle ] >>turtle-values
+
+  ! "&(90)+(90)FFF[-(120)'(.6)x][-(60)'(.8)x][+(120)'(.6)x][+(60)'(.8)x]x"
+  "FFF[-(120)'(.6)x][-(60)'(.8)x][+(120)'(.6)x][+(60)'(.8)x]x"
+  >>axiom
+
+  {
+    { "a" "F[cdx][cex]F!(.9)a" }
+    { "x" "a" }
+
+    { "d" "+d" }
+    { "e" "-e" }
+
+    { "F" "'(1.25)F'(.8)" }
+  }
+    >>rules ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: main ( -- ) [ L-system abop-6 "L-system" open-window ] with-ui ;
+
+MAIN: main
+
diff --git a/L-system/models/airhorse/airhorse.factor b/L-system/models/airhorse/airhorse.factor
new file mode 100644 (file)
index 0000000..07f4224
--- /dev/null
@@ -0,0 +1,52 @@
+
+USING: accessors ui L-system ;
+
+IN: L-system.models.airhorse
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: airhorse ( <L-system> -- <L-system> )
+
+  L-parser-dialect >>commands
+
+  [ 10 >>angle ] >>turtle-values
+
+  "C" >>axiom
+
+  {
+    { "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 ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: main ( -- ) [ L-system airhorse "L-system" open-window ] with-ui ;
+
+MAIN: main
diff --git a/L-system/models/tree-5/tree-5.factor b/L-system/models/tree-5/tree-5.factor
new file mode 100644 (file)
index 0000000..d4026ef
--- /dev/null
@@ -0,0 +1,36 @@
+
+USING: accessors ui L-system ;
+
+IN: L-system.models.tree-5
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: tree-5 ( <L-system> -- <L-system> )
+
+  L-parser-dialect >>commands
+
+  [ 5 >>angle ] >>turtle-values
+
+  "c(4)FFS" >>axiom
+
+  {
+    { "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 ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: main ( -- ) [ L-system tree-5 "L-system" open-window ] with-ui ;
+
+MAIN: main
diff --git a/LICENSE b/LICENSE
index 533cdba1cb8d0f52ed65ee89d636914c60ee30e8..e9cd58a5e422b2f067d378d447865db638dbfbdb 100644 (file)
--- a/LICENSE
+++ b/LICENSE
@@ -1,29 +1,20 @@
-BSD 3-Clause License
-
-Copyright (c) 2017, Factor - A Practical Stack Language
-All rights reserved.
-
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
 
-* Redistributions of source code must retain the above copyright notice, this
-  list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright notice,
-  this list of conditions and the following disclaimer in the documentation
-  and/or other materials provided with the distribution.
+1. Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
 
-* Neither the name of the copyright holder nor the names of its
-  contributors may be used to endorse or promote products derived from
-  this software without specific prior written permission.
+2. Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
 
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (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 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.
diff --git a/adsoda/adsoda-docs.factor b/adsoda/adsoda-docs.factor
new file mode 100644 (file)
index 0000000..a6ad0c7
--- /dev/null
@@ -0,0 +1,307 @@
+! Copyright (C) 2008 Jeff Bigot
+! See http://factorcode.org/license.txt for BSD license.
+USING: help.markup help.syntax ;
+IN: adsoda
+
+! --------------------------------------------------------------
+! faces
+! --------------------------------------------------------------
+ARTICLE: "face-page" "Face in ADSODA"
+"explanation of faces"
+$nl
+"link to functions" $nl
+"what is an halfspace" $nl
+"halfspace touching-corners adjacent-faces" $nl
+"touching-corners list of pointers to the corners which touch this face" $nl
+"adjacent-faces list of pointers to the faces which touch this face"
+{ $subsections
+    face
+    <face>
+}
+"test relative position"
+{ $subsections
+    point-inside-or-on-face?
+    point-inside-face?
+}
+"handling face"
+{ $subsections
+    flip-face
+    face-translate
+    face-transform
+}
+
+;
+
+HELP: face
+{ $class-description "a face is defined by"
+{ $list "halfspace equation" }
+{ $list "list of touching corners" }
+{ $list "list of adjacent faces" }
+$nl
+"Touching corners and adjacent faces are defined by algorithm thanks to other faces of the solid"
+}
+
+
+;
+HELP: <face> 
+{ $values { "v" "an halfspace equation" } { "tuple" "a face" }  }   ;
+HELP: flip-face 
+{ $values { "face" "a face" } { "face" "flipped face" } }
+{ $description "change the orientation of a face" }
+;
+
+HELP: face-translate 
+{ $values { "face" "a face" } { "v" "a vector" } }
+{ $description 
+"translate a face following a vector"
+$nl
+"a translation of an halfspace doesn't change the normal vector. this word just compute the new constant term" }
+
+ ;
+HELP: face-transform 
+{ $values { "face" "a face" } { "m" "a transformation matrix" } }
+{ $description  "compute the transformation of a face using a transformation matrix" }
+ ;
+! --------------------------------
+! solid
+! --------------------------------------------------------------
+ARTICLE: "solid-page" "Solid in ADSODA"
+"explanation of solids"
+$nl
+"link to functions"
+{ $subsections
+    solid
+    <solid>
+}
+"test relative position"
+{ $subsections
+    point-inside-solid?
+    point-inside-or-on-solid?
+}
+"playing with faces and solids"
+{ $subsections
+    add-face
+    cut-solid
+    slice-solid
+}
+"solid handling"
+{ $subsections
+    solid-project
+    solid-translate
+    solid-transform
+    subtract
+    get-silhouette 
+    solid=
+}
+;
+
+HELP: solid 
+{ $class-description "dimension" $nl "silhouettes" $nl "faces" $nl "corners" $nl "adjacencies-valid" $nl "color" $nl "name" 
+}
+;
+
+HELP: add-face 
+{ $values { "solid" "a solid" } { "face" "a face" } }
+{ $description "reshape a solid with a face. The face truncate the solid." } ;
+
+HELP: cut-solid
+{ $values { "solid" "a solid" } { "halfspace" "an halfspace" } }
+{ $description "like add-face but just with halfspace equation" } ;
+
+HELP: slice-solid
+{ $values { "solid" "a solid" } { "face" "a face" } { "solid1" "the outer part of the former solid" } { "solid2" "the inner part of the former solid" } }
+{ $description "cut a solid into two parts. The face acts like a knife"
+}  ;
+
+
+HELP: solid-project
+{ $values { "lights" "lights" } { "ambient" "ambient" } { "solid" "solid" } { "solids" "projection of solid" } }
+{ $description "Project the solid using pv vector" 
+$nl
+"TODO: explain how to use lights"
+} ;
+
+HELP: solid-translate 
+{ $values { "solid" "a solid" } { "v" "translating vector" } }
+{ $description "Translate a solid using a vector" 
+$nl
+"v and solid must have the same dimension "
+} ;
+
+HELP: solid-transform 
+{ $values { "solid" "a solid" } { "m" "transformation matrix" } }
+{ $description "Transform a solid using a matrix"
+$nl
+"v and solid must have the same dimension "
+} ;
+
+HELP: subtract 
+{ $values { "solid1" "initial shape" } { "solid2" "shape to remove" } { "solids" "resulting shape" } }
+{ $description  "Substract solid2 from solid1" } ;
+
+
+! --------------------------------------------------------------
+! space 
+! --------------------------------------------------------------
+ARTICLE: "space-page" "Space in ADSODA"
+"A space is a collection of solids and lights."
+$nl
+"link to functions"
+$nl
+"Defining words"
+{ $subsections
+    space
+    <space>
+    suffix-solids 
+    suffix-lights
+    clear-space-solids 
+    describe-space
+}
+
+
+"Handling space"
+{ $subsections
+    space-ensure-solids
+    eliminate-empty-solids
+    space-transform
+    space-translate
+    remove-hidden-solids
+    space-project
+}
+
+
+;
+
+HELP: space 
+{ $class-description 
+"dimension" $nl " solids" $nl " ambient-color" $nl "lights" 
+}
+;
+
+HELP: suffix-solids 
+"( space solid -- space )"
+{ $values { "space" "a space" } { "solid" "a solid to add" } }
+{ $description "Add solid to space definition" } ;
+
+HELP: suffix-lights 
+"( space light -- space ) "
+{ $values { "space" "a space" } { "light" "a light to add" } }
+{ $description "Add a light to space definition" } ;
+
+HELP: clear-space-solids 
+"( space -- space )"   
+{ $values { "space" "a space" } }
+{ $description "remove all solids in space" } ;
+
+HELP: space-ensure-solids 
+{ $values { "space" "a space" } }
+{ $description "rebuild corners of all solids in space" } ;
+
+
+
+HELP: space-transform 
+{ $values { "space" "a space" } { "m" "a matrix" } }
+{ $description "Transform a space using a matrix" } ;
+
+HELP: space-translate 
+{ $values { "space" "a space" } { "v" "a vector" } }
+{ $description "Translate a space following a vector" } ;
+
+HELP: describe-space
+{ $values { "space" "a space" } }
+{ $description "return a description of space" } ;
+
+HELP: space-project 
+{ $values { "space" "a space" } { "i" "an integer" } }
+{ $description "Project a space along ith coordinate" } ;
+
+! --------------------------------------------------------------
+! 3D rendering
+! --------------------------------------------------------------
+ARTICLE: "3D-rendering-page" "The 3D rendering in ADSODA"
+"explanation of 3D rendering"
+$nl
+"link to functions"
+{ $subsections
+    face->GL
+    solid->GL
+    space->GL
+}
+
+;
+
+HELP: face->GL 
+{ $values { "face" "a face" } { "color" "3 3 values array" } }
+{ $description "display a face" } ;
+
+HELP: solid->GL 
+{ $values { "solid" "a solid" } }
+{ $description "display a solid" } ;
+
+HELP: space->GL 
+{ $values { "space" "a space" } }
+{ $description "display a space" } ;
+
+! --------------------------------------------------------------
+! light
+! --------------------------------------------------------------
+
+ARTICLE: "light-page" "Light in ADSODA"
+"explanation of light"
+$nl
+"link to functions"
+;
+
+ARTICLE: { "adsoda" "light" } "ADSODA : lights"
+{ $code """
+! HELP: light position color
+! <light> ( -- tuple ) light new ;
+! light est un vecteur avec 3 variables pour les couleurs\n
+ void Light::Apply(Vector& normal, double &cRed, double &cGreen, double &cBlue)\n
+ { \n
+   // Dot the light direction with the normalized normal of Face.
+   register double intensity = -(normal * (*this));
+   // Face is a backface, from light's perspective
+   if (intensity < 0)
+     return;
+   
+   // Add the intensity componentwise
+   cRed += red * intensity;
+   cGreen += green * intensity;
+   cBlue += blue * intensity;
+   // Clip to unit range
+  if (cRed > 1.0) cRed = 1.0;
+   if (cGreen > 1.0) cGreen = 1.0;
+   if (cBlue > 1.0) cBlue = 1.0;
+""" }
+;
+
+
+
+ARTICLE: { "adsoda" "halfspace" } "ADSODA : halfspace"
+" defined by the concatenation of the normal vector and a constant"  
+ ;
+
+
+
+ARTICLE:  "adsoda-main-page"  "ADSODA : Arbitrary-Dimensional Solid Object Display Algorithm"
+"multidimensional handler :" 
+$nl
+"design a solid using face delimitations. Only works on convex shapes"
+$nl
+{ $emphasis "written in C++ by Greg Ferrar" }
+$nl
+"full explanation on adsoda page at " { $url "http://www.flowerfire.com/ADSODA/" }
+$nl
+"Useful words are describe on the following pages: "
+{ $subsections
+    "face-page"
+    "solid-page"
+    "space-page"
+    "light-page"
+    "3D-rendering-page"
+} ;
+
+ABOUT: "adsoda-main-page"
diff --git a/adsoda/adsoda-tests.factor b/adsoda/adsoda-tests.factor
new file mode 100644 (file)
index 0000000..1b90557
--- /dev/null
@@ -0,0 +1,310 @@
+USING: adsoda
+kernel
+math
+accessors
+sequences
+    adsoda.solution2
+    fry
+    tools.test 
+    arrays ;
+
+IN: adsoda.tests
+
+
+
+: s1 ( -- solid )
+    <solid> 
+    2 >>dimension
+    "s1" >>name
+    { 1 1 1 } >>color
+    { 1 -1 -5 } cut-solid 
+    { -1 -1 -21 } cut-solid 
+    { -1 0 -12 } cut-solid 
+    { 1 2 16 } cut-solid
+;
+: solid1 ( -- solid )
+    <solid> 
+    2 >>dimension
+    "solid1" >>name
+    { 1 -1 -5 } cut-solid 
+    { -1 -1 -21 } cut-solid 
+    { -1 0 -12 } cut-solid 
+    { 1 2 16 } cut-solid
+    ensure-adjacencies
+    
+;
+: solid2 ( -- solid )
+    <solid> 
+    2 >>dimension
+    "solid2" >>name
+    { -1 1 -10 } cut-solid 
+    { -1 -1 -28 } cut-solid 
+    { 1 0 13 } cut-solid 
+ !   { 1 2 16 } cut-solid
+    ensure-adjacencies
+    
+;
+
+: solid3 ( -- solid )
+      <solid> 
+    2 >>dimension
+    "solid3" >>name
+    { 1 1 1 } >>color
+    { 1 0 16 } cut-solid 
+    { -1 0 -36 } cut-solid 
+    { 0 1 1 } cut-solid 
+    { 0 -1  -17 } cut-solid 
+ !   { 1 2 16 } cut-solid
+    ensure-adjacencies
+    
+
+;
+
+: solid4 ( -- solid )
+      <solid> 
+    2 >>dimension
+    "solid4" >>name
+    { 1 1 1 } >>color
+    { 1 0 21 } cut-solid 
+    { -1 0 -36 } cut-solid 
+    { 0 1 1 } cut-solid 
+    { 0 -1  -17 } cut-solid 
+    ensure-adjacencies
+    
+;
+
+: solid5 ( -- solid )
+      <solid> 
+    2 >>dimension
+    "solid5" >>name
+    { 1 1 1 } >>color
+    { 1 0 6 } cut-solid 
+    { -1 0 -17 } cut-solid 
+    { 0 1 17 } cut-solid 
+    { 0 -1  -19 } cut-solid 
+    ensure-adjacencies
+    
+;
+
+: solid7 ( -- solid )
+      <solid> 
+    2 >>dimension
+    "solid7" >>name
+    { 1 1 1 } >>color
+    { 1 0 38 } cut-solid 
+    { 1 -5 -66 } cut-solid 
+    { -2 1 -75 } cut-solid
+    ensure-adjacencies
+    
+;
+
+: solid6s ( -- seq )
+  solid3 clone solid2 clone subtract
+;
+
+: space1 ( -- space )
+    <space>
+        2 >>dimension
+     !    solid3 suffix-solids
+        solid1 suffix-solids
+        solid2 suffix-solids
+    !   solid6s [ suffix-solids ] each 
+        solid4 suffix-solids
+     !   solid5 suffix-solids
+        solid7 suffix-solids
+        { 1 1 1 } >>ambient-color
+            <light>
+        { -100 -100 } >>position
+        { 0.2 0.7 0.1 } >>color
+        suffix-lights
+;
+
+: space2 ( -- space )
+    <space>
+        4 >>dimension
+       ! 4cube suffix-solids
+        { 1 1 1 } >>ambient-color
+            <light>
+        { -100 -100 } >>position
+        { 0.2 0.7 0.1 } >>color
+        suffix-lights
+
+       ;
+
+
+
+! {
+!        { 1 0 0 0 }
+!        { 0 1 0 0 }
+!        { 0 0 0.984807753012208 -0.1736481776669303 }
+!        { 0 0 0.1736481776669303 0.984807753012208 }
+!    }
+
+! ------------------------------------------------------------
+! constant+
+[ { 1 2 5 } ] [ { 1 2 3 } 2 constant+ ] unit-test
+
+! ------------------------------------------------------------
+! translate
+[ { 1 -1 0 } ] [ { 1 -1 -5 } { 3 -2 } translate ] unit-test
+
+! ------------------------------------------------------------
+! transform
+[ { -1 -1 -5 21.0 } ] [ { -1 -1 -5 21 }
+  { { 1 0 0 }
+    { 0 1 0 }
+    { 0 0 1 }
+    } transform  
+] unit-test
+
+! ------------------------------------------------------------
+! compare-nleft-to-identity-matrix
+[ t ] [ 
+    { 
+        { 1 0 0 1232 } 
+        { 0 1 0 0 321 } 
+        { 0 0 1 0 } } 
+        3 compare-nleft-to-identity-matrix 
+]  unit-test
+
+[ f ] [ 
+    { { 1 0 0 } { 0 1 0 } { 0 0 0 } } 
+    3 compare-nleft-to-identity-matrix 
+] unit-test
+
+[ f ] [ 
+    { { 2 0 0 } { 0 1 0 } { 0 0 1 } } 
+    3 compare-nleft-to-identity-matrix 
+] unit-test
+! ------------------------------------------------------------
+[ t ] [ 
+  { { 1 0 0 }
+    { 0 1 0 }
+    { 0 0 1 } } 3 valid-solution? 
+] unit-test
+
+[ f ] [ 
+  { { 1 0 0 1 }
+    { 0 0 0 1 }
+    { 0 0 1 0 } } 3 valid-solution? 
+] unit-test
+
+[ f ] [ 
+  { { 1 0 0 1 }
+    { 0 0 0 1 } } 3 valid-solution? 
+] unit-test
+
+[ f ] [ 
+  { { 1 0 0 1 }
+    { 0 0 0 1 }
+    { 0 0 1 0 } } 2 valid-solution? 
+] unit-test
+
+! ------------------------------------------------------------
+[ 3 ] [ { 1 2 3 } last ] unit-test 
+
+[ { 1 2 5 } ] [ { 1 2 3 } dup [ 2 + ] change-last ] unit-test 
+
+! ------------------------------------------------------------
+! position-point 
+[ 0 ] [ 
+    { 1 -1 -5 } { 2 7 } position-point 
+] unit-test
+
+! ------------------------------------------------------------
+
+! transform
+! TODO construire un exemple
+
+
+! ------------------------------------------------------------
+! slice-solid 
+
+! ------------------------------------------------------------
+! solve-equation 
+! deux cas de tests, avec solution et sans solution
+
+[ { 2 7 } ] 
+[ { { 1 -1 -5 } { 1 2 16 } } intersect-hyperplanes ] 
+unit-test
+
+[ f ] 
+[ { { 1 -1 -5 } { 1 2 16 } { -1 -1 -21 } } intersect-hyperplanes  ]
+unit-test
+
+[ f ] 
+[ { { 1 0 -5 } { 1 0 16 }  } intersect-hyperplanes  ]
+unit-test
+
+! ------------------------------------------------------------
+! point-inside-halfspace
+[ t ] [ { 1 -1 -5 } { 0 0 }  point-inside-halfspace? ] 
+unit-test
+[ f ] [ { 1 -1 -5 } { 8 13 }  point-inside-halfspace? ] 
+unit-test
+[ t ] [ { 1 -1 -5 } { 8 13 }  point-inside-or-on-halfspace? ] 
+unit-test
+
+
+! ------------------------------
+! order solid
+
+[  1 ] [ 0 >pv solid1 solid2 order-solid ] unit-test
+[ -1 ] [ 0 >pv solid2 solid1 order-solid ] unit-test
+[  f ] [ 1 >pv solid1 solid2 order-solid ] unit-test
+[  f ] [ 1 >pv solid2 solid1 order-solid ] unit-test
+
+
+! clip-solid
+[ { { 13 15 } { 15 13 } { 13 13 } } ]
+    [ 0 >pv solid2 solid1 clip-solid first corners>> ] unit-test
+
+solid1 corners>> '[ _ ]
+    [ 0 >pv solid1 solid1 clip-solid first corners>> ] unit-test
+
+solid1 corners>> '[ _ ]
+    [ 0 >pv solid1 solid2 clip-solid first corners>> ] unit-test
+
+solid1 corners>> '[ _ ]
+    [ 1 >pv solid1 solid2 clip-solid first corners>> ] unit-test
+solid2 corners>> '[ _ ]
+    [ 1 >pv solid2 solid1 clip-solid first corners>> ] unit-test
+
+!
+[
+    {
+        { { 13 15 } { 15 13 } { 13 13 } }
+        { { 16 17 } { 16 13 } { 36 17 } { 36 13 } }
+        { { 16 1 } { 16 2 } { 36 1 } { 36 2 } }
+    }
+] [     0 >pv solid2 solid3  2array 
+        solid1 (solids-silhouette-subtract) 
+        [ corners>> ] map
+  ] unit-test
+
+
+[
+{
+    { { 8 13 } { 2 7 } { 12 9 } { 12 2 } }
+    { { 13 15 } { 15 13 } { 13 13 } }
+    { { 16 17 } { 16 15 } { 36 17 } { 36 15 } }
+    { { 16 1 } { 16 2 } { 36 1 } { 36 2 } }
+}
+] [ 
+    0 >pv  <space> solid1 suffix-solids 
+        solid2 suffix-solids 
+        solid3 suffix-solids
+     remove-hidden-solids
+    solids>> [ corners>> ] map
+] unit-test
+
+! { }
+! { }
+! <light> { 0.2 0.3 0.4 } >>color { 1 -1 1 } >>direction     suffix
+! <light> { 0.4 0.3 0.1 } >>color { -1 -1 -1 } >>direction   suffix
+! suffix 
+! { 0.1 0.1 0.1 } suffix ! ambient color
+! { 0.23 0.32 0.17 } suffix ! solid color
+! solid3 faces>> first 
+
+! enlight-projection
diff --git a/adsoda/adsoda.factor b/adsoda/adsoda.factor
new file mode 100644 (file)
index 0000000..f6987dc
--- /dev/null
@@ -0,0 +1,569 @@
+! Copyright (C) 2008 Jeff Bigot
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors
+arrays 
+assocs
+combinators
+kernel 
+fry
+math 
+math.constants
+math.functions
+math.libm
+math.order
+math.vectors 
+math.matrices 
+math.parser
+namespaces
+prettyprint
+sequences
+sequences.deep
+sets
+slots
+sorting
+tools.time
+vars
+continuations
+words
+opengl
+opengl.gl
+colors
+adsoda.solution2
+adsoda.combinators
+opengl.demo-support
+values
+tools.walker
+;
+
+IN: adsoda
+
+DEFER: combinations
+VAR: pv
+
+
+! -------------------------------------------------------------
+! global values
+VALUE: remove-hidden-solids?
+VALUE: VERY-SMALL-NUM
+VALUE: ZERO-VALUE
+VALUE: MAX-FACE-PER-CORNER
+
+t \ remove-hidden-solids? set-value
+0.0000001 \ VERY-SMALL-NUM set-value
+0.0000001 \ ZERO-VALUE set-value
+4 \ MAX-FACE-PER-CORNER set-value
+! -------------------------------------------------------------
+! sequence complement
+
+: with-pv ( i quot -- ) [ swap >pv call ] with-scope  ; inline
+
+: dimension ( array -- x )      length 1 - ; inline 
+: change-last ( seq quot -- ) 
+    [ [ dimension ] keep ] dip change-nth  ; inline
+
+! -------------------------------------------------------------
+! light
+! -------------------------------------------------------------
+
+TUPLE: light name { direction array } color ;
+: <light> ( -- tuple ) light new ;
+
+! -------------------------------------------------------------
+! halfspace manipulation
+! -------------------------------------------------------------
+
+: constant+ ( v x -- w )  '[ [ _ + ] change-last ] keep ;
+: translate ( u v -- w )   dupd     v* sum     constant+ ; 
+
+: transform ( u matrix -- w )
+    [ swap m.v ] 2keep ! compute new normal vector    
+    [
+        [ [ abs ZERO-VALUE > ] find ] keep 
+        ! find a point on the frontier
+        ! be sure it's not null vector
+        last ! get constant
+        swap /f neg swap ! intercept value
+    ] dip  
+    flip 
+    nth
+    [ * ] with map ! apply intercep value
+    over v*
+    sum  neg
+    suffix ! add value as constant at the end of equation
+;
+
+: position-point ( halfspace v -- x ) 
+    -1 suffix v* sum  ; inline
+: point-inside-halfspace? ( halfspace v -- ? )       
+    position-point VERY-SMALL-NUM  > ; 
+: point-inside-or-on-halfspace? ( halfspace v -- ? ) 
+    position-point VERY-SMALL-NUM neg > ;
+: project-vector (  seq -- seq )     
+    pv> [ head ] [ 1 +  tail ] 2bi append ; 
+: get-intersection ( matrice -- seq )     
+    [ 1 tail* ] map     flip first ;
+
+: islenght=? ( seq n -- seq n ? ) 2dup [ length ] [ = ] bi*  ;
+
+: compare-nleft-to-identity-matrix ( seq n -- ? ) 
+    [ [ head ] curry map ] keep  identity-matrix m- 
+    flatten
+    [ abs ZERO-VALUE < ] all?
+;
+
+: valid-solution? ( matrice n -- ? )
+    islenght=?
+    [ compare-nleft-to-identity-matrix ]  
+    [ 2drop f ] if ; inline
+
+: intersect-hyperplanes ( matrice -- seq )
+    [ solution dup ] [ first dimension ] bi
+    valid-solution?     [ get-intersection ] [ drop f ] if ;
+
+! -------------------------------------------------------------
+! faces
+! -------------------------------------------------------------
+
+TUPLE: face { halfspace array } 
+    touching-corners adjacent-faces ;
+: <face> ( v -- tuple )       face new swap >>halfspace ;
+: flip-face ( face -- face ) [ vneg ] change-halfspace ;
+: erase-face-touching-corners ( face -- face ) 
+    f >>touching-corners ;
+: erase-face-adjacent-faces ( face -- face )   
+    f >>adjacent-faces ;
+: faces-intersection ( faces -- v )  
+    [ halfspace>> ] map intersect-hyperplanes ;
+: face-translate ( face v -- face ) 
+    [ translate ] curry change-halfspace ; inline
+: face-transform ( face m -- face )
+    [ transform ] curry change-halfspace ; inline
+: face-orientation ( face -- x ) pv> swap halfspace>> nth sgn ;
+: backface? ( face -- face ? )      dup face-orientation 0 <= ;
+: pv-factor ( face -- f face )     
+    halfspace>> [ pv> swap nth [ * ] curry ] keep ; inline
+: suffix-touching-corner ( face corner -- face ) 
+    [ suffix ] curry   change-touching-corners ; inline
+: real-face? ( face -- ? )
+    [ touching-corners>> length ] 
+    [ halfspace>> dimension ] bi >= ;
+
+: (add-to-adjacent-faces) ( face face -- face )
+    over adjacent-faces>> 2dup member?
+    [ 2drop ] [ swap suffix >>adjacent-faces ] if ;
+
+: add-to-adjacent-faces ( face face -- face )
+    2dup =   [ drop ] [ (add-to-adjacent-faces) ] if ;
+
+: update-adjacent-faces ( faces corner -- )
+   '[ [ _ suffix-touching-corner drop ] each ] keep 
+    2 among [ 
+        [ first ] keep second  
+        [ add-to-adjacent-faces drop ] 2keep 
+        swap add-to-adjacent-faces drop  
+    ] each ; inline
+
+: face-project-dim ( face -- x )  halfspace>> length 2 -  ;
+
+: apply-light ( color light normal -- u )
+    over direction>>  v. 
+    neg dup 0 > 
+    [ 
+        [ color>> swap ] dip 
+        [ * ] curry map v+ 
+        [ 1 min ] map 
+    ] 
+    [ 2drop ] 
+    if
+;
+
+: enlight-projection ( array face -- color )
+    ! array = lights + ambient color
+    [ [ third ] [ second ] [ first ] tri ]
+    [ halfspace>> project-vector normalize ] bi*
+    [ apply-light ] curry each
+    v*
+;
+
+: (intersection-into-face) ( face-init face-adja quot -- face )
+    [
+    [  [ pv-factor ] bi@ 
+        roll 
+        [ map ] 2bi@
+        v-
+    ] 2keep
+    [ touching-corners>> ] bi@
+    [ swap  [ = ] curry find  nip f = ] curry find nip
+    ] dip  over
+     [
+        call
+        dupd
+        point-inside-halfspace? [ vneg ] unless 
+        <face> 
+     ] [ 3drop f ] if 
+    ; inline
+
+: intersection-into-face ( face-init face-adja -- face )
+    [ [ project-vector ] bi@ ]     (intersection-into-face) ;
+
+: intersection-into-silhouette-face ( face-init face-adja -- face )
+    [ ] (intersection-into-face) ;
+
+: intersections-into-faces ( face -- faces )
+    clone dup  
+    adjacent-faces>> [ intersection-into-face ] with map 
+    sift ;
+
+: (face-silhouette) ( face -- faces )
+    clone dup adjacent-faces>>
+    [   backface?
+        [ intersection-into-silhouette-face ] [ 2drop f ]  if  
+    ] with map 
+    sift
+; inline
+
+: face-silhouette ( face -- faces )     
+    backface? [ drop f ] [ (face-silhouette) ] if ;
+
+! --------------------------------
+! solid
+! -------------------------------------------------------------
+TUPLE: solid dimension silhouettes 
+    faces corners adjacencies-valid color name ;
+
+: <solid> ( -- tuple ) solid new ;
+
+: suffix-silhouettes ( solid silhouette -- solid )  
+    [ suffix ] curry change-silhouettes ;
+
+: suffix-face ( solid face -- solid )     
+    [ suffix ] curry change-faces ;
+: suffix-corner ( solid corner -- solid ) 
+    [ suffix ] curry change-corners ; 
+: erase-solid-corners ( solid -- solid )  f >>corners ;
+
+: erase-silhouettes ( solid -- solid ) 
+    dup dimension>> f <array> >>silhouettes ;
+: filter-real-faces ( solid -- solid ) 
+    [ [ real-face? ] filter ] change-faces ;
+: initiate-solid-from-face ( face -- solid ) 
+    face-project-dim  <solid> swap >>dimension ;
+
+: erase-old-adjacencies ( solid -- solid )
+    erase-solid-corners
+    [ dup [ erase-face-touching-corners 
+        erase-face-adjacent-faces drop ] each ]
+    change-faces ;
+
+: point-inside-or-on-face? ( face v -- ? ) 
+    [ halfspace>> ] dip point-inside-or-on-halfspace?  ;
+
+: point-inside-face? ( face v -- ? ) 
+    [ halfspace>> ] dip  point-inside-halfspace? ;
+
+: point-inside-solid? ( solid point -- ? )
+    [ faces>> ] dip [ point-inside-face? ] curry all? ; inline
+
+: point-inside-or-on-solid? ( solid point -- ? )
+    [ faces>> ] dip 
+    [ point-inside-or-on-face? ] curry  all?   ; inline
+
+: unvalid-adjacencies ( solid -- solid )  
+    erase-old-adjacencies f >>adjacencies-valid 
+    erase-silhouettes ;
+
+: add-face ( solid face -- solid ) 
+    suffix-face unvalid-adjacencies ; 
+
+: cut-solid ( solid halfspace -- solid )    <face> add-face ; 
+
+: slice-solid ( solid face  -- solid1 solid2 )
+    [ [ clone ] bi@ flip-face add-face 
+    [ "/outer/" append ] change-name  ] 2keep
+    add-face [ "/inner/" append ] change-name ;
+
+! -------------
+
+
+: add-silhouette ( solid  -- solid )
+   dup 
+   ! find-adjacencies 
+   faces>> { } 
+   [ face-silhouette append ] reduce
+   sift
+   <solid> 
+        swap >>faces
+        over dimension>> >>dimension 
+        over name>> " silhouette " append 
+                 pv> number>string append 
+        >>name
+     !   ensure-adjacencies
+   suffix-silhouettes ; inline
+
+: find-silhouettes ( solid -- solid )
+    { } >>silhouettes 
+    dup dimension>> [ [ add-silhouette ] with-pv ] each ;
+
+: ensure-silhouettes ( solid  -- solid )
+    dup  silhouettes>>  [ f = ] all?
+    [ find-silhouettes  ]  when ; 
+
+! ------------
+
+: corner-added? ( solid corner -- ? ) 
+    ! add corner to solid if it is inside solid
+    [ ] 
+    [ point-inside-or-on-solid? ] 
+    [ swap corners>> member? not ] 
+    2tri and
+    [ suffix-corner drop t ] [ 2drop f ] if ;
+
+: process-corner ( solid faces corner -- )
+    swapd 
+    [ corner-added? ] keep swap ! test if corner is inside solid
+    [ update-adjacent-faces ] 
+    [ 2drop ]
+    if ;
+
+: compute-intersection ( solid faces -- )
+    dup faces-intersection
+    dup f = [ 3drop ] [ process-corner ]  if ;
+
+: test-faces-combinaisons ( solid n -- )
+    [ dup faces>> ] dip among   
+    [ compute-intersection ] with each ;
+
+: compute-adjacencies ( solid -- solid )
+    dup dimension>> [ >= ] curry 
+    [ keep swap ] curry MAX-FACE-PER-CORNER swap
+    [ [ test-faces-combinaisons ] 2keep 1 - ] while drop ;
+
+: find-adjacencies ( solid -- solid ) 
+    erase-old-adjacencies   
+    compute-adjacencies
+    filter-real-faces 
+    t >>adjacencies-valid ;
+
+: ensure-adjacencies ( solid -- solid ) 
+    dup adjacencies-valid>> 
+    [ find-adjacencies ] unless 
+    ensure-silhouettes
+    ;
+
+: (non-empty-solid?) ( solid -- ? ) 
+    [ dimension>> ] [ corners>> length ] bi < ;
+: non-empty-solid? ( solid -- ? )   
+    ensure-adjacencies (non-empty-solid?) ;
+
+: compare-corners-roughly ( corner corner -- ? )
+    2drop t ;
+! : remove-inner-faces ( -- ) ;
+: face-project ( array face -- seq )
+    backface? 
+  [ 2drop f ]
+    [   [ enlight-projection ] 
+        [ initiate-solid-from-face ]
+        [ intersections-into-faces ]  tri
+        >>faces
+        swap >>color        
+    ]    if ;
+
+: solid-project ( lights ambient solid -- solids )
+  ensure-adjacencies
+    [ color>> ] [ faces>> ] bi [ 3array  ] dip
+    [ face-project ] with map 
+    sift
+    [ ensure-adjacencies ] map
+;
+
+: (solid-move) ( solid v move -- solid ) 
+   curry [ map ] curry 
+   [ dup faces>> ] dip call drop  
+   unvalid-adjacencies ; inline
+
+: solid-translate ( solid v -- solid ) 
+    [ face-translate ] (solid-move) ; 
+: solid-transform ( solid m -- solid ) 
+    [ face-transform ] (solid-move) ; 
+
+: find-corner-in-silhouette ( s1 s2 -- elt bool )
+    pv> swap silhouettes>> nth     
+    swap corners>>
+    [ point-inside-solid? ] with find swap ;
+
+: valid-face-for-order ( solid point -- face )
+    [ point-inside-face? not ] 
+    [ drop face-orientation  0 = not ] 2bi and ;
+
+: check-orientation ( s1 s2 pt -- int )
+    [ nip faces>> ] dip
+    [ valid-face-for-order ] curry find swap
+    [ face-orientation ] [ drop f ] if ;
+
+: (order-solid) ( s1 s2 -- int )
+    2dup find-corner-in-silhouette
+    [ check-orientation ] [ 3drop f ] if ;
+
+: order-solid ( solid solid  -- i ) 
+    2dup (order-solid)
+    [ 2nip ]
+    [   swap (order-solid)
+        [ neg ] [ f ] if*
+    ] if* ;
+
+: subtract ( solid1 solid2 -- solids )
+    faces>> swap clone ensure-adjacencies ensure-silhouettes  
+    [ swap slice-solid drop ]  curry map
+    [ non-empty-solid? ] filter
+    [ ensure-adjacencies ] map
+; inline
+
+! -------------------------------------------------------------
+! space 
+! -------------------------------------------------------------
+TUPLE: space name dimension solids ambient-color lights ;
+: <space> ( -- space )      space new ;
+: suffix-solids ( space solid -- space ) 
+    [ suffix ] curry change-solids ; inline
+: suffix-lights ( space light -- space ) 
+    [ suffix ] curry change-lights ; inline
+: clear-space-solids ( space -- space )     f >>solids ;
+
+: space-ensure-solids ( space -- space ) 
+    [ [ ensure-adjacencies ] map ] change-solids ;
+: eliminate-empty-solids ( space -- space ) 
+    [ [ non-empty-solid? ] filter ] change-solids ;
+
+: projected-space ( space solids -- space ) 
+   swap dimension>> 1 -  <space>    
+   swap >>dimension    swap  >>solids ;
+
+: get-silhouette ( solid -- silhouette )    
+    silhouettes>> pv> swap nth ;
+: solid= ( solid solid -- ? )            [ corners>> ]  same? ;
+
+: space-apply ( space m quot -- space ) 
+        curry [ map ] curry [ dup solids>> ] dip
+        [ call ] [ 2drop ] recover drop ; inline
+: space-transform ( space m -- space ) 
+    [ solid-transform ] space-apply ;
+: space-translate ( space v -- space ) 
+    [ solid-translate ] space-apply ; 
+
+: describe-space ( space -- ) 
+    solids>>  
+    [  [ corners>>  [ pprint ] each ] [ name>> . ] bi ] each ;
+
+: clip-solid ( solid solid -- solids )
+    [ ]
+    [ solid= not ]
+    [ order-solid -1 = ] 2tri 
+    and
+    [ get-silhouette subtract ] 
+    [  drop 1array ] 
+    if 
+    
+    ;
+
+: (solids-silhouette-subtract) ( solids solid -- solids ) 
+     [  clip-solid append ] curry { } -rot each ; inline
+
+: solids-silhouette-subtract ( solids i solid -- solids )
+! solids is an array of 1 solid arrays
+      [ (solids-silhouette-subtract) ] curry map-but 
+; inline 
+
+: remove-hidden-solids ( space -- space ) 
+! We must include each solid in a sequence because 
+! during substration 
+! a solid can be divided in more than on solid
+    [ 
+        [ [ 1array ] map ] 
+        [ length ] 
+        [ ] 
+        tri     
+        [ solids-silhouette-subtract ] 2each
+        { } [ append ] reduce 
+    ] change-solids
+    eliminate-empty-solids ! TODO include into change-solids
+;
+
+: space-project ( space i -- space )
+  [
+  [ clone  
+    remove-hidden-solids? [ remove-hidden-solids ] when
+    dup 
+        [ solids>> ] 
+        [ lights>> ] 
+        [ ambient-color>> ]  tri 
+        [ rot solid-project ] 2curry 
+        map 
+        [ append ] { } -rot each 
+        ! TODO project lights
+        projected-space 
+      ! remove-inner-faces 
+      ! 
+      eliminate-empty-solids
+    ] with-pv 
+    ] [ 3drop <space> ] recover
+    ; inline
+
+: middle-of-space ( space -- point )
+    solids>> [ corners>> ] map concat
+    [ [ ] [ v+ ] map-reduce ] [ length ] bi v/n
+;
+
+! -------------------------------------------------------------
+! 3D rendering
+! -------------------------------------------------------------
+
+: face-reference ( face -- halfspace point vect )
+       [ halfspace>> ] 
+       [ touching-corners>> first ] 
+       [ touching-corners>> second ] tri 
+       over v-
+;
+
+: theta ( v halfspace point vect -- v x )
+   [ [ over ] dip v- ] dip    
+   [ cross dup norm >float ]
+   [ v. >float ]  
+   2bi 
+   fatan2
+   -rot v. 
+   0 < [ neg ] when
+;
+
+: ordered-face-points ( face -- corners )  
+    [ touching-corners>> 1 head ] 
+    [ touching-corners>> 1 tail ] 
+    [ face-reference [ theta ] 3curry ]         tri
+    { } map>assoc    sort-values keys 
+    append
+    ; inline
+
+: point->GL  ( point -- )   gl-vertex ;
+: points->GL ( array -- )   do-cycle [ point->GL ] each ;
+
+: face->GL ( face color -- )
+   [ ordered-face-points ] dip
+   [ first3 1.0 glColor4d GL_POLYGON 
+        [ [ point->GL  ] each ] do-state ] curry
+   [  0 0 0 1 glColor4d GL_LINE_LOOP 
+        [ [ point->GL  ] each ] do-state ]
+   bi
+   ; inline
+
+: solid->GL ( solid -- )    
+    [ faces>> ]    
+    [ color>> ] bi
+    [ face->GL ] curry each ; inline
+
+: space->GL ( space -- )
+    solids>>
+    [ solid->GL ] each ;
+
+
+
+
+
diff --git a/adsoda/adsoda.tests b/adsoda/adsoda.tests
new file mode 100644 (file)
index 0000000..f0b0c54
--- /dev/null
@@ -0,0 +1,147 @@
+! : init-4D-demo ( -- space )\r
+! OK\r
+! espace de dimension 4 et de couleur 0,3 0.3 0.3\r
+<space> \r
+    4 >>dimension\r
+    { 0.3 0.3 0.3 } >>ambient-color\r
+    { 100 150 100  150 100 150 100 150 } "4cube1" 4cube suffix-solids\r
+   { 160 180  160 180 160 180 160 180 } "4cube2" 4cube suffix-solids\r
+    <light>\r
+        { -100 -100 -100 -100 } >>position\r
+        { 0.2 0.7 0.1 } >>color\r
+        suffix-lights\r
+! ;\r
+! : init-3D-demo ( -- space )\r
+! OK\r
+! espace de dimension 4 et de couleur 0,3 0.3 0.3\r
+<space> \r
+    3 >>dimension\r
+    { 0.3 0.3 0.3 } >>ambient-color\r
+    { 100 150 100  150 100 150 } "3cube1" 3cube suffix-solids\r
+  !  { -150 -10  -150 -10 -150 -10 -150 -10 } "4cube2" 4cube suffix-solids\r
+    <light>\r
+        { -100 -100 -100 -100 } >>position\r
+        { 0.2 0.7 0.1 } >>color\r
+        suffix-lights\r
+! ;\r
+\r
+\r
+: s1 ( -- solid )\r
+    <solid> \r
+    2 >>dimension\r
+    "s1" >>name\r
+    { 1 1 1 } >>color\r
+    { 1 -1 -5 } cut-solid \r
+    { -1 -1 -21 } cut-solid \r
+    { -1 0 -12 } cut-solid \r
+    { 1 2 16 } cut-solid\r
+;\r
+: solid1 ( -- solid )\r
+    <solid> \r
+    2 >>dimension\r
+    "solid1" >>name\r
+    { 1 -1 -5 } cut-solid \r
+    { -1 -1 -21 } cut-solid \r
+    { -1 0 -12 } cut-solid \r
+    { 1 2 16 } cut-solid\r
+    ensure-adjacencies\r
+    \r
+;\r
+: solid2 ( -- solid )\r
+    <solid> \r
+    2 >>dimension\r
+    "solid2" >>name\r
+    { -1 1 -10 } cut-solid \r
+    { -1 -1 -28 } cut-solid \r
+    { 1 0 13 } cut-solid \r
+ !   { 1 2 16 } cut-solid\r
+    ensure-adjacencies\r
+    \r
+;\r
+\r
+: solid3 ( -- solid )\r
+      <solid> \r
+    2 >>dimension\r
+    "solid3" >>name\r
+    { 1 1 1 } >>color\r
+    { 1 0 16 } cut-solid \r
+    { -1 0 -36 } cut-solid \r
+    { 0 1 1 } cut-solid \r
+    { 0 -1  -17 } cut-solid \r
+ !   { 1 2 16 } cut-solid\r
+    ensure-adjacencies\r
+    \r
+\r
+;\r
+\r
+: solid4 ( -- solid )\r
+      <solid> \r
+    2 >>dimension\r
+    "solid4" >>name\r
+    { 1 1 1 } >>color\r
+    { 1 0 21 } cut-solid \r
+    { -1 0 -36 } cut-solid \r
+    { 0 1 1 } cut-solid \r
+    { 0 -1  -17 } cut-solid \r
+    ensure-adjacencies\r
+    \r
+;\r
+\r
+: solid5 ( -- solid )\r
+      <solid> \r
+    2 >>dimension\r
+    "solid5" >>name\r
+    { 1 1 1 } >>color\r
+    { 1 0 6 } cut-solid \r
+    { -1 0 -17 } cut-solid \r
+    { 0 1 17 } cut-solid \r
+    { 0 -1  -19 } cut-solid \r
+    ensure-adjacencies\r
+    \r
+;\r
+\r
+: solid7 ( -- solid )\r
+      <solid> \r
+    2 >>dimension\r
+    "solid7" >>name\r
+    { 1 1 1 } >>color\r
+    { 1 0 38 } cut-solid \r
+    { 1 -5 -66 } cut-solid \r
+    { -2 1 -75 } cut-solid\r
+    ensure-adjacencies\r
+    \r
+;\r
+\r
+: solid6s ( -- seq )\r
+  solid3 clone solid2 clone subtract\r
+;\r
+\r
+: space1 ( -- space )\r
+    <space>\r
+        2 >>dimension\r
+     !    solid3 suffix-solids\r
+        solid1 suffix-solids\r
+        solid2 suffix-solids\r
+    !   solid6s [ suffix-solids ] each \r
+        solid4 suffix-solids\r
+     !   solid5 suffix-solids\r
+        solid7 suffix-solids\r
+        { 1 1 1 } >>ambient-color\r
+            <light>\r
+        { -100 -100 } >>position\r
+        { 0.2 0.7 0.1 } >>color\r
+        suffix-lights\r
+;\r
+\r
+: space2 ( -- space )\r
+    <space>\r
+        4 >>dimension\r
+       ! 4cube suffix-solids\r
+        { 1 1 1 } >>ambient-color\r
+            <light>\r
+        { -100 -100 } >>position\r
+        { 0.2 0.7 0.1 } >>color\r
+        suffix-lights\r
+\r
+       ;\r
+\r
diff --git a/adsoda/authors.txt b/adsoda/authors.txt
new file mode 100644 (file)
index 0000000..856f3b0
--- /dev/null
@@ -0,0 +1,2 @@
+Jeff Bigot\r
+Greg Ferrar
\ No newline at end of file
diff --git a/adsoda/combinators/authors.txt b/adsoda/combinators/authors.txt
new file mode 100644 (file)
index 0000000..e7f4cde
--- /dev/null
@@ -0,0 +1 @@
+JF Bigot, after Greg Ferrar
\ No newline at end of file
diff --git a/adsoda/combinators/combinators-docs.factor b/adsoda/combinators/combinators-docs.factor
new file mode 100644 (file)
index 0000000..5b540e7
--- /dev/null
@@ -0,0 +1,39 @@
+! Copyright (C) 2008 Jeff Bigot.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays help.markup help.syntax kernel sequences ;
+IN: adsoda.combinators
+
+HELP: among
+{ $values
+     { "array" array } { "n" "number of value to select" }
+     { "array" array }
+}
+{ $description "returns an array containings every possibilities of n choices among a given sequence" } ;
+
+HELP: columnize
+{ $values
+     { "array" array }
+     { "array" array }
+}
+{ $description "flip a sequence into a sequence of 1 element sequences" } ;
+
+HELP: concat-nth
+{ $values
+     { "seq1" sequence } { "seq2" sequence }
+     { "seq" sequence }
+}
+{ $description "merges 2 sequences of sequences appending corresponding elements" } ;
+
+HELP: do-cycle
+{ $values
+     { "array" array }
+     { "array" array }
+}
+{ $description "Copy the first element at the end of the sequence in order to close the cycle." } ;
+
+
+ARTICLE: "adsoda.combinators" "Combinators"
+{ $vocab-link "adsoda.combinators" }
+;
+
+ABOUT: "adsoda.combinators"
diff --git a/adsoda/combinators/combinators-tests.factor b/adsoda/combinators/combinators-tests.factor
new file mode 100644 (file)
index 0000000..d46dc14
--- /dev/null
@@ -0,0 +1,11 @@
+USING: adsoda.combinators
+sequences
+    tools.test 
+ ;
+
+IN: adsoda.combinators.tests
+
+
+[ { "atoto" "b" "ctoto" } ] [ { "a" "b" "c" } 1 [ "toto" append ] map-but ] 
+    unit-test
+
diff --git a/adsoda/combinators/combinators.factor b/adsoda/combinators/combinators.factor
new file mode 100644 (file)
index 0000000..dfa0130
--- /dev/null
@@ -0,0 +1,45 @@
+! Copyright (C) 2008 Jeff Bigot
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel arrays sequences fry math combinators ;
+
+IN: adsoda.combinators
+
+! : (combinations) ( seq -- seq ) [ 1 tail ] dip combinations ;
+
+! : prefix-each [ prefix ] curry map ; inline
+
+! : combinations ( seq n -- seqs )
+!    {
+!        { [ dup 0 = ] [ 2drop { { } } ] }
+!        { [ over empty? ] [ 2drop { } ] }
+!        { [ t ] [ 
+!            [ [ 1 - (combinations) ] [ drop first ] 2bi prefix-each ]
+!            [ (combinations) ] 2bi append
+!        ] }
+!    } cond ;
+
+: columnize ( array -- array ) [ 1array ] map ; inline
+
+: among ( array n -- array )
+    2dup swap length 
+    {
+        { [ over 1 = ] [ 3drop columnize ] }
+        { [ over 0 = ] [ 4drop { } ] }
+        { [ 2dup < ] [ 2drop [ 1 cut ] dip
+                         [ 1 - among [ append ] with map ]
+                         [ among append ] 2bi
+                       ] }
+        { [ 2dup = ] [ 3drop 1array ] }
+        { [ 2dup > ] [ 4drop { } ] }
+    } cond
+;
+
+: concat-nth ( seq1 seq2 -- seq )
+    [ nth append ] curry map-index ;
+
+: do-cycle   ( array -- array )   dup first suffix ;
+
+: map-but ( seq i quot -- seq )
+    ! quot : ( seq x -- seq )
+    '[ _ = [ @ ] unless ] map-index ; inline
+
diff --git a/adsoda/solution2/solution2.factor b/adsoda/solution2/solution2.factor
new file mode 100644 (file)
index 0000000..9b75e05
--- /dev/null
@@ -0,0 +1,126 @@
+USING: kernel
+sequences
+namespaces
+
+math
+math.vectors
+math.matrices
+;
+IN: adsoda.solution2
+
+! -------------------
+! correctif solution
+! ---------------
+SYMBOL: matrix
+: MIN-VAL-adsoda ( -- x ) 0.00000001
+! 0.000000000001 
+;
+
+: zero? ( x -- ? ) 
+    abs MIN-VAL-adsoda <
+;
+
+! [ number>string string>number ] map 
+
+: with-matrix ( matrix quot -- )
+    [ swap matrix set call matrix get ] with-scope ; inline
+
+: nth-row ( row# -- seq ) matrix get nth ;
+
+: change-row ( row# quot -- seq ) ! 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 ;
+
+: skip ( i seq quot -- n )
+    over [ find-from drop ] dip length or ; inline
+
+: first-col ( row# -- n )
+    ! First non-zero column
+    0 swap nth-row [ zero? not ] skip ;
+
+: clear-scale ( col# pivot-row i-row -- n )
+    [ over ] dip nth dup zero? [
+        3drop 0
+    ] [
+        [ nth dup zero? ] dip swap [
+            2drop 0
+        ] [
+            swap / neg
+        ] if
+    ] if ;
+
+: (clear-col) ( col# pivot-row i -- )
+    [ [ clear-scale ] 2keep [ n*v ] dip v+ ] change-row ;
+
+: rows-from ( row# -- slice )
+    rows dup <slice> ;
+
+: clear-col ( col# row# rows -- )
+    [ nth-row ] dip [ [ 2dup ] dip (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 )
+    [ rows-from ] dip 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*
+        [ 1 + ] dip (echelon)
+    ] [
+        2drop
+    ] if ;
+
+: echelon ( matrix -- matrix' )
+    [ 0 0 (echelon) ] with-matrix ;
+
+: nonzero-rows ( matrix -- matrix' )
+    [ [ zero? ] all? ] reject ;
+
+: 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# -- )
+    [ clone ] dip
+    [ swap nth neg recip ] 2keep
+    [ 0 spin set-nth ] 2keep
+    [ n*v ] dip
+    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 ;
+
diff --git a/adsoda/solution2/summary.txt b/adsoda/solution2/summary.txt
new file mode 100644 (file)
index 0000000..a25a451
--- /dev/null
@@ -0,0 +1 @@
+A modification of solution to approximate solutions
\ No newline at end of file
diff --git a/adsoda/summary.txt b/adsoda/summary.txt
new file mode 100644 (file)
index 0000000..ee666bc
--- /dev/null
@@ -0,0 +1 @@
+ADSODA : Arbitrary-Dimensional Solid Object Display Algorithm
\ No newline at end of file
diff --git a/adsoda/tags.txt b/adsoda/tags.txt
new file mode 100644 (file)
index 0000000..6e25b2f
--- /dev/null
@@ -0,0 +1 @@
+adsoda 4D viewer
\ No newline at end of file
diff --git a/adsoda/tools/authors.txt b/adsoda/tools/authors.txt
new file mode 100644 (file)
index 0000000..6536f34
--- /dev/null
@@ -0,0 +1 @@
+Jeff Bigot
diff --git a/adsoda/tools/tools-docs.factor b/adsoda/tools/tools-docs.factor
new file mode 100644 (file)
index 0000000..1d952e3
--- /dev/null
@@ -0,0 +1,62 @@
+! Copyright (C) 2008 Jeff Bigot.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays help.markup help.syntax kernel sequences ;
+IN: adsoda.tools
+
+HELP: 3cube
+{ $values 
+    { "array" "array" } { "name" "name" } 
+    { "solid" "solid" } 
+}
+{ $description "array : xmin xmax ymin ymax zmin zmax" 
+"returns a 3D solid with given limits"
+} ;
+
+HELP: 4cube
+{ $values 
+    { "array" "array" } { "name" "name" } 
+    { "solid" "solid" } 
+}
+{ $description "array : xmin xmax ymin ymax zmin zmax wmin wmax"  
+"returns a 4D solid with given limits"
+} ;
+
+
+HELP: equation-system-for-normal
+{ $values
+     { "points" "a list of n points" }
+     { "matrix" "matrix" }
+}
+{ $description "From a list of points, return the matrix" 
+"to solve in order to find the vector normal to the plan defined by the points" } 
+;
+
+HELP: normal-vector
+{ $values
+     { "points" "a list of n points" }
+     { "v" "a vector" }
+}
+{ $description "From a list of points, returns the vector normal to the plan defined by the points" 
+"With n points, creates n-1 vectors and then find a vector orthogonal to every others"
+"returns { f } if a normal vector can not be found" } 
+;
+
+HELP: points-to-hyperplane
+{ $values
+     { "points" "a list of n points" }
+     { "hyperplane" "an hyperplane equation" }
+}
+{ $description "From a list of points, returns the equation of the hyperplan"
+"Finds a normal vector and then translate it so that it includes one of the points"
+
+} 
+;
+
+ARTICLE: "adsoda.tools" "Tools"
+{ $vocab-link "adsoda.tools" }
+"Tools to help in building an " { $vocab-link "adsoda" } "-space"
+;
+
+ABOUT: "adsoda.tools"
+
+
diff --git a/adsoda/tools/tools-tests.factor b/adsoda/tools/tools-tests.factor
new file mode 100644 (file)
index 0000000..5d1ffa5
--- /dev/null
@@ -0,0 +1,14 @@
+! Copyright (C) 2008 Jeff Bigot
+! See http://factorcode.org/license.txt for BSD license.
+USING: 
+adsoda.tools
+tools.test
+;
+
+IN: adsoda.tools.tests
+
+
+ [ { 1 0 } ] [ { { 0 0 } { 0 1 } }  normal-vector    ] unit-test
+ [ f ] [ { { 0 0 } { 0 0 } }  normal-vector    ] unit-test
+
+ [  { 1/2 1/2 1+1/2 }  ] [ { { 1 2 } { 2 1 } }  points-to-hyperplane ] unit-test
diff --git a/adsoda/tools/tools.factor b/adsoda/tools/tools.factor
new file mode 100644 (file)
index 0000000..69d8a38
--- /dev/null
@@ -0,0 +1,150 @@
+! Copyright (C) 2008 Jeff Bigot
+! See http://factorcode.org/license.txt for BSD license.
+USING: 
+kernel
+sequences
+math
+accessors
+adsoda
+math.vectors 
+math.matrices
+bunny.model
+io.encodings.ascii
+io.files
+sequences.deep
+combinators
+adsoda.combinators
+fry
+io.files.temp
+grouping
+;
+
+IN: adsoda.tools
+
+
+
+
+
+! ---------------------------------
+: coord-min ( x array -- array )  swap suffix  ;
+: coord-max ( x array -- array )  swap neg suffix ;
+
+: 4cube ( array name -- solid )
+! array : xmin xmax ymin ymax zmin zmax wmin wmax
+    <solid> 
+    4 >>dimension
+    swap >>name
+    swap
+    { 
+       [ { 1 0 0 0 } coord-min ] [ { -1 0 0 0 } coord-max ] 
+       [ { 0 1 0 0 } coord-min ] [ { 0 -1 0 0 } coord-max ]
+       [ { 0 0 1 0 } coord-min ] [ { 0 0 -1 0 } coord-max ] 
+       [ { 0 0 0 1 } coord-min ] [ { 0 0 0 -1 } coord-max ]
+    }
+    [ curry call ] 2map 
+    [ cut-solid ] each 
+    ensure-adjacencies
+    
+; inline
+
+: 3cube ( array name -- solid )
+! array : xmin xmax ymin ymax zmin zmax wmin wmax
+    <solid> 
+    3 >>dimension
+    swap >>name
+    swap
+    { 
+       [ { 1 0 0 } coord-min ] [ { -1 0 0 } coord-max ] 
+       [ { 0 1 0 } coord-min ] [ { 0 -1 0 } coord-max ]
+       [ { 0 0 1 } coord-min ] [ { 0 0 -1 } coord-max ] 
+    }
+    [ curry call ] 2map 
+    [ cut-solid ] each 
+    ensure-adjacencies
+    
+; inline
+
+
+: equation-system-for-normal ( points -- matrix )
+    unclip [ v- 0 suffix ] curry map
+    dup first [ drop 1 ] map     suffix
+;
+
+: normal-vector ( points -- v ) 
+    equation-system-for-normal
+    intersect-hyperplanes ;
+
+: points-to-hyperplane ( points -- hyperplane )
+    [ normal-vector 0 suffix ] [ first ] bi
+    translate ;
+
+: refs-to-points ( points faces -- faces )
+   [ swap [ nth 10 v*n { 100 100 100 } v+ ] curry map ] 
+   with map
+;
+! V{ { 0.1 0.2 } { 1.1 1.3 } } V{ { 1 0 } { 0 1 } }
+! V{ { { 1.1 1.3 } { 0.1 0.2 } } { { 0.1 0.2 } { 1.1 1.3 } } }
+
+: ply-model-path ( -- path )
+
+! "bun_zipper.ply" 
+"screw2.ply"
+temp-file 
+;
+
+: read-bunny-model ( -- v )
+ply-model-path ascii [  parse-model ] with-file-reader
+
+refs-to-points
+;
+
+: 3points-to-normal ( seq -- v )
+    unclip [ v- ] curry map first2 cross normalize
+;
+: 2-faces-to-prism ( seq seq -- seq )
+  2dup
+    [ do-cycle 2 clump ] bi@ concat-nth  
+    !  3 faces rectangulaires
+    swap prefix
+    swap prefix
+;    
+
+: Xpoints-to-prisme ( seq height -- cube )
+    ! from 3 points gives a list of faces representing 
+    ! a cube of height "height"
+    ! and of based on the three points
+    ! a face is a group of 3 or mode points.   
+    [ dup dup  3points-to-normal ] dip 
+    v*n [ v+ ] curry map ! 2 eme face triangulaire 
+    2-faces-to-prism  
+
+! [ dup number? [ 1 + ] when ] deep-map
+! dup keep 
+;
+
+
+: Xpoints-to-plane4D ( seq x y -- 4Dplane )
+    ! from 3 points gives a list of faces representing 
+    ! a cube in 4th dim
+    ! from x to y (height = y-x)
+    ! and of based on the X points
+    ! a face is a group of 3 or mode points.   
+    '[ [ [ _ suffix ] map ] [ [ _ suffix ] map ] bi ] call
+    2-faces-to-prism
+;
+
+: 3pointsfaces-to-3Dsolidfaces ( seq -- seq )
+    [ 1 Xpoints-to-prisme [ 100 
+        110 Xpoints-to-plane4D ] map concat ] map 
+
+;
+
+: test-figure ( -- solid )
+    <solid> 
+    2 >>dimension
+    { 1 -1 -5 } cut-solid 
+    { -1 -1 -21 } cut-solid 
+    { -1 0 -12 } cut-solid 
+    { 1 2 16 } cut-solid
+;
+
diff --git a/advice/advice-docs.factor b/advice/advice-docs.factor
new file mode 100644 (file)
index 0000000..04e2f85
--- /dev/null
@@ -0,0 +1,27 @@
+IN: advice
+USING: help.markup help.syntax tools.annotations words coroutines ;
+
+HELP: make-advised
+{ $values { "word" "a word to annotate in preparation of advising" } }
+{ $description "Prepares a word for being advised.  This is done by: "
+    { $list
+        { "Annotating it to call the appropriate words before, around, and after the original body " }
+        { "Adding " { $snippet "before" } ", " { $snippet "around" } ", and " { $snippet "after" } " properties, which will contain the advice" }
+        { "Adding an " { $snippet "advised" } "property, which can later be used to determine if a given word is defined (see " { $link advised? } ")" }
+    }
+}
+{ $see-also advised? annotate } ;
+
+HELP: advised?
+{ $values { "word" "a word" } { "?" "t or f, indicating if " { $snippet "word" } " is advised" } }
+{ $description "Determines whether or not the given word has any advice on it." } ;
+
+HELP: ad-do-it
+{ $values { "input" "an object" } { "result" "an object" } }
+{ $description "Calls either the next applicable around advice or the main body, returning back to the point it was called from when finished.  This word should only be called from inside advice." }
+{ $see-also coyield } ;
+
+ARTICLE: "advice" "Advice"
+"Advice is a simple way of adding additition functionality to words by adding 'hooks' to a word, which can act before, after, or around the calling of the word." ;
+
+ABOUT: "advice"
diff --git a/advice/advice-tests.factor b/advice/advice-tests.factor
new file mode 100644 (file)
index 0000000..396687e
--- /dev/null
@@ -0,0 +1,94 @@
+! Copyright (C) 2008 James Cash
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel sequences io io.streams.string math tools.test advice math.parser
+parser namespaces multiline eval words assocs ;
+IN: advice.tests
+
+[
+    [ ad-do-it ] must-fail
+    
+    : foo ( -- str ) "foo" ; 
+    \ foo make-advised
+    { "bar" "foo" } [
+        [ "bar" ] "barify" \ foo advise-before
+        foo
+    ] unit-test
+    { "bar" "foo" "baz" } [
+        [ "baz" ] "bazify" \ foo advise-after
+        foo
+    ] unit-test
+    { "foo" "baz" } [
+        "barify" \ foo before remove-advice
+        foo
+    ] unit-test
+    : bar ( a -- b ) 1 + ;
+    \ bar make-advised
+
+    { 11 } [
+        [ 2 * ] "double" \ bar advise-before
+        5 bar
+    ] unit-test 
+
+    { 11/3 } [
+        [ 3 / ] "third" \ bar advise-after
+        5 bar
+    ] unit-test
+
+    { -2 } [
+        [ -1 * ad-do-it 3 + ] "frobnobicate" \ bar advise-around
+        5 bar
+    ] unit-test
+
+    : add ( a b -- c ) + ;
+    \ add make-advised
+
+    { 10 } [
+        [ [ 2 * ] bi@ ] "double-args" \ add advise-before
+        2 3 add
+    ] unit-test 
+
+    { 21 } [
+        [ 3 * ad-do-it 1- ] "around1" \ add advise-around
+        2 3 add
+    ] unit-test 
+
+!     { 9 } [
+!         [ [ 1- ] bi@ ad-do-it 2 / ] "around2" \ add advise-around
+!         2 3 add
+!     ] unit-test
+
+!     { { "around1" "around2" } } [
+!         \ add around word-prop keys
+!     ] unit-test
+
+    { 5 f } [
+        \ add unadvise
+        2 3 add \ add advised?
+    ] unit-test
+
+!     : quux ( a b -- c ) * ;
+
+!     { f t 3+3/4 } [
+!         <" USING: advice kernel math ;
+!            IN: advice.tests
+!            \ quux advised?
+!            ADVISE: quux halve before [ 2 / ] bi@ ;
+!            \ quux advised? 
+!            3 5 quux"> eval
+!     ] unit-test
+
+!     { 3+3/4 "1+1/2 2+1/2 3+3/4" } [
+!         <" USING: advice kernel math math.parser io io.streams.string ;
+!            IN: advice.tests
+!            ADVISE: quux log around
+!            2dup [ number>string write " " write ] bi@
+!            ad-do-it 
+!            dup number>string write ;
+!            [ 3 5 quux ] with-string-writer"> eval
+!     ] unit-test 
+] with-scope
diff --git a/advice/advice.factor b/advice/advice.factor
new file mode 100644 (file)
index 0000000..8e22609
--- /dev/null
@@ -0,0 +1,69 @@
+! Copyright (C) 2008 James Cash
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel sequences fry words assocs linked-assocs tools.annotations
+coroutines lexer parser quotations arrays namespaces continuations
+summary ;
+IN: advice
+
+SYMBOLS: before after around advised in-advice? ;
+
+: advised? ( word -- ? )
+    advised word-prop ;
+
+DEFER: make-advised
+
+<PRIVATE
+: init-around-co ( quot -- coroutine )
+    \ coreset suffix cocreate ;
+PRIVATE>
+
+: advise ( quot name word loc --  )
+    dup around eq? [ [ init-around-co ] 3dip ] when
+    over advised? [ over make-advised ] unless
+    word-prop set-at ;
+    
+: advise-before ( quot name word --  ) before advise ;
+    
+: advise-after ( quot name word --  ) after advise ;
+
+: advise-around ( quot name word --  ) around advise ;
+
+: get-advice ( word type -- seq )
+    word-prop values ;
+
+: call-before ( word --  )
+    before get-advice [ call ] each ;
+
+: call-after ( word --  )
+    after get-advice [ call ] each ;
+
+: call-around ( main word --  )
+    t in-advice? [
+        around get-advice tuck 
+        [ [ coresume ] each ] [ call ] [ <reversed> [ coresume ] each ] tri*
+    ] with-variable ;
+
+: remove-advice ( name word loc --  )
+    word-prop delete-at ;
+
+ERROR: ad-do-it-error ;
+
+M: ad-do-it-error summary
+    drop "ad-do-it should only be called inside 'around' advice" ;
+
+: ad-do-it ( input -- result )
+    in-advice? get [ ad-do-it-error ] unless coyield ;
+    
+: make-advised ( word -- )
+    [ dup '[ [ _ ] dip over dup '[ _ call-before _ _ call-around _ call-after ] ] annotate ]
+    [ { before after around } [ <linked-hash> swap set-word-prop ] with each ] 
+    [ t advised set-word-prop ] tri ;
+
+: unadvise ( word --  )
+    [ reset ] [ { before after around advised } [ f swap set-word-prop ] with each ] bi ;
+
+SYNTAX: ADVISE: ! word adname location => word adname quot loc
+    scan-word scan scan-word parse-definition swap [ spin ] dip advise ;
+    
+SYNTAX: UNADVISE:    
+    scan-word suffix! \ unadvise suffix! ;
diff --git a/advice/authors.txt b/advice/authors.txt
new file mode 100644 (file)
index 0000000..4b7af4a
--- /dev/null
@@ -0,0 +1 @@
+James Cash
diff --git a/advice/summary.txt b/advice/summary.txt
new file mode 100644 (file)
index 0000000..a6f9c06
--- /dev/null
@@ -0,0 +1 @@
+Implmentation of advice/aspects
diff --git a/advice/tags.txt b/advice/tags.txt
new file mode 100644 (file)
index 0000000..f427429
--- /dev/null
@@ -0,0 +1 @@
+extensions
diff --git a/alien/cxx/authors.txt b/alien/cxx/authors.txt
new file mode 100644 (file)
index 0000000..845910d
--- /dev/null
@@ -0,0 +1 @@
+Jeremy Hughes
diff --git a/alien/cxx/cxx.factor b/alien/cxx/cxx.factor
new file mode 100644 (file)
index 0000000..a8449b8
--- /dev/null
@@ -0,0 +1,34 @@
+! Copyright (C) 2009 Jeremy Hughes.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors alien.c-types alien.cxx.parser alien.marshall
+alien.inline.types classes.mixin classes.tuple kernel namespaces
+assocs sequences parser classes.parser alien.marshall.syntax
+interpolate locals effects io strings make vocabs.parser words
+generic fry quotations ;
+IN: alien.cxx
+
+<PRIVATE
+: class-mixin ( str -- word )
+    create-class-in [ define-mixin-class ] keep ;
+
+: class-tuple-word ( word -- word' )
+    "#" append create-word-in ;
+
+: define-class-tuple ( word mixin -- )
+    [ drop class-wrapper { } define-tuple-class ]
+    [ add-mixin-instance ] 2bi ;
+PRIVATE>
+
+: define-c++-class ( name superclass-mixin -- )
+    [ [ class-tuple-word ] [ class-mixin ] bi dup ] dip
+    add-mixin-instance define-class-tuple ;
+
+:: define-c++-method ( class-name generic name types effect virtual -- )
+    [ name % "_" % class-name H{ { CHAR: : CHAR: _ } } substitute % ] "" make           :> name'
+    effect [ in>> "self" suffix ] [ out>> ] bi <effect> :> effect'
+    types class-name "*" append suffix                  :> types'
+    effect in>> "," join                                :> args
+    class-name virtual [ "#" append ] unless current-vocab lookup                  :> class
+    SBUF" " clone dup [ I[ return self->${name}(${args});]I ] with-output-stream >string :> body
+    name' types' effect' body define-c-marshalled
+    class generic create-method name' current-vocab lookup 1quotation define ;
diff --git a/alien/cxx/parser/authors.txt b/alien/cxx/parser/authors.txt
new file mode 100644 (file)
index 0000000..845910d
--- /dev/null
@@ -0,0 +1 @@
+Jeremy Hughes
diff --git a/alien/cxx/parser/parser.factor b/alien/cxx/parser/parser.factor
new file mode 100644 (file)
index 0000000..5afaab2
--- /dev/null
@@ -0,0 +1,10 @@
+! Copyright (C) 2009 Jeremy Hughes.
+! See http://factorcode.org/license.txt for BSD license.
+USING: parser lexer alien.inline ;
+IN: alien.cxx.parser
+
+: parse-c++-class-definition ( -- class superclass-mixin )
+    scan scan-word ;
+
+: parse-c++-method-definition ( -- class-name generic name types effect )
+    scan scan-word function-types-effect ;
diff --git a/alien/cxx/syntax/authors.txt b/alien/cxx/syntax/authors.txt
new file mode 100644 (file)
index 0000000..845910d
--- /dev/null
@@ -0,0 +1 @@
+Jeremy Hughes
diff --git a/alien/cxx/syntax/syntax-tests.factor b/alien/cxx/syntax/syntax-tests.factor
new file mode 100644 (file)
index 0000000..b8b0851
--- /dev/null
@@ -0,0 +1,113 @@
+! Copyright (C) 2009 Jeremy Hughes.
+! See http://factorcode.org/license.txt for BSD license.
+USING: tools.test alien.cxx.syntax alien.inline.syntax
+alien.marshall.syntax alien.marshall accessors kernel ;
+IN: alien.cxx.syntax.tests
+
+DELETE-C-LIBRARY: test
+C-LIBRARY: test
+
+COMPILE-AS-C++
+
+C-INCLUDE: <string>
+
+C-TYPEDEF: std::string string
+
+C++-CLASS: std::string c++-root
+
+GENERIC: to-string ( obj -- str )
+
+C++-METHOD: std::string to-string const-char* c_str ( )
+
+CM-FUNCTION: std::string* new_string ( const-char* s )
+    return new std::string(s);
+;
+
+;C-LIBRARY
+
+ALIAS: <std::string> new_string
+
+{ 1 1 } [ new_string ] must-infer-as
+{ 1 1 } [ c_str_std__string ] must-infer-as
+[ t ] [ "abc" <std::string> std::string? ] unit-test
+[ "abc" ] [ "abc" <std::string> to-string ] unit-test
+
+
+DELETE-C-LIBRARY: inheritance
+C-LIBRARY: inheritance
+
+COMPILE-AS-C++
+
+C-INCLUDE: <cstring>
+
+<RAW-C
+class alpha {
+    public:
+    alpha(const char* s) {
+        str = s;
+    };
+    const char* render() {
+        return str;
+    };
+    virtual const char* chop() {
+        return str;
+    };
+    virtual int length() {
+        return strlen(str);
+    };
+    const char* str;
+};
+
+class beta : alpha {
+    public:
+    beta(const char* s) : alpha(s + 1) { };
+    const char* render() {
+        return str + 1;
+    };
+    virtual const char* chop() {
+        return str + 2;
+    };
+};
+RAW-C>
+
+C++-CLASS: alpha c++-root
+C++-CLASS: beta alpha
+
+CM-FUNCTION: alpha* new_alpha ( const-char* s )
+    return new alpha(s);
+;
+
+CM-FUNCTION: beta* new_beta ( const-char* s )
+    return new beta(s);
+;
+
+ALIAS: <alpha> new_alpha
+ALIAS: <beta> new_beta
+
+GENERIC: render ( obj -- obj )
+GENERIC: chop ( obj -- obj )
+GENERIC: length ( obj -- n )
+
+C++-METHOD: alpha render const-char* render ( )
+C++-METHOD: beta render const-char* render ( )
+C++-VIRTUAL: alpha chop const-char* chop ( )
+C++-VIRTUAL: beta chop const-char* chop ( )
+C++-VIRTUAL: alpha length int length ( )
+
+;C-LIBRARY
+
+{ 1 1 } [ render_alpha ] must-infer-as
+{ 1 1 } [ chop_beta ] must-infer-as
+{ 1 1 } [ length_alpha ] must-infer-as
+[ t ] [ "x" <alpha> alpha#? ] unit-test
+[ t ] [ "x" <alpha> alpha? ] unit-test
+[ t ] [ "x" <beta> alpha? ] unit-test
+[ f ] [ "x" <beta> alpha#? ] unit-test
+[ 5 ] [ "hello" <alpha> length ] unit-test
+[ 4 ] [ "hello" <beta> length ] unit-test
+[ "hello" ] [ "hello" <alpha> render ] unit-test
+[ "llo" ] [ "hello" <beta> render ] unit-test
+[ "ello" ] [ "hello" <beta> underlying>> \ alpha# new swap >>underlying render ] unit-test
+[ "hello" ] [ "hello" <alpha> chop ] unit-test
+[ "lo" ] [ "hello" <beta> chop ] unit-test
+[ "lo" ] [ "hello" <beta> underlying>> \ alpha# new swap >>underlying chop ] unit-test
diff --git a/alien/cxx/syntax/syntax.factor b/alien/cxx/syntax/syntax.factor
new file mode 100644 (file)
index 0000000..66c72c1
--- /dev/null
@@ -0,0 +1,13 @@
+! Copyright (C) 2009 Jeremy Hughes.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.cxx alien.cxx.parser ;
+IN: alien.cxx.syntax
+
+SYNTAX: C++-CLASS:
+    parse-c++-class-definition define-c++-class ;
+
+SYNTAX: C++-METHOD:
+    parse-c++-method-definition f define-c++-method ;
+
+SYNTAX: C++-VIRTUAL:
+    parse-c++-method-definition t define-c++-method ;
diff --git a/alien/inline/authors.txt b/alien/inline/authors.txt
new file mode 100644 (file)
index 0000000..845910d
--- /dev/null
@@ -0,0 +1 @@
+Jeremy Hughes
diff --git a/alien/inline/compiler/authors.txt b/alien/inline/compiler/authors.txt
new file mode 100644 (file)
index 0000000..845910d
--- /dev/null
@@ -0,0 +1 @@
+Jeremy Hughes
diff --git a/alien/inline/compiler/compiler-docs.factor b/alien/inline/compiler/compiler-docs.factor
new file mode 100644 (file)
index 0000000..a5c204c
--- /dev/null
@@ -0,0 +1,78 @@
+! Copyright (C) 2009 Jeremy Hughes.
+! See http://factorcode.org/license.txt for BSD license.
+USING: help.markup help.syntax kernel strings words.symbol sequences ;
+IN: alien.inline.compiler
+
+HELP: C
+{ $var-description "A symbol representing C source." } ;
+
+HELP: C++
+{ $var-description "A symbol representing C++ source." } ;
+
+HELP: compile-to-library
+{ $values
+    { "lang" symbol } { "args" sequence } { "contents" string } { "name" string }
+}
+{ $description "Compiles and links " { $snippet "contents" } " into a shared library called " { $snippet "libname.suffix" }
+  "in " { $snippet "resource:alien-inline-libs" } ". " { $snippet "suffix" } " is OS specific. "
+  { $snippet "args" } " is a sequence of arguments for the linking stage." }
+{ $notes
+  { $list
+    "C and C++ are the only supported languages."
+    { "Source and object files are placed in " { $snippet "resource:temp" } "." } }
+} ;
+
+HELP: compiler
+{ $values
+    { "lang" symbol }
+    { "str" string }
+}
+{ $description "Returns a compiler name based on OS and source language." }
+{ $see-also compiler-descr } ;
+
+HELP: compiler-descr
+{ $values
+    { "lang" symbol }
+    { "descr" "a process description" }
+}
+{ $description "Returns a compiler process description based on OS and source language." }
+{ $see-also compiler } ;
+
+HELP: inline-library-file
+{ $values
+    { "name" string }
+    { "path" "a pathname string" }
+}
+{ $description "Appends " { $snippet "name" } " to the " { $link inline-libs-directory } "." } ;
+
+HELP: inline-libs-directory
+{ $values
+    { "path" "a pathname string" }
+}
+{ $description "The directory where libraries created using " { $snippet "alien.inline" } " are stored." } ;
+
+HELP: library-path
+{ $values
+    { "str" string }
+    { "path" "a pathname string" }
+}
+{ $description "Converts " { $snippet "name" } " into a full path to the corresponding inline library." } ;
+
+HELP: library-suffix
+{ $values
+    { "str" string }
+}
+{ $description "The appropriate shared library suffix for the current OS." } ;
+
+HELP: link-descr
+{ $values
+    { "lang" "a language" }
+    { "descr" sequence }
+}
+{ $description "Returns part of a process description. OS dependent." } ;
+
+ARTICLE: "alien.inline.compiler" "Inline C compiler"
+{ $vocab-link "alien.inline.compiler" }
+;
+
+ABOUT: "alien.inline.compiler"
diff --git a/alien/inline/compiler/compiler.factor b/alien/inline/compiler/compiler.factor
new file mode 100644 (file)
index 0000000..4f9515c
--- /dev/null
@@ -0,0 +1,93 @@
+! Copyright (C) 2009 Jeremy Hughes.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors arrays combinators fry generalizations
+io.encodings.ascii io.files io.files.temp io.launcher kernel
+locals make sequences system vocabs.parser words io.directories
+io.pathnames ;
+IN: alien.inline.compiler
+
+SYMBOL: C
+SYMBOL: C++
+
+: inline-libs-directory ( -- path )
+    "alien-inline-libs" resource-path dup make-directories ;
+
+: inline-library-file ( name -- path )
+    inline-libs-directory prepend-path ;
+
+: library-suffix ( -- str )
+    os {
+        { [ dup macosx? ]  [ drop ".dylib" ] }
+        { [ dup unix? ]    [ drop ".so" ] }
+        { [ dup windows? ] [ drop ".dll" ] }
+    } cond ;
+
+: library-path ( str -- path )
+    '[ "lib" % _ % library-suffix % ] "" make inline-library-file ;
+
+HOOK: compiler os ( lang -- str )
+
+M: word compiler
+    {
+        { C [ "gcc" ] }
+        { C++ [ "g++" ] }
+    } case ;
+
+M: openbsd compiler
+    {
+        { C [ "gcc" ] }
+        { C++ [ "eg++" ] }
+    } case ;
+
+M: windows compiler
+    {
+        { C [ "gcc" ] }
+        { C++ [ "g++" ] }
+    } case ;
+
+HOOK: compiler-descr os ( lang -- descr )
+
+M: word compiler-descr compiler 1array ;
+M: macosx compiler-descr
+    call-next-method cpu x86.64?
+    [ { "-arch" "x86_64" } append ] when ;
+
+HOOK: link-descr os ( lang -- descr )
+
+M: word link-descr drop { "-shared" "-o" } ;
+M: macosx link-descr
+    drop { "-g" "-prebind" "-dynamiclib" "-o" }
+    cpu x86.64? [ { "-arch" "x86_64" } prepend ] when ;
+M: windows link-descr
+    {
+        { C [ { "-mno-cygwin" "-shared" "-o" } ] }
+        { C++ [ { "-lstdc++" "-mno-cygwin" "-shared" "-o" } ] }
+    } case ;
+
+<PRIVATE
+: src-suffix ( lang -- str )
+    {
+        { C [ ".c" ] }
+        { C++ [ ".cpp" ] }
+    } case ;
+
+: link-command ( args in out lang -- descr )
+    [ 2array ] dip [ compiler 1array ] [ link-descr ] bi
+    append prepend prepend ;
+
+:: compile-to-object ( lang contents name -- )
+    name ".o" append temp-file
+    contents name lang src-suffix append temp-file
+    [ ascii set-file-contents ] keep 2array
+    lang compiler-descr { "-fPIC" "-c" "-o" } append prepend
+    try-process ;
+
+:: link-object ( lang args name -- )
+    args name [ library-path ]
+    [ ".o" append temp-file ] bi
+    lang link-command try-process ;
+PRIVATE>
+
+:: compile-to-library ( lang args contents name -- )
+    lang contents name compile-to-object
+    lang args name link-object ;
diff --git a/alien/inline/inline-docs.factor b/alien/inline/inline-docs.factor
new file mode 100644 (file)
index 0000000..2c0cd28
--- /dev/null
@@ -0,0 +1,113 @@
+! Copyright (C) 2009 Jeremy Hughes.
+! See http://factorcode.org/license.txt for BSD license.
+USING: help.markup help.syntax kernel strings effects quotations ;
+IN: alien.inline
+
+<PRIVATE
+: $binding-note ( x -- )
+    drop
+    { "This word requires that certain variables are correctly bound. "
+        "Call " { $link POSTPONE: define-c-library } " to set them up." } print-element ;
+PRIVATE>
+
+HELP: compile-c-library
+{ $description "Writes, compiles, and links code generated since last invocation of " { $link POSTPONE: define-c-library } ". "
+  "Also calls " { $snippet "add-library" } ". "
+  "This word does nothing if the shared library is younger than the factor source file." }
+{ $notes $binding-note } ;
+
+HELP: c-use-framework
+{ $values
+    { "str" string }
+}
+{ $description "OS X only. Adds " { $snippet "-framework name" } " to linker command." }
+{ $notes $binding-note }
+{ $see-also c-link-to c-link-to/use-framework } ;
+
+HELP: define-c-function
+{ $values
+    { "function" "function name" } { "types" "a sequence of C types" } { "effect" effect } { "body" string }
+}
+{ $description "Defines a C function and a factor word which calls it." }
+{ $notes
+  { $list
+    { "The number of " { $snippet "types" } " must match the " { $snippet "in" } " count of the " { $snippet "effect" } "." }
+    { "There must be only one " { $snippet "out" } " element. It must be a legal C return type with dashes (-) instead of spaces." }
+    $binding-note
+  }
+}
+{ $see-also POSTPONE: define-c-function' } ;
+
+HELP: define-c-function'
+{ $values
+    { "function" "function name" } { "effect" effect } { "body" string }
+}
+{ $description "Defines a C function and a factor word which calls it. See " { $link define-c-function } " for more information." }
+{ $notes
+  { $list
+    { "Each effect element must be a legal C type with dashes (-) instead of spaces. "
+      "C argument names will be generated alphabetically, starting with " { $snippet "a" } "." }
+    $binding-note
+  }
+}
+{ $see-also define-c-function } ;
+
+HELP: c-include
+{ $values
+    { "str" string }
+}
+{ $description "Appends an include line to the C library in scope." }
+{ $notes $binding-note } ;
+
+HELP: define-c-library
+{ $values
+    { "name" string }
+}
+{ $description "Starts a new C library scope. Other " { $snippet "alien.inline" } " words can be used after this one." } ;
+
+HELP: c-link-to
+{ $values
+    { "str" string }
+}
+{ $description "Adds " { $snippet "-lname" } " to linker command." }
+{ $notes $binding-note }
+{ $see-also c-use-framework c-link-to/use-framework } ;
+
+HELP: c-link-to/use-framework
+{ $values
+    { "str" string }
+}
+{ $description "Equivalent to " { $link c-use-framework } " on OS X and " { $link c-link-to } " everywhere else." }
+{ $notes $binding-note }
+{ $see-also c-link-to c-use-framework } ;
+
+HELP: define-c-struct
+{ $values
+    { "name" string } { "fields" "type/name pairs" }
+}
+{ $description "Defines a C struct and factor words which operate on it." }
+{ $notes $binding-note } ;
+
+HELP: define-c-typedef
+{ $values
+    { "old" "C type" } { "new" "C type" }
+}
+{ $description "Define C and factor typedefs." }
+{ $notes $binding-note } ;
+
+HELP: delete-inline-library
+{ $values
+    { "name" string }
+}
+{ $description "Delete the shared library file corresponding to " { $snippet "name" } "." }
+{ $notes "Must be executed in the vocabulary where " { $snippet "name" } " is defined. " } ;
+
+HELP: with-c-library
+{ $values
+    { "name" string } { "quot" quotation }
+}
+{ $description "Calls " { $link define-c-library } ", then the quotation, then " { $link compile-c-library } ", then sets all variables bound by " { $snippet "define-c-library" } " to " { $snippet "f" } "." } ;
+
+HELP: raw-c
+{ $values { "str" string } }
+{ $description "Insert a string into the generated source file. Useful for macros and other details not implemented in " { $snippet "alien.inline" } "." } ;
diff --git a/alien/inline/inline.factor b/alien/inline/inline.factor
new file mode 100644 (file)
index 0000000..b40bc8c
--- /dev/null
@@ -0,0 +1,131 @@
+! Copyright (C) 2009 Jeremy Hughes.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors alien.inline.compiler alien.inline.types
+alien.libraries alien.parser arrays assocs effects fry
+generalizations grouping io.directories io.files
+io.files.info io.files.temp kernel lexer math math.order
+math.ranges multiline namespaces sequences source-files
+splitting strings system vocabs.loader vocabs.parser words
+alien.c-types alien.structs make parser continuations ;
+IN: alien.inline
+
+SYMBOL: c-library
+SYMBOL: library-is-c++
+SYMBOL: linker-args
+SYMBOL: c-strings
+
+<PRIVATE
+: cleanup-variables ( -- )
+    { c-library library-is-c++ linker-args c-strings }
+    [ off ] each ;
+
+: arg-list ( types -- params )
+    CHAR: a swap length CHAR: a + [a,b]
+    [ 1string ] map ;
+
+: compile-library? ( -- ? )
+    c-library get library-path dup exists? [
+        file get [
+            path>>
+            [ file-info modified>> ] bi@ <=> +lt+ =
+        ] [ drop t ] if*
+    ] [ drop t ] if ;
+
+: compile-library ( -- )
+    library-is-c++ get [ C++ ] [ C ] if
+    linker-args get
+    c-strings get "\n" join
+    c-library get compile-to-library ;
+
+: c-library-name ( name -- name' )
+    [ current-vocab name>> % "_" % % ] "" make ;
+PRIVATE>
+
+: parse-arglist ( parameters return -- types effect )
+    [ 2 group unzip [ "," ?tail drop ] map ]
+    [ [ { } ] [ 1array ] if-void ]
+    bi* <effect> ;
+
+: append-function-body ( prototype-str body -- str )
+    [ swap % " {\n" % % "\n}\n" % ] "" make ;
+
+: function-types-effect ( -- function types effect )
+    scan scan swap ")" parse-tokens
+    [ "(" subseq? ] reject swap parse-arglist ;
+
+: prototype-string ( function types effect -- str )
+    [ [ cify-type ] map ] dip
+    types-effect>params-return cify-type -rot
+    [ " " join ] map ", " join
+    "(" prepend ")" append 3array " " join
+    library-is-c++ get [ "extern \"C\" " prepend ] when ;
+
+: prototype-string' ( function types return -- str )
+    [ dup arg-list ] <effect> prototype-string ;
+
+: factor-function ( function types effect -- word quot effect )
+    annotate-effect [ c-library get ] 3dip
+    [ [ factorize-type ] map ] dip
+    types-effect>params-return factorize-type -roll
+    concat make-function ;
+
+: define-c-library ( name -- )
+    c-library-name [ c-library set ] [ "c-library" set ] bi
+    V{ } clone c-strings set
+    V{ } clone linker-args set ;
+
+: compile-c-library ( -- )
+    compile-library? [ compile-library ] when
+    c-library get dup library-path cdecl add-library ;
+
+: define-c-function ( function types effect body -- )
+    [
+        [ factor-function define-declared ]
+        [ prototype-string ] 3bi
+    ] dip append-function-body c-strings get push ;
+
+: define-c-function' ( function effect body -- )
+    [
+        [ in>> ] keep
+        [ factor-function define-declared ]
+        [ out>> prototype-string' ] 3bi
+    ] dip append-function-body c-strings get push ;
+
+: c-link-to ( str -- )
+    "-l" prepend linker-args get push ;
+
+: c-use-framework ( str -- )
+    "-framework" swap linker-args get '[ _ push ] bi@ ;
+
+: c-link-to/use-framework ( str -- )
+    os macosx? [ c-use-framework ] [ c-link-to ] if ;
+
+: c-include ( str -- )
+    "#include " prepend c-strings get push ;
+
+: define-c-typedef ( old new -- )
+    [ typedef ] [
+        [ swap "typedef " % % " " % % ";" % ]
+        "" make c-strings get push
+    ] 2bi ;
+
+: define-c-struct ( name fields -- )
+    [ current-vocab swap define-struct ] [
+        over
+        [
+            "typedef struct " % "_" % % " {\n" %
+            [ first2 swap % " " % % ";\n" % ] each
+            "} " % % ";\n" %
+        ] "" make c-strings get push
+    ] 2bi ;
+
+: delete-inline-library ( name -- )
+    c-library-name [ remove-library ]
+    [ library-path dup exists? [ delete-file ] [ drop ] if ] bi ;
+
+: with-c-library ( name quot -- )
+    [ [ define-c-library ] dip call compile-c-library ]
+    [ cleanup-variables ] [ ] cleanup ; inline
+
+: raw-c ( str -- )
+    [ "\n" % % "\n" % ] "" make c-strings get push ;
diff --git a/alien/inline/syntax/authors.txt b/alien/inline/syntax/authors.txt
new file mode 100644 (file)
index 0000000..845910d
--- /dev/null
@@ -0,0 +1 @@
+Jeremy Hughes
diff --git a/alien/inline/syntax/syntax-docs.factor b/alien/inline/syntax/syntax-docs.factor
new file mode 100644 (file)
index 0000000..844cb1d
--- /dev/null
@@ -0,0 +1,100 @@
+! Copyright (C) 2009 Jeremy Hughes.
+! See http://factorcode.org/license.txt for BSD license.
+USING: help.markup help.syntax alien.inline ;
+IN: alien.inline.syntax
+
+HELP: ;C-LIBRARY
+{ $syntax ";C-LIBRARY" }
+{ $description "Writes, compiles, and links code generated since previous invocation of " { $link POSTPONE: C-LIBRARY: } "." }
+{ $see-also POSTPONE: compile-c-library } ;
+
+HELP: C-FRAMEWORK:
+{ $syntax "C-FRAMEWORK: name" }
+{ $description "OS X only. Link to named framework. Takes effect when " { $link POSTPONE: ;C-LIBRARY } " is called." }
+{ $see-also POSTPONE: c-use-framework } ;
+
+HELP: C-FUNCTION:
+{ $syntax "C-FUNCTION: return name ( args ... )\nbody\n;" }
+{ $description "Appends a function to the C library in scope and defines an FFI word that calls it." }
+{ $examples
+  { $example
+    "USING: alien.inline.syntax prettyprint ;"
+    "IN: cmath.ffi"
+    ""
+    "C-LIBRARY: cmathlib"
+    ""
+    "C-FUNCTION: int add ( int a, int b )"
+    "    return a + b;"
+    ";"
+    ""
+    ";C-LIBRARY"
+    ""
+    "1 2 add ."
+    "3" }
+}
+{ $see-also POSTPONE: define-c-function } ;
+
+HELP: C-INCLUDE:
+{ $syntax "C-INCLUDE: name" }
+{ $description "Appends an include line to the C library in scope." }
+{ $see-also POSTPONE: c-include } ;
+
+HELP: C-LIBRARY:
+{ $syntax "C-LIBRARY: name" }
+{ $description "Starts a new C library scope. Other " { $snippet "alien.inline" } " syntax can be used after this word." }
+{ $examples
+  { $example
+    "USING: alien.inline.syntax ;"
+    "IN: rectangle.ffi"
+    ""
+    "C-LIBRARY: rectlib"
+    ""
+    "C-STRUCTURE: rectangle { \"int\" \"width\" } { \"int\" \"height\" } ;"
+    ""
+    "C-FUNCTION: int area ( rectangle c )"
+    "    return c.width * c.height;"
+    ";"
+    ""
+    ";C-LIBRARY"
+    "" }
+}
+{ $see-also POSTPONE: define-c-library } ;
+
+HELP: C-LINK/FRAMEWORK:
+{ $syntax "C-LINK/FRAMEWORK: name" }
+{ $description "Equivalent to " { $link POSTPONE: C-FRAMEWORK: } " on OS X and " { $link POSTPONE: C-LINK: } " everywhere else." }
+{ $see-also POSTPONE: c-link-to/use-framework } ;
+
+HELP: C-LINK:
+{ $syntax "C-LINK: name" }
+{ $description "Link to named library. Takes effect when " { $link POSTPONE: ;C-LIBRARY } " is called." }
+{ $see-also POSTPONE: c-link-to } ;
+
+HELP: C-STRUCTURE:
+{ $syntax "C-STRUCTURE: name pairs ... ;" }
+{ $description "Like " { $snippet "C-STRUCT:" } " but also generates equivalent C code."}
+{ $see-also POSTPONE: define-c-struct } ;
+
+HELP: C-TYPEDEF:
+{ $syntax "C-TYPEDEF: old new" }
+{ $description "Like " { $snippet "TYPEDEF:" } " but generates a C typedef statement too." }
+{ $see-also POSTPONE: define-c-typedef } ;
+
+HELP: COMPILE-AS-C++
+{ $syntax "COMPILE-AS-C++" }
+{ $description "Insert this word anywhere between " { $link POSTPONE: C-LIBRARY: } " and " { $link POSTPONE: ;C-LIBRARY } " and the generated code will be treated as C++ with " { $snippet "extern \"C\"" } " prepended to each function prototype." } ;
+
+HELP: DELETE-C-LIBRARY:
+{ $syntax "DELETE-C-LIBRARY: name" }
+{ $description "Deletes the shared library file corresponding to " { $snippet "name" } " . " }
+{ $notes
+  { $list
+    { "Must be executed in the vocabulary where " { $snippet "name" } " is defined. " }
+    "This word is mainly useful for unit tests."
+  }
+}
+{ $see-also POSTPONE: delete-inline-library } ;
+
+HELP: <RAW-C
+{ $syntax "<RAW-C code RAW-C>" }
+{ $description "Insert a (multiline) string into the generated source file. Useful for macros and other details not implemented in " { $snippet "alien.inline" } "." } ;
diff --git a/alien/inline/syntax/syntax-tests.factor b/alien/inline/syntax/syntax-tests.factor
new file mode 100644 (file)
index 0000000..4044e16
--- /dev/null
@@ -0,0 +1,72 @@
+! Copyright (C) 2009 Jeremy Hughes.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.inline alien.inline.syntax io.directories io.files
+kernel namespaces tools.test alien.c-types alien.data alien.structs ;
+IN: alien.inline.syntax.tests
+
+DELETE-C-LIBRARY: test
+C-LIBRARY: test
+
+C-FUNCTION: const-int add ( int a, int b )
+    return a + b;
+;
+
+C-TYPEDEF: double bigfloat
+
+C-FUNCTION: bigfloat smaller ( bigfloat a )
+    return a / 10;
+;
+
+C-STRUCTURE: rectangle
+    { "int" "width" }
+    { "int" "height" } ;
+
+C-FUNCTION: int area ( rectangle c )
+    return c.width * c.height;
+;
+
+;C-LIBRARY
+
+{ 2 1 } [ add ] must-infer-as
+[ 5 ] [ 2 3 add ] unit-test
+
+[ t ] [ "double" "bigfloat" [ resolve-typedef ] same? ] unit-test
+{ 1 1 } [ smaller ] must-infer-as
+[ 1.0 ] [ 10 smaller ] unit-test
+
+[ t ] [ "rectangle" resolve-typedef struct-type? ] unit-test
+{ 1 1 } [ area ] must-infer-as
+[ 20 ] [
+    "rectangle" <c-object>
+    4 over set-rectangle-width
+    5 over set-rectangle-height
+    area
+] unit-test
+
+
+DELETE-C-LIBRARY: cpplib
+C-LIBRARY: cpplib
+
+COMPILE-AS-C++
+
+C-INCLUDE: <string>
+
+C-FUNCTION: const-char* hello ( )
+    std::string s("hello world");
+    return s.c_str();
+;
+
+;C-LIBRARY
+
+{ 0 1 } [ hello ] must-infer-as
+[ "hello world" ] [ hello ] unit-test
+
+
+DELETE-C-LIBRARY: compile-error
+C-LIBRARY: compile-error
+
+C-FUNCTION: char* breakme ( )
+    return not a string;
+;
+
+<< [ compile-c-library ] must-fail >>
diff --git a/alien/inline/syntax/syntax.factor b/alien/inline/syntax/syntax.factor
new file mode 100644 (file)
index 0000000..ce18616
--- /dev/null
@@ -0,0 +1,31 @@
+! Copyright (C) 2009 Jeremy Hughes.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.inline lexer multiline namespaces parser ;
+IN: alien.inline.syntax
+
+
+SYNTAX: C-LIBRARY: scan define-c-library ;
+
+SYNTAX: COMPILE-AS-C++ t library-is-c++ set ;
+
+SYNTAX: C-LINK: scan c-link-to ;
+
+SYNTAX: C-FRAMEWORK: scan c-use-framework ;
+
+SYNTAX: C-LINK/FRAMEWORK: scan c-link-to/use-framework ;
+
+SYNTAX: C-INCLUDE: scan c-include ;
+
+SYNTAX: C-FUNCTION:
+    function-types-effect parse-here define-c-function ;
+
+SYNTAX: C-TYPEDEF: scan scan define-c-typedef ;
+
+SYNTAX: C-STRUCTURE:
+    scan parse-definition define-c-struct ;
+
+SYNTAX: ;C-LIBRARY compile-c-library ;
+
+SYNTAX: DELETE-C-LIBRARY: scan delete-inline-library ;
+
+SYNTAX: <RAW-C "RAW-C>" parse-multiline-string raw-c ;
diff --git a/alien/inline/types/authors.txt b/alien/inline/types/authors.txt
new file mode 100644 (file)
index 0000000..845910d
--- /dev/null
@@ -0,0 +1 @@
+Jeremy Hughes
diff --git a/alien/inline/types/types.factor b/alien/inline/types/types.factor
new file mode 100644 (file)
index 0000000..fe4e31f
--- /dev/null
@@ -0,0 +1,102 @@
+! Copyright (C) 2009 Jeremy Hughes.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors alien.c-types assocs combinators.short-circuit
+continuations effects fry kernel math memoize sequences
+splitting strings peg.ebnf make words ;
+IN: alien.inline.types
+
+: cify-type ( str -- str' )
+    dup word? [ name>> ] when
+    H{ { CHAR: - CHAR: space } } substitute ;
+
+: factorize-type ( str -- str' )
+    cify-type
+    "const " ?head drop
+    "unsigned " ?head [ "u" prepend ] when
+    "long " ?head [ "long" prepend ] when
+    " const" ?tail drop ;
+
+: const-pointer? ( str -- ? )
+    cify-type { [ " const" tail? ] [ "&" tail? ] } 1|| ;
+
+: pointer-to-const? ( str -- ? )
+    cify-type "const " head? ;
+
+: template-class? ( str -- ? )
+    [ CHAR: < = ] any? ;
+
+MEMO: resolved-primitives ( -- seq )
+    primitive-types [ resolve-typedef ] map ;
+
+: primitive-type? ( type -- ? )
+    [
+        factorize-type resolve-typedef [ resolved-primitives ] dip
+        '[ _ = ] any?
+    ] [ 2drop f ] recover ;
+
+: pointer? ( type -- ? )
+    factorize-type [ "*" tail? ] [ "&" tail? ] bi or ;
+
+: type-sans-pointer ( type -- type' )
+    factorize-type [ '[ _ = ] "*&" swap any? ] trim-tail ;
+
+: pointer-to-primitive? ( type -- ? )
+    factorize-type
+    { [ pointer? ] [ type-sans-pointer primitive-type? ] } 1&& ;
+
+: pointer-to-non-const-primitive? ( str -- ? )
+    {
+        [ pointer-to-const? not ]
+        [ factorize-type pointer-to-primitive? ]
+    } 1&& ;
+
+: types-effect>params-return ( types effect -- params return )
+    [ in>> zip ]
+    [ nip out>> dup length 0 > [ first ] [ drop "void" ] if ]
+    2bi ;
+
+: annotate-effect ( types effect -- types effect' )
+    [ in>> ] [ out>> ] bi [
+        zip
+        [ over pointer-to-primitive? [ ">" prepend ] when ]
+        assoc-map unzip
+    ] dip <effect> ;
+
+TUPLE: c++-type name params ptr ;
+C: <c++-type> c++-type
+
+EBNF: (parse-c++-type)
+dig  = [0-9]
+alpha = [a-zA-Z]
+alphanum = [1-9a-zA-Z]
+name = [_a-zA-Z] [_a-zA-Z1-9:]* => [[ first2 swap prefix >string ]]
+ptr = [*&] => [[ empty? not ]]
+
+param = "," " "* type " "* => [[ third ]]
+
+params = "<" " "* type " "* param* ">" => [[ [ 4 swap nth ] [ third ] bi prefix ]]
+
+type = name " "* params? " "* ptr? => [[ { 0 2 4 } [ swap nth ] with map first3 <c++-type> ]]
+;EBNF
+
+: parse-c++-type ( str -- c++-type )
+    factorize-type (parse-c++-type) ;
+
+DEFER: c++-type>string
+
+: params>string ( params -- str )
+    [ "<" % [ c++-type>string ] map "," join % ">" % ] "" make ;
+
+: c++-type>string ( c++-type -- str )
+    [
+        [ name>> % ]
+        [ params>> [ params>string % ] when* ]
+        [ ptr>> [ "*" % ] when ]
+        tri
+    ] "" make ;
+
+GENERIC: c++-type ( obj -- c++-type/f )
+
+M: object c++-type drop f ;
+
+M: c++-type c-type ;
diff --git a/alien/marshall/authors.txt b/alien/marshall/authors.txt
new file mode 100644 (file)
index 0000000..845910d
--- /dev/null
@@ -0,0 +1 @@
+Jeremy Hughes
diff --git a/alien/marshall/marshall-docs.factor b/alien/marshall/marshall-docs.factor
new file mode 100644 (file)
index 0000000..519fe99
--- /dev/null
@@ -0,0 +1,638 @@
+! Copyright (C) 2009 Jeremy Hughes.
+! See http://factorcode.org/license.txt for BSD license.
+USING: help.markup help.syntax kernel quotations sequences
+strings alien alien.c-types alien.data math byte-arrays ;
+IN: alien.marshall
+
+<PRIVATE
+: $memory-note ( arg -- )
+    drop "This word returns a pointer to unmanaged memory."
+    print-element ;
+
+: $c-ptr-note ( arg -- )
+    drop "Does nothing if its argument is a non false c-ptr."
+    print-element ;
+
+: $see-article ( arg -- )
+    drop { "See " { $vocab-link "alien.inline" } "." }
+    print-element ;
+PRIVATE>
+
+HELP: ?malloc-byte-array
+{ $values
+    { "c-type" c-type }
+    { "alien" alien }
+}
+{ $description "Does nothing if input is an alien, otherwise assumes it is a byte array and calls "
+  { $snippet "malloc-byte-array" } "."
+}
+{ $notes $memory-note } ;
+
+HELP: alien-wrapper
+{ $var-description "For wrapping C pointers in a structure factor can dispatch on." } ;
+
+HELP: unmarshall-cast
+{ $values
+    { "alien-wrapper" alien-wrapper }
+    { "alien-wrapper'" alien-wrapper }
+}
+{ $description "Called immediately after unmarshalling. Useful for automatically casting to subtypes." } ;
+
+HELP: marshall-bool
+{ $values
+    { "?" "a generalized boolean" }
+    { "n" "0 or 1" }
+}
+{ $description "Marshalls objects to bool." }
+{ $notes "Will treat " { $snippet "0" } " as " { $snippet "t" } "." } ;
+
+HELP: marshall-bool*
+{ $values
+    { "?/seq" "t/f or sequence" }
+    { "alien" alien }
+}
+{ $description "When the argument is a sequence, returns a pointer to an array of bool, "
+   "otherwise returns a pointer to a single bool value."
+}
+{ $notes { $list $c-ptr-note $memory-note } } ;
+
+HELP: marshall-bool**
+{ $values
+    { "seq" sequence }
+    { "alien" alien }
+}
+{ $description "Takes a one or two dimensional array of generalized booleans "
+  "and returns a pointer to the equivalent C structure."
+}
+{ $notes { $list $c-ptr-note $memory-note } } ;
+
+HELP: marshall-primitive
+{ $values
+    { "n" number }
+    { "n" number }
+}
+{ $description "Marshall numbers to C primitives."
+    $nl
+    "Factor marshalls numbers to primitives for FFI calls, so all "
+    "this word does is convert " { $snippet "t" } " to " { $snippet "1" }
+    ", " { $snippet "f" } " to " { $snippet "0" } ", and lets anything else "
+    "pass through untouched."
+} ;
+
+HELP: marshall-char*
+{ $values
+    { "n/seq" "number or sequence" }
+    { "alien" alien }
+}
+{ $description $see-article }
+{ $notes { $list $c-ptr-note $memory-note } } ;
+
+HELP: marshall-char**
+{ $values
+    { "seq" sequence }
+    { "alien" alien }
+}
+{ $description $see-article }
+{ $notes { $list $c-ptr-note $memory-note } } ;
+
+HELP: marshall-char**-or-strings
+{ $values
+    { "seq" "a sequence of strings" }
+    { "alien" alien }
+}
+{ $description "Marshalls an array of strings or characters to an array of C strings." }
+{ $notes { $list $c-ptr-note $memory-note } } ;
+
+HELP: marshall-char*-or-string
+{ $values
+    { "n/string" "a number or string" }
+    { "alien" alien }
+}
+{ $description "Marshalls a string to a C string or a number to a pointer to " { $snippet "char" } "." }
+{ $notes { $list $c-ptr-note $memory-note } } ;
+
+HELP: marshall-double*
+{ $values
+    { "n/seq" "a number or sequence" }
+    { "alien" alien }
+}
+{ $description $see-article }
+{ $notes { $list $c-ptr-note $memory-note } } ;
+
+HELP: marshall-double**
+{ $values
+    { "seq" sequence }
+    { "alien" alien }
+}
+{ $description $see-article }
+{ $notes { $list $c-ptr-note $memory-note } } ;
+
+HELP: marshall-float*
+{ $values
+    { "n/seq" "a number or sequence" }
+    { "alien" alien }
+}
+{ $description $see-article }
+{ $notes { $list $c-ptr-note $memory-note } } ;
+
+HELP: marshall-float**
+{ $values
+    { "seq" sequence }
+    { "alien" alien }
+}
+{ $description $see-article }
+{ $notes { $list $c-ptr-note $memory-note } } ;
+
+HELP: marshall-int*
+{ $values
+    { "n/seq" "a number or sequence" }
+    { "alien" alien }
+}
+{ $description $see-article }
+{ $notes { $list $c-ptr-note $memory-note } } ;
+
+HELP: marshall-int**
+{ $values
+    { "seq" sequence }
+    { "alien" alien }
+}
+{ $description $see-article }
+{ $notes { $list $c-ptr-note $memory-note } } ;
+
+HELP: marshall-long*
+{ $values
+    { "n/seq" "a number or sequence" }
+    { "alien" alien }
+}
+{ $description $see-article }
+{ $notes { $list $c-ptr-note $memory-note } } ;
+
+HELP: marshall-long**
+{ $values
+    { "seq" sequence }
+    { "alien" alien }
+}
+{ $description $see-article }
+{ $notes { $list $c-ptr-note $memory-note } } ;
+
+HELP: marshall-longlong*
+{ $values
+    { "n/seq" "a number or sequence" }
+    { "alien" alien }
+}
+{ $description $see-article }
+{ $notes { $list $c-ptr-note $memory-note } } ;
+
+HELP: marshall-longlong**
+{ $values
+    { "seq" sequence }
+    { "alien" alien }
+}
+{ $description $see-article }
+{ $notes { $list $c-ptr-note $memory-note } } ;
+
+HELP: marshall-non-pointer
+{ $values
+    { "alien-wrapper/byte-array" "an alien-wrapper or byte-array" }
+    { "byte-array" byte-array }
+}
+{ $description "Converts argument to a byte array." }
+{ $notes "Not meant to be called directly. Use the output of " { $link marshaller } " instead." } ;
+
+HELP: marshall-pointer
+{ $values
+    { "obj" object }
+    { "alien" alien }
+}
+{ $description "Converts argument to a C pointer." }
+{ $notes "Can marshall the following types: " { $snippet "alien, f, byte-array, alien-wrapper, struct-array" } "." } ;
+
+HELP: marshall-short*
+{ $values
+    { "n/seq" "a number or sequence" }
+    { "alien" alien }
+}
+{ $description $see-article }
+{ $notes { $list $c-ptr-note $memory-note } } ;
+
+HELP: marshall-short**
+{ $values
+    { "seq" sequence }
+    { "alien" alien }
+}
+{ $description $see-article }
+{ $notes { $list $c-ptr-note $memory-note } } ;
+
+HELP: marshall-uchar*
+{ $values
+    { "n/seq" "a number or sequence" }
+    { "alien" alien }
+}
+{ $description $see-article }
+{ $notes { $list $c-ptr-note $memory-note } } ;
+
+HELP: marshall-uchar**
+{ $values
+    { "seq" sequence }
+    { "alien" alien }
+}
+{ $description $see-article }
+{ $notes { $list $c-ptr-note $memory-note } } ;
+
+HELP: marshall-uint*
+{ $values
+    { "n/seq" "a number or sequence" }
+    { "alien" alien }
+}
+{ $description $see-article }
+{ $notes { $list $c-ptr-note $memory-note } } ;
+
+HELP: marshall-uint**
+{ $values
+    { "seq" sequence }
+    { "alien" alien }
+}
+{ $description $see-article }
+{ $notes { $list $c-ptr-note $memory-note } } ;
+
+HELP: marshall-ulong*
+{ $values
+    { "n/seq" "a number or sequence" }
+    { "alien" alien }
+}
+{ $description $see-article }
+{ $notes { $list $c-ptr-note $memory-note } } ;
+
+HELP: marshall-ulong**
+{ $values
+    { "seq" sequence }
+    { "alien" alien }
+}
+{ $description $see-article }
+{ $notes { $list $c-ptr-note $memory-note } } ;
+
+HELP: marshall-ulonglong*
+{ $values
+    { "n/seq" "a number or sequence" }
+    { "alien" alien }
+}
+{ $description $see-article }
+{ $notes { $list $c-ptr-note $memory-note } } ;
+
+HELP: marshall-ulonglong**
+{ $values
+    { "seq" sequence }
+    { "alien" alien }
+}
+{ $description $see-article }
+{ $notes { $list $c-ptr-note $memory-note } } ;
+
+HELP: marshall-ushort*
+{ $values
+    { "n/seq" "a number or sequence" }
+    { "alien" alien }
+}
+{ $description $see-article }
+{ $notes { $list $c-ptr-note $memory-note } } ;
+
+HELP: marshall-ushort**
+{ $values
+    { "seq" sequence }
+    { "alien" alien }
+}
+{ $description $see-article }
+{ $notes { $list $c-ptr-note $memory-note } } ;
+
+HELP: marshall-void**
+{ $values
+    { "seq" sequence }
+    { "alien" alien }
+}
+{ $description "Marshalls a sequence of objects to an array of pointers to void." }
+{ $notes { $list $c-ptr-note $memory-note } } ;
+
+HELP: marshaller
+{ $values
+    { "type" "a C type string" }
+    { "quot" quotation }
+}
+{ $description "Given a C type, returns a quotation that will marshall its argument to that type." } ;
+
+HELP: out-arg-unmarshaller
+{ $values
+    { "type" "a C type string" }
+    { "quot" quotation }
+}
+{ $description "Like " { $link unmarshaller } " but returns an empty quotation "
+    "for all types except pointers to non-const primitives."
+} ;
+
+HELP: class-unmarshaller
+{ $values
+    { "type" " a C type string" }
+    { "quot/f" quotation }
+}
+{ $description "If in the vocab in which this word is called, there is a subclass of " { $link alien-wrapper }
+    " named after the type argument, " { $snippet "pointer-unmarshaller" } " will return a quotation which "
+    "wraps its argument in an instance of that subclass. In any other case it returns an empty quotation."
+}
+{ $notes "Not meant to be called directly. Use the output of " { $link marshaller } " instead." } ;
+
+HELP: primitive-marshaller
+{ $values
+    { "type" "a C type string" }
+    { "quot/f" "a quotation or f" }
+}
+{ $description "Returns a quotation to marshall objects to the argument type." }
+{ $notes "Not meant to be called directly. Use the output of " { $link marshaller } " instead." } ;
+
+HELP: primitive-unmarshaller
+{ $values
+    { "type" "a C type string" }
+    { "quot/f" "a quotation or f" }
+}
+{ $description "Returns a quotation to unmarshall objects from the argument type." }
+{ $notes "Not meant to be called directly. Use the output of " { $link unmarshaller } " instead." } ;
+
+HELP: struct-field-unmarshaller
+{ $values
+    { "type" "a C type string" }
+    { "quot" quotation }
+}
+{ $description "Like " { $link unmarshaller } " but returns a quotation that "
+    "does not call " { $snippet "free" } " on its argument."
+}
+{ $notes "Not meant to be called directly. Use the output of " { $link unmarshaller } " instead." } ;
+
+HELP: struct-primitive-unmarshaller
+{ $values
+    { "type" "a C type string" }
+    { "quot/f" "a quotation or f" }
+}
+{ $description "Like " { $link primitive-unmarshaller } " but returns a quotation that "
+    "does not call " { $snippet "free" } " on its argument." }
+{ $notes "Not meant to be called directly. Use the output of " { $link unmarshaller } " instead." } ;
+
+HELP: struct-unmarshaller
+{ $values
+    { "type" "a C type string" }
+    { "quot/f" quotation }
+}
+{ $description "Returns a quotation which wraps its argument in the subclass of "
+    { $link struct-wrapper } " which matches the " { $snippet "type" } " arg."
+}
+{ $notes "Not meant to be called directly. Use the output of " { $link unmarshaller } " instead." } ;
+
+HELP: struct-wrapper
+{ $var-description "For wrapping C structs in a structure factor can dispatch on." } ;
+
+HELP: unmarshall-bool
+{ $values
+    { "n" number }
+    { "?" boolean }
+}
+{ $description "Unmarshalls a number to a boolean." } ;
+
+HELP: unmarshall-bool*
+{ $values
+    { "alien" alien }
+    { "?" boolean }
+}
+{ $description "Unmarshalls a C pointer to a boolean." } ;
+
+HELP: unmarshall-bool*-free
+{ $values
+    { "alien" alien }
+    { "?" boolean }
+}
+{ $description "Unmarshalls a C pointer to a boolean and frees the pointer." } ;
+
+HELP: unmarshall-char*
+{ $values
+    { "alien" alien }
+    { "n" number }
+}
+{ $description $see-article } ;
+
+HELP: unmarshall-char*-free
+{ $values
+    { "alien" alien }
+    { "n" number }
+}
+{ $description $see-article } ;
+
+HELP: unmarshall-char*-to-string
+{ $values
+    { "alien" alien }
+    { "string" string }
+}
+{ $description "Unmarshalls a " { $snippet "char" } " pointer to a factor string." } ;
+
+HELP: unmarshall-char*-to-string-free
+{ $values
+    { "alien" alien }
+    { "string" string }
+}
+{ $description "Unmarshalls a " { $snippet "char" } " pointer to a factor string and frees the pointer." } ;
+
+HELP: unmarshall-double*
+{ $values
+    { "alien" alien }
+    { "n" number }
+}
+{ $description $see-article } ;
+
+HELP: unmarshall-double*-free
+{ $values
+    { "alien" alien }
+    { "n" number }
+}
+{ $description $see-article } ;
+
+HELP: unmarshall-float*
+{ $values
+    { "alien" alien }
+    { "n" number }
+}
+{ $description $see-article } ;
+
+HELP: unmarshall-float*-free
+{ $values
+    { "alien" alien }
+    { "n" number }
+}
+{ $description $see-article } ;
+
+HELP: unmarshall-int*
+{ $values
+    { "alien" alien }
+    { "n" number }
+}
+{ $description $see-article } ;
+
+HELP: unmarshall-int*-free
+{ $values
+    { "alien" alien }
+    { "n" number }
+}
+{ $description $see-article } ;
+
+HELP: unmarshall-long*
+{ $values
+    { "alien" alien }
+    { "n" number }
+}
+{ $description $see-article } ;
+
+HELP: unmarshall-long*-free
+{ $values
+    { "alien" alien }
+    { "n" number }
+}
+{ $description $see-article } ;
+
+HELP: unmarshall-longlong*
+{ $values
+    { "alien" alien }
+    { "n" number }
+}
+{ $description $see-article } ;
+
+HELP: unmarshall-longlong*-free
+{ $values
+    { "alien" alien }
+    { "n" number }
+}
+{ $description $see-article } ;
+
+HELP: unmarshall-short*
+{ $values
+    { "alien" alien }
+    { "n" number }
+}
+{ $description $see-article } ;
+
+HELP: unmarshall-short*-free
+{ $values
+    { "alien" alien }
+    { "n" number }
+}
+{ $description $see-article } ;
+
+HELP: unmarshall-uchar*
+{ $values
+    { "alien" alien }
+    { "n" number }
+}
+{ $description $see-article } ;
+
+HELP: unmarshall-uchar*-free
+{ $values
+    { "alien" alien }
+    { "n" number }
+}
+{ $description $see-article } ;
+
+HELP: unmarshall-uint*
+{ $values
+    { "alien" alien }
+    { "n" number }
+}
+{ $description $see-article } ;
+
+HELP: unmarshall-uint*-free
+{ $values
+    { "alien" alien }
+    { "n" number }
+}
+{ $description $see-article } ;
+
+HELP: unmarshall-ulong*
+{ $values
+    { "alien" alien }
+    { "n" number }
+}
+{ $description $see-article } ;
+
+HELP: unmarshall-ulong*-free
+{ $values
+    { "alien" alien }
+    { "n" number }
+}
+{ $description $see-article } ;
+
+HELP: unmarshall-ulonglong*
+{ $values
+    { "alien" alien }
+    { "n" number }
+}
+{ $description $see-article } ;
+
+HELP: unmarshall-ulonglong*-free
+{ $values
+    { "alien" alien }
+    { "n" number }
+}
+{ $description $see-article } ;
+
+HELP: unmarshall-ushort*
+{ $values
+    { "alien" alien }
+    { "n" number }
+}
+{ $description $see-article } ;
+
+HELP: unmarshall-ushort*-free
+{ $values
+    { "alien" alien }
+    { "n" number }
+}
+{ $description $see-article } ;
+
+HELP: unmarshaller
+{ $values
+    { "type" "a C type string" }
+    { "quot" quotation }
+}
+{ $description "Given a C type, returns a quotation that will unmarshall values of that type." } ;
+
+ARTICLE: "alien.marshall" "C marshalling"
+{ $vocab-link "alien.marshall" } " provides alien wrappers and marshalling words for the "
+"automatic marshalling and unmarshalling of C function arguments, return values, and output parameters."
+
+{ $subheading "Important words" }
+"Wrap an alien:" { $subsections alien-wrapper }
+"Wrap a struct:" { $subsections struct-wrapper }
+"Get the marshaller for a C type:" { $subsections marshaller }
+"Get the unmarshaller for a C type:" { $subsections unmarshaller }
+"Get the unmarshaller for an output parameter:" { $subsections out-arg-unmarshaller }
+"Get the unmarshaller for a struct field:" { $subsections struct-field-unmarshaller }
+$nl
+"Other marshalling and unmarshalling words in this vocabulary are not intended to be "
+"invoked directly."
+$nl
+"Most marshalling words allow non false c-ptrs to pass through unchanged."
+
+{ $subheading "Primitive marshallers" }
+{ $subsections marshall-primitive } "for marshalling primitive values."
+{ $subsections marshall-int* }
+  "marshalls a number or sequence of numbers. If argument is a sequence, returns a pointer "
+  "to a C array, otherwise returns a pointer to a single value."
+{ $subsections marshall-int** }
+"marshalls a 1D or 2D array of numbers. Returns an array of pointers to arrays."
+
+{ $subheading "Primitive unmarshallers" }
+{ $snippet "unmarshall-<prim>*" } " and " { $snippet "unmarshall-<prim>*-free" }
+" for all values of " { $snippet "<prim>" } " in " { $link primitive-types } "."
+{ $subsections unmarshall-int* }
+"unmarshalls a pointer to primitive. Returns a number. "
+"Assumes the pointer is not an array (if it is, only the first value is returned). "
+"C functions that return arrays are not handled correctly by " { $snippet "alien.marshall" }
+" and must be unmarshalled by hand."
+{ $subsections unmarshall-int*-free }
+"unmarshalls a pointer to primitive, and then frees the pointer."
+$nl
+"Primitive values require no unmarshalling. The factor FFI already does this."
+;
+
+ABOUT: "alien.marshall"
diff --git a/alien/marshall/marshall.factor b/alien/marshall/marshall.factor
new file mode 100644 (file)
index 0000000..059ee72
--- /dev/null
@@ -0,0 +1,326 @@
+! Copyright (C) 2009 Jeremy Hughes.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors alien alien.c-types alien.inline.types
+alien.marshall.private alien.strings byte-arrays classes
+combinators combinators.short-circuit destructors fry
+io.encodings.utf8 kernel libc sequences alien.data
+specialized-arrays strings unix.utilities vocabs.parser
+words libc.private locals generalizations math ;
+FROM: alien.c-types => float short ;
+SPECIALIZED-ARRAY: bool
+SPECIALIZED-ARRAY: char
+SPECIALIZED-ARRAY: double
+SPECIALIZED-ARRAY: float
+SPECIALIZED-ARRAY: int
+SPECIALIZED-ARRAY: long
+SPECIALIZED-ARRAY: longlong
+SPECIALIZED-ARRAY: short
+SPECIALIZED-ARRAY: uchar
+SPECIALIZED-ARRAY: uint
+SPECIALIZED-ARRAY: ulong
+SPECIALIZED-ARRAY: ulonglong
+SPECIALIZED-ARRAY: ushort
+SPECIALIZED-ARRAY: void*
+IN: alien.marshall
+
+<< primitive-types [ [ void* = ] [ bool = ] bi or not ]
+filter [ define-primitive-marshallers ] each >>
+
+TUPLE: alien-wrapper { underlying alien } ;
+TUPLE: struct-wrapper < alien-wrapper disposed ;
+TUPLE: class-wrapper < alien-wrapper disposed ;
+
+MIXIN: c++-root
+
+GENERIC: unmarshall-cast ( alien-wrapper -- alien-wrapper' )
+
+M: alien-wrapper unmarshall-cast ;
+M: struct-wrapper unmarshall-cast ;
+
+M: struct-wrapper dispose* underlying>> free ;
+
+M: class-wrapper c++-type class name>> parse-c++-type ;
+
+: marshall-pointer ( obj -- alien )
+    {
+        { [ dup alien? ] [ ] }
+        { [ dup not ] [ ] }
+        { [ dup byte-array? ] [ malloc-byte-array ] }
+        { [ dup alien-wrapper? ] [ underlying>> ] }
+    } cond ;
+
+: marshall-primitive ( n -- n )
+    [ bool>arg ] ptr-pass-through ;
+
+ALIAS: marshall-void* marshall-pointer
+
+: marshall-void** ( seq -- alien )
+    [ marshall-void* ] void*-array{ } map-as malloc-underlying ;
+
+: (marshall-char*-or-string) ( n/string -- alien )
+    dup string?
+    [ utf8 string>alien malloc-byte-array ]
+    [ (marshall-char*) ] if ;
+
+: marshall-char*-or-string ( n/string -- alien )
+    [ (marshall-char*-or-string) ] ptr-pass-through ;
+
+: (marshall-char**-or-strings) ( seq -- alien )
+    [ marshall-char*-or-string ] void*-array{ } map-as
+    malloc-underlying ;
+
+: marshall-char**-or-strings ( seq -- alien )
+    [ (marshall-char**-or-strings) ] ptr-pass-through ;
+
+: marshall-bool ( ? -- n )
+    >boolean [ 1 ] [ 0 ] if ;
+
+: (marshall-bool*) ( ?/seq -- alien )
+    [ marshall-bool <bool> malloc-byte-array ]
+    [ >bool-array malloc-underlying ]
+    marshall-x* ;
+
+: marshall-bool* ( ?/seq -- alien )
+    [ (marshall-bool*) ] ptr-pass-through ;
+
+: (marshall-bool**) ( seq -- alien )
+    [ marshall-bool* ] map >void*-array malloc-underlying ;
+
+: marshall-bool** ( seq -- alien )
+    [ (marshall-bool**) ] ptr-pass-through ;
+
+: unmarshall-bool ( n -- ? )
+    0 = not ;
+
+: unmarshall-bool* ( alien -- ? )
+    *bool unmarshall-bool ;
+
+: unmarshall-bool*-free ( alien -- ? )
+    [ *bool unmarshall-bool ] keep add-malloc free ;
+
+: primitive-marshaller ( type -- quot/f )
+    {
+        { "bool"        [ [ ] ] }
+        { "boolean"     [ [ marshall-bool ] ] }
+        { "char"        [ [ marshall-primitive ] ] }
+        { "uchar"       [ [ marshall-primitive ] ] }
+        { "short"       [ [ marshall-primitive ] ] }
+        { "ushort"      [ [ marshall-primitive ] ] }
+        { "int"         [ [ marshall-primitive ] ] }
+        { "uint"        [ [ marshall-primitive ] ] }
+        { "long"        [ [ marshall-primitive ] ] }
+        { "ulong"       [ [ marshall-primitive ] ] }
+        { "long"        [ [ marshall-primitive ] ] }
+        { "ulong"       [ [ marshall-primitive ] ] }
+        { "float"       [ [ marshall-primitive ] ] }
+        { "double"      [ [ marshall-primitive ] ] }
+        { "bool*"       [ [ marshall-bool* ] ] }
+        { "boolean*"    [ [ marshall-bool* ] ] }
+        { "char*"       [ [ marshall-char*-or-string ] ] }
+        { "uchar*"      [ [ marshall-uchar* ] ] }
+        { "short*"      [ [ marshall-short* ] ] }
+        { "ushort*"     [ [ marshall-ushort* ] ] }
+        { "int*"        [ [ marshall-int* ] ] }
+        { "uint*"       [ [ marshall-uint* ] ] }
+        { "long*"       [ [ marshall-long* ] ] }
+        { "ulong*"      [ [ marshall-ulong* ] ] }
+        { "longlong*"   [ [ marshall-longlong* ] ] }
+        { "ulonglong*"  [ [ marshall-ulonglong* ] ] }
+        { "float*"      [ [ marshall-float* ] ] }
+        { "double*"     [ [ marshall-double* ] ] }
+        { "bool&"       [ [ marshall-bool* ] ] }
+        { "boolean&"    [ [ marshall-bool* ] ] }
+        { "char&"       [ [ marshall-char* ] ] }
+        { "uchar&"      [ [ marshall-uchar* ] ] }
+        { "short&"      [ [ marshall-short* ] ] }
+        { "ushort&"     [ [ marshall-ushort* ] ] }
+        { "int&"        [ [ marshall-int* ] ] }
+        { "uint&"       [ [ marshall-uint* ] ] }
+        { "long&"       [ [ marshall-long* ] ] }
+        { "ulong&"      [ [ marshall-ulong* ] ] }
+        { "longlong&"   [ [ marshall-longlong* ] ] }
+        { "ulonglong&"  [ [ marshall-ulonglong* ] ] }
+        { "float&"      [ [ marshall-float* ] ] }
+        { "double&"     [ [ marshall-double* ] ] }
+        { "void*"       [ [ marshall-void* ] ] }
+        { "bool**"      [ [ marshall-bool** ] ] }
+        { "boolean**"   [ [ marshall-bool** ] ] }
+        { "char**"      [ [ marshall-char**-or-strings ] ] }
+        { "uchar**"     [ [ marshall-uchar** ] ] }
+        { "short**"     [ [ marshall-short** ] ] }
+        { "ushort**"    [ [ marshall-ushort** ] ] }
+        { "int**"       [ [ marshall-int** ] ] }
+        { "uint**"      [ [ marshall-uint** ] ] }
+        { "long**"      [ [ marshall-long** ] ] }
+        { "ulong**"     [ [ marshall-ulong** ] ] }
+        { "longlong**"  [ [ marshall-longlong** ] ] }
+        { "ulonglong**" [ [ marshall-ulonglong** ] ] }
+        { "float**"     [ [ marshall-float** ] ] }
+        { "double**"    [ [ marshall-double** ] ] }
+        { "void**"      [ [ marshall-void** ] ] }
+        [ drop f ]
+    } case ;
+
+: marshall-non-pointer ( alien-wrapper/byte-array -- byte-array )
+    {
+        { [ dup byte-array? ] [ ] }
+        { [ dup alien-wrapper? ]
+          [ [ underlying>> ] [ class name>> heap-size ] bi
+            memory>byte-array ] }
+    } cond ;
+
+
+: marshaller ( type -- quot )
+    factorize-type dup primitive-marshaller [ nip ] [
+        pointer?
+        [ [ marshall-pointer ] ]
+        [ [ marshall-non-pointer ] ] if
+    ] if* ;
+
+
+: unmarshall-char*-to-string ( alien -- string )
+    utf8 alien>string ;
+
+: unmarshall-char*-to-string-free ( alien -- string )
+    [ unmarshall-char*-to-string ] keep add-malloc free ;
+
+: primitive-unmarshaller ( type -- quot/f )
+    {
+        { "bool"       [ [ ] ] }
+        { "boolean"    [ [ unmarshall-bool ] ] }
+        { "char"       [ [ ] ] }
+        { "uchar"      [ [ ] ] }
+        { "short"      [ [ ] ] }
+        { "ushort"     [ [ ] ] }
+        { "int"        [ [ ] ] }
+        { "uint"       [ [ ] ] }
+        { "long"       [ [ ] ] }
+        { "ulong"      [ [ ] ] }
+        { "longlong"   [ [ ] ] }
+        { "ulonglong"  [ [ ] ] }
+        { "float"      [ [ ] ] }
+        { "double"     [ [ ] ] }
+        { "bool*"      [ [ unmarshall-bool*-free ] ] }
+        { "boolean*"   [ [ unmarshall-bool*-free ] ] }
+        { "char*"      [ [ ] ] }
+        { "uchar*"     [ [ unmarshall-uchar*-free ] ] }
+        { "short*"     [ [ unmarshall-short*-free ] ] }
+        { "ushort*"    [ [ unmarshall-ushort*-free ] ] }
+        { "int*"       [ [ unmarshall-int*-free ] ] }
+        { "uint*"      [ [ unmarshall-uint*-free ] ] }
+        { "long*"      [ [ unmarshall-long*-free ] ] }
+        { "ulong*"     [ [ unmarshall-ulong*-free ] ] }
+        { "longlong*"  [ [ unmarshall-long*-free ] ] }
+        { "ulonglong*" [ [ unmarshall-ulong*-free ] ] }
+        { "float*"     [ [ unmarshall-float*-free ] ] }
+        { "double*"    [ [ unmarshall-double*-free ] ] }
+        { "bool&"      [ [ unmarshall-bool*-free ] ] }
+        { "boolean&"   [ [ unmarshall-bool*-free ] ] }
+        { "char&"      [ [ ] ] }
+        { "uchar&"     [ [ unmarshall-uchar*-free ] ] }
+        { "short&"     [ [ unmarshall-short*-free ] ] }
+        { "ushort&"    [ [ unmarshall-ushort*-free ] ] }
+        { "int&"       [ [ unmarshall-int*-free ] ] }
+        { "uint&"      [ [ unmarshall-uint*-free ] ] }
+        { "long&"      [ [ unmarshall-long*-free ] ] }
+        { "ulong&"     [ [ unmarshall-ulong*-free ] ] }
+        { "longlong&"  [ [ unmarshall-longlong*-free ] ] }
+        { "ulonglong&" [ [ unmarshall-ulonglong*-free ] ] }
+        { "float&"     [ [ unmarshall-float*-free ] ] }
+        { "double&"    [ [ unmarshall-double*-free ] ] }
+        [ drop f ]
+    } case ;
+
+: struct-primitive-unmarshaller ( type -- quot/f )
+    {
+        { "bool"       [ [ unmarshall-bool ] ] }
+        { "boolean"    [ [ unmarshall-bool ] ] }
+        { "char"       [ [ ] ] }
+        { "uchar"      [ [ ] ] }
+        { "short"      [ [ ] ] }
+        { "ushort"     [ [ ] ] }
+        { "int"        [ [ ] ] }
+        { "uint"       [ [ ] ] }
+        { "long"       [ [ ] ] }
+        { "ulong"      [ [ ] ] }
+        { "longlong"   [ [ ] ] }
+        { "ulonglong"  [ [ ] ] }
+        { "float"      [ [ ] ] }
+        { "double"     [ [ ] ] }
+        { "bool*"      [ [ unmarshall-bool* ] ] }
+        { "boolean*"   [ [ unmarshall-bool* ] ] }
+        { "char*"      [ [ ] ] }
+        { "uchar*"     [ [ unmarshall-uchar* ] ] }
+        { "short*"     [ [ unmarshall-short* ] ] }
+        { "ushort*"    [ [ unmarshall-ushort* ] ] }
+        { "int*"       [ [ unmarshall-int* ] ] }
+        { "uint*"      [ [ unmarshall-uint* ] ] }
+        { "long*"      [ [ unmarshall-long* ] ] }
+        { "ulong*"     [ [ unmarshall-ulong* ] ] }
+        { "longlong*"  [ [ unmarshall-long* ] ] }
+        { "ulonglong*" [ [ unmarshall-ulong* ] ] }
+        { "float*"     [ [ unmarshall-float* ] ] }
+        { "double*"    [ [ unmarshall-double* ] ] }
+        { "bool&"      [ [ unmarshall-bool* ] ] }
+        { "boolean&"   [ [ unmarshall-bool* ] ] }
+        { "char&"      [ [ unmarshall-char* ] ] }
+        { "uchar&"     [ [ unmarshall-uchar* ] ] }
+        { "short&"     [ [ unmarshall-short* ] ] }
+        { "ushort&"    [ [ unmarshall-ushort* ] ] }
+        { "int&"       [ [ unmarshall-int* ] ] }
+        { "uint&"      [ [ unmarshall-uint* ] ] }
+        { "long&"      [ [ unmarshall-long* ] ] }
+        { "ulong&"     [ [ unmarshall-ulong* ] ] }
+        { "longlong&"  [ [ unmarshall-longlong* ] ] }
+        { "ulonglong&" [ [ unmarshall-ulonglong* ] ] }
+        { "float&"     [ [ unmarshall-float* ] ] }
+        { "double&"    [ [ unmarshall-double* ] ] }
+        [ drop f ]
+    } case ;
+
+
+: ?malloc-byte-array ( c-type -- alien )
+    dup alien? [ malloc-byte-array ] unless ;
+
+:: x-unmarshaller ( type type-quot superclass def clean -- quot/f )
+    type type-quot call current-vocab lookup [
+        dup superclasses superclass swap member?
+        [ def call ] [ drop clean call f ] if
+    ] [ clean call f ] if* ; inline
+
+: struct-unmarshaller ( type -- quot/f )
+    [ ] \ struct-wrapper
+    [ '[ ?malloc-byte-array _ new swap >>underlying ] ]
+    [ ]
+    x-unmarshaller ;
+
+: class-unmarshaller ( type -- quot/f )
+    [ type-sans-pointer "#" append ] \ class-wrapper
+    [ '[ _ new swap >>underlying ] ]
+    [ ]
+    x-unmarshaller ;
+
+: non-primitive-unmarshaller ( type -- quot/f )
+    {
+        { [ dup pointer? ] [ class-unmarshaller ] }
+        [ struct-unmarshaller ]
+    } cond ;
+
+: unmarshaller ( type -- quot )
+    factorize-type {
+        [ primitive-unmarshaller ]
+        [ non-primitive-unmarshaller ]
+        [ drop [ ] ]
+    } 1|| ;
+
+: struct-field-unmarshaller ( type -- quot )
+    factorize-type {
+        [ struct-primitive-unmarshaller ]
+        [ non-primitive-unmarshaller ]
+        [ drop [ ] ]
+    } 1|| ;
+
+: out-arg-unmarshaller ( type -- quot )
+    dup pointer-to-non-const-primitive?
+    [ factorize-type primitive-unmarshaller ]
+    [ drop [ drop ] ] if ;
diff --git a/alien/marshall/private/authors.txt b/alien/marshall/private/authors.txt
new file mode 100644 (file)
index 0000000..845910d
--- /dev/null
@@ -0,0 +1 @@
+Jeremy Hughes
diff --git a/alien/marshall/private/private.factor b/alien/marshall/private/private.factor
new file mode 100644 (file)
index 0000000..d138282
--- /dev/null
@@ -0,0 +1,61 @@
+! Copyright (C) 2009 Jeremy Hughes.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors alien alien.c-types alien.inline arrays
+combinators fry functors kernel lexer libc macros math
+sequences specialized-arrays libc.private
+combinators.short-circuit alien.data ;
+SPECIALIZED-ARRAY: void*
+IN: alien.marshall.private
+
+: bool>arg ( ? -- 1/0/obj )
+    {
+        { t [ 1 ] }
+        { f [ 0 ] }
+        [ ]
+    } case ;
+
+MACRO: marshall-x* ( num-quot seq-quot -- alien )
+    '[ bool>arg dup number? _ _ if ] ;
+
+: ptr-pass-through ( obj quot -- alien )
+    over { [ c-ptr? ] [ ] } 1&& [ drop ] [ call ] if ; inline
+
+: malloc-underlying ( obj -- alien )
+    underlying>> malloc-byte-array ;
+
+FUNCTOR: define-primitive-marshallers ( TYPE -- )
+<TYPE> IS <${TYPE}>
+*TYPE IS *${TYPE}
+>TYPE-array IS >${TYPE}-array
+marshall-TYPE DEFINES marshall-${TYPE}
+(marshall-TYPE*) DEFINES (marshall-${TYPE}*)
+(marshall-TYPE**) DEFINES (marshall-${TYPE}**)
+marshall-TYPE* DEFINES marshall-${TYPE}*
+marshall-TYPE** DEFINES marshall-${TYPE}**
+marshall-TYPE*-free DEFINES marshall-${TYPE}*-free
+marshall-TYPE**-free DEFINES marshall-${TYPE}**-free
+unmarshall-TYPE* DEFINES unmarshall-${TYPE}*
+unmarshall-TYPE*-free DEFINES unmarshall-${TYPE}*-free
+WHERE
+<PRIVATE
+: (marshall-TYPE*) ( n/seq -- alien )
+    [ <TYPE> malloc-byte-array ]
+    [ >TYPE-array malloc-underlying ]
+    marshall-x* ;
+PRIVATE>
+: marshall-TYPE* ( n/seq -- alien )
+    [ (marshall-TYPE*) ] ptr-pass-through ;
+<PRIVATE
+: (marshall-TYPE**) ( seq -- alien )
+    [ marshall-TYPE* ] void*-array{ } map-as malloc-underlying ;
+PRIVATE>
+: marshall-TYPE** ( seq -- alien )
+    [ (marshall-TYPE**) ] ptr-pass-through ;
+: unmarshall-TYPE* ( alien -- n )
+    *TYPE ; inline
+: unmarshall-TYPE*-free ( alien -- n )
+    [ unmarshall-TYPE* ] keep add-malloc free ;
+;FUNCTOR
+
+SYNTAX: PRIMITIVE-MARSHALLERS:
+";" parse-tokens [ define-primitive-marshallers ] each ;
diff --git a/alien/marshall/structs/authors.txt b/alien/marshall/structs/authors.txt
new file mode 100644 (file)
index 0000000..845910d
--- /dev/null
@@ -0,0 +1 @@
+Jeremy Hughes
diff --git a/alien/marshall/structs/structs-docs.factor b/alien/marshall/structs/structs-docs.factor
new file mode 100644 (file)
index 0000000..0c56458
--- /dev/null
@@ -0,0 +1,19 @@
+! Copyright (C) 2009 Jeremy Hughes.
+! See http://factorcode.org/license.txt for BSD license.
+USING: classes help.markup help.syntax kernel quotations words
+alien.marshall.structs strings alien.structs alien.marshall ;
+IN: alien.marshall.structs
+
+HELP: define-marshalled-struct
+{ $values
+    { "name" string } { "vocab" "a vocabulary specifier" } { "fields" "an alist" }
+}
+{ $description "Calls " { $link define-struct } " and " { $link define-struct-tuple } "." } ;
+
+HELP: define-struct-tuple
+{ $values
+    { "name" string }
+}
+{ $description "Defines a subclass of " { $link struct-wrapper } ", a constructor, "
+  "and accessor words."
+} ;
diff --git a/alien/marshall/structs/structs.factor b/alien/marshall/structs/structs.factor
new file mode 100644 (file)
index 0000000..07ebb6a
--- /dev/null
@@ -0,0 +1,50 @@
+! Copyright (C) 2009 Jeremy Hughes.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors alien.c-types alien.marshall arrays assocs
+classes.tuple combinators destructors generalizations generic
+kernel libc locals parser quotations sequences slots words
+alien.structs lexer vocabs.parser fry effects alien.data ;
+IN: alien.marshall.structs
+
+<PRIVATE
+: define-struct-accessor ( class name quot -- )
+    [ "accessors" create create-method dup make-inline ] dip define ;
+
+: define-struct-getter ( class name word type -- )
+    [ ">>" append \ underlying>> ] 2dip
+    struct-field-unmarshaller \ call 4array >quotation
+    define-struct-accessor ;
+
+: define-struct-setter ( class name word type -- )
+    [ "<<" append ] 2dip
+    marshaller [ underlying>> ] \ bi* roll 4array >quotation
+    define-struct-accessor ;
+
+: define-struct-accessors ( class name type reader writer -- )
+    [ dup define-protocol-slot ] 3dip
+    [ drop swap define-struct-getter ]
+    [ nip swap define-struct-setter ] 5 nbi ;
+
+: define-struct-constructor ( class -- )
+    {
+        [ name>> "<" prepend ">" append create-word-in ]
+        [ '[ _ new ] ]
+        [ name>> '[ _ malloc-struct >>underlying ] append ]
+        [ name>> 1array ]
+    } cleave { } swap <effect> define-declared ;
+PRIVATE>
+
+:: define-struct-tuple ( name -- )
+    name create-word-in :> class
+    class struct-wrapper { } define-tuple-class
+    class define-struct-constructor
+    name c-type fields>> [
+        class swap
+        {
+            [ name>> H{ { CHAR: space CHAR: - } } substitute ]
+            [ type>> ] [ reader>> ] [ writer>> ]
+        } cleave define-struct-accessors
+    ] each ;
+
+: define-marshalled-struct ( name vocab fields -- )
+    [ define-struct ] [ 2drop define-struct-tuple ] 3bi ;
diff --git a/alien/marshall/syntax/authors.txt b/alien/marshall/syntax/authors.txt
new file mode 100644 (file)
index 0000000..845910d
--- /dev/null
@@ -0,0 +1 @@
+Jeremy Hughes
diff --git a/alien/marshall/syntax/syntax-docs.factor b/alien/marshall/syntax/syntax-docs.factor
new file mode 100644 (file)
index 0000000..4d296cc
--- /dev/null
@@ -0,0 +1,84 @@
+! Copyright (C) 2009 Jeremy Hughes.
+! See http://factorcode.org/license.txt for BSD license.
+USING: help.markup help.syntax kernel quotations words
+alien.inline alien.syntax effects alien.marshall
+alien.marshall.structs strings sequences alien.inline.syntax ;
+IN: alien.marshall.syntax
+
+HELP: CM-FUNCTION:
+{ $syntax "CM-FUNCTION: return name args\n    body\n;" }
+{ $description "Like " { $link POSTPONE: C-FUNCTION: } " but with marshalling "
+    "of arguments and return values."
+}
+{ $examples
+  { $example
+    "USING: alien.inline.syntax alien.marshall.syntax prettyprint ;"
+    "IN: example"
+    ""
+    "C-LIBRARY: exlib"
+    ""
+    "C-INCLUDE: <stdio.h>"
+    "C-INCLUDE: <stdlib.h>"
+    "CM-FUNCTION: char* sum_diff ( const-int a, const-int b, int* x, int* y )"
+    "    *x = a + b;"
+    "    *y = a - b;"
+    "    char* s = (char*) malloc(sizeof(char) * 64);"
+    "    sprintf(s, \"sum %i, diff %i\", *x, *y);"
+    "    return s;"
+    ";"
+    ""
+    ";C-LIBRARY"
+    ""
+    "8 5 0 0 sum_diff . . ."
+    "3\n13\n\"sum 13, diff 3\""
+  }
+}
+{ $see-also define-c-marshalled POSTPONE: C-FUNCTION: POSTPONE: M-FUNCTION: } ;
+
+HELP: CM-STRUCTURE:
+{ $syntax "CM-STRUCTURE: name fields ... ;" }
+{ $description "Like " { $link POSTPONE: C-STRUCTURE: } " but with marshalling of fields. "
+    "Defines a subclass of " { $link struct-wrapper } " a constructor, and slot-like accessor words."
+}
+{ $see-also POSTPONE: C-STRUCTURE: POSTPONE: M-STRUCTURE: } ;
+
+HELP: M-FUNCTION:
+{ $syntax "M-FUNCTION: return name args ;" }
+{ $description "Like " { $link POSTPONE: FUNCTION: } " but with marshalling "
+    "of arguments and return values."
+}
+{ $see-also marshalled-function POSTPONE: C-FUNCTION: POSTPONE: CM-FUNCTION: } ;
+
+HELP: M-STRUCTURE:
+{ $syntax "M-STRUCTURE: name fields ... ;" }
+{ $description "Like " { $link POSTPONE: C-STRUCT: } " but with marshalling of fields. "
+    "Defines a subclass of " { $link struct-wrapper } " a constructor, and slot-like accessor words."
+}
+{ $see-also define-marshalled-struct POSTPONE: C-STRUCTURE: POSTPONE: CM-STRUCTURE: } ;
+
+HELP: define-c-marshalled
+{ $values
+    { "name" string } { "types" sequence } { "effect" effect } { "body" string }
+}
+{ $description "Defines a C function and a factor word which calls it with marshalling of "
+    "args and return values."
+}
+{ $see-also define-c-marshalled' } ;
+
+HELP: define-c-marshalled'
+{ $values
+    { "name" string } { "effect" effect } { "body" string }
+}
+{ $description "Like " { $link define-c-marshalled } ". "
+     "The effect elements must be C type strings."
+} ;
+
+HELP: marshalled-function
+{ $values
+    { "name" string } { "types" sequence } { "effect" effect }
+    { "word" word } { "quot" quotation } { "effect" effect }
+}
+{ $description "Defines a word which calls the named C function. Arguments, "
+     "return value, and output parameters are marshalled and unmarshalled."
+} ;
+
diff --git a/alien/marshall/syntax/syntax-tests.factor b/alien/marshall/syntax/syntax-tests.factor
new file mode 100644 (file)
index 0000000..4376851
--- /dev/null
@@ -0,0 +1,75 @@
+! Copyright (C) 2009 Jeremy Hughes.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.inline.syntax alien.marshall.syntax destructors
+tools.test accessors kernel ;
+IN: alien.marshall.syntax.tests
+
+DELETE-C-LIBRARY: test
+C-LIBRARY: test
+
+C-INCLUDE: <stdlib.h>
+C-INCLUDE: <string.h>
+C-INCLUDE: <stdbool.h>
+
+CM-FUNCTION: void outarg1 ( int* a )
+    *a += 2;
+;
+
+CM-FUNCTION: unsigned-long* outarg2 ( unsigned-long a, unsigned-long* b )
+    unsigned long* x = malloc(sizeof(unsigned long*));
+    *b = 10 + *b;
+    *x = a + *b;
+    return x;
+;
+
+CM-STRUCTURE: wedge
+    { "double" "degrees" } ;
+
+CM-STRUCTURE: sundial
+    { "double" "radius" }
+    { "wedge" "wedge" } ;
+
+CM-FUNCTION: double hours ( sundial* d )
+    return d->wedge.degrees / 30;
+;
+
+CM-FUNCTION: void change_time ( double hours, sundial* d )
+    d->wedge.degrees = hours * 30;
+;
+
+CM-FUNCTION: bool c_not ( bool p )
+    return !p;
+;
+
+CM-FUNCTION: char* upcase ( const-char* s )
+    int len = strlen(s);
+    char* t = malloc(sizeof(char) * len);
+    int i;
+    for (i = 0; i < len; i++)
+        t[i] = toupper(s[i]);
+    t[i] = '\0';
+    return t;
+;
+
+;C-LIBRARY
+
+{ 1 1 } [ outarg1 ] must-infer-as
+[ 3 ] [ 1 outarg1 ] unit-test
+[ 3 ] [ t outarg1 ] unit-test
+[ 2 ] [ f outarg1 ] unit-test
+
+{ 2 2 } [ outarg2 ] must-infer-as
+[ 18 15 ] [ 3 5 outarg2 ] unit-test
+
+{ 1 1 } [ hours ] must-infer-as
+[ 5.0 ] [ <sundial> <wedge> 150 >>degrees >>wedge hours ] unit-test
+
+{ 2 0 } [ change_time ] must-infer-as
+[ 150.0 ] [ 5 <sundial> <wedge> 11 >>degrees >>wedge [ change_time ] keep wedge>> degrees>> ] unit-test
+
+{ 1 1 } [ c_not ] must-infer-as
+[ f ] [ "x" c_not ] unit-test
+[ f ] [ 0 c_not ] unit-test
+
+{ 1 1 } [ upcase ] must-infer-as
+[ "ABC" ] [ "abc" upcase ] unit-test
diff --git a/alien/marshall/syntax/syntax.factor b/alien/marshall/syntax/syntax.factor
new file mode 100644 (file)
index 0000000..3343436
--- /dev/null
@@ -0,0 +1,50 @@
+! Copyright (C) 2009 Jeremy Hughes.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors alien.inline alien.inline.types alien.marshall
+combinators effects generalizations kernel locals make namespaces
+quotations sequences words alien.marshall.structs lexer parser
+vocabs.parser multiline ;
+IN: alien.marshall.syntax
+
+:: marshalled-function ( name types effect -- word quot effect )
+    name types effect factor-function
+    [ in>> ]
+    [ out>> types [ pointer-to-non-const-primitive? ] filter append ]
+    bi <effect>
+    [
+        [
+            types [ marshaller ] map , \ spread , ,
+            types length , \ nkeep ,
+            types [ out-arg-unmarshaller ] map
+            effect out>> dup empty?
+            [ drop ] [ first unmarshaller prefix ] if
+            , \ spread ,
+        ] [ ] make
+    ] dip ;
+
+: define-c-marshalled ( name types effect body -- )
+    [
+        [ marshalled-function define-declared ]
+        [ prototype-string ] 3bi
+    ] dip append-function-body c-strings get push ;
+
+: define-c-marshalled' ( name effect body -- )
+    [
+        [ in>> ] keep
+        [ marshalled-function define-declared ]
+        [ out>> prototype-string' ] 3bi
+    ] dip append-function-body c-strings get push ;
+
+SYNTAX: CM-FUNCTION:
+    function-types-effect parse-here define-c-marshalled ;
+
+SYNTAX: M-FUNCTION:
+    function-types-effect marshalled-function define-declared ;
+
+SYNTAX: M-STRUCTURE:
+    scan current-vocab parse-definition
+    define-marshalled-struct ;
+
+SYNTAX: CM-STRUCTURE:
+    scan current-vocab parse-definition
+    [ define-marshalled-struct ] [ nip define-c-struct ] 3bi ;
diff --git a/animations/animations-docs.factor b/animations/animations-docs.factor
new file mode 100644 (file)
index 0000000..1acdfd3
--- /dev/null
@@ -0,0 +1,67 @@
+USING: help.markup help.syntax ;
+IN: animations
+
+HELP: animate
+
+{ $values
+    { "quot" "a quot which uses " { $link progress } }
+    { "duration" "a duration of time" }
+}
+{ $description
+    { $link animate } " calls " { $link reset-progress }
+    " , then continously calls the given quot until the"
+    " duration of time has elapsed. The quot should use "
+    { $link progress } " at least once."
+}
+{ $examples
+    { $unchecked-example 
+        "USING: animations calendar threads prettyprint ;"
+        "[ 1 sleep progress unparse write \" ms elapsed\" print ] "
+        "1/20 seconds animate ;"
+        "46 ms elapsed\n17 ms elapsed"
+    }
+    { $notes "The amount of time elapsed between these iterations will vary." }
+} ;
+
+HELP: reset-progress
+{ $description
+    "Initiates the timer. Call this before using "
+    "a loop which makes use of " { $link progress } "."
+} ;
+
+HELP: progress
+{ $values { "time" "an integer" } }
+{ $description
+    "Gives the time elapsed since the last time"
+    " this word was called, in milliseconds." 
+}
+{ $examples
+    { $unchecked-example
+        "USING: animations threads prettyprint ;"
+        "reset-progress 3 "
+        "[ 1 sleep progress unparse write \"ms elapsed\" print ] "
+        "times ;"
+        "31 ms elapsed\n18 ms elapsed\n16 ms elapsed"
+    }
+    { $notes "The amount of time elapsed between these iterations will vary." }
+} ;
+
+ARTICLE: "animations" "Animations"
+"Provides a lightweight framework for properly simulating continuous"
+" functions of real time. This framework helps one create animations "
+"that use rates which do not change across platforms. The speed of the "
+"computer should correlate with the smoothness of the animation, not "
+"the speed of the animation!"
+{ $subsections
+    animate
+    reset-progress
+    progress
+}
+! A little talk about when to use progress and when to use animate
+    { $link progress } " specifically provides the length of time since "
+    { $link reset-progress } " was called, and also calls "
+    { $link reset-progress } " as its last action. This can be directly "
+    "used when one's quote runs for a specific number of iterations, instead "
+    "of a length of time. If the animation is like most, and is expected to "
+    "run for a specific length of time, " { $link animate } " should be used." ;
+ABOUT: "animations"
diff --git a/animations/animations.factor b/animations/animations.factor
new file mode 100644 (file)
index 0000000..8f416dc
--- /dev/null
@@ -0,0 +1,17 @@
+! Small library for cross-platform continuous functions of real time
+
+USING: kernel shuffle system locals
+prettyprint math io namespaces threads calendar ;
+IN: animations
+
+SYMBOL: last-loop
+SYMBOL: sleep-period
+
+: reset-progress ( -- ) millis last-loop set ;
+! : my-progress ( -- progress ) millis 
+: progress ( -- time ) millis last-loop get - reset-progress ;
+: progress-peek ( -- progress ) millis last-loop get - ;
+: set-end ( duration -- end-time ) duration>milliseconds millis + ;
+: loop ( quot end -- ) dup millis > [ [ dup call ] dip loop ] [ 2drop ] if ; inline
+: animate ( quot duration -- ) reset-progress set-end loop ; inline
+: sample ( revs quot -- avg ) reset-progress dupd times progress swap / ; inline
diff --git a/animations/authors.txt b/animations/authors.txt
new file mode 100644 (file)
index 0000000..0f10bf5
--- /dev/null
@@ -0,0 +1 @@
+Reginald Ford
diff --git a/arm/4/4.factor b/arm/4/4.factor
new file mode 100644 (file)
index 0000000..0d317fd
--- /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.arm4
+
+: (%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/arm/4/authors.txt b/arm/4/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/arm/4/summary.txt b/arm/4/summary.txt
new file mode 100644 (file)
index 0000000..7be5231
--- /dev/null
@@ -0,0 +1 @@
+Additional compiler intrinsics for ARM4
diff --git a/arm/allot/allot.factor b/arm/allot/allot.factor
new file mode 100644 (file)
index 0000000..6949d3b
--- /dev/null
@@ -0,0 +1,79 @@
+! 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 sequences
+generator generator.registers generator.fixup system layouts
+alien ;
+IN: cpu.arm.allot
+
+: load-zone-ptr ( reg -- ) "nursery" f rot %alien-global ;
+
+: %allot ( header size -- )
+    ! Store a pointer to 'size' bytes allocated from the
+    ! nursery in R11
+    8 align ! align the size
+    R12 load-zone-ptr ! nusery -> r12
+    R11 R12 cell <+> LDR ! nursery.here -> r11
+    R11 R11 pick ADD ! increment r11
+    R11 R12 cell <+> STR ! r11 -> nursery.here
+    R11 R11 rot SUB ! old value
+    R12 swap type-number tag-fixnum MOV ! compute header
+    R12 R11 0 <+> STR ! store header
+    ;
+    
+: %store-tagged ( reg tag -- )
+    >r dup fresh-object v>operand R11 r> tag-number ORR ;
+
+: %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 R11 cell <+> STR ! store the length
+    ;
+
+: %allot-bignum-signed-1 ( dst src -- )
+    ! on entry, reg is a 30-bit quantity sign-extended to
+    ! 32-bits.
+    ! exits with tagged ptr to bignum in reg.
+    [
+        "end" define-label
+        ! is it zero?
+        dup v>operand 0 CMP
+        0 >bignum pick EQ load-literal
+        "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 R11 2 cells <+> STR
+        ! store the number
+        v>operand R11 3 cells <+> STR
+        ! tag the bignum, store it in reg
+        bignum %store-tagged
+        "end" resolve-label
+    ] with-scope ;
+
+M: arm-backend %box-alien ( dst src -- )
+    "end" define-label
+    dup v>operand 0 CMP
+    over v>operand f v>operand EQ MOV
+    "end" get EQ B
+    alien 4 cells %allot
+    ! Store offset
+    v>operand R11 3 cells <+> STR
+    R12 f v>operand MOV
+    ! Store expired slot
+    R12 R11 1 cells <+> STR
+    ! Store underlying-alien slot
+    R12 R11 2 cells <+> STR
+    ! Store tagged ptr in reg
+    object %store-tagged
+    "end" resolve-label ;
diff --git a/arm/allot/authors.txt b/arm/allot/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/arm/architecture/architecture.factor b/arm/architecture/architecture.factor
new file mode 100644 (file)
index 0000000..f4ad13d
--- /dev/null
@@ -0,0 +1,370 @@
+! 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 namespaces words words.private
+generator.registers generator.fixup generator cpu.architecture
+system layouts ;
+IN: cpu.arm.architecture
+
+TUPLE: arm-backend ;
+
+! ARM register assignments:
+! R0-R4, R7-R10 integer vregs
+! R11, 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 R4 R7 R8 R9 R10 } ;
+
+! 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 <+/-> ;
+
+: load-cell ( reg -- )
+    [
+        "end" define-label
+        ! Load target address
+        PC 0 <+> LDR
+        ! Skip an instruction
+        "end" get B
+        ! The target address
+        0 ,
+        ! Continue here
+        "end" resolve-label
+    ] with-scope ;
+
+: call-cell ( -- )
+    ! Compute return address; we skip 3 instructions
+    LR PC 8 ADD
+    ! Load target address
+    R12 PC 0 <+> LDR
+    ! Jump to target address
+    R12 BX
+    ! The target address
+    0 , ;
+
+M: arm-backend load-indirect ( obj reg -- )
+    tuck load-cell rc-absolute-cell rel-literal
+    dup 0 <+> LDR ;
+
+M: immediate load-literal
+    over v>operand small-enough? [
+        [ v>operand ] bi@ swap MOV
+    ] [
+        v>operand load-indirect
+    ] if ;
+
+: lr-save ( n -- i ) cell - ;
+: next-save ( n -- i ) 2 cells - ;
+: xt-save ( n -- i ) 3 cells - ;
+: factor-area-size 5 cells ;
+
+M: arm-backend stack-frame ( n -- i )
+    factor-area-size + 8 align ;
+
+M: arm-backend %save-word-xt ( -- )
+    R12 PC 9 cells SUB ;
+
+M: arm-backend %save-dispatch-xt ( -- )
+    R12 PC 2 cells SUB ;
+
+M: arm-backend %prologue ( n -- )
+    SP SP pick SUB
+    R11 over MOV
+    R11 SP pick next-save <+> STR
+    R12 SP pick xt-save <+> STR
+    LR SP rot lr-save <+> STR ;
+
+M: arm-backend %epilogue ( n -- )
+    LR SP pick lr-save <+> LDR
+    SP SP rot ADD ;
+
+: compile-dlsym ( symbol dll reg -- )
+    load-cell rc-absolute rel-dlsym ;
+
+: %alien-global ( symbol dll reg -- )
+    [ compile-dlsym ] keep dup 0 <+> LDR ;
+
+M: arm-backend %profiler-prologue ( -- )
+    ! We can clobber R0 here since it is undefined at the start
+    ! of a word.
+    R12 load-indirect
+    R0 R12 profile-count-offset <+> LDR
+    R0 R0 1 v>operand ADD
+    R0 R12 profile-count-offset <+> STR ;
+
+M: arm-backend %call-label ( label -- ) BL ;
+
+M: arm-backend %jump-label ( label -- ) B ;
+
+: %prepare-primitive ( -- )
+    ! Save stack pointer to stack_chain->callstack_top, load XT
+    R1 SP 4 SUB ;
+
+M: arm-backend %call-primitive ( word -- )
+    %prepare-primitive
+    call-cell rc-absolute-cell rel-word ;
+
+M: arm-backend %jump-primitive ( word -- )
+    %prepare-primitive
+    ! Load target address
+    R12 PC 0 <+> LDR
+    ! Jump to target address
+    R12 BX
+    ! The target address
+    0 , rc-absolute-cell rel-word ;
+
+M: arm-backend %jump-t ( label -- )
+    "flag" operand f v>operand CMP NE B ;
+
+: (%dispatch) ( word-table# -- )
+    ! Load jump table target address into reg.
+    "scratch" operand PC "n" operand 1 <LSR> ADD
+    "scratch" operand dup 0 <+> LDR
+    rc-indirect-arm rel-dispatch
+    "scratch" operand dup compiled-header-size ADD ;
+
+M: arm-backend %call-dispatch ( word-table# -- )
+    [
+        (%dispatch)
+        "scratch" operand BLX
+    ] H{
+        { +input+ { { f "n" } } }
+        { +scratch+ { { f "scratch" } } }
+    } with-template ;
+
+M: arm-backend %jump-dispatch ( word-table# -- )
+    [
+        %epilogue-later
+        (%dispatch)
+        "scratch" operand BX
+    ] H{
+        { +input+ { { f "n" } } }
+        { +scratch+ { { f "scratch" } } }
+    } with-template ;
+
+M: arm-backend %return ( -- ) %epilogue-later PC LR MOV ;
+
+M: arm-backend %unwind drop %return ;
+
+M: arm-backend %peek >r v>operand r> loc>operand LDR ;
+
+M: arm-backend %replace >r v>operand r> loc>operand STR ;
+
+: (%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 ;
+
+: temp@ stack-frame* factor-area-size - swap - ;
+
+: struct-return@ ( size n -- n )
+    [
+        stack-frame* +
+    ] [
+        stack-frame* factor-area-size - swap -
+    ] ?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 -- ? )
+    4 <= ;
+
+M: arm-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 R12 %alien-global
+    SP R12 0 <+> STR
+    ds-reg R12 8 <+> STR
+    rs-reg R12 12 <+> STR ;
+
+M: arm-backend %alien-invoke ( symbol dll -- )
+    call-cell rc-absolute-cell rel-dlsym ;
+
+M: arm-backend %prepare-alien-indirect ( -- )
+    "unbox_alien" f %alien-invoke
+    R0 SP cell temp@ <+> STR ;
+
+M: arm-backend %alien-indirect ( -- )
+    R12 SP cell temp@ <+> LDR
+    R12 BLX ;
+
+M: arm-backend %alien-callback ( quot -- )
+    R0 load-indirect
+    "c_to_factor" f %alien-invoke ;
+
+M: arm-backend %callback-value ( ctype -- )
+    ! Save top of data stack
+    %prepare-unbox
+    R0 SP cell temp@ <+> STR
+    ! Restore data/call/retain stacks
+    "unnest_stacks" f %alien-invoke
+    ! Place former top of data stack in R0
+    R0 SP cell temp@ <+> LDR
+    ! Unbox R0
+    unbox-return ;
+
+M: arm-backend %cleanup ( alien-node -- ) drop ;
+
+: %untag ( dest src -- ) 0b111 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 t ;
+
+M: arm-backend fp-shadows-int? ( -- ? ) f ;
+
+! Alien intrinsics
+M: arm-backend %unbox-byte-array ( dst src -- )
+    [ v>operand ] bi@ byte-array-offset ADD ;
+
+M: arm-backend %unbox-alien ( dst src -- )
+    [ v>operand ] bi@ alien-offset <+> LDR ;
+
+M: arm-backend %unbox-f ( dst src -- )
+    drop v>operand 0 MOV ;
+
+M: arm-backend %unbox-any-c-ptr ( dst src -- )
+    ! We need three registers here. R11 and R12 are reserved
+    ! temporary registers. The third one is R14, which we have
+    ! to save/restore.
+    "end" define-label
+    "start" define-label
+    ! Save R14.
+    R14 SP 4 <-> STR
+    ! Address is computed in R11
+    R11 0 MOV
+    ! Load object into R12
+    R12 swap v>operand MOV
+    ! We come back here with displaced aliens
+    "start" resolve-label
+    ! Is the object f?
+    R12 f v>operand CMP
+    ! If so, done
+    "end" get EQ B
+    ! Is the object an alien?
+    R14 R12 header-offset <+/-> LDR
+    R14 alien type-number tag-fixnum CMP
+    ! Add byte array address to address being computed
+    R11 R11 R12 NE ADD
+    ! Add an offset to start of byte array's data area
+    R11 R11 byte-array-offset NE ADD
+    "end" get NE B
+    ! If alien, load the offset
+    R14 R12 alien-offset <+/-> LDR
+    ! Add it to address being computed
+    R11 R11 R14 ADD
+    ! Now recurse on the underlying alien
+    R12 R12 underlying-alien-offset <+/-> LDR
+    "start" get B
+    "end" resolve-label
+    ! Done, store address in destination register
+    v>operand R11 MOV
+    ! Restore R14.
+    R14 SP 4 <-> LDR ;
diff --git a/arm/architecture/authors.txt b/arm/architecture/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/arm/arm.factor b/arm/arm.factor
new file mode 100644 (file)
index 0000000..641beee
--- /dev/null
@@ -0,0 +1,56 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.c-types kernel math namespaces
+cpu.architecture cpu.arm.architecture cpu.arm.assembler
+cpu.arm.intrinsics generator generator.registers continuations
+compiler io vocabs sequences system ;
+
+! 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
+
+! We don't auto-detect since that would require us to support
+! illegal instruction traps. This works on Linux but not on
+! Windows CE.
+
+"arm-variant" get [
+    "ARM variant: " write "arm-variant" get print
+] [
+    "==========" print
+    "You should specify the -arm-variant=<variant> switch." print
+    "<variant> can be one of arm3, arm4, arm4t, or arm5." print
+    "Assuming arm3." print
+    "==========" print
+    "arm3" "arm-variant" set-global
+] if
+
+"arm-variant" get { "arm4" "arm4t" "arm5" } member? [
+    "cpu.arm.4" require
+] when
+
+"arm-variant" get { "arm4t" "arm5" } member? [
+    t have-BX? set-global
+] when
+
+"arm-variant" get "arm5" = [
+    t have-BLX? set-global
+] when
+
+7 cells profiler-prologues set-global
diff --git a/arm/authors.txt b/arm/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/arm/bootstrap.factor b/arm/bootstrap.factor
new file mode 100644 (file)
index 0000000..793a488
--- /dev/null
@@ -0,0 +1,119 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: bootstrap.image.private kernel namespaces system
+cpu.arm.assembler math layouts words compiler.units ;
+IN: bootstrap.arm
+
+! We generate ARM3 code
+f have-BX? set
+
+4 \ cell set
+big-endian off
+
+4 jit-code-format set
+
+: ds-reg R5 ;
+
+: word-reg R0 ;
+: quot-reg R0 ;
+: scan-reg R2 ;
+: temp-reg R3 ;
+: xt-reg R12 ;
+
+: stack-frame 16 bootstrap-cells ;
+
+: next-save stack-frame 2 bootstrap-cells - ;
+: xt-save stack-frame 3 bootstrap-cells - ;
+: array-save stack-frame 4 bootstrap-cells - ;
+: scan-save stack-frame 5 bootstrap-cells - ;
+
+[
+    temp-reg quot-reg quot-array@ <+> LDR      ! load array
+    scan-reg temp-reg scan@ ADD                ! initialize scan pointer
+] { } make jit-setup set
+
+[
+    LR SP 4 <-> STR                            ! save return address
+    SP SP stack-frame SUB
+    xt-reg SP xt-save <+> STR                  ! save XT
+    xt-reg stack-frame MOV
+    xt-reg SP next-save <+> STR                ! save frame size
+    temp-reg SP array-save <+> STR             ! save array
+] { } make jit-prolog set
+
+[
+    temp-reg scan-reg 4 <!+> LDR               ! load literal and advance
+    temp-reg ds-reg 4 <!+> STR                 ! push literal
+] { } make jit-push-literal set
+
+[
+    temp-reg scan-reg 4 <!+> LDR               ! load wrapper and advance
+    temp-reg dup wrapper@ <+> LDR              ! load wrapped object
+    temp-reg ds-reg 4 <!+> STR                 ! push wrapped object
+] { } make jit-push-wrapper set
+
+[
+    R1 SP 4 SUB                                ! pass stack pointer to primitive
+] { } make jit-word-primitive-jump set
+
+[
+    R1 SP 4 SUB                                ! pass stack pointer to primitive
+] { } make jit-word-primitive-call set
+
+: load-word-xt ( -- )
+    word-reg scan-reg 4 <!+> LDR               ! load word and advance
+    xt-reg word-reg word-xt@ <+> LDR ;
+
+: jit-call
+    scan-reg SP scan-save <+> STR              ! save scan pointer
+    LR PC MOV                                  ! save return address
+    xt-reg BX                                  ! call
+    scan-reg SP scan-save <+> LDR              ! restore scan pointer
+    ;
+
+: jit-jump
+    xt-reg BX ;
+
+[ load-word-xt jit-call ] { } make jit-word-call set
+
+[ load-word-xt jit-jump ] { } make jit-word-jump set
+
+: load-quot-xt
+    xt-reg quot-reg quot-xt@ <+> LDR ;
+
+: load-branch
+    temp-reg ds-reg 4 <-!> LDR                 ! pop boolean
+    temp-reg \ f tag-number CMP                ! compare it with f
+    quot-reg scan-reg MOV                      ! point quot-reg at false branch
+    quot-reg dup 4 EQ ADD                      ! point quot-reg at true branch
+    quot-reg dup 4 <+> LDR                     ! load the branch
+    scan-reg dup 12 ADD                        ! advance scan pointer
+    load-quot-xt
+    ;
+
+[
+    load-branch jit-jump
+] { } make jit-if-jump set
+
+[
+    load-branch jit-call
+] { } make jit-if-call set
+
+[
+    temp-reg ds-reg 4 <-!> LDR                 ! pop index
+    temp-reg dup 1 <LSR> MOV                   ! turn it into an array offset
+    scan-reg dup 4 <+> LDR                     ! load array
+    temp-reg dup scan-reg ADD                  ! compute quotation location
+    quot-reg temp-reg array-start <+> LDR      ! load quotation
+    load-quot-xt
+    jit-jump
+] { } make jit-dispatch set
+
+[
+    SP SP stack-frame ADD                      ! pop stack frame
+    LR SP 4 <-> LDR                            ! load return address
+] { } make jit-epilog set
+
+[ LR BX ] { } make jit-return set
+
+[ "bootstrap.arm" forget-vocab ] with-compilation-unit
diff --git a/arm/intrinsics/authors.txt b/arm/intrinsics/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/arm/intrinsics/intrinsics.factor b/arm/intrinsics/intrinsics.factor
new file mode 100644 (file)
index 0000000..d7ddd0c
--- /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.private namespaces sequences words
+quotations byte-arrays hashtables.private hashtables generator
+generator.registers generator.fixup sequences.private sbufs
+sbufs.private vectors vectors.private system
+classes.tuple.private layouts strings.private slots.private ;
+IN: cpu.arm.intrinsics
+
+: %slot-literal-known-tag
+    "val" operand
+    "obj" operand
+    "n" get cells
+    "obj" get operand-tag - <+/-> ;
+
+: %slot-literal-any-tag
+    "scratch" operand "obj" operand %untag
+    "val" operand "scratch" operand "n" get cells <+> ;
+
+: %slot-any
+    "scratch" operand "obj" operand %untag
+    "n" operand dup 1 <LSR> MOV
+    "val" operand "scratch" operand "n" operand <+> ;
+
+\ slot {
+    ! Slot number is literal and the tag is known
+    {
+        [ %slot-literal-known-tag LDR ] H{
+            { +input+ { { f "obj" known-tag } { [ small-slot? ] "n" } } }
+            { +scratch+ { { f "val" } } }
+            { +output+ { "val" } }
+        }
+    }
+    ! Slot number is literal
+    {
+        [ %slot-literal-any-tag LDR ] H{
+            { +input+ { { f "obj" } { [ small-slot? ] "n" } } }
+            { +scratch+ { { f "scratch" } { f "val" } } }
+            { +output+ { "val" } }
+        }
+    }
+    ! Slot number in a register
+    {
+        [ %slot-any LDR ] H{
+            { +input+ { { f "obj" } { f "n" } } }
+            { +scratch+ { { f "val" } { f "scratch" } } }
+            { +output+ { "val" } }
+            { +clobber+ { "n" } }
+        }
+    }
+} define-intrinsics
+
+: %write-barrier ( -- )
+    "val" get operand-immediate? "obj" get fresh-object? or [
+        "cards_offset" f R12 %alien-global
+        "scratch" operand R12 "obj" 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 and tag is known
+    {
+        [ %slot-literal-known-tag STR %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 STR %write-barrier ] H{
+            { +input+ { { f "val" } { f "obj" } { [ small-slot? ] "n" } } }
+            { +scratch+ { { f "scratch" } } }
+            { +clobber+ { "val" } }
+        }
+    }
+    ! Slot number is in a register
+    {
+        [ %slot-any STR %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
+        [ "out" 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
+        "out" get "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 "out" } } }
+        { +output+ { "out" } }
+        { +clobber+ { "x" "y" } }
+    } define-intrinsic ;
+
+\ fixnum+ \ ADD overflow-template
+\ fixnum- \ SUB overflow-template
+
+\ fixnum>bignum [
+    "x" operand dup %untag-fixnum
+    "out" get "x" get %allot-bignum-signed-1
+] H{
+    { +input+ { { f "x" } } }
+    { +scratch+ { { f "out" } } }
+    { +clobber+ { "x" } }
+    { +output+ { "out" } }
+} 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 [
+    ! Get the tag
+    "out" operand "obj" operand tag-mask get AND
+    ! Compare with object tag number (3).
+    "out" operand object tag-number CMP
+    ! Tag the tag if it is not equal to 3
+    "out" operand dup NE %tag-fixnum
+    ! Load the object header if tag is equal to 3
+    "out" operand "obj" operand object tag-number <-> EQ LDR
+] H{
+    { +input+ { { f "obj" } } }
+    { +scratch+ { { f "out" } } }
+    { +output+ { "out" } }
+} define-intrinsic
+
+\ class-hash [
+    "end" define-label
+    ! Get the tag
+    "out" operand "obj" operand tag-mask get AND
+    ! Compare with tuple tag number (2).
+    "out" operand tuple tag-number CMP
+    "out" operand "obj" operand tuple-class-offset <+/-> EQ LDR
+    "out" operand dup class-hash-offset <+/-> EQ LDR
+    "end" get EQ B
+    ! Compare with object tag number (3).
+    "out" operand object tag-number CMP
+    "out" operand "obj" operand object tag-number <-> EQ LDR
+    ! Tag the tag
+    "out" operand dup NE %tag-fixnum
+    "end" resolve-label
+] H{
+    { +input+ { { f "obj" } } }
+    { +scratch+ { { f "out" } } }
+    { +output+ { "out" } }
+} 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 R11 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
+    "initial" operand f v>operand MOV
+    "n" get 1- [ 1+ "initial" operand %fill-array ] each
+    "out" get tuple %store-tagged
+] H{
+    { +input+ { { f "class" } { [ inline-array? ] "n" } } }
+    { +scratch+ { { f "out" } { f "initial" } } }
+    { +output+ { "out" } }
+} define-intrinsic
+
+\ <array> [
+    array "n" get 2 + cells %allot
+    %store-length
+    ! Store initial element
+    "n" get [ "initial" operand %fill-array ] each
+    "out" get object %store-tagged
+] H{
+    { +input+ { { [ inline-array? ] "n" } { f "initial" } } }
+    { +scratch+ { { f "out" } } }
+    { +output+ { "out" } }
+} 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
+    "out" get object %store-tagged
+] H{
+    { +input+ { { [ inline-array? ] "n" } } }
+    { +scratch+ { { f "out" } } }
+    { +output+ { "out" } }
+} define-intrinsic
+
+\ <ratio> [
+    ratio 3 cells %allot
+    "numerator" operand 1 %set-slot
+    "denominator" operand 2 %set-slot
+    "out" get ratio %store-tagged
+] H{
+    { +input+ { { f "numerator" } { f "denominator" } } }
+    { +scratch+ { { f "out" } } }
+    { +output+ { "out" } }
+} define-intrinsic
+
+\ <complex> [
+    complex 3 cells %allot
+    "real" operand 1 %set-slot
+    "imaginary" operand 2 %set-slot
+    ! Store tagged ptr in reg
+    "out" get complex %store-tagged
+] H{
+    { +input+ { { f "real" } { f "imaginary" } } }
+    { +scratch+ { { f "out" } } }
+    { +output+ { "out" } }
+} define-intrinsic
+
+\ <wrapper> [
+    wrapper 2 cells %allot
+    "obj" operand 1 %set-slot
+    ! Store tagged ptr in reg
+    "out" get object %store-tagged
+] H{
+    { +input+ { { f "obj" } } }
+    { +scratch+ { { f "out" } } }
+    { +output+ { "out" } }
+} define-intrinsic
+
+! Alien intrinsics
+: %alien-accessor ( quot -- )
+    "offset" operand dup %untag-fixnum
+    "offset" operand dup "alien" operand ADD
+    "value" operand "offset" operand 0 <+> roll call ; inline
+
+: alien-integer-get-template
+    H{
+        { +input+ {
+            { unboxed-c-ptr "alien" c-ptr }
+            { f "offset" fixnum }
+        } }
+        { +scratch+ { { f "value" } } }
+        { +output+ { "value" } }
+        { +clobber+ { "offset" } }
+    } ;
+
+: %alien-integer-get ( quot -- )
+    %alien-accessor
+    "value" operand dup %tag-fixnum ; inline
+
+: alien-integer-set-template
+    H{
+        { +input+ {
+            { f "value" fixnum }
+            { unboxed-c-ptr "alien" c-ptr }
+            { f "offset" fixnum }
+        } }
+        { +clobber+ { "value" "offset" } }
+    } ;
+
+: %alien-integer-set ( quot -- )
+    "offset" get "value" get = [
+        "value" operand dup %untag-fixnum
+    ] unless
+    %alien-accessor ; inline
+
+: 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-template
+    H{
+        { +input+ {
+            { unboxed-c-ptr "alien" c-ptr }
+            { f "offset" fixnum }
+        } }
+        { +scratch+ { { unboxed-alien "value" } } }
+        { +output+ { "value" } }
+        { +clobber+ { "offset" } }
+    } ;
+
+\ alien-cell
+[ [ LDR ] %alien-accessor ]
+alien-cell-template define-intrinsic
+
+: set-alien-cell-template
+    H{
+        { +input+ {
+            { unboxed-c-ptr "value" pinned-c-ptr }
+            { unboxed-c-ptr "alien" c-ptr }
+            { f "offset" fixnum }
+        } }
+        { +clobber+ { "offset" } }
+    } ;
+
+\ set-alien-cell
+[ [ STR ] %alien-accessor ]
+set-alien-cell-template define-intrinsic
diff --git a/arm/summary.txt b/arm/summary.txt
new file mode 100644 (file)
index 0000000..f3e46d9
--- /dev/null
@@ -0,0 +1 @@
+ARM3 compiler backend
diff --git a/arm/tags.txt b/arm/tags.txt
new file mode 100644 (file)
index 0000000..86a7c8e
--- /dev/null
@@ -0,0 +1 @@
+compiler
diff --git a/automata/authors.txt b/automata/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/automata/automata.factor b/automata/automata.factor
new file mode 100644 (file)
index 0000000..35f02f8
--- /dev/null
@@ -0,0 +1,98 @@
+
+USING: kernel math math.parser random arrays hashtables assocs sequences
+       grouping vars ;
+
+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-head string>digits ;
+
+: set-rule ( n -- )
+  dup >rule-number rule-values rule-keys [ rule> set-at ] 2each ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! step-capped-line
+! step-wrapped-line
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: pattern>state ( {_a_b_c_} -- state ) rule> at ;
+
+: cap-line ( line -- 0-line-0 ) { 0 } prepend { 0 } append ;
+
+: wrap-line ( a-line-z -- za-line-za )
+  dup peek 1array swap dup first 1array append append ;
+
+: step-line ( line -- new-line ) 3 <clumps> [ pattern>state ] map ;
+
+: 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 ? ] with 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 ;
diff --git a/automata/summary.txt b/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/automata/ui/authors.txt b/automata/ui/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/automata/ui/deploy.factor b/automata/ui/deploy.factor
new file mode 100644 (file)
index 0000000..12861cf
--- /dev/null
@@ -0,0 +1,12 @@
+USING: tools.deploy.config ;
+V{
+    { deploy-ui? t }
+    { deploy-io 1 }
+    { deploy-reflection 1 }
+    { deploy-compiler? t }
+    { deploy-math? t }
+    { deploy-word-props? f }
+    { deploy-c-types? f }
+    { "stop-after-last-window?" t }
+    { deploy-name "Cellular Automata" }
+}
diff --git a/automata/ui/tags.txt b/automata/ui/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/automata/ui/ui.factor b/automata/ui/ui.factor
new file mode 100644 (file)
index 0000000..def71e7
--- /dev/null
@@ -0,0 +1,100 @@
+
+USING: kernel namespaces math quotations arrays hashtables sequences threads
+       opengl
+       opengl.gl
+       colors
+       ui
+       ui.gestures
+       ui.gadgets
+       ui.gadgets.slate
+       ui.gadgets.labels
+       ui.gadgets.buttons
+       ui.gadgets.frames
+       ui.gadgets.packs
+       ui.gadgets.grids
+       ui.gadgets.theme
+       ui.gadgets.handler
+       accessors
+       vars fry
+       rewrite-closures automata math.geometry.rect newfx ;
+
+IN: automata.ui
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: draw-point ( y x value -- ) 1 = [ swap glVertex2i ] [ 2drop ] if ;
+
+: draw-line ( y line -- ) 0 swap [ [ 2dup ] dip draw-point 1+ ] each 2drop ;
+
+: (draw-bitmap) ( bitmap -- ) 0 swap [ [ dup ] dip 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 ] closed-quot ;
+
+: view-button ( label quot -- button ) [ <label> ] dip 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>
+
+    <shelf>
+
+      "1 - Center"      [ start-center    ] view-button add-gadget
+      "2 - Random"      [ start-random    ] view-button add-gadget
+      "3 - Continue"    [ run-rule        ] view-button add-gadget
+      "5 - Random Rule" [ random-rule     ] view-button add-gadget
+      "n - New"         [ automata-window ] view-button add-gadget
+
+    @top grid-add
+
+    C[ display ] <slate>
+      { 400 400 } >>pdim
+    dup >slate
+
+    @center grid-add
+
+  <handler>
+
+  H{ }
+    T{ key-down f f "1" } [ start-center    ] view-action is
+    T{ key-down f f "2" } [ start-random    ] view-action is
+    T{ key-down f f "3" } [ run-rule        ] view-action is
+    T{ key-down f f "5" } [ random-rule     ] view-action is
+    T{ key-down f f "n" } [ automata-window ] view-action is
+
+  >>table
+
+  "Automata" open-window ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: automata-window ( -- ) [ [ automata-window* ] with-scope ] with-ui ;
+
+MAIN: automata-window
diff --git a/boolean-expr/authors.txt b/boolean-expr/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/boolean-expr/boolean-expr.factor b/boolean-expr/boolean-expr.factor
new file mode 100644 (file)
index 0000000..33e5e92
--- /dev/null
@@ -0,0 +1,95 @@
+! Copyright (C) 2008 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors arrays classes kernel sequences sets
+io prettyprint multi-methods ;
+IN: boolean-expr
+
+! Demonstrates the use of Unicode symbols in source files, and
+! multi-method dispatch.
+
+TUPLE: ⋀ x y ;
+TUPLE: ⋁ x y ;
+TUPLE: ¬ x ;
+
+SINGLETONS: ⊤ ⊥ ;
+
+SINGLETONS: P Q R S T U V W X Y Z ;
+
+UNION: □ ⋀ ⋁ ¬ ⊤ ⊥ P Q R S T U V W X Y Z ;
+
+GENERIC: ⋀ ( x y -- expr )
+
+METHOD: ⋀ { ⊤ □ } nip ;
+METHOD: ⋀ { □ ⊤ } drop ;
+METHOD: ⋀ { ⊥ □ } drop ;
+METHOD: ⋀ { □ ⊥ } nip ;
+
+METHOD: ⋀ { ⋁ □ } [ [ x>> ] dip ⋀ ] [ [ y>> ] dip ⋀ ] 2bi ⋁ ;
+METHOD: ⋀ { □ ⋁ } [ x>> ⋀ ] [ y>> ⋀ ] 2bi ⋁ ;
+
+METHOD: ⋀ { □ □ } \ ⋀ boa ;
+
+GENERIC: ⋁ ( x y -- expr )
+
+METHOD: ⋁ { ⊤ □ } drop ;
+METHOD: ⋁ { □ ⊤ } nip ;
+METHOD: ⋁ { ⊥ □ } nip ;
+METHOD: ⋁ { □ ⊥ } drop ;
+
+METHOD: ⋁ { □ □ } \ ⋁ boa ;
+
+GENERIC: ¬ ( x -- expr )
+
+METHOD: ¬ { ⊤ } drop ⊥ ;
+METHOD: ¬ { ⊥ } drop ⊤ ;
+
+METHOD: ¬ { ⋀ } [ x>> ¬ ] [ y>> ¬ ] bi ⋁ ;
+METHOD: ¬ { ⋁ } [ x>> ¬ ] [ y>> ¬ ] bi ⋀ ;
+
+METHOD: ¬ { □ } \ ¬ boa ;
+
+: → ( x y -- expr ) ¬ ⋀ ;
+: ⊕ ( x y -- expr ) [ ⋁ ] [ ⋀ ¬ ] 2bi ⋀ ;
+: ≣ ( x y -- expr ) [ ⋀ ] [ [ ¬ ] bi@ ⋀ ] 2bi ⋁ ;
+
+GENERIC: (cnf) ( expr -- cnf )
+
+METHOD: (cnf) { ⋀ } [ x>> (cnf) ] [ y>> (cnf) ] bi append ;
+METHOD: (cnf) { □ } 1array ;
+
+GENERIC: cnf ( expr -- cnf )
+
+METHOD: cnf { ⋁ } [ x>> cnf ] [ y>> cnf ] bi append ;
+METHOD: cnf { □ } (cnf) 1array ;
+
+GENERIC: satisfiable? ( expr -- ? )
+
+METHOD: satisfiable? { ⊤ } drop t ;
+METHOD: satisfiable? { ⊥ } drop f ;
+
+: partition ( seq quot -- left right )
+    [ [ not ] compose filter ] [ filter ] 2bi ; inline
+
+: (satisfiable?) ( seq -- ? )
+    [ \ ¬ instance? ] partition [ x>> ] map intersect empty? ;
+
+METHOD: satisfiable? { □ }
+    cnf [ (satisfiable?) ] any? ;
+
+GENERIC: (expr.) ( expr -- )
+
+METHOD: (expr.) { □ } pprint ;
+
+: op. ( expr -- )
+    "(" write
+    [ x>> (expr.) ]
+    [ bl class pprint bl ]
+    [ y>> (expr.) ]
+    tri
+    ")" write ;
+
+METHOD: (expr.) { ⋀ } op. ;
+METHOD: (expr.) { ⋁ } op. ;
+METHOD: (expr.) { ¬ } [ class pprint ] [ x>> (expr.) ] bi ;
+
+: expr. ( expr -- ) (expr.) nl ;
diff --git a/boolean-expr/summary.txt b/boolean-expr/summary.txt
new file mode 100644 (file)
index 0000000..9b51186
--- /dev/null
@@ -0,0 +1 @@
+Simple boolean expression evaluator and simplifier
diff --git a/bubble-chamber/bubble-chamber.factor b/bubble-chamber/bubble-chamber.factor
new file mode 100644 (file)
index 0000000..914dd77
--- /dev/null
@@ -0,0 +1,652 @@
+
+USING: kernel syntax accessors sequences
+       arrays calendar
+       combinators.cleave combinators.short-circuit 
+       locals math math.constants math.functions math.libm
+       math.order math.points math.vectors
+       namespaces random sequences threads ui ui.gadgets ui.gestures
+       math.ranges
+       colors
+       colors.gray
+       vars
+       multi-methods
+       multi-method-syntax
+       processing.shapes
+       frame-buffer ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+IN: bubble-chamber
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! This is a Factor implementation of an art piece by Jared Tarbell:
+!
+!   http://complexification.net/gallery/machines/bubblechamber/
+!
+! Jared's version is written in Processing (Java)
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! processing
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: 2random ( a b -- num ) 2dup swap - 100 / <range> random ;
+
+: 1random ( b -- num ) 0 swap 2random ;
+
+: at-fraction ( seq fraction -- val ) over length 1- * swap nth ;
+
+: at-fraction-of ( fraction seq -- val ) swap at-fraction ;
+
+: mouse ( -- point ) hand-loc get ;
+
+: mouse-x ( -- x ) mouse first  ;
+: mouse-y ( -- y ) mouse second ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! bubble-chamber.particle
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+GENERIC: collide ( particle -- )
+GENERIC: move    ( particle -- )
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+TUPLE: particle
+  bubble-chamber pos vel speed speed-d theta theta-d theta-dd myc mya ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: initialize-particle ( particle -- particle )
+
+  0 0 {2} >>pos
+  0 0 {2} >>vel
+
+  0 >>speed
+  0 >>speed-d
+  0 >>theta
+  0 >>theta-d
+  0 >>theta-dd
+
+  0 0 0 1 rgba boa >>myc
+  0 0 0 1 rgba boa >>mya ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: center ( particle -- point ) bubble-chamber>> size>> 2 v/n ;
+
+DEFER: collision-theta
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: move-by ( obj delta -- obj ) over pos>> v+ >>pos ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: theta-dd-small? ( par limit -- par ? ) [ dup theta-dd>> abs ] dip < ;
+
+: random-theta-dd  ( par a b -- par ) 2random >>theta-dd ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: turn ( particle -- particle )
+  dup
+    [ speed>> ] [ theta>> { sin cos } <arr> ] bi n*v
+  >>vel ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: step-theta     ( p -- p ) [ ] [ theta>>   ] [ theta-d>>  ] tri + >>theta   ;
+: step-theta-d   ( p -- p ) [ ] [ theta-d>> ] [ theta-dd>> ] tri + >>theta-d ;
+: step-speed-sub ( p -- p ) [ ] [ speed>>   ] [ speed-d>>  ] tri - >>speed   ;
+: step-speed-mul ( p -- p ) [ ] [ speed>>   ] [ speed-d>>  ] tri * >>speed   ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+:: out-of-bounds? ( PARTICLE -- ? )
+  [let | X      [ PARTICLE pos>> first                    ]
+         Y      [ PARTICLE pos>> second                   ]
+         WIDTH  [ PARTICLE bubble-chamber>> size>> first  ]
+         HEIGHT [ PARTICLE bubble-chamber>> size>> second ] |
+
+    [let | LEFT   [ WIDTH  neg ]
+           RIGHT  [ WIDTH  2 * ]
+           BOTTOM [ HEIGHT neg ]
+           TOP    [ HEIGHT 2 * ] |
+
+      { [ X LEFT < ] [ X RIGHT > ] [ Y BOTTOM < ] [ Y TOP > ] } 0|| ] ] ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! bubble-chamber.particle.axion
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+TUPLE: <axion> < particle ;
+
+: axion ( -- <axion> ) <axion> new initialize-particle ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+METHOD: collide ( <axion> -- )
+
+  dup center          >>pos
+  2 pi *      1random >>theta
+  1.0   6.0   2random >>speed
+  0.998 1.000 2random >>speed-d
+  0                   >>theta-d
+  0                   >>theta-dd
+
+  [ 0.00001 theta-dd-small? ] [ -0.001 0.001 random-theta-dd ] while
+
+  drop ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: dy>alpha ( dy -- alpha ) neg 6 * 30 + 255.0 / ;
+
+! : axion-white ( dy -- dy ) dup 1 swap dy>alpha {2} \ stroke-color set ;
+! : axion-black ( dy -- dy ) dup 0 swap dy>alpha {2} \ stroke-color set ;
+
+: axion-white ( dy -- dy ) dup 1 swap dy>alpha gray boa \ stroke-color set ;
+: axion-black ( dy -- dy ) dup 0 swap dy>alpha gray boa \ stroke-color set ;
+
+: axion-point- ( particle dy -- particle ) [ dup pos>> ] dip v-y point ;
+: axion-point+ ( particle dy -- particle ) [ dup pos>> ] dip v+y point ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+METHOD: move ( <axion> -- )
+
+  T{ gray f 0.06 0.59 } \ stroke-color set
+  dup pos>>  point
+
+  1 4 [a,b] [ axion-white axion-point- ] each
+  1 4 [a,b] [ axion-black axion-point+ ] each
+
+  dup vel>> move-by
+
+  turn
+
+  step-theta
+  step-theta-d
+  step-speed-mul
+
+  [ ] [ speed-d>> 0.9999 * ] bi >>speed-d
+
+  1000 random 996 >
+    [
+      dup speed>>   neg     >>speed
+      dup speed-d>> neg 2 + >>speed-d
+
+      100 random 30 > [ collide ] [ drop ] if
+    ]
+    [ drop ]
+  if ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! bubble-chamber.particle.hadron
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+TUPLE: <hadron> < particle ;
+
+: hadron ( -- <hadron> ) <hadron> new initialize-particle ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+METHOD: collide ( <hadron> -- )
+
+  dup center          >>pos
+  2 pi *      1random >>theta
+  0.5   3.5   2random >>speed
+  0.996 1.001 2random >>speed-d
+  0                   >>theta-d
+  0                   >>theta-dd
+
+  [ 0.00001 theta-dd-small? ] [ -0.001 0.001 random-theta-dd ] while
+
+  0 1 0 1 rgba boa >>myc
+
+  drop ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+METHOD: move ( <hadron> -- )
+
+  T{ gray f 1 0.11 } \ stroke-color set  dup pos>> 1 v-y point
+  T{ gray f 0 0.11 } \ stroke-color set  dup pos>> 1 v+y point
+
+  dup vel>> move-by
+
+  turn
+
+  step-theta
+  step-theta-d
+  step-speed-mul
+
+  1000 random 997 >
+    [
+      1.0     >>speed-d
+      0.00001 >>theta-dd
+
+      100 random 70 > [ dup collide ] when
+    ]
+  when
+
+  dup out-of-bounds? [ collide ] [ drop ] if ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! bubble-chamber.particle.muon.colors
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: good-colors ( -- seq )
+  {
+    T{ rgba f 0.23 0.14 0.17 1 }
+    T{ rgba f 0.23 0.14 0.15 1 }
+    T{ rgba f 0.21 0.14 0.15 1 }
+    T{ rgba f 0.51 0.39 0.33 1 }
+    T{ rgba f 0.49 0.33 0.20 1 }
+    T{ rgba f 0.55 0.45 0.32 1 }
+    T{ rgba f 0.69 0.63 0.51 1 }
+    T{ rgba f 0.64 0.39 0.18 1 }
+    T{ rgba f 0.73 0.42 0.20 1 }
+    T{ rgba f 0.71 0.45 0.29 1 }
+    T{ rgba f 0.79 0.45 0.22 1 }
+    T{ rgba f 0.82 0.56 0.34 1 }
+    T{ rgba f 0.88 0.72 0.49 1 }
+    T{ rgba f 0.85 0.69 0.40 1 }
+    T{ rgba f 0.96 0.92 0.75 1 }
+    T{ rgba f 0.99 0.98 0.87 1 }
+    T{ rgba f 0.85 0.82 0.69 1 }
+    T{ rgba f 0.99 0.98 0.87 1 }
+    T{ rgba f 0.82 0.82 0.79 1 }
+    T{ rgba f 0.65 0.69 0.67 1 }
+    T{ rgba f 0.53 0.60 0.55 1 }
+    T{ rgba f 0.57 0.53 0.68 1 }
+    T{ rgba f 0.47 0.42 0.56 1 }
+  } ;
+
+: anti-colors ( -- seq ) good-colors <reversed> ; 
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: color-fraction ( particle -- particle fraction ) dup theta>> pi + 2 pi * / ;
+
+: set-good-color ( particle -- particle )
+  color-fraction dup 0 1 between?
+    [ good-colors at-fraction-of >>myc ]
+    [ drop ]
+  if ;
+
+: set-anti-color ( particle -- particle )
+  color-fraction dup 0 1 between?
+    [ anti-colors at-fraction-of >>mya ]
+    [ drop ]
+  if ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! bubble-chamber.particle.muon
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+TUPLE: <muon> < particle ;
+
+: muon ( -- <muon> ) <muon> new initialize-particle ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+METHOD: collide ( <muon> -- )
+
+  dup center           >>pos
+  2 32 [a,b] random    >>speed
+  0.0001 0.001 2random >>speed-d
+
+  dup collision-theta  -0.1 0.1 2random + >>theta
+  0                                    >>theta-d
+  0                                    >>theta-dd
+
+  [ 0.001 theta-dd-small? ] [ -0.1 0.1 random-theta-dd ] while
+
+  set-good-color
+  set-anti-color
+
+  drop ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+METHOD: move ( <muon> -- )
+
+  [let | MUON [ ] |
+
+    [let | WIDTH [ MUON bubble-chamber>> size>> first ] |
+
+      MUON
+
+      dup myc>> 0.16 >>alpha \ stroke-color set
+      dup pos>> point
+
+      dup mya>> 0.16 >>alpha \ stroke-color set
+      dup pos>> first2 [ WIDTH swap - ] dip 2array point
+
+      dup
+      [ speed>> ] [ theta>> { sin cos } <arr> ] bi n*v
+      move-by
+
+      step-theta
+      step-theta-d
+      step-speed-sub
+
+      dup out-of-bounds? [ collide ] [ drop ] if ] ] ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! bubble-chamber.particle.quark
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+TUPLE: <quark> < particle ;
+
+: quark ( -- <quark> ) <quark> new initialize-particle ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+METHOD: collide ( <quark> -- )
+
+  dup center                             >>pos
+  dup collision-theta -0.11 0.11 2random +  >>theta
+  0.5 3.0 2random                        >>speed
+
+  0.996 1.001 2random                    >>speed-d
+  0                                      >>theta-d
+  0                                      >>theta-dd
+
+  [ 0.00001 theta-dd-small? ] [ -0.001 0.001 random-theta-dd ] while
+
+  drop ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+METHOD: move ( <quark> -- )
+
+  [let | QUARK [ ] |
+
+    [let | WIDTH [ QUARK bubble-chamber>> size>> first ] |
+
+      QUARK
+    
+      dup myc>> 0.13 >>alpha \ stroke-color set
+      dup pos>>              point
+
+      dup pos>> first2 [ WIDTH swap - ] dip 2array point
+
+      [ ] [ vel>> ] bi move-by
+
+      turn
+
+      step-theta
+      step-theta-d
+      step-speed-mul
+
+      1000 random 997 >
+      [
+      dup speed>> neg    >>speed
+      2 over speed-d>> - >>speed-d
+      ]
+      when
+
+      dup out-of-bounds? [ collide ] [ drop ] if ] ] ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+USE: syntax ! Switch back to non-multi-method 'TUPLE:' syntax
+
+TUPLE: <bubble-chamber> < <frame-buffer>
+  paused particles collision-theta size ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! : randomize-collision-theta ( bubble-chamber -- bubble-chamber )
+!   0  2 pi *  0.001  <range>  random >>collision-theta ;
+
+: randomize-collision-theta ( bubble-chamber -- bubble-chamber )
+  pi neg  pi  0.001 <range> random >>collision-theta ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: collision-theta ( particle -- theta ) bubble-chamber>> collision-theta>> ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+M: <bubble-chamber> pref-dim* ( gadget -- dim ) size>> ;
+
+M: <bubble-chamber> ungraft* ( <bubble-chamber> -- ) t >>paused drop ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: iterate-particle ( particle -- ) move ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+M:: <bubble-chamber> update-frame-buffer ( BUBBLE-CHAMBER -- )
+
+  BUBBLE-CHAMBER particles>> [ iterate-particle ] each ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: iterate-system ( <bubble-chamber> -- ) drop ;
+
+:: start-bubble-chamber-thread ( GADGET -- )
+  GADGET f >>paused drop
+  [
+    [
+      GADGET paused>>
+        [ f ]
+        [ GADGET iterate-system GADGET relayout-1 1 milliseconds sleep t ]
+      if
+    ]
+    loop
+  ]
+  in-thread ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: bubble-chamber ( -- <bubble-chamber> )
+  <bubble-chamber> new-gadget
+    { 1000 1000 } >>size
+    randomize-collision-theta ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: bubble-chamber-window ( -- <bubble-chamber> )
+  bubble-chamber
+    dup start-bubble-chamber-thread
+    dup "Bubble Chamber" open-window ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+:: add-particle ( BUBBLE-CHAMBER PARTICLE -- bubble-chamber )
+  
+  PARTICLE BUBBLE-CHAMBER >>bubble-chamber drop
+
+  BUBBLE-CHAMBER  BUBBLE-CHAMBER particles>> PARTICLE suffix  >>particles ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+:: mouse->collision-theta ( BUBBLE-CHAMBER -- BUBBLE-CHAMBER )
+  mouse
+  BUBBLE-CHAMBER size>> 2 v/n
+  v-
+  first2
+  fatan2
+  BUBBLE-CHAMBER collision-theta<<
+  BUBBLE-CHAMBER ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+:: mouse-pressed ( BUBBLE-CHAMBER -- )
+
+  BUBBLE-CHAMBER mouse->collision-theta drop
+
+  11
+  [
+    BUBBLE-CHAMBER particles>> [ <hadron>? ] filter random [ collide ] when*
+    BUBBLE-CHAMBER particles>> [ <quark>?  ] filter random [ collide ] when*
+    BUBBLE-CHAMBER particles>> [ <muon>?   ] filter random [ collide ] when*
+  ]
+  times ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+<bubble-chamber> H{ { T{ button-down } [ mouse-pressed ] } } set-gestures
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: collide-random-particle ( bubble-chamber -- bubble-chamber )
+  dup particles>> random collide ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: big-bang ( bubble-chamber -- bubble-chamber )
+  dup particles>> [ collide ] each ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: collide-one-of-each ( bubble-chamber -- bubble-chamber )
+  dup
+  particles>>
+  [ [ <muon>?   ] filter random collide ]
+  [ [ <quark>?  ] filter random collide ]
+  [ [ <hadron>? ] filter random collide ]
+  tri ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! Some initial configurations
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: ten-hadrons ( -- )
+  bubble-chamber-window
+  10 [ drop hadron add-particle ] each
+  drop ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: original ( -- )
+  
+  bubble-chamber-window
+  
+    1789 [ muon   add-particle ] times
+    1300 [ quark  add-particle ] times
+    1000 [ hadron add-particle ] times
+     111 [ axion  add-particle ] times
+
+    particles>>
+    [ [ <muon>?   ] filter random collide ]
+    [ [ <quark>?  ] filter random collide ]
+    [ [ <hadron>? ] filter random collide ]
+    tri ;
+    
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: hadron-chamber ( -- )
+  bubble-chamber-window
+  1000 [ hadron add-particle ] times
+  big-bang
+  drop ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: quark-chamber ( -- )
+  bubble-chamber-window
+  100 [ quark add-particle ] times
+  big-bang
+  drop ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: small ( -- )
+  <bubble-chamber> new-gadget
+    { 200 200 } >>size
+    randomize-collision-theta
+    dup start-bubble-chamber-thread
+    dup "Bubble Chamber" open-window
+
+    42 [ muon   add-particle ] times
+    30 [ quark  add-particle ] times
+    21 [ hadron add-particle ] times
+     7 [ axion  add-particle ] times
+
+    collide-one-of-each
+
+  drop ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: medium ( -- )
+  <bubble-chamber> new-gadget
+    { 400 400 } >>size
+    randomize-collision-theta
+    dup start-bubble-chamber-thread
+    dup "Bubble Chamber" open-window
+
+    100 [ muon   add-particle ] times
+     81 [ quark  add-particle ] times
+     60 [ hadron add-particle ] times
+      9 [ axion  add-particle ] times
+
+    collide-one-of-each
+
+  drop ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: large ( -- )
+  <bubble-chamber> new-gadget
+    { 600 600 } >>size
+    randomize-collision-theta
+    dup start-bubble-chamber-thread
+    dup "Bubble Chamber" open-window
+
+    550 [ muon   add-particle ] times
+    339 [ quark  add-particle ] times
+    100 [ hadron add-particle ] times
+     11 [ axion  add-particle ] times
+
+    collide-one-of-each
+
+  drop ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! Experimental
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: muon-chamber ( -- )
+  bubble-chamber-window
+  1000 [ muon add-particle ] times
+  dup particles>> [ collide randomize-collision-theta ] each
+  drop ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: original-big-bang ( -- )
+  bubble-chamber
+    { 1000 1000 } >>size
+    dup start-bubble-chamber-thread
+    dup "Bubble Chamber" open-window
+
+  1789 [ muon   add-particle ] times
+  1300 [ quark  add-particle ] times
+  1000 [ hadron add-particle ] times
+   111 [ axion  add-particle ] times
+
+  big-bang
+
+  drop ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: original-big-bang-variant ( -- )
+  bubble-chamber-window
+  1789 [ muon   add-particle ] times
+  1300 [ quark  add-particle ] times
+  1000 [ hadron add-particle ] times
+   111 [ axion  add-particle ] times
+  dup particles>> [ collide randomize-collision-theta ] each
+  drop ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
diff --git a/bubble-chamber/hadron-chamber/hadron-chamber.factor b/bubble-chamber/hadron-chamber/hadron-chamber.factor
new file mode 100644 (file)
index 0000000..092dd1e
--- /dev/null
@@ -0,0 +1,8 @@
+
+USING: ui bubble-chamber ;
+
+IN: bubble-chamber.hadron-chamber
+
+: main ( -- ) [ hadron-chamber ] with-ui ;
+
+MAIN: main
diff --git a/bubble-chamber/hadron-chamber/tags.txt b/bubble-chamber/hadron-chamber/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/bubble-chamber/large/large.factor b/bubble-chamber/large/large.factor
new file mode 100644 (file)
index 0000000..aef9d38
--- /dev/null
@@ -0,0 +1,8 @@
+
+USING: ui bubble-chamber ;
+
+IN: bubble-chamber.large
+
+: main ( -- ) [ large ] with-ui ;
+
+MAIN: main
diff --git a/bubble-chamber/large/tags.txt b/bubble-chamber/large/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/bubble-chamber/medium/medium.factor b/bubble-chamber/medium/medium.factor
new file mode 100644 (file)
index 0000000..a72ca1c
--- /dev/null
@@ -0,0 +1,8 @@
+
+USING: ui bubble-chamber ;
+
+IN: bubble-chamber.medium
+
+: main ( -- ) [ medium ] with-ui ;
+
+MAIN: main
diff --git a/bubble-chamber/medium/tags.txt b/bubble-chamber/medium/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/bubble-chamber/original/original.factor b/bubble-chamber/original/original.factor
new file mode 100644 (file)
index 0000000..4940957
--- /dev/null
@@ -0,0 +1,8 @@
+
+USING: ui bubble-chamber ;
+
+IN: bubble-chamber.original
+
+: main ( -- ) [ original ] with-ui ;
+
+MAIN: main
diff --git a/bubble-chamber/original/tags.txt b/bubble-chamber/original/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/bubble-chamber/quark-chamber/quark-chamber.factor b/bubble-chamber/quark-chamber/quark-chamber.factor
new file mode 100644 (file)
index 0000000..97aaebe
--- /dev/null
@@ -0,0 +1,8 @@
+
+USING: ui bubble-chamber ;
+
+IN: bubble-chamber.quark-chamber
+
+: main ( -- ) [ quark-chamber ] with-ui ;
+
+MAIN: main
diff --git a/bubble-chamber/quark-chamber/tags.txt b/bubble-chamber/quark-chamber/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/bubble-chamber/small/small.factor b/bubble-chamber/small/small.factor
new file mode 100644 (file)
index 0000000..774a2bc
--- /dev/null
@@ -0,0 +1,8 @@
+
+USING: ui bubble-chamber ;
+
+IN: bubble-chamber.small
+
+: main ( -- ) [ small ] with-ui ;
+
+MAIN: main
diff --git a/bubble-chamber/small/tags.txt b/bubble-chamber/small/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/bubble-chamber/ten-hadrons/tags.txt b/bubble-chamber/ten-hadrons/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/bubble-chamber/ten-hadrons/ten-hadrons.factor b/bubble-chamber/ten-hadrons/ten-hadrons.factor
new file mode 100644 (file)
index 0000000..7eb6673
--- /dev/null
@@ -0,0 +1,8 @@
+
+USING: ui bubble-chamber ;
+
+IN: bubble-chamber.ten-hadrons
+
+: main ( -- ) [ ten-hadrons ] with-ui ;
+
+MAIN: main
diff --git a/cartesian/cartesian.factor b/cartesian/cartesian.factor
new file mode 100644 (file)
index 0000000..730b0f5
--- /dev/null
@@ -0,0 +1,42 @@
+
+USING: kernel combinators sequences opengl.gl
+       ui.render ui.gadgets ui.gadgets.slate
+       accessors ;
+
+IN: ui.gadgets.cartesian
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+TUPLE: cartesian < slate x-min x-max y-min y-max z-min z-max perspective ;
+
+: init-cartesian ( cartesian -- cartesian )
+  init-slate
+  -10 >>x-min
+   10 >>x-max
+  -10 >>y-min
+   10 >>y-max
+   -1 >>z-min
+    1 >>z-max ;
+
+: <cartesian> ( -- cartesian ) cartesian new init-cartesian ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+M: cartesian establish-coordinate-system ( cartesian -- cartesian )
+   dup
+   {
+     [ x-min>> ] [ x-max>> ]
+     [ y-min>> ] [ y-max>> ]
+     [ z-min>> ] [ z-max>> ]
+   }
+   cleave
+   glOrtho ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: x-range ( cartesian range -- cartesian ) first2 [ >>x-min ] [ >>x-max ] bi* ;
+: y-range ( cartesian range -- cartesian ) first2 [ >>y-min ] [ >>y-max ] bi* ;
+: z-range ( cartesian range -- cartesian ) first2 [ >>z-min ] [ >>z-max ] bi* ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
diff --git a/cfdg/authors.txt b/cfdg/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/cfdg/cfdg.factor b/cfdg/cfdg.factor
new file mode 100644 (file)
index 0000000..834b4b1
--- /dev/null
@@ -0,0 +1,262 @@
+
+USING: kernel alien.c-types combinators namespaces make arrays
+       sequences splitting
+       math math.functions math.vectors math.trig
+       opengl.gl opengl.glu opengl ui ui.gadgets.slate
+       vars colors self self.slots
+       random-weighted colors.hsv cfdg.gl accessors
+       ui.gadgets.handler ui.gestures assocs ui.gadgets macros
+       specialized-arrays.double ;
+
+QUALIFIED: syntax
+
+IN: cfdg
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+SELF-SLOTS: hsva
+
+: clear-color ( color -- ) gl-clear-color GL_COLOR_BUFFER_BIT glClear ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! if (adjustment < 0)
+!   base + base * adjustment
+
+! if (adjustment > 0)
+!   base + (1 - base) * adjustment
+
+: adjust ( val num -- val ) dup 0 > [ 1 pick - * + ] [ dupd * + ] if ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: hue ( num -- ) hue-> + 360 mod ->hue ;
+
+: saturation ( num -- ) saturation-> swap adjust ->saturation ;
+: brightness ( num -- ) value->      swap adjust ->value ;
+: alpha      ( num -- ) alpha->      swap adjust ->alpha ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: h   ( num -- ) hue ;
+: sat ( num -- ) saturation ;
+: b   ( num -- ) brightness ;
+: a   ( num -- ) alpha ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+VAR: color-stack
+
+: init-color-stack ( -- ) V{ } clone >color-stack ;
+
+: push-color ( -- ) self> color-stack> push   self> clone >self ;
+
+: pop-color ( -- ) color-stack> pop dup >self gl-color ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! : double-nth* ( c-array indices -- seq ) swap [ double-nth ] curry map ;
+
+: double-nth* ( c-array indices -- seq )
+  swap byte-array>double-array [ nth ] curry map ;
+
+: check-size ( modelview -- num ) { 0 1 4 5 } double-nth* [ abs ] map supremum ;
+
+VAR: threshold
+
+: iterate? ( -- ? ) get-modelview-matrix check-size threshold> > ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! 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 dup dup
+  [ 2 * cos ,   2 * sin ,       0 ,   0 ,
+    2 * sin ,   2 * cos neg ,   0 ,   0 ,
+          0 ,             0 ,   1 ,   0 , 
+          0 ,             0 ,   0 ,   1 , ]
+  double-array{ } make underlying>> glMultMatrixd ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: circle ( -- )
+  self> gl-color
+  gluNewQuadric dup 0 0.5 20 10 gluDisk gluDeleteQuadric ;
+
+: triangle ( -- )
+  self> gl-color
+  GL_POLYGON glBegin
+    0    0.577 glVertex2d
+    0.5 -0.289 glVertex2d
+   -0.5 -0.289 glVertex2d
+  glEnd ;
+
+: square ( -- )
+  self> gl-color
+  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 ;
+
+: size* ( scale-x scale-y -- ) 1 glScaled ;
+
+: rotate ( angle -- ) 0 0 1 glRotated ;
+
+: x ( x -- ) 0 0 glTranslated ;
+
+: y ( y -- ) 0 swap 0 glTranslated ;
+
+: flip ( angle -- ) gl-flip ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: s  ( scale -- ) size ;
+: s* ( scale-x scale-y -- ) size* ;
+: r  ( angle -- ) rotate ;
+: f  ( angle -- ) flip ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: do ( quot -- )
+  push-modelview-matrix
+  push-color
+  call
+  pop-modelview-matrix
+  pop-color ; inline
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: recursive ( quot -- ) iterate? swap when ; inline
+
+: multi ( seq -- ) random-weighted* call ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: [rules] ( seq -- quot )
+  [ unclip swap [ [ do ] curry ] map concat 2array ] map
+  [ call-random-weighted ] swap prefix
+  [ when ] swap prefix
+  [ iterate? ] swap append ;
+
+MACRO: rules ( seq -- quot ) [rules] ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: [rule] ( seq -- quot )
+  [ [ do ] swap prefix ] map concat
+  [ when ] swap prefix
+  [ iterate? ] prepend ;
+
+MACRO: rule ( seq -- quot ) [rule] ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+VAR: background
+
+: set-initial-background ( -- ) T{ hsva f 0 0 1 1 } clone >self ;
+
+: set-background ( -- )
+  set-initial-background
+  background> call
+  self> clear-color ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+USING: rewrite-closures ;
+
+VAR: viewport ! { left width bottom height }
+
+VAR: start-shape
+
+: set-initial-color ( -- ) T{ hsva f 0 0 0 1 } clone >self ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+SYMBOL: dlist
+
+! : build-model-dlist ( -- )
+!   1 glGenLists dlist set
+!   dlist get GL_COMPILE_AND_EXECUTE glNewList
+!   start-shape> call
+!   glEndList ;
+
+: build-model-dlist ( -- )
+  1 glGenLists dlist set
+  dlist get GL_COMPILE_AND_EXECUTE glNewList
+
+  set-initial-color
+
+  self> gl-color
+
+  start-shape> call
+      
+  glEndList ;
+
+: display ( -- )
+
+  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
+
+  dlist get not
+    [ build-model-dlist ]
+    [ dlist get glCallList ]
+  if ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: delete-dlist ( -- ) dlist get [ dlist get 1 glDeleteLists dlist off ] when ;
+
+: cfdg-window* ( -- slate )
+  C[ display ] <slate>
+    { 500 500 }       >>pdim
+    C[ delete-dlist ] >>ungraft
+  dup "CFDG" open-window ;
+
+: cfdg-window ( -- slate ) [ cfdg-window* ] with-ui ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+SYMBOL: the-slate
+
+: rebuild ( -- ) delete-dlist the-slate get relayout-1 ;
+
+: <cfdg-gadget> ( -- slate )
+  C[ display ] <slate>
+    dup the-slate set
+    { 500 500 } >>pdim
+    C[ dlist get [ dlist get 1 glDeleteLists ] when ] >>ungraft
+  <handler>
+    H{ } clone
+      T{ key-down f f "ENTER" } C[ drop rebuild ] swap pick set-at
+      T{ button-down } C[ drop rebuild ] swap pick set-at
+    >>table ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+USE: fry
+
+: cfdg-window. ( quot -- )
+  '[ [ @ <cfdg-gadget> "CFDG" open-window ] with-scope ] with-ui ;
diff --git a/cfdg/gl/authors.txt b/cfdg/gl/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/cfdg/gl/gl.factor b/cfdg/gl/gl.factor
new file mode 100644 (file)
index 0000000..a54f4ca
--- /dev/null
@@ -0,0 +1,16 @@
+
+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 ;
diff --git a/cfdg/models/aqua-star/aqua-star.factor b/cfdg/models/aqua-star/aqua-star.factor
new file mode 100644 (file)
index 0000000..dbb7eb5
--- /dev/null
@@ -0,0 +1,36 @@
+
+USING: kernel namespaces math random opengl.gl opengl.glu ui ui.gadgets.slate
+       random-weighted cfdg ;
+
+IN: cfdg.models.aqua-star
+
+: tentacle ( -- )
+iterate? [
+  { { 1 [ circle
+          [ .23 y .99 s .002 b tentacle ] do ] }
+    { 1 [ circle
+          [ .17 y 2 r .99 s .002 b tentacle ] do ] }
+    { 1 [ circle
+          [ .12 y -2 r .99 s .001 b tentacle ] do ] } }
+  call-random-weighted
+] 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 ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: init ( -- )
+  [ -1 b ]             >background
+  { -60 140 -120 140 } >viewport
+  0.1                  >threshold
+  [ anemone-begin ]    >start-shape ;
+
+: run ( -- ) [ init ] cfdg-window. ;
+
+MAIN: run
diff --git a/cfdg/models/aqua-star/authors.txt b/cfdg/models/aqua-star/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/cfdg/models/aqua-star/tags.txt b/cfdg/models/aqua-star/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/cfdg/models/chiaroscuro/authors.txt b/cfdg/models/chiaroscuro/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/cfdg/models/chiaroscuro/chiaroscuro.factor b/cfdg/models/chiaroscuro/chiaroscuro.factor
new file mode 100644 (file)
index 0000000..d0474cd
--- /dev/null
@@ -0,0 +1,38 @@
+
+USING: kernel namespaces sequences math
+       opengl.gl opengl.glu ui ui.gadgets.slate
+       random-weighted cfdg ;
+
+IN: cfdg.models.chiaroscuro
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+DEFER: white
+
+: black ( -- )
+  {
+    { 60 [ 0.6 s circle ] [ 0.1 x 5 r 0.99 s -0.01 b -0.01 a black ] }
+    {  1 [ white black ]                                             }
+  }
+  rules ;
+
+: white ( -- )
+  {
+    { 60 [ 0.6 s circle ] [ 0.1 x -5 r 0.99 s 0.01 b -0.01 a white ] }
+    {  1 [ black white ] }
+  }
+  rules ;
+
+: chiaroscuro ( -- ) { [ 0.5 b black ] } rule ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: init ( -- )
+  [ -0.5 b ]      >background
+  { -3 6 -2 6 }   >viewport
+  0.03            >threshold  
+  [ chiaroscuro ] >start-shape ;
+
+: run ( -- ) [ init ] cfdg-window. ;
+
+MAIN: run
diff --git a/cfdg/models/chiaroscuro/tags.txt b/cfdg/models/chiaroscuro/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/cfdg/models/flower6/authors.txt b/cfdg/models/flower6/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/cfdg/models/flower6/deploy.factor b/cfdg/models/flower6/deploy.factor
new file mode 100644 (file)
index 0000000..d6dadc0
--- /dev/null
@@ -0,0 +1,12 @@
+USING: tools.deploy.config ;
+V{
+    { deploy-ui? t }
+    { deploy-io 1 }
+    { deploy-reflection 2 }
+    { deploy-compiler? t }
+    { deploy-math? t }
+    { deploy-word-props? f }
+    { deploy-c-types? f }
+    { "stop-after-last-window?" t }
+    { "bundle-name" "cfdg.models.flower6.app" }
+}
diff --git a/cfdg/models/flower6/flower6.factor b/cfdg/models/flower6/flower6.factor
new file mode 100644 (file)
index 0000000..91fecd7
--- /dev/null
@@ -0,0 +1,30 @@
+
+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 ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: init ( -- )
+  [ ]           >background
+  { -1 2 -1 2 } >viewport
+  0.01          >threshold
+  [ flower6 ]   >start-shape ;
+
+: run ( -- ) [ init ] cfdg-window. ;
+
+MAIN: run
+
diff --git a/cfdg/models/flower6/tags.txt b/cfdg/models/flower6/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/cfdg/models/game1-turn6/authors.txt b/cfdg/models/game1-turn6/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/cfdg/models/game1-turn6/game1-turn6.factor b/cfdg/models/game1-turn6/game1-turn6.factor
new file mode 100644 (file)
index 0000000..fe48d58
--- /dev/null
@@ -0,0 +1,54 @@
+
+USING: kernel namespaces math opengl.gl opengl.glu ui ui.gadgets.slate
+       random-weighted cfdg ;
+
+IN: cfdg.models.game1-turn6
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: f-triangles ( -- )
+  {
+    [ 0.1 x 0.1 y -0.33 alpha 20 hue 0.7 sat 0.80 b triangle ]
+    [                         10 hue 0.9 sat 0.33 b triangle ]
+    [ 0.9 s                   10 hue 0.5 sat 1.00 b triangle ]
+    [ 0.8 s 5 r f-triangles ]
+  }
+  rule ;
+
+: f-squares ( -- )
+  {
+    [ 0.1 x 0.1 y -0.33 alpha 250 hue 0.70 sat 0.80 b square ]
+    [                         220 hue 0.90 sat 0.33 b square ]
+    [ 0.9 s                   220 hue 0.25 sat 1.00 b square ]
+    [ 0.8 s 5 r f-squares ]
+  }
+  rule ;
+
+DEFER: start
+
+: spiral ( -- )
+  {
+    { 1 [ f-squares ]
+        [ 0.5 x 0.5 y 45 r f-triangles ]
+        [ 1 y 25 r 0.9 s spiral ] }
+            
+    { 0.022 [ 90 flip 50 hue start ] }
+  }
+  rules ;
+
+: start ( -- )
+  [       spiral ] do
+  [ 120 r spiral ] do
+  [ 240 r spiral ] do ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: init ( -- )
+  [ 66 hue 0.4 sat 0.5 b ] >background
+  { -5 10 -5 10 }          >viewport
+  0.001                    >threshold
+  [ start ]                >start-shape ;
+
+: run ( -- ) [ init ] cfdg-window. ;
+
+MAIN: run
diff --git a/cfdg/models/game1-turn6/tags.txt b/cfdg/models/game1-turn6/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/cfdg/models/lesson/authors.txt b/cfdg/models/lesson/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/cfdg/models/lesson/lesson.factor b/cfdg/models/lesson/lesson.factor
new file mode 100644 (file)
index 0000000..5902c12
--- /dev/null
@@ -0,0 +1,108 @@
+
+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 ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: init ( -- )
+  [ ]              >background
+  { -5 25 -15 25 } >viewport
+  0.03             >threshold
+  [ toc ]          >start-shape ;
+
+: run ( -- ) [ init ] cfdg-window. ;
+
+MAIN: run
+
diff --git a/cfdg/models/lesson/tags.txt b/cfdg/models/lesson/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/cfdg/models/rules08/rules08.factor b/cfdg/models/rules08/rules08.factor
new file mode 100644 (file)
index 0000000..7b4e88b
--- /dev/null
@@ -0,0 +1,48 @@
+
+USING: namespaces sequences math random-weighted cfdg ;
+
+IN: cfdg.models.rules08
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: insct ( -- )
+  [ 1.5 5.5 size* -1 brightness triangle ] do
+  10
+    [ [ [ 1 0.9 size* -0.15 y 0.05 brightness ] times 1 5 size* triangle ] do ]
+  each ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+DEFER: line
+
+: ligne ( -- )
+  {
+    { 1   [ 4.5 y 1.15 0.8 size* -0.3 b line ] }
+    { 0.5 [ ] }
+  }
+  rules ;
+
+: line ( -- ) { [ insct ligne ] } rule ;
+
+: sole ( -- )
+  {
+    { 1    [ 1 brightness 0.5 saturation ligne ] [ 140 r 1 hue sole ] }
+    { 0.01 [ ] }
+  }
+  rules ;
+
+: centre ( -- ) { [ 1 b 5 s circle ] [ sole ] } rule ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: init ( -- )
+  [ -1 b ] >background
+  { -20 40 -20 40 } viewport set
+  [ centre ] >start-shape
+  0.0001 >threshold ;
+
+: run ( -- ) [ init ] cfdg-window. ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+MAIN: run
diff --git a/cfdg/models/rules08/tags.txt b/cfdg/models/rules08/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/cfdg/models/sierpinski/authors.txt b/cfdg/models/sierpinski/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/cfdg/models/sierpinski/sierpinski.factor b/cfdg/models/sierpinski/sierpinski.factor
new file mode 100644 (file)
index 0000000..c02806f
--- /dev/null
@@ -0,0 +1,37 @@
+
+USING: kernel namespaces math opengl.gl opengl.glu ui ui.gadgets.slate
+       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 ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: init ( -- )
+  [ ]           >background
+  { -4 8 -4 8 } >viewport
+  0.01          >threshold
+  [ top ]       >start-shape ;
+
+: run ( -- ) [ init ] cfdg-window. ;
+
+MAIN: run
diff --git a/cfdg/models/sierpinski/tags.txt b/cfdg/models/sierpinski/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/cfdg/models/snowflake/authors.txt b/cfdg/models/snowflake/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/cfdg/models/snowflake/snowflake.factor b/cfdg/models/snowflake/snowflake.factor
new file mode 100644 (file)
index 0000000..9efb335
--- /dev/null
@@ -0,0 +1,37 @@
+
+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 ] } }
+  call-random-weighted
+] when ;
+
+: snowflake ( -- )
+spike
+[ 60 r spike ] do
+[ 120 r spike ] do
+[ 180 r spike ] do
+[ 240 r spike ] do
+[ 300 r spike ] do ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: init ( -- )
+  [ ]               >background
+  { -40 80 -40 80 } >viewport
+  0.1               >threshold
+  [ snowflake ]     >start-shape ;
+
+: run ( -- ) [ init ] cfdg-window. ;
+
+MAIN: run
+
diff --git a/cfdg/models/snowflake/tags.txt b/cfdg/models/snowflake/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/cfdg/models/spirales/spirales.factor b/cfdg/models/spirales/spirales.factor
new file mode 100644 (file)
index 0000000..40d58ca
--- /dev/null
@@ -0,0 +1,28 @@
+
+USING: namespaces sequences math random-weighted cfdg ;
+
+IN: cfdg.models.spirales
+
+DEFER: line
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: block ( -- ) { [ circle ] [ 0.3 s 60 flip line ] } rule ;
+
+: a1 ( -- ) { [ 0.95 s 2 x 12 r 0.5 b 10 hue 1.5 sat a1 ] [ block ] } rule ;
+
+: line ( -- ) -0.3 a { [ 0 r a1 ] [ 120 r a1 ] [ 240 r a1 ] } rule ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: init ( -- )
+  [ -1 b ]          >background
+  { -20 40 -20 40 } >viewport
+  [ line ]          >start-shape
+  0.04              >threshold ;
+
+: run ( -- ) [ init ] cfdg-window. ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+MAIN: run
diff --git a/cfdg/models/spirales/tags.txt b/cfdg/models/spirales/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/cfdg/summary.txt b/cfdg/summary.txt
new file mode 100644 (file)
index 0000000..0b5e92c
--- /dev/null
@@ -0,0 +1 @@
+Implementation of: http://contextfreeart.org
diff --git a/closures/closures.factor b/closures/closures.factor
new file mode 100644 (file)
index 0000000..faa8ec0
--- /dev/null
@@ -0,0 +1,13 @@
+USING: assocs io.pathnames fry namespaces namespaces.private kernel sequences parser hashtables ;
+IN: closures
+SYMBOL: |
+
+! Selective Binding
+: delayed-bind-with ( vars quot -- quot' ) '[ _ dup [ get ] map zip >hashtable [ _ bind ] curry ] ;
+SYNTAX: C[ | parse-until parse-quotation delayed-bind-with append! ;
+! Common ones
+SYNTAX: DIR[ parse-quotation { current-directory } swap delayed-bind-with append! ;
+
+! Namespace Binding
+: bind-to-namespace ( quot -- quot' ) '[ namespace [ _ bind ] curry ] ;
+SYNTAX: NS[ parse-quotation bind-to-namespace append! ;
diff --git a/cont-responder/callbacks-tests.factor b/cont-responder/callbacks-tests.factor
new file mode 100644 (file)
index 0000000..f9302de
--- /dev/null
@@ -0,0 +1,67 @@
+USING: furnace furnace.actions furnace.callbacks accessors
+http http.server http.server.responses tools.test
+namespaces io fry sequences
+splitting kernel hashtables continuations ;
+IN: furnace.callbacks.tests
+
+[ 123 ] [
+    [
+        <request> "GET" >>method init-request
+        [
+            exit-continuation set
+            { }
+            <action> [ [ "hello" print 123 ] show-final ] >>display
+            <callback-responder>
+            call-responder
+        ] callcc1
+    ] with-scope
+] unit-test
+
+[
+    <action> [
+        [
+            "hello" print
+            <html-content>
+        ] show-page
+        "byebye" print
+        [ 123 ] show-final
+    ] >>display
+    <callback-responder> "r" set
+
+    [ 123 ] [
+        <request> init-request
+
+        [
+            exit-continuation set
+            <request> "GET" >>method init-request
+            { } "r" get call-responder
+        ] callcc1
+
+        body>> first
+
+        <request>
+            "GET" >>method
+            dup url>> rot cont-id associate >>query drop
+            dup url>> "/" >>path drop
+        init-request
+
+        [
+            exit-continuation set
+            { }
+            "r" get call-responder
+        ] callcc1
+
+        ! get-post-get
+        <request>
+            "GET" >>method
+            dup url>> rot "location" header query>> >>query drop
+            dup url>> "/" >>path drop
+        init-request
+
+        [
+            exit-continuation set
+            { }
+            "r" get call-responder
+        ] callcc1
+    ] unit-test
+] with-scope
diff --git a/cont-responder/callbacks.factor b/cont-responder/callbacks.factor
new file mode 100644 (file)
index 0000000..088ae6d
--- /dev/null
@@ -0,0 +1,122 @@
+! Copyright (C) 2004 Chris Double.
+! Copyright (C) 2006, 2008 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: http http.server io kernel math namespaces
+continuations calendar sequences assocs hashtables
+accessors arrays alarms quotations combinators fry
+http.server.redirection furnace assocs.lib urls ;
+IN: furnace.callbacks
+
+SYMBOL: responder
+
+TUPLE: callback-responder responder callbacks ;
+
+: <callback-responder> ( responder -- responder' )
+    H{ } clone callback-responder boa ;
+
+TUPLE: callback cont quot expires alarm responder ;
+
+: timeout 20 minutes ;
+
+: timeout-callback ( callback -- )
+    [ alarm>> cancel-alarm ]
+    [ dup responder>> callbacks>> delete-at ]
+    bi ;
+
+: touch-callback ( callback -- )
+    dup expires>> [
+        dup alarm>> [ cancel-alarm ] when*
+        dup '[ , timeout-callback ] timeout later >>alarm
+    ] when drop ;
+
+: <callback> ( cont quot expires? -- callback )
+    f callback-responder get callback boa
+    dup touch-callback ;
+
+: invoke-callback ( callback -- response )
+    [ touch-callback ]
+    [ quot>> request get exit-continuation get 3array ]
+    [ cont>> continue-with ]
+    tri ;
+
+: register-callback ( cont quot expires? -- id )
+    <callback> callback-responder get callbacks>> set-at-unique ;
+
+: 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.
+    <temporary-redirect> exit-with ;
+
+: cont-id "factorcontid" ;
+
+: 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.
+    <url>
+        swap cont-id set-query-param forward-to-url ;
+
+: restore-request ( pair -- )
+    first3 exit-continuation set request set call ;
+
+SYMBOL: post-refresh-get?
+
+: 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 [
+        [
+            [ ] t register-callback forward-to-id
+        ] callcc1 restore-request
+    ] [
+        post-refresh-get? on
+    ] if ;
+
+SYMBOL: current-show
+
+: store-current-show ( -- )
+    ! Store the current continuation in the variable 'current-show'
+    ! so it can be returned to later by 'quot-id'. Note that it
+    ! recalls itself when the continuation is called to ensure that
+    ! it resets its value back to the most recent show call.
+    [ current-show set f ] callcc1
+    [ restore-request store-current-show ] when* ;
+
+: show-final ( quot -- * )
+    [ redirect-to-here store-current-show ] dip
+    call exit-with ; inline
+
+: resuming-callback ( responder request -- id )
+    url>> cont-id query-param swap callbacks>> at ;
+
+M: callback-responder call-responder* ( path responder -- response )
+    '[
+        , ,
+
+        [ callback-responder set ]
+        [ request get resuming-callback ] bi
+
+        [
+            invoke-callback
+        ] [
+            callback-responder get responder>> call-responder
+        ] ?if
+    ] with-exit-continuation ;
+
+: show-page ( quot -- )
+    [ redirect-to-here store-current-show ] dip
+    [
+        [ ] t register-callback swap call exit-with
+    ] callcc1 restore-request ; inline
+
+: quot-id ( quot -- id )
+    current-show get swap t register-callback ;
+
+: quot-url ( quot -- url )
+    quot-id f swap cont-id associate derive-url ;
diff --git a/cryptlib/authors.txt b/cryptlib/authors.txt
new file mode 100644 (file)
index 0000000..7c29e7c
--- /dev/null
@@ -0,0 +1 @@
+Elie Chaftari
diff --git a/cryptlib/cryptlib-tests.factor b/cryptlib/cryptlib-tests.factor
new file mode 100644 (file)
index 0000000..aeac468
--- /dev/null
@@ -0,0 +1,377 @@
+USING: cryptlib.libcl cryptlib prettyprint kernel alien sequences libc math
+tools.test io io.files continuations alien.c-types splitting generic.math
+io.encodings.binary ;
+
+"=========================================================" 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
+        binary file-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
+        binary file-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/cryptlib/cryptlib.factor b/cryptlib/cryptlib.factor
new file mode 100644 (file)
index 0000000..1bb9f3d
--- /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 alien.accessors 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/cryptlib/libcl/libcl.factor b/cryptlib/libcl/libcl.factor
new file mode 100644 (file)
index 0000000..634d766
--- /dev/null
@@ -0,0 +1,1052 @@
+! 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
+
+<< "libcl" {
+        { [ win32? ] [ "cl32.dll" stdcall ] }
+        { [ macosx? ] [ "libcl.dylib" cdecl ] }
+        { [ unix? ] [ "libcl.so" cdecl ] }
+    } cond add-library >>
+
+! ===============================================
+! 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                            0x000 ; inline
+: CRYPT_KEYUSAGE_DIGITALSIGNATURE                0x001 ; inline
+: CRYPT_KEYUSAGE_NONREPUDIATION                  0x002 ; inline
+: CRYPT_KEYUSAGE_KEYENCIPHERMENT                 0x004 ; inline
+: CRYPT_KEYUSAGE_DATAENCIPHERMENT                0x008 ; inline
+: CRYPT_KEYUSAGE_KEYAGREEMENT                    0x010 ; inline
+: CRYPT_KEYUSAGE_KEYCERTSIGN                     0x020 ; inline
+: CRYPT_KEYUSAGE_CRLSIGN                         0x040 ; inline
+: CRYPT_KEYUSAGE_ENCIPHERONLY                    0x080 ; inline
+: CRYPT_KEYUSAGE_DECIPHERONLY                    0x100 ; inline
+: CRYPT_KEYUSAGE_LAST                            0x200 ; 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                     0x001 ; inline
+: CRYPT_CRLREASONFLAG_KEYCOMPROMISE              0x002 ; inline
+: CRYPT_CRLREASONFLAG_CACOMPROMISE               0x004 ; inline
+: CRYPT_CRLREASONFLAG_AFFILIATIONCHANGED         0x008 ; inline
+: CRYPT_CRLREASONFLAG_SUPERSEDED                 0x010 ; inline
+: CRYPT_CRLREASONFLAG_CESSATIONOFOPERATION       0x020 ; inline
+: CRYPT_CRLREASONFLAG_CERTIFICATEHOLD            0x040 ; inline
+: CRYPT_CRLREASONFLAG_LAST                       0x080 ; 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                    0x001 ; inline
+: CRYPT_NS_CERTTYPE_SSLSERVER                    0x002 ; inline
+: CRYPT_NS_CERTTYPE_SMIME                        0x004 ; inline
+: CRYPT_NS_CERTTYPE_OBJECTSIGNING                0x008 ; inline
+: CRYPT_NS_CERTTYPE_RESERVED                     0x010 ; inline
+: CRYPT_NS_CERTTYPE_SSLCA                        0x020 ; inline
+: CRYPT_NS_CERTTYPE_SMIMECA                      0x040 ; inline
+: CRYPT_NS_CERTTYPE_OBJECTSIGNINGCA              0x080 ; inline
+: CRYPT_NS_CERTTYPE_LAST                         0x100 ; inline ! Last possible value
+
+! Flags for the SET certificate-type extension
+: CRYPT_SET_CERTTYPE_CARD                        0x001 ; inline
+: CRYPT_SET_CERTTYPE_MER                         0x002 ; inline
+: CRYPT_SET_CERTTYPE_PGWY                        0x004 ; inline
+: CRYPT_SET_CERTTYPE_CCA                         0x008 ; inline
+: CRYPT_SET_CERTTYPE_MCA                         0x010 ; inline
+: CRYPT_SET_CERTTYPE_PCA                         0x020 ; inline
+: CRYPT_SET_CERTTYPE_GCA                         0x040 ; inline
+: CRYPT_SET_CERTTYPE_BCA                         0x080 ; inline
+: CRYPT_SET_CERTTYPE_RCA                         0x100 ; inline
+: CRYPT_SET_CERTTYPE_ACQ                         0x200 ; inline
+: CRYPT_SET_CERTTYPE_LAST                        0x400 ; 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)
+CONSTANT: CRYPT_KEYOPT_NONE 0
+CONSTANT: CRYPT_KEYOPT_READONLY 1
+CONSTANT: CRYPT_KEYOPT_CREATE 2
+CONSTANT: CRYPT_IKEYOPT_EXCLUSIVEACCESS 3
+CONSTANT: CRYPT_KEYOPT_LAST 4
+
+: CRYPT_KEYOPT_LAST_EXTERNAL   3 ; inline ! = CRYPT_KEYOPT_CREATE + 1
+
+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/cryptlib/notes.txt b/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/cryptlib/streams/streams.factor b/cryptlib/streams/streams.factor
new file mode 100644 (file)
index 0000000..929143f
--- /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 continuations
+byte-arrays namespaces io.buffers math generic io strings
+io.streams.lines io.streams.plain io.streams.duplex combinators
+alien.c-types continuations ;
+
+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 )
+    dup init-crypt-stream
+    default-buffer-size <buffer>
+    { set-crypt-stream-handle set-delegate }
+    crypt-stream construct
+    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 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-read-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-read-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 dispose ( 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
+    
+    dispose 
+    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
+    
+    dispose
+    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)
+    
+    dispose 
+    end 
+    ;
diff --git a/cryptlib/streams/tags.txt b/cryptlib/streams/tags.txt
new file mode 100644 (file)
index 0000000..992ae12
--- /dev/null
@@ -0,0 +1 @@
+network
diff --git a/cryptlib/summary.txt b/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/cryptlib/tags.txt b/cryptlib/tags.txt
new file mode 100644 (file)
index 0000000..b88f984
--- /dev/null
@@ -0,0 +1,2 @@
+enterprise
+bindings
diff --git a/cryptlib/test/keys.p15 b/cryptlib/test/keys.p15
new file mode 100644 (file)
index 0000000..deacec6
Binary files /dev/null and b/cryptlib/test/keys.p15 differ
diff --git a/cryptlib/test/large_data.txt b/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/db/mysql/ffi/ffi.factor b/db/mysql/ffi/ffi.factor
new file mode 100644 (file)
index 0000000..98fd0b3
--- /dev/null
@@ -0,0 +1,25 @@
+! Copyright (C) 2007 Berlin Brown, 2008 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+! Adapted from mysql.h and mysql.c
+! Tested with MySQL version - 5.0.24a
+USING: alien alien.syntax combinators kernel system ;
+IN: db.mysql.ffi
+
+<< "mysql" {
+    { [ os winnt? ] [ "libmySQL.dll" stdcall ] }
+    { [ os macosx? ] [ "libmysqlclient.14.dylib" cdecl ] }
+    { [ os unix? ] [ "libmysqlclient.so.14" cdecl ] }
+} cond add-library >>
+
+LIBRARY: mysql
+
+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/db/mysql/lib/lib.factor b/db/mysql/lib/lib.factor
new file mode 100644 (file)
index 0000000..6c16248
--- /dev/null
@@ -0,0 +1,78 @@
+! Copyright (C) 2007 Berlin Brown, 2008 Doug Coleman.
+! See http://factorcode.org/license.txt for license.
+! Adapted from mysql.h and mysql.c
+! Tested with MySQL version - 5.0.24a
+USING: kernel alien io prettyprint sequences
+namespaces arrays math db.mysql.ffi system accessors ;
+IN: db.mysql.lib
+
+SYMBOL: my-conn
+
+TUPLE: mysql-db handle host user password db port ;
+TUPLE: mysql-statement ;
+TUPLE: mysql-result-set ;
+
+: new-mysql ( -- conn )
+    f mysql_init ;
+
+: mysql-error ( mysql -- )
+    [ mysql_error throw ] when* ;
+
+! : mysql-connect ( mysql-connection -- )
+    ! new-mysql over set-mysql-db-handle
+    ! dup {
+        ! mysql-db-handle
+        ! mysql-db-host
+        ! mysql-db-user
+        ! mysql-db-password
+        ! mysql-db-db
+        ! mysql-db-port
+    ! } get-slots f 0 mysql_real_connect mysql-error ;
+
+! =========================================================
+! Low level mysql utility definitions
+! =========================================================
+
+: (mysql-query) ( mysql-connection query -- ret )
+    >r db-handle>> r> mysql_query ;
+
+! : (mysql-result) ( mysql-connection -- ret )
+    ! [ mysql-db-handle 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) ;
+
+! : 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) ;
diff --git a/db/mysql/mysql.factor b/db/mysql/mysql.factor
new file mode 100644 (file)
index 0000000..1767bf3
--- /dev/null
@@ -0,0 +1,51 @@
+! Copyright (C) 2008 Doug Coleman.
+! See http://factorcode.org/license.txt for license.
+USING: alien continuations destructors io kernel prettyprint
+sequences db db.mysql.ffi ;
+IN: db.mysql
+
+TUPLE: mysql-db handle host user password db port ;
+TUPLE: mysql-statement ;
+TUPLE: mysql-result-set ;
+
+M: mysql-db db-open ( mysql-db -- )
+    ;
+
+M: mysql-db dispose ( mysql-db -- )
+    mysql-db-handle mysql_close ;
+
+M: mysql-db <simple-statement> ( str in out -- statement )
+    3drop f ;
+
+M: mysql-db <prepared-statement> ( str in out -- statement )
+    3drop f ;
+
+M: mysql-statement prepare-statement ( statement -- )
+    drop ;
+
+M: mysql-statement bind-statement* ( statement -- )
+    drop ;
+
+M: mysql-statement query-results ( query -- result-set )
+    drop f ;
+
+M: mysql-result-set #rows ( result-set -- n )
+    drop 0 ;
+
+M: mysql-result-set #columns ( result-set -- n )
+    drop 0 ;
+
+M: mysql-result-set row-column ( result-set n -- obj )
+    2drop f ;
+
+M: mysql-result-set advance-row ( result-set -- )
+    drop ;
+
+M: mysql-db begin-transaction ( -- )
+    ;
+
+M: mysql-db commit-transaction ( -- )
+    ;
+
+M: mysql-db rollback-transaction ( -- )
+    ;
diff --git a/dns/cache/nx/nx.factor b/dns/cache/nx/nx.factor
new file mode 100644 (file)
index 0000000..292e5f1
--- /dev/null
@@ -0,0 +1,35 @@
+
+USING: kernel assocs locals combinators
+       math math.functions system unicode ;
+
+IN: dns.cache.nx
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: nx-cache ( -- table ) H{ } ;
+
+: nx-cache-at        (      name -- time ) >lower nx-cache at        ;
+: nx-cache-delete-at (      name --      ) >lower nx-cache delete-at ;
+: nx-cache-set-at    ( time name --      ) >lower nx-cache set-at    ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: now ( -- seconds ) millis 1000.0 / round >integer ;
+
+:: non-existent-name? ( NAME -- ? )
+   [let | TIME [ NAME nx-cache-at ] |
+     {
+       { [ TIME f    = ] [                         f ] }
+       { [ TIME now <= ] [ NAME nx-cache-delete-at f ] }
+       { [ t           ] [                         t ] }
+     }
+     cond
+   ] ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+:: cache-non-existent-name ( NAME TTL -- )
+   [let | TIME [ TTL now + ] | TIME NAME nx-cache-set-at ] ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
diff --git a/dns/cache/rr/rr.factor b/dns/cache/rr/rr.factor
new file mode 100644 (file)
index 0000000..e2ce523
--- /dev/null
@@ -0,0 +1,65 @@
+
+USING: kernel sequences assocs sets locals combinators
+       accessors system math math.functions unicode prettyprint
+       combinators.smart dns ;
+
+IN: dns.cache.rr
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+TUPLE: <entry> time data ;
+
+: now ( -- seconds ) millis 1000.0 / round >integer ;
+
+: expired? ( <entry> -- ? ) time>> now <= ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: make-cache-key ( obj -- key )
+  [ [ name>> >lower ] [ type>> ] [ class>> ] tri ] output>array ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: cache ( -- table ) H{ } ;
+
+: cache-at     (     obj -- ent ) make-cache-key cache at ;
+: cache-delete (     obj --     ) make-cache-key cache delete-at ;
+: cache-set-at ( ent obj --     ) make-cache-key cache set-at ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+:: cache-get ( OBJ -- rrs/f )
+   [let | ENT [ OBJ cache-at ] |
+     {
+       { [ ENT f =      ] [                  f ] }
+       { [ ENT expired? ] [ OBJ cache-delete f ] }
+       {
+         [ t ]
+         [
+           [let | NAME  [ OBJ name>>       ]
+                  TYPE  [ OBJ type>>       ]
+                  CLASS [ OBJ class>>      ]
+                  TTL   [ ENT time>> now - ] |
+             ENT data>>
+               [| RDATA | T{ rr f NAME TYPE CLASS TTL RDATA } ]
+             map
+           ]
+         ]
+       }
+     }
+     cond
+   ] ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+:: cache-add ( RR -- )
+   [let | ENT   [ RR cache-at    ]
+          TIME  [ RR ttl>> now + ]
+          RDATA [ RR rdata>>     ] |
+     {
+       { [ ENT f =      ] [ T{ <entry> f TIME V{ RDATA } } RR cache-set-at ] }
+       { [ ENT expired? ] [ RR cache-delete RR cache-add                   ] }
+       { [ t            ] [ TIME ENT time<< RDATA ENT data>> adjoin      ] }
+     }
+     cond
+   ] ;
diff --git a/dns/dns.factor b/dns/dns.factor
new file mode 100644 (file)
index 0000000..a51347f
--- /dev/null
@@ -0,0 +1,501 @@
+
+USING: kernel byte-arrays combinators strings arrays sequences splitting
+       grouping
+       math math.functions math.parser random
+       destructors
+       io io.binary io.sockets io.encodings.binary
+       accessors
+       combinators.smart
+       assocs
+       ;
+
+IN: dns
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+TUPLE: query name type class ;
+
+TUPLE: rr name type class ttl rdata ;
+
+TUPLE: hinfo cpu os ;
+
+TUPLE: mx preference exchange ;
+
+TUPLE: soa mname rname serial refresh retry expire minimum ;
+
+TUPLE: message
+       id qr opcode aa tc rd ra z rcode
+       question-section
+       answer-section
+       authority-section
+       additional-section ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: random-id ( -- id ) 2 16 ^ random ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! TYPE
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+SYMBOLS: A NS MD MF CNAME SOA MB MG MR NULL WKS PTR HINFO MINFO MX TXT AAAA ;
+
+: type-table ( -- table )
+  {
+    { A     1 }
+    { NS    2 }
+    { MD    3 }
+    { MF    4 }
+    { CNAME 5 }
+    { SOA   6 }
+    { MB    7 }
+    { MG    8 }
+    { MR    9 }
+    { NULL  10 }
+    { WKS   11 }
+    { PTR   12 }
+    { HINFO 13 }
+    { MINFO 14 }
+    { MX    15 }
+    { TXT   16 }
+    { AAAA  28 }
+  } ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! CLASS
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+SYMBOLS: IN CS CH HS ;
+
+: class-table ( -- table )
+  {
+    { IN 1 }
+    { CS 2 }
+    { CH 3 }
+    { HS 4 }
+  } ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! OPCODE
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+SYMBOLS: QUERY IQUERY STATUS ;
+
+: opcode-table ( -- table )
+  {
+    { QUERY  0 }
+    { IQUERY 1 }
+    { STATUS 2 }
+  } ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! RCODE
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+SYMBOLS: NO-ERROR FORMAT-ERROR SERVER-FAILURE NAME-ERROR NOT-IMPLEMENTED
+         REFUSED ;
+
+: rcode-table ( -- table )
+  {
+    { NO-ERROR        0 }
+    { FORMAT-ERROR    1 }
+    { SERVER-FAILURE  2 }
+    { NAME-ERROR      3 }
+    { NOT-IMPLEMENTED 4 }
+    { REFUSED         5 }
+  } ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: <message> ( -- message )
+  message new
+    random-id >>id
+    0         >>qr
+    QUERY     >>opcode
+    0         >>aa
+    0         >>tc
+    1         >>rd
+    0         >>ra
+    0         >>z
+    NO-ERROR  >>rcode
+    { }       >>question-section
+    { }       >>answer-section
+    { }       >>authority-section
+    { }       >>additional-section ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: ip->ba ( ip -- ba ) "." split [ string>number ] map >byte-array ;
+
+: ipv6->ba ( ip -- ba ) ":" split [ hex> ] map [ 2 >be ] map concat ;
+
+: label->ba ( label -- ba ) [ >byte-array ] [ length ] bi prefix ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: uint8->ba  ( n -- ba ) 1 >be ;
+: uint16->ba ( n -- ba ) 2 >be ;
+: uint32->ba ( n -- ba ) 4 >be ;
+: uint64->ba ( n -- ba ) 8 >be ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: dn->ba ( dn -- ba ) "." split [ label->ba ] map concat ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: query->ba ( query -- ba )
+  [
+    {
+      [ name>>                 dn->ba ]
+      [ type>>  type-table  at uint16->ba ]
+      [ class>> class-table at uint16->ba ]
+    } cleave
+  ] output>array concat ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: hinfo->ba ( rdata -- ba )
+    [ cpu>> label->ba ]
+    [ os>>  label->ba ]
+  bi append ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: mx->ba ( rdata -- ba )
+    [ preference>> uint16->ba ]
+    [ exchange>>   dn->ba ]
+  bi append ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: soa->ba ( rdata -- ba )
+  [
+    {
+      [ mname>>   dn->ba ]
+      [ rname>>   dn->ba ]
+      [ serial>>  uint32->ba ]
+      [ refresh>> uint32->ba ]
+      [ retry>>   uint32->ba ]
+      [ expire>>  uint32->ba ]
+      [ minimum>> uint32->ba ]
+    } cleave
+  ] output>array concat ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: rdata->ba ( type rdata -- ba )
+  swap
+    {
+      { CNAME [ dn->ba ] }
+      { HINFO [ hinfo->ba ] }
+      { MX    [ mx->ba ] }
+      { NS    [ dn->ba ] }
+      { PTR   [ dn->ba ] }
+      { SOA   [ soa->ba ] }
+      { A     [ ip->ba ] }
+    }
+  case ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: rr->ba ( rr -- ba )
+  [
+    {
+      [ name>>                 dn->ba     ]
+      [ type>>  type-table  at uint16->ba ]
+      [ class>> class-table at uint16->ba ]
+      [ ttl>>   uint32->ba ]
+      [
+        [ type>>            ] [ rdata>> ] bi rdata->ba
+        [ length uint16->ba ] [         ] bi append
+      ]
+    } cleave
+  ] output>array concat ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: header-bits-ba ( message -- ba )
+  [
+    {
+      [ qr>>                     15 shift ]
+      [ opcode>> opcode-table at 11 shift ]
+      [ aa>>                     10 shift ]
+      [ tc>>                      9 shift ]
+      [ rd>>                      8 shift ]
+      [ ra>>                      7 shift ]
+      [ z>>                       4 shift ]
+      [ rcode>>  rcode-table at   0 shift ]
+    } cleave
+  ] sum-outputs uint16->ba ;
+
+: message->ba ( message -- ba )
+  [
+    {
+      [ id>> uint16->ba ]
+      [ header-bits-ba ]
+      [ question-section>>   length uint16->ba ]
+      [ answer-section>>     length uint16->ba ]
+      [ authority-section>>  length uint16->ba ]
+      [ additional-section>> length uint16->ba ]
+      [ question-section>>   [ query->ba ] map concat ]
+      [ answer-section>>     [ rr->ba    ] map concat ]
+      [ authority-section>>  [ rr->ba    ] map concat ]
+      [ additional-section>> [ rr->ba    ] map concat ]
+    } cleave
+  ] output>array concat ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: get-single ( ba i -- n ) at ;
+: get-double ( ba i -- n ) dup 2 + subseq be> ;
+: get-quad   ( ba i -- n ) dup 4 + subseq be> ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: label-length ( ba i -- length ) get-single ;
+
+: skip-label ( ba i -- ba i ) 2dup label-length + 1 + ;
+
+: null-label? ( ba i -- ? ) get-single 0 = ;
+
+: get-label ( ba i -- label ) [ 1 + ] [ skip-label nip ] 2bi subseq >string ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: bit-test ( a b -- ? ) bitand 0 = not ;
+
+: pointer? ( ba i -- ? ) get-single 0b11000000 bit-test ;
+
+: pointer ( ba i -- val ) get-double 0b0011111111111111 bitand ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: skip-name ( ba i -- ba i )
+    {
+      { [ 2dup null-label? ] [ 1 + ] }
+      { [ 2dup pointer?    ] [ 2 + ] }
+      { [ t ] [ skip-label skip-name ] }
+    }
+  cond ;
+
+: get-name ( ba i -- name )
+    {
+      { [ 2dup null-label? ] [ 2drop "" ] }
+      { [ 2dup pointer?    ] [ dupd pointer get-name ] }
+      {
+        [ t ]
+        [
+          [ get-label ]
+          [ skip-label get-name ]
+          2bi
+          "." glue 
+        ]
+      }
+    }
+  cond ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: get-query ( ba i -- query )
+    [ get-name ]
+    [
+      skip-name
+      [ 0 + get-double type-table  value-at ]
+      [ 2 + get-double class-table value-at ]
+      2bi
+    ]
+  2bi query boa ;
+
+: skip-query ( ba i -- ba i ) skip-name 4 + ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: get-mx ( ba i -- mx ) [ get-double ] [ 2 + get-double ] 2bi mx boa ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: get-soa ( ba i -- soa )
+    {
+      [           get-name ]
+      [ skip-name get-name ]
+      [
+        skip-name
+        skip-name
+        {
+          [  0 + get-quad ]
+          [  4 + get-quad ]
+          [  8 + get-quad ]
+          [ 12 + get-quad ]
+          [ 16 + get-quad ]
+        }
+          2cleave
+      ]
+    }
+  2cleave soa boa ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: get-ip ( ba i -- ip ) dup 4 + subseq >array [ number>string ] map "." join ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: get-ipv6 ( ba i -- ip )
+  dup 16 + subseq 2 group [ be> >hex ] map ":" join ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: get-rdata ( ba i type -- rdata )
+    {
+      { CNAME [ get-name ] }
+      { NS    [ get-name ] }
+      { PTR   [ get-name ] }
+      { MX    [ get-mx   ] }
+      { SOA   [ get-soa  ] }
+      { A     [ get-ip   ] }
+      { AAAA  [ get-ipv6 ] }
+    }
+  case ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: get-rr ( ba i -- rr )
+  [ get-name ]
+  [
+    skip-name
+      {
+        [ 0 + get-double type-table  value-at ]
+        [ 2 + get-double class-table value-at ]
+        [ 4 + get-quad   ]
+        [ [ 10 + ] [ get-double type-table value-at ] 2bi get-rdata ]
+      }
+    2cleave
+  ]
+    2bi rr boa ;
+
+: skip-rr ( ba i -- ba i ) skip-name 8 + 2dup get-double + 2 + ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: get-question-section ( ba i count -- seq ba i )
+  [ drop [ skip-query ] [ get-query ] 2bi ] map -rot ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: get-rr-section ( ba i count -- seq ba i )
+  [ drop [ skip-rr ] [ get-rr ] 2bi ] map -rot ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: >> ( x n -- y ) neg shift ;
+
+: get-header-bits ( ba i -- qr opcode aa tc rd ra z rcode )
+    get-double
+    {
+      [ 15 >> 0b1 bitand ]
+      [ 11 >> 0b111 bitand opcode-table value-at ]
+      [ 10 >> 0b1 bitand ]
+      [  9 >> 0b1 bitand ]
+      [  8 >> 0b1 bitand ]
+      [  7 >> 0b1 bitand ]
+      [  4 >> 0b111 bitand ]
+      [       0b1111 bitand rcode-table value-at ]
+    }
+  cleave ;
+
+: parse-message ( ba -- message )
+  0
+  {
+    [ get-double ]
+    [ 2 + get-header-bits ]
+    [
+      4 +
+      {
+        [ 8 +            ]
+        [ 0 + get-double ]
+        [ 2 + get-double ]
+        [ 4 + get-double ]
+        [ 6 + get-double ]
+      }
+        2cleave
+      {
+        [ get-question-section ]
+        [ get-rr-section ]
+        [ get-rr-section ]
+        [ get-rr-section ]
+      } spread
+      2drop
+    ]
+  }
+    2cleave message boa ;
+
+: ba->message ( ba -- message ) parse-message ;
+
+: with-message-bytes ( ba quot -- ) [ ba->message ] dip call message->ba ; inline
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: send-receive-udp ( ba server -- ba )
+  f 0 <inet4> <datagram>
+    [
+      [ send ] [ receive drop ] bi
+    ]
+  with-disposal ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: send-receive-tcp ( ba server -- ba )
+  [ dup length 2 >be prepend ] [ ] bi*
+  binary
+    [
+      write flush
+      2 read be> read
+    ]
+  with-client ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: >dns-inet4 ( obj -- inet4 )
+  dup string?
+    [ 53 <inet4> ]
+    [            ]
+  if ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: ask-server ( message server -- message )
+  [ message->ba ] [ >dns-inet4 ] bi*
+  2dup
+  send-receive-udp parse-message
+  dup tc>> 1 =
+    [ drop send-receive-tcp parse-message ]
+    [ nip nip                             ]
+  if ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: dns-servers ( -- seq ) V{ } ;
+
+: dns-server ( -- server ) dns-servers random ;
+
+: ask ( message -- message ) dns-server ask-server ;
+
+: query->message ( query -- message ) <message> swap 1array >>question-section ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: message-query ( message -- query ) question-section>> first ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+ERROR: name-error name ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: fully-qualified ( name -- name )
+    {
+      { [ dup empty?         ] [ "." append ] }
+      { [ dup last CHAR: . = ] [            ] }
+      { [ t                  ] [ "." append ] }
+    }
+  cond ;
diff --git a/dns/forwarding/forwarding.factor b/dns/forwarding/forwarding.factor
new file mode 100644 (file)
index 0000000..4b7db30
--- /dev/null
@@ -0,0 +1,124 @@
+
+USING: kernel sequences combinators accessors locals random
+       combinators.short-circuit
+       io.sockets
+       dns dns.util dns.cache.rr dns.cache.nx
+       dns.resolver ;
+
+IN: dns.forwarding
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+:: query->rrs ( QUERY -- rrs/f )
+   [let | RRS [ QUERY cache-get ] |
+     RRS
+       [ RRS ]
+       [
+         [let | NAME  [ QUERY name>>  ]
+                TYPE  [ QUERY type>>  ]
+                CLASS [ QUERY class>> ] |
+               
+           [let | RRS/CNAME [ T{ query f NAME CNAME CLASS } cache-get ] |
+
+             RRS/CNAME f =
+               [ f ]
+               [
+                 [let | RR/CNAME [ RRS/CNAME first ] |
+            
+                   [let | REAL-NAME [ RR/CNAME rdata>> ] |
+              
+                     [let | RRS [
+                                  T{ query f REAL-NAME TYPE CLASS } query->rrs
+                                ] |
+
+                       RRS
+                         [ RRS/CNAME RRS append ]
+                         [ f ]
+                       if
+                     ] ] ]
+               ]
+             if
+           ] ]
+       ]
+     if
+   ] ;
+
+:: answer-from-cache ( MSG -- msg/f )
+   [let | QUERY [ MSG message-query ] |
+
+     [let | NX  [ QUERY name>> non-existent-name? ]
+            RRS [ QUERY query->rrs                ] |
+
+       {
+         { [ NX  ] [ MSG NAME-ERROR >>rcode          ] }
+         { [ RRS ] [ MSG RRS        >>answer-section ] }
+         { [ t   ] [ f                               ] }
+       }
+       cond
+     ]
+   ] ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: message-soa ( message -- rr/soa )
+  authority-section>> [ type>> SOA = ] filter first ;
+
+! :: cache-message ( MSG -- msg )
+!    MSG rcode>> NAME-ERROR =
+!      [
+!        [let | NAME [ MSG message-query name>> ]
+!               TTL  [ MSG message-soa   ttl>>  ] |
+!          NAME TTL cache-non-existent-name
+!        ]
+!      ]
+!    when
+!    MSG answer-section>>     [ cache-add ] each
+!    MSG authority-section>>  [ cache-add ] each
+!    MSG additional-section>> [ cache-add ] each
+!    MSG ;
+
+:: cache-message ( MSG -- msg )
+   MSG rcode>> NAME-ERROR =
+     [
+       [let | RR/SOA [ MSG
+                         authority-section>>
+                         [ type>> SOA = ] filter
+                       dup empty? [ drop f ] [ first ] if ] |
+         RR/SOA
+           [
+             [let | NAME [ MSG message-query name>> ]
+                    TTL  [ MSG message-soa   ttl>>  ] |
+               NAME TTL cache-non-existent-name
+             ]
+           ]
+         when
+       ]
+     ]
+   when
+   MSG answer-section>>     [ cache-add ] each
+   MSG authority-section>>  [ cache-add ] each
+   MSG additional-section>> [ cache-add ] each
+   MSG ;
+
+! : answer-from-server ( msg servers -- msg ) random ask-server cache-message ;
+
+: answer-from-server ( msg servers -- msg ) ask-servers cache-message ;
+
+:: find-answer ( MSG SERVERS -- msg )
+   { [ MSG answer-from-cache ] [ MSG SERVERS answer-from-server ] } 0|| ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+:: start-server ( ADDR-SPEC SERVERS -- )
+
+  [let | SOCKET [ ADDR-SPEC <datagram> ] |
+
+    [
+      SOCKET receive-packet
+        [ parse-message SERVERS find-answer message->ba ]
+      change-data
+      respond
+    ]
+    forever
+
+  ] ;
diff --git a/dns/misc/misc.factor b/dns/misc/misc.factor
new file mode 100644 (file)
index 0000000..72f553c
--- /dev/null
@@ -0,0 +1,34 @@
+
+USING: kernel combinators sequences splitting math 
+       io.files io.encodings.utf8 random dns.util ;
+
+IN: dns.misc
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: resolv-conf-servers ( -- seq )
+  "/etc/resolv.conf" utf8 file-lines
+  [ " " split ] map
+  [ first "nameserver" = ] filter
+  [ second ] map ;
+
+: resolv-conf-server ( -- ip ) resolv-conf-servers random ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: cdr-name ( name -- name ) dup CHAR: . index 1 + tail ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: domain-has-name? ( domain name -- ? )
+    {
+      { [ 2dup =       ] [ 2drop t ] }
+      { [ 2dup longer? ] [ 2drop f ] }
+      { [ t            ] [ cdr-name domain-has-name? ] }
+    }
+  cond ;
+
+: name-in-domain? ( name domain -- ? ) swap domain-has-name? ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
diff --git a/dns/resolver/resolver.factor b/dns/resolver/resolver.factor
new file mode 100644 (file)
index 0000000..32ad236
--- /dev/null
@@ -0,0 +1,72 @@
+
+USING: kernel accessors namespaces continuations
+       io io.sockets io.binary io.timeouts io.encodings.binary
+       destructors
+       locals strings sequences random prettyprint calendar dns dns.misc ;
+
+IN: dns.resolver
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+:: send-receive-udp ( BA SERVER -- ba )
+   T{ inet4 f f 0 } <datagram>
+   T{ duration { second 3 } } over set-timeout
+     [| SOCKET | BA SERVER SOCKET send SOCKET receive drop ]
+   with-disposal ;
+
+:: send-receive-tcp ( BA SERVER -- ba )
+   [let | BA [ BA length 2 >be BA append ] |
+     SERVER binary
+       [
+         T{ duration { second 3 } } input-stream get set-timeout
+         BA write flush 2 read be> read
+       ]
+     with-client                                        ] ;
+
+:: send-receive-server ( BA SERVER -- msg )
+   [let | RESULT [ BA SERVER send-receive-udp parse-message ] |
+     RESULT tc>> 1 =
+       [ BA SERVER send-receive-tcp parse-message ]
+       [ RESULT                                   ]
+     if                                                 ] ;
+
+: >dns-inet4 ( obj -- inet4 ) dup string? [ 53 <inet4> ] [ ] if ;
+
+:: send-receive-servers ( BA SERVERS -- msg )
+   SERVERS empty? [ "send-receive-servers: servers list empty" throw ] when
+   [let | SERVER [ SERVERS random >dns-inet4 ] |
+     ! if this throws an error ...
+     [ BA SERVER send-receive-server ]
+     ! we try with the other servers...
+     [ drop BA SERVER SERVERS remove send-receive-servers ]
+     recover                                            ] ;
+
+:: ask-servers ( MSG SERVERS -- msg )
+   MSG message->ba SERVERS send-receive-servers ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: fully-qualified ( name -- name ) dup "." tail? [ ] [ "." append ] if ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: dns-servers ( -- seq )
+  \ dns-servers get
+    [ ]
+    [ resolv-conf-servers \ dns-servers set dns-servers ]
+  if* ;
+
+! : dns-server ( -- server ) dns-servers random ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: dns-ip4 ( name -- ips )
+  fully-qualified
+  [let | MSG [ A IN query boa query->message dns-servers ask-servers ] |
+    MSG rcode>> NO-ERROR =
+      [ MSG answer-section>> [ type>> A = ] filter [ rdata>> ] map ]
+      [ "dns-ip: rcode = " MSG rcode>> unparse append throw        ]
+    if ] ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
diff --git a/dns/server/server.factor b/dns/server/server.factor
new file mode 100644 (file)
index 0000000..072e6a9
--- /dev/null
@@ -0,0 +1,208 @@
+
+USING: kernel combinators sequences sets math threads namespaces continuations
+       debugger io io.sockets unicode accessors destructors
+       combinators.short-circuit combinators.smart
+       fry arrays
+       dns dns.util dns.misc ;
+
+IN: dns.server
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+SYMBOL: records-var
+
+: records ( -- records ) records-var get ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: {name-type-class} ( obj -- array )
+  [ [ name>> >lower ] [ type>> ] [ class>> ] tri ] output>array ; 
+
+: rr=query? ( obj obj -- ? ) [ {name-type-class} ] same? ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: matching-rrs  ( query -- rrs ) records [ rr=query? ] with filter ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! zones
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: zones    ( -- names ) records [ type>> NS  = ] filter [ name>> ] map prune ;
+: my-zones ( -- names ) records [ type>> SOA = ] filter [ name>> ] map ;
+
+: delegated-zones ( -- names ) zones my-zones diff ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! name->zone
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: name->zone ( name -- zone/f )
+  zones sort-largest-first [ name-in-domain? ] with find nip ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! name->authority
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: name->authority ( name -- rrs-ns ) name->zone NS IN query boa matching-rrs ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! extract-names
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: rr->rdata-names ( rr -- names/f )
+    {
+      { [ dup type>> NS    = ] [ rdata>>            1array ] }
+      { [ dup type>> MX    = ] [ rdata>> exchange>> 1array ] }
+      { [ dup type>> CNAME = ] [ rdata>>            1array ] }
+      { [ t ]                  [ drop f ] }
+    }
+  cond ;
+
+: extract-rdata-names ( message -- names )
+  [ answer-section>> ] [ authority-section>> ] bi append
+  [ rr->rdata-names ] map concat ;
+
+: extract-names ( message -- names )
+  [ message-query name>> ] [ extract-rdata-names ] bi swap prefix ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! fill-authority
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: fill-authority ( message -- message )
+  dup
+    extract-names [ name->authority ] map concat prune
+    over answer-section>> diff
+  >>authority-section ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! fill-additional
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: name->rrs-a ( name -- rrs-a ) A IN query boa matching-rrs ;
+
+: fill-additional ( message -- message )
+  dup
+    extract-rdata-names [ name->rrs-a ] map concat prune
+    over answer-section>> diff
+  >>additional-section ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! query->rrs
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+DEFER: query->rrs
+
+: matching-rrs? ( query -- rrs/f ) matching-rrs [ empty? ] [ drop f ] [ ] 1if ;
+
+: matching-cname? ( query -- rrs/f )
+  [ ] [ clone CNAME >>type matching-rrs ] bi ! query rrs
+  [ empty? not ]
+    [ first swap clone over rdata>> >>name query->rrs swap prefix ]
+    [ 2drop f ]
+  1if ;
+
+: query->rrs ( query -- rrs/f ) { [ matching-rrs? ] [ matching-cname? ] } 1|| ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! have-answers
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: have-answers ( message -- message/f )
+  dup message-query query->rrs
+  [ empty? ]
+    [ 2drop f ]
+    [ >>answer-section fill-authority fill-additional ]
+  1if ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! have-delegates?
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: cdr-name ( name -- name ) dup CHAR: . index 1 + tail ;
+
+: is-soa? ( name -- ? ) SOA IN query boa matching-rrs empty? not ;
+
+: have-ns? ( name -- rrs/f )
+  NS IN query boa matching-rrs [ empty? ] [ drop f ] [ ] 1if ;
+
+: name->delegates ( name -- rrs-ns )
+    {
+      [ "" =    { } and ]
+      [ is-soa? { } and ]
+      [ have-ns? ]
+      [ cdr-name name->delegates ]
+    }
+  1|| ;
+
+: have-delegates ( message -- message/f )
+  dup message-query name>> name->delegates ! message rrs-ns
+  [ empty? ]
+    [ 2drop f ]
+    [
+      dup [ rdata>> A IN query boa matching-rrs ] map concat
+                                           ! message rrs-ns rrs-a
+      [ >>authority-section ]
+      [ >>additional-section ]
+      bi*
+    ]
+  1if ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! outsize-zones
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: outside-zones ( message -- message/f )
+  dup message-query name>> name->zone f =
+    [ ]
+    [ drop f ]
+  if ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! is-nx
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: is-nx ( message -- message/f )
+  [ message-query name>> records [ name>> = ] with any? not ]
+    [
+      NAME-ERROR >>rcode
+      dup
+        message-query name>> name->zone SOA IN query boa matching-rrs
+      >>authority-section
+    ]
+    [ drop f ]
+  1if ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: none-of-type ( message -- message )
+  dup
+    message-query name>> name->zone SOA IN query boa matching-rrs
+  >>authority-section ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: find-answer ( message -- message )
+    {
+      [ have-answers   ]
+      [ have-delegates ]
+      [ outside-zones  ]
+      [ is-nx          ]
+      [ none-of-type   ]
+    }
+  1|| ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: (handle-request) ( packet -- )
+  [ [ find-answer ] with-message-bytes ] change-data respond ;
+
+: handle-request ( packet -- ) [ (handle-request) ] curry in-thread ;
+
+: receive-loop ( socket -- )
+  [ receive-packet handle-request ] [ receive-loop ] bi ;
+
+: loop ( addr-spec -- )
+  [ <datagram> '[ _ [ receive-loop ] with-disposal ] try ] [ loop ] bi ;
+
diff --git a/dns/stub/stub.factor b/dns/stub/stub.factor
new file mode 100644 (file)
index 0000000..a15feb5
--- /dev/null
@@ -0,0 +1,20 @@
+
+USING: kernel sequences random accessors dns ;
+
+IN: dns.stub
+
+! Stub resolver
+! 
+! Generally useful, but particularly when running a forwarding,
+! caching, nameserver on localhost with multiple Factor instances
+! querying it.
+
+: name->ip ( name -- ip )
+  A IN query boa
+  query->message
+  ask
+  dup rcode>> NAME-ERROR =
+    [ message-query name>> name-error ]
+    [ answer-section>> [ type>> A = ] filter random rdata>> ]
+  if ;
+
diff --git a/dns/util/util.factor b/dns/util/util.factor
new file mode 100644 (file)
index 0000000..33d6ced
--- /dev/null
@@ -0,0 +1,31 @@
+
+USING: kernel sequences sorting math math.order macros fry ;
+
+IN: dns.util
+
+: tri-chain ( obj p q r -- x y z )
+  [ [ call dup ] dip call dup ] dip call ; inline
+
+MACRO: 1if ( test then else -- ) '[ dup @ _ _ if ] ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: sort-largest-first ( seq -- seq ) [ length ] sort-with reverse ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: longer? ( seq seq -- ? ) [ length ] bi@ > ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+USING: io.sockets accessors ;
+
+TUPLE: packet data addr socket ;
+
+: receive-packet ( socket -- packet ) [ receive ] keep packet boa ;
+
+: respond ( packet -- ) [ data>> ] [ addr>> ] [ socket>> ] tri send ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: forever ( quot: ( -- ) -- ) [ call ] [ forever ] bi ; inline recursive
diff --git a/dragdrop-listener/dragdrop-listener.factor b/dragdrop-listener/dragdrop-listener.factor
new file mode 100644 (file)
index 0000000..5f3f12b
--- /dev/null
@@ -0,0 +1,74 @@
+USING: alien.strings io.encodings.utf16n windows.com
+windows.com.wrapper combinators windows.kernel32 windows.ole32
+windows.shell32 kernel accessors windows.types
+prettyprint namespaces ui.tools.listener ui.tools.workspace
+alien.data alien sequences math classes.struct ;
+SPECIALIZED-ARRAY: WCHAR
+IN: windows.dragdrop-listener
+
+: filenames-from-hdrop ( hdrop -- filenames )
+    dup 0xFFFFFFFF f 0 DragQueryFile ! get count of files
+    [
+        2dup f 0 DragQueryFile 1 + ! get size of filename buffer
+        dup WCHAR <c-array>
+        [ swap DragQueryFile drop ] keep
+        utf16n alien>string
+    ] with map ;
+
+: filenames-from-data-object ( data-object -- filenames )
+    FORMATETC <struct>
+        CF_HDROP         >>cfFormat
+        f                >>ptd
+        DVASPECT_CONTENT >>dwAspect
+        -1               >>lindex
+        TYMED_HGLOBAL    >>tymed
+    STGMEDIUM <struct>
+    [ IDataObject::GetData ] keep swap succeeded? [
+        dup data>>
+        [ filenames-from-hdrop ] with-global-lock
+        swap ReleaseStgMedium
+    ] [ drop f ] if ;
+
+TUPLE: listener-dragdrop hWnd last-drop-effect ;
+
+: <listener-dragdrop> ( hWnd -- object )
+    DROPEFFECT_NONE listener-dragdrop construct-boa ;
+
+SYMBOL: +listener-dragdrop-wrapper+
+{
+    { "IDropTarget" {
+        [ ! DragEnter
+            [
+                2drop
+                filenames-from-data-object
+                length 1 = [ DROPEFFECT_COPY ] [ DROPEFFECT_NONE ] if
+                dup 0
+            ] dip set-ulong-nth
+            >>last-drop-effect drop
+            S_OK
+        ] [ ! DragOver
+            [ 2drop last-drop-effect>> 0 ] dip set-ulong-nth
+            S_OK
+        ] [ ! DragLeave
+            drop S_OK
+        ] [ ! Drop
+            [
+                2drop nip
+                filenames-from-data-object
+                dup length 1 = [
+                    first unparse [ "USE: parser " % % " run-file" % ] "" make
+                    eval-listener
+                    DROPEFFECT_COPY
+                ] [ 2drop DROPEFFECT_NONE ] if
+                0
+            ] dip set-ulong-nth
+            S_OK
+        ]
+    } }
+} <com-wrapper> +listener-dragdrop-wrapper+ set-global
+
+: dragdrop-listener-window ( -- )
+    get-workspace parent>> handle>> hWnd>>
+    dup <listener-dragdrop>
+    +listener-dragdrop-wrapper+ get-global com-wrap
+    [ RegisterDragDrop ole32-error ] with-com-interface ;
diff --git a/dragdrop-listener/platforms.txt b/dragdrop-listener/platforms.txt
new file mode 100644 (file)
index 0000000..8e1a559
--- /dev/null
@@ -0,0 +1 @@
+windows
diff --git a/drills/deployed/deploy.factor b/drills/deployed/deploy.factor
new file mode 100644 (file)
index 0000000..c1e9307
--- /dev/null
@@ -0,0 +1,14 @@
+USING: tools.deploy.config ;
+H{
+    { deploy-name "drills" }
+    { deploy-c-types? t }
+    { "stop-after-last-window?" t }
+    { deploy-unicode? t }
+    { deploy-threads? t }
+    { deploy-reflection 6 }
+    { deploy-word-defs? t }
+    { deploy-math? t }
+    { deploy-ui? t }
+    { deploy-word-props? t }
+    { deploy-io 3 }
+}
diff --git a/drills/deployed/deployed.factor b/drills/deployed/deployed.factor
new file mode 100644 (file)
index 0000000..20cdcb6
--- /dev/null
@@ -0,0 +1,36 @@
+USING: arrays cocoa.dialogs combinators continuations
+fry grouping io.encodings.utf8 io.files io.styles kernel math
+math.parser models models.arrow models.history namespaces random
+sequences splitting ui ui.gadgets.alerts ui.gadgets.book-extras
+ui.gadgets.books ui.gadgets.buttons ui.gadgets.frames
+ui.gadgets.grids ui.gadgets.labels ui.gadgets.tracks fonts
+wrap.strings system ;
+EXCLUDE: accessors => change-model ;
+IN: drills.deployed
+SYMBOLS: it startLength ;
+: big ( gadget -- gadget ) T{ font { name "sans-serif" } { size 30 } } >>font ;
+: card ( model quot -- button ) <arrow> <label-control> big [ next ] <book-btn> ;
+: op ( quot str -- gadget ) <label> big swap <book-bevel-btn> ;
+
+: show ( model -- gadget ) dup it set-global [ random ] <arrow>
+   { [ [ first ] card ]
+     [ [ second ] card ]
+     [ '[ |<< it get _ model-changed ] "No" op ]
+          [ '[ |<< [ it get [
+        _ value>> swap remove
+        [ [ it get go-back ] "Drill Complete" alert return ] when-empty
+     ] change-model ] with-return ] "Yes" op ]
+   } cleave
+2array { 1 0 } <track> swap [ 0.5 track-add ] each
+3array <book*> 3 3 <frame> { 1 1 } >>filled-cell { 450 175 } >>pref-dim swap { 1 1 } grid-add
+it get [ length startLength get swap - number>string "/" startLength get number>string 3append ] <arrow> <label-control> { 1 2 } grid-add ;
+
+: drill ( -- ) [
+   open-panel [
+         [ utf8 file-lines [ "\t" split [ 25 wrap-string ] map ] map dup [ first2 swap 2array ] map append ] map concat
+            [ length startLength set-global ] keep <history> [ add-history ] [ show ] bi
+         "Got it?" open-window
+   ] [ 0 exit ] if*
+] with-ui ;
+
+MAIN: drill
diff --git a/drills/deployed/tags.txt b/drills/deployed/tags.txt
new file mode 100644 (file)
index 0000000..6bf6830
--- /dev/null
@@ -0,0 +1 @@
+unportable
diff --git a/drills/drills.factor b/drills/drills.factor
new file mode 100644 (file)
index 0000000..7b9ebfc
--- /dev/null
@@ -0,0 +1,37 @@
+USING: arrays cocoa.dialogs combinators continuations
+fry grouping io.encodings.utf8 io.files io.styles kernel math
+math.parser models models.arrow models.history namespaces random
+sequences splitting ui ui.gadgets.alerts ui.gadgets.book-extras
+ui.gadgets.books ui.gadgets.buttons ui.gadgets.frames
+ui.gadgets.grids ui.gadgets.labels ui.gadgets.tracks fonts
+wrap.strings ;
+EXCLUDE: accessors => change-model ;
+
+IN: drills
+SYMBOLS: it startLength ;
+: big ( gadget -- gadget ) T{ font { name "sans-serif" } { size 30 } } >>font ;
+: card ( model quot -- button ) <arrow> <label-control> big [ next ] <book-btn> ;
+: op ( quot str -- gadget ) <label> big swap <book-border-btn> ;
+
+: show ( model -- gadget ) dup it set-global [ random ] <arrow>
+   { [ [ first ] card ]
+     [ [ second ] card ]
+     [ '[ |<< it get _ model-changed ] "No" op ]
+          [ '[ |<< [ it get [
+        _ value>> swap remove
+        [ [ it get go-back ] "Drill Complete" alert return ] when-empty
+     ] change-model ] with-return ] "Yes" op ]
+   } cleave
+2array { 1 0 } <track> swap [ 0.5 track-add ] each
+3array <book*> 3 3 <frame> { 1 1 } >>filled-cell { 450 175 } >>pref-dim swap { 1 1 } grid-add
+it get [ length startLength get swap - number>string "/" startLength get number>string 3append ] <arrow> <label-control> { 1 2 } grid-add ;
+
+: drill ( -- ) [
+   open-panel [
+         [ utf8 file-lines [ "\t" split [ 25 wrap-string ] map ] map dup [ first2 swap 2array ] map append ] map concat
+            [ length startLength set-global ] keep <history> [ add-history ] [ show ] bi
+         "Got it?" open-window
+   ] when*
+] with-ui ;
+
+MAIN: drill
diff --git a/drills/tags.txt b/drills/tags.txt
new file mode 100644 (file)
index 0000000..6bf6830
--- /dev/null
@@ -0,0 +1 @@
+unportable
diff --git a/easy-help/easy-help.factor b/easy-help/easy-help.factor
new file mode 100644 (file)
index 0000000..37870ab
--- /dev/null
@@ -0,0 +1,111 @@
+
+USING: arrays assocs compiler.units 
+       grouping help help.markup help.topics kernel lexer multiline
+       namespaces parser sequences splitting words
+       easy-help.expand-markup ;
+
+IN: easy-help
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: parse-text-block ( -- array )
+  
+  ".." parse-multiline-string
+  string-lines
+  1 tail
+  [ dup "    " head? [ 4 tail ] [ ] if ] map
+  [ expand-markup ] map
+  concat
+  [ dup "" = [ drop { $nl } ] [ ] if ] map ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: Text: parse-text-block parsed ; parsing
+
+: Block: scan-word 1array parse-text-block append parsed ; parsing
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: Notes:           { $notes       } parse-text-block append parsed ; parsing
+: Description:     { $description } parse-text-block append parsed ; parsing
+: Contract:        { $contract    } parse-text-block append parsed ; parsing
+: Checked-Example: { $example     } parse-text-block append parsed ; parsing
+
+: Class-Description:
+  { $class-description } parse-text-block append parsed ; parsing
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: Code:
+  
+  { $code }
+  parse-text-block [ dup array? [ drop "" ] [ ] if ] map
+  append
+  parsed
+  
+  ; parsing
+
+: Example:
+  { $heading "Example" }
+  { $code }
+  parse-text-block
+  [ dup array? [ drop "" ] [ ] if ] map ! Each item in $code must be a string
+  append 
+  2array parsed ; parsing
+
+: Introduction:
+
+  { $heading "Introduction" }
+  parse-text-block
+  2array parsed ; parsing
+
+: Summary:
+
+  { $heading "Summary" }
+  parse-text-block
+  2array parsed ; parsing
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: Values:
+
+  ".." parse-multiline-string
+  string-lines
+  1 tail
+  [ dup "    " head? [ 4 tail ] [ ] if ] map
+  [ " " split1 [ " " first = ] trim-head 2array ] map
+  \ $values prefix
+  parsed
+
+  ; parsing
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: Word:
+
+  scan current-vocab create dup old-definitions get
+  [ delete-at ] with each dup set-word
+
+  bootstrap-word dup set-word
+  dup >link save-location
+  \ ; parse-until >array swap set-word-help ; parsing
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: Heading: { $heading } ".." parse-multiline-string suffix parsed ; parsing
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: List:
+
+  { $list }
+
+  ".." parse-multiline-string
+  string-lines
+  1 tail
+  [ dup "    " head? [ 4 tail ] [ ] if ] map
+  [ expand-markup ] map
+
+  append parsed
+
+  ; parsing
diff --git a/easy-help/expand-markup/expand-markup.factor b/easy-help/expand-markup/expand-markup.factor
new file mode 100644 (file)
index 0000000..7550158
--- /dev/null
@@ -0,0 +1,47 @@
+
+USING: accessors arrays kernel lexer locals math namespaces parser
+       sequences splitting ;
+
+IN: easy-help.expand-markup
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: scan-one-array ( string -- array rest )
+  string-lines
+  lexer-factory get call
+  [
+  [
+    \ } parse-until >array
+    lexer get line-text>>
+    lexer get column>> tail
+  ]
+  with-lexer
+  ]
+  with-scope ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: contains-markup? ( string -- ? ) "{ $" swap subseq? ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+:: expand-markup ( LINE -- lines )
+  
+  LINE contains-markup?
+    [
+    
+      [let | N [ "{ $" LINE start ] |
+
+        LINE N head
+
+        LINE N 2 + tail scan-one-array  dup " " head? [ 1 tail ] [ ] if
+
+        [ 2array ] dip
+
+        expand-markup
+
+        append ]
+        
+    ]
+    [ LINE 1array ]
+  if ;
diff --git a/fonts/syntax/authors.txt b/fonts/syntax/authors.txt
new file mode 100644 (file)
index 0000000..2300f69
--- /dev/null
@@ -0,0 +1 @@
+Sam Anklesaria
diff --git a/fonts/syntax/summary.txt b/fonts/syntax/summary.txt
new file mode 100644 (file)
index 0000000..35dcf4e
--- /dev/null
@@ -0,0 +1 @@
+Syntax for modifying gadget fonts
\ No newline at end of file
diff --git a/fonts/syntax/syntax-docs.factor b/fonts/syntax/syntax-docs.factor
new file mode 100644 (file)
index 0000000..768f0b7
--- /dev/null
@@ -0,0 +1,6 @@
+USING: help.syntax help.markup ;
+IN: fonts.syntax
+
+HELP: FONT:
+{ $syntax "\"testing\" <label> FONT: 18 serif bold ... ;" }
+{ $description "Used after a gadget to change font settings.  Attributes can be in any order: the first number is set as the size, the style attributes like bold and italic will set the bold? and italic? slots, and font-names like serif or monospace will set the name slot." } ;
diff --git a/fonts/syntax/syntax.factor b/fonts/syntax/syntax.factor
new file mode 100644 (file)
index 0000000..34ccbc8
--- /dev/null
@@ -0,0 +1,16 @@
+USING: accessors arrays variants combinators io.styles
+kernel math parser sequences fry ;
+IN: fonts.syntax
+
+VARIANT: fontname serif monospace ;
+
+: install ( object quot -- quot/? ) over [ curry ] [ 2drop [ ] ] if ;
+
+: >>name* ( object fontname -- object ) name>> >>name ;
+
+SYNTAX: FONT: \ ; parse-until {
+    [ [ number? ] find nip [ >>size ] install ]
+    [ [ italic = ] find nip [ >>italic? ] install ]
+    [ [ bold = ] find nip [ >>bold? ] install ]
+    [ [ fontname? ] find nip [ >>name* ] install ]
+} cleave 4array concat '[ dup font>> @ drop ] append! ;
diff --git a/frame-buffer/frame-buffer.factor b/frame-buffer/frame-buffer.factor
new file mode 100644 (file)
index 0000000..e8137fe
--- /dev/null
@@ -0,0 +1,111 @@
+
+USING: accessors alien.c-types combinators grouping kernel
+       locals math math.geometry.rect math.vectors opengl.gl sequences
+       ui.gadgets ui.render ;
+
+IN: frame-buffer
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+TUPLE: <frame-buffer> < gadget pixels last-dim ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+GENERIC: update-frame-buffer ( <frame-buffer> -- )
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: init-frame-buffer-pixels ( frame-buffer -- )
+  dup
+    rect-dim product "uint[4]" <c-array>
+  >>pixels
+  drop ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: frame-buffer ( -- <frame-buffer> ) <frame-buffer> new-gadget ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+:: draw-pixels ( FRAME-BUFFER -- )
+
+  FRAME-BUFFER rect-dim first2
+  GL_RGBA
+  GL_UNSIGNED_INT
+  FRAME-BUFFER pixels>>
+  glDrawPixels ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+:: read-pixels ( FRAME-BUFFER -- )
+
+  0
+  0
+  FRAME-BUFFER rect-dim first2
+  GL_RGBA
+  GL_UNSIGNED_INT
+  FRAME-BUFFER pixels>>
+  glReadPixels ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+:: copy-row ( OLD NEW -- )
+  
+  [let | LEN [ OLD NEW min-length ] |
+
+    OLD LEN head-slice 0 NEW copy ] ;
+
+: copy-pixels ( old-pixels old-width new-pixels new-width -- )
+  [ 16 * <groups> ] 2bi@ [ copy-row ] 2each ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: update-last-dim ( frame-buffer -- ) dup rect-dim >>last-dim drop ;
+
+M:: <frame-buffer> layout* ( FRAME-BUFFER -- )
+
+  {
+    {
+      [ FRAME-BUFFER last-dim>> f = ]
+      [
+        FRAME-BUFFER init-frame-buffer-pixels
+
+        FRAME-BUFFER update-last-dim
+      ]
+    }
+    {
+      [ FRAME-BUFFER [ rect-dim ] [ last-dim>> ] bi = not ]
+      [
+        [let | OLD-PIXELS [ FRAME-BUFFER pixels>>         ]
+               OLD-WIDTH  [ FRAME-BUFFER last-dim>> first ] |
+
+          FRAME-BUFFER init-frame-buffer-pixels
+
+          FRAME-BUFFER update-last-dim
+
+          [let | NEW-PIXELS [ FRAME-BUFFER pixels>>         ]
+                 NEW-WIDTH  [ FRAME-BUFFER last-dim>> first ] |
+
+            OLD-PIXELS OLD-WIDTH NEW-PIXELS NEW-WIDTH copy-pixels ] ]
+      ]
+    }
+    { [ t ] [ ] }
+  }
+  cond ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+M:: <frame-buffer> draw-gadget* ( FRAME-BUFFER -- )
+
+  FRAME-BUFFER rect-dim { 0 1 } v* first2 glRasterPos2i
+
+  FRAME-BUFFER draw-pixels
+
+  FRAME-BUFFER update-frame-buffer
+
+  glFlush
+
+  FRAME-BUFFER read-pixels ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
diff --git a/fries/authors.txt b/fries/authors.txt
new file mode 100644 (file)
index 0000000..2300f69
--- /dev/null
@@ -0,0 +1 @@
+Sam Anklesaria
diff --git a/fries/fries.factor b/fries/fries.factor
new file mode 100644 (file)
index 0000000..3f970a8
--- /dev/null
@@ -0,0 +1,17 @@
+USING: arrays vectors combinators effects kernel math sequences splitting
+strings.parser parser fry sequences.extras ;
+
+! a b c glue => acb
+! c b a [ append ] dip prepend
+
+IN: fries
+: str-fry ( str on -- quot ) split
+    [ unclip-last [ [ [ append ] [ prepend ] bi* ] reduce-r ] 2curry ]
+    [ length 1 - 1 <effect> [ call-effect ] 2curry ] bi ;
+: gen-fry ( str on -- quot ) split
+    [ unclip-last [ [ [ 1array ] [ append ] [ prepend ] tri* ] reduce-r ] 2curry ]
+    [ length 1 - 1 <effect> [ call-effect ] 2curry ] bi ;
+
+SYNTAX: i" parse-string rest "_" str-fry append! ;
+SYNTAX: i{ \ } parse-until >array { _ } gen-fry append! ;
+SYNTAX: iV{ \ } parse-until >vector V{ _ } gen-fry append! ;
diff --git a/fries/summary.txt b/fries/summary.txt
new file mode 100644 (file)
index 0000000..44e9456
--- /dev/null
@@ -0,0 +1 @@
+Generalized Frying
\ No newline at end of file
diff --git a/gir/samples/lowlevel/gstreamer/authors.txt b/gir/samples/lowlevel/gstreamer/authors.txt
new file mode 100644 (file)
index 0000000..4af9fbe
--- /dev/null
@@ -0,0 +1 @@
+Anton Gorenko
diff --git a/gir/samples/lowlevel/gstreamer/gstreamer.factor b/gir/samples/lowlevel/gstreamer/gstreamer.factor
new file mode 100644 (file)
index 0000000..7508386
--- /dev/null
@@ -0,0 +1,63 @@
+! Copyright (C) 2010 Anton Gorenko.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.c-types alien.strings fry byte-arrays classes.struct
+io.encodings.utf8 kernel locals math prettyprint 
+gstreamer.ffi glib.ffi gobject.ffi gtk.ffi ;
+IN: gir.samples.lowlevel.gstreamer
+
+! CONSTANT: uri "http://www.xiph.org/vorbis/listen/compilation-ogg-q4.ogg"
+CONSTANT: uri "http://tinyvid.tv/file/3gocxnjott7wr.ogg"
+
+:: gstreamer-win ( -- window )
+    f f gst_init
+    "playbin" "player" [ utf8 string>alien ] bi@ gst_element_factory_make :> pipeline
+
+    GValue <struct> :> value
+    value G_TYPE_STRING g_value_init drop
+    value uri utf8 string>alien g_value_set_string
+    
+    pipeline "uri" utf8 string>alien value g_object_set_property
+        
+    ! pipeline GST_STATE_PLAYING gst_element_set_state drop
+
+    GTK_WINDOW_TOPLEVEL gtk_window_new :> window
+
+    window
+    [ "GStreamer" utf8 string>alien gtk_window_set_title ]
+    [ 300 200 gtk_window_set_default_size ]
+    [ GTK_WIN_POS_CENTER gtk_window_set_position ] tri
+
+    gtk_fixed_new :> frame
+    window frame gtk_container_add
+    
+    "Start" utf8 string>alien gtk_button_new_with_label :> button
+    button 140 30 gtk_widget_set_size_request
+    frame button 80 60 gtk_fixed_put
+
+    button "clicked" utf8 string>alien
+    [ nip GST_STATE_PLAYING gst_element_set_state drop ] GtkButton:clicked
+    pipeline f 0 g_signal_connect_data drop
+
+    window "destroy" utf8 string>alien
+    [ 
+        nip [ GST_STATE_NULL gst_element_set_state drop ]
+        [ gst_object_unref ] bi
+    ] GtkObject:destroy
+    pipeline f 0 g_signal_connect_data drop
+    
+    window ;
+
+:: gstreamer-main ( -- )
+    f f gtk_init
+    gstreamer-win :> window
+
+    window "destroy" utf8 string>alien
+    [ 2drop gtk_main_quit ] GtkObject:destroy
+    f f 0 g_signal_connect_data drop
+
+    window gtk_widget_show_all
+    
+    gtk_main ;
+
+MAIN: gstreamer-main
+
diff --git a/golden-section/authors.txt b/golden-section/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/golden-section/deploy.factor b/golden-section/deploy.factor
new file mode 100644 (file)
index 0000000..0aa3185
--- /dev/null
@@ -0,0 +1,12 @@
+USING: tools.deploy.config ;
+V{
+    { deploy-ui? t }
+    { deploy-io 1 }
+    { deploy-reflection 1 }
+    { deploy-compiler? t }
+    { deploy-math? t }
+    { deploy-word-props? f }
+    { deploy-c-types? f }
+    { "stop-after-last-window?" t }
+    { deploy-name "Golden Section" }
+}
diff --git a/golden-section/golden-section.factor b/golden-section/golden-section.factor
new file mode 100644 (file)
index 0000000..8d1e6b4
--- /dev/null
@@ -0,0 +1,54 @@
+
+USING: kernel namespaces math math.constants math.functions math.order
+       arrays sequences
+       opengl opengl.gl opengl.glu ui ui.render ui.gadgets ui.gadgets.theme
+       ui.gadgets.cartesian colors accessors combinators.cleave
+       processing.shapes ;
+
+IN: golden-section
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! omega(i) = 2*pi*i*(phi-1)
+
+! x(i) = 0.5*i*cos(omega(i))
+! y(i) = 0.5*i*sin(omega(i))
+
+! radius(i) = 10*sin((pi*i)/720)
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: omega ( i -- omega ) phi 1- * 2 * pi * ;
+
+: x ( i -- x ) [ omega cos ] [ 0.5 * ] bi * ;
+: y ( i -- y ) [ omega sin ] [ 0.5 * ] bi * ;
+
+: center ( i -- point ) { x y } 1arr ;
+
+: radius ( i -- radius ) pi * 720 / sin 10 * ;
+
+: color ( i -- i ) dup 360.0 / dup 0.25 1 rgba boa >fill-color ;
+
+: line-width ( i -- i ) dup radius 0.5 * 1 max glLineWidth ;
+
+: draw ( i -- ) [ center ] [ radius 1.5 * 2 * ] bi circle ;
+
+: dot ( i -- ) color line-width draw ;
+
+: golden-section ( -- ) 720 [ dot ] each ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: <golden-section> ( -- gadget )
+  <cartesian>
+    {  600 600 }       >>pdim
+    { -400 400 }       x-range
+    { -400 400 }       y-range
+    [ golden-section ] >>action ;
+
+: golden-section-window ( -- )
+  [ <golden-section> "Golden Section" open-window ] with-ui ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+MAIN: golden-section-window
diff --git a/golden-section/summary.txt b/golden-section/summary.txt
new file mode 100644 (file)
index 0000000..5f44091
--- /dev/null
@@ -0,0 +1 @@
+Golden section demo
diff --git a/golden-section/tags.txt b/golden-section/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/graph-theory/authors.txt b/graph-theory/authors.txt
new file mode 100644 (file)
index 0000000..9366723
--- /dev/null
@@ -0,0 +1 @@
+William Schlieper
diff --git a/graph-theory/graph-theory-docs.factor b/graph-theory/graph-theory-docs.factor
new file mode 100644 (file)
index 0000000..2b07f52
--- /dev/null
@@ -0,0 +1,139 @@
+! See http://factorcode.org/license.txt for BSD licence.
+USING: help.markup help.syntax ;
+
+IN: graph-theory
+
+ARTICLE: "graph-protocol" "Graph protocol"
+"All graphs must be instances of the graph mixin:"
+{ $subsections graph }
+"All graphs must implement a method on the following generic word:"
+{ $subsections vertices }
+"At least one of the following two generic words must have a method; the " { $link graph } " mixin has default definitions which are mutually recursive:"
+{ $subsections
+    adjlist
+    adj?
+}
+"All mutable graphs must implement a method on the following generic word:"
+{ $subsections add-blank-vertex }
+"All mutable undirected graphs must implement a method on the following generic word:"
+{ $subsections add-edge }
+"Mutable directed graphs should not implement the above word, as it has a default definition defined in terms of the following generic word:"
+{ $subsections add-edge* }
+"The following two words have default definitions, but are available as generics to allow implementations to optimize them:"
+{ $subsections
+    num-vertices
+    num-edges
+} ;
+
+HELP: graph
+{ $class-description "A mixin class whose instances are graphs.  Custom implementations of the graph protocol should be declared as instances of this mixin for all graph functionality to work correctly:"
+    { $code "INSTANCE: hex-board graph" }
+} ;
+
+{ vertices num-vertices num-edges } related-words
+
+HELP: vertices
+{ $values { "graph" graph } { "seq" "The vertices" } }
+{ $description "Returns the vertices of the graph." } ;
+
+HELP: num-vertices
+{ $values { "graph" graph } { "n" "The number of vertices" } }
+{ $description "Returns the number of vertices in the graph." } ;
+
+HELP: num-edges
+{ $values { "graph" "A graph" } { "n" "The number of edges" } }
+{ $description "Returns the number of edges in the graph." } ;
+
+{ adjlist adj? } related-words
+
+HELP: adjlist
+{ $values
+    { "from" "The index of a vertex" }
+    { "graph" "The graph to be examined" }
+    { "seq" "The adjacency list" } }
+{ $description "Returns a sequence of vertices that this vertex links to" } ;
+
+HELP: adj?
+{ $values
+    { "from" "The index of a vertex" }
+    { "to" "The index of a vertex" }
+    { "graph" "A graph" }
+    { "?" "A boolean" } }
+{ $description "Returns a boolean describing whether there is an edge in the graph between from and to." } ;
+
+{ add-blank-vertex add-blank-vertices add-edge add-edge* } related-words
+
+HELP: add-blank-vertex
+{ $values
+    { "index" "A vertex index" }
+    { "graph" "A graph" } }
+{ $description "Adds a vertex to the graph." } ;
+
+HELP: add-blank-vertices
+{ $values
+    { "seq" "A sequence of vertex indices" }
+    { "graph" "A graph" } }
+{ $description "Adds vertices with indices in seq to the graph." } ;
+
+HELP: add-edge*
+{ $values
+    { "from" "The index of a vertex" }
+    { "to" "The index of another vertex" }
+    { "graph" "A graph" } }
+{ $description "Adds a one-way edge to the graph, between " { $snippet "from" } " and " { $snippet "to" } "."
+  $nl 
+  "If you want to add a two-way edge, use " { $link add-edge } " instead." } ;
+
+HELP: add-edge
+{ $values
+    { "u" "The index of a vertex" }
+    { "v" "The index of another vertex" }
+    { "graph" "A graph" } }
+{ $description "Adds a two-way edge to the graph, between " { $snippet "u" } " and " { $snippet "v" } "."
+  $nl
+  "If you want to add a one-way edge, use " { $link add-edge* } " instead." } ;
+
+{ depth-first full-depth-first dag? topological-sort } related-words
+
+HELP: depth-first
+{ $values
+    { "v" "The vertex to start the search at" }
+    { "graph" "The graph to search" }
+    { "pre" "A quotation of the form ( n -- )" }
+    { "post" "A quotation of the form ( n -- )" }
+    { "?list" "A list of booleans describing the vertices visited in the search" }
+    { "?" "A boolean describing whether or not the end-search error was thrown" } }
+{ $description "Performs a depth-first search on " { $emphasis "graph" } ".  The variable " { $emphasis "graph" } " can be accessed in both quotations."
+  $nl
+  "The " { $emphasis "pre" } " quotation is run before the recursive application of depth-first."
+  $nl
+  "The " { $emphasis "post" } " quotation is run after the recursive application of depth-first."
+  $nl
+  { $emphasis "?list" } " is a list of booleans, " { $link t } " for every vertex visted during the search, and " { $link f } " for every vertex not visited." } ;
+
+HELP: full-depth-first
+{ $values
+    { "graph" "The graph to search" }
+    { "pre" "A quotation of the form ( n -- )" }
+    { "post" "A quotation of the form ( n -- )" }
+    { "tail" "A quotation of the form ( -- )" }
+    { "?" "A boolean describing whether or not the end-search error was thrown" } }
+{ $description "Performs a depth-first search on " { $emphasis "graph" } ".  The variable " { $emphasis "graph" } "can be accessed in both quotations."
+  $nl
+  "The " { $emphasis "pre" } " quotation is run before the recursive application of depth-first."
+  $nl
+  "The " { $emphasis "post" } " quotation is run after the recursive application of depth-first."
+  $nl
+  "The " { $emphasis "tail" } " quotation is run after each time the depth-first search runs out of nodes.  On an undirected graph this will be each connected subgroup but on a directed graph it can be more complex." } ;
+
+HELP: dag?
+{ $values
+    { "graph" graph }
+    { "?" "A boolean indicating if the graph is acyclic" } }
+{ $description "Using a depth-first search, determines if the specified directed graph is a directed acyclic graph.  An undirected graph will produce a false result, as the algorithm does not eliminate cycles of length 2, which will include any edge that goes both ways." } ;
+
+HELP: topological-sort
+{ $values
+    { "graph" graph }
+    { "seq/f" "Either a sequence of values or f" } }
+{ $description "Using a depth-first search, topologically sorts the specified directed graph.  Returns f if the graph contains any cycles, and a topologically sorted sequence otherwise." } ;
diff --git a/graph-theory/graph-theory.factor b/graph-theory/graph-theory.factor
new file mode 100644 (file)
index 0000000..e14ffb4
--- /dev/null
@@ -0,0 +1,91 @@
+! Copyright (C) 2008 William Schlieper <schlieper@unc.edu>
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel combinators fry continuations sequences arrays
+vectors assocs hashtables heaps namespaces ;
+IN: graph-theory
+
+MIXIN: graph
+SYMBOL: visited?
+ERROR: end-search ;
+
+GENERIC: vertices ( graph -- seq ) flushable
+
+GENERIC: num-vertices ( graph -- n ) flushable
+
+GENERIC: num-edges ( graph -- n ) flushable
+
+GENERIC: adjlist ( from graph -- seq ) flushable
+
+GENERIC: adj? ( from to graph -- ? ) flushable
+
+GENERIC: add-blank-vertex ( index graph -- )
+
+GENERIC: delete-blank-vertex ( index graph -- )
+
+GENERIC: add-edge* ( from to graph -- )
+
+GENERIC: add-edge ( u v graph -- )
+
+GENERIC: delete-edge* ( from to graph -- )
+
+GENERIC: delete-edge ( u v graph -- )
+
+M: graph num-vertices
+    vertices length ;
+
+M: graph num-edges
+   [ vertices ] [ '[ _ adjlist length ] map-sum ] bi ;
+
+M: graph adjlist
+    [ vertices ] [ swapd '[ _ swap _ adj? ] filter ] bi ;
+
+M: graph adj?
+    swapd adjlist index >boolean ;
+
+M: graph add-edge
+    [ add-edge* ] [ swapd add-edge* ] 3bi ;
+
+M: graph delete-edge
+    [ delete-edge* ] [ swapd delete-edge* ] 3bi ;
+
+: add-blank-vertices ( seq graph -- )
+    '[ _ add-blank-vertex ] each ;
+
+: delete-vertex ( index graph -- )
+    [ adjlist ]
+    [ '[ _ _ 3dup adj? [ delete-edge* ] [ 3drop ] if ] each ]
+    [ delete-blank-vertex ] 2tri ;
+
+<PRIVATE
+
+: search-wrap ( quot graph -- ? )
+    [ [ graph set ] [ vertices [ f 2array ] map >hashtable visited? set ] bi
+      [ t ] compose [ dup end-search? [ drop f ] [ rethrow ] if ] recover ] with-scope ; inline
+
+: (depth-first) ( v pre post -- )
+    { [ 2drop visited? get t -rot set-at ] 
+      [ drop call ]
+      [ [ graph get adjlist ] 2dip
+        '[ dup visited? get at [ drop ] [ _ _ (depth-first) ] if ] each ]
+      [ nip call ] } 3cleave ; inline
+
+PRIVATE>
+
+: depth-first ( v graph pre post -- ?list ? )
+    '[ _ _ (depth-first) visited? get ] swap search-wrap ; inline
+
+: full-depth-first ( graph pre post tail -- ? )
+    '[ [ visited? get [ nip not ] assoc-find ] 
+       [ drop _ _ (depth-first) @ ] 
+       while 2drop ] swap search-wrap ; inline
+
+: dag? ( graph -- ? )
+    V{ } clone swap [ 2dup swap push dupd
+                     '[ _ swap graph get adj? not ] all? 
+                      [ end-search ] unless ]
+                    [ drop dup pop* ] [ ] full-depth-first nip ;
+
+: topological-sort ( graph -- seq/f )
+    dup dag?
+    [ V{ } clone swap [ drop ] [ prefix ] [ ] full-depth-first drop ]
+    [ drop f ] if ;
diff --git a/graph-theory/reversals/reversals.factor b/graph-theory/reversals/reversals.factor
new file mode 100644 (file)
index 0000000..1ea1a3f
--- /dev/null
@@ -0,0 +1,22 @@
+! Copyright (C) 2008 William Schlieper <schlieper@unc.edu>
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: accessors kernel graph-theory ;
+
+IN: graph-theory.reversals
+
+TUPLE: reversal graph ;
+
+GENERIC: reverse-graph ( graph -- reversal )
+
+M: graph reverse-graph reversal boa ;
+
+M: reversal reverse-graph graph>> ;
+
+INSTANCE: reversal graph
+
+M: reversal vertices
+    graph>> vertices ;
+
+M: reversal adj?
+    swapd graph>> adj? ;
diff --git a/graph-theory/sparse/sparse.factor b/graph-theory/sparse/sparse.factor
new file mode 100644 (file)
index 0000000..5c6365b
--- /dev/null
@@ -0,0 +1,35 @@
+! Copyright (C) 2008 William Schlieper <schlieper@unc.edu>
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: accessors kernel sequences arrays vectors sets assocs hashtables graph-theory namespaces fry ;
+
+IN: graph-theory.sparse
+
+TUPLE: sparse-graph alist ; 
+
+: <sparse-graph> ( -- sparse-graph )
+    H{ } clone sparse-graph boa ;
+
+: >sparse-graph ( graph -- sparse-graph )
+    [ vertices ] keep
+    '[ dup _ adjlist 2array ] map >hashtable sparse-graph boa ;
+
+INSTANCE: sparse-graph graph
+
+M: sparse-graph vertices
+    alist>> keys ;
+
+M: sparse-graph adjlist
+    alist>> at ;
+
+M: sparse-graph add-blank-vertex 
+    alist>> V{ } clone -rot set-at ;
+
+M: sparse-graph delete-blank-vertex
+    alist>> delete-at ;
+
+M: sparse-graph add-edge*
+    alist>> swapd at adjoin ;
+
+M: sparse-graph delete-edge*
+    alist>> swapd at delete ;
diff --git a/graph-theory/summary.txt b/graph-theory/summary.txt
new file mode 100644 (file)
index 0000000..3e1d791
--- /dev/null
@@ -0,0 +1 @@
+Graph-theoretic algorithms
diff --git a/graph-theory/tags.txt b/graph-theory/tags.txt
new file mode 100644 (file)
index 0000000..42d711b
--- /dev/null
@@ -0,0 +1 @@
+collections
diff --git a/gstreamer/plugins/app/GstApp-0.10.gir b/gstreamer/plugins/app/GstApp-0.10.gir
new file mode 100644 (file)
index 0000000..32af8f8
--- /dev/null
@@ -0,0 +1,1085 @@
+<?xml version="1.0"?>
+<!-- This file was automatically generated from C sources - DO NOT EDIT!
+To affect the contents of this file, edit the original C definitions,
+and/or use gtk-doc annotations.  -->
+<repository version="1.2"
+            xmlns="http://www.gtk.org/introspection/core/1.0"
+            xmlns:c="http://www.gtk.org/introspection/c/1.0"
+            xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+  <include name="GLib" version="2.0"/>
+  <include name="GModule" version="2.0"/>
+  <include name="GObject" version="2.0"/>
+  <include name="Gst" version="0.10"/>
+  <include name="GstBase" version="0.10"/>
+  <include name="libxml2" version="2.0"/>
+  <package name="gstreamer-app-0.10"/>
+  <c:include name="gst/app/gstappbuffer.h"/>
+  <c:include name="gst/app/gstappsink.h"/>
+  <c:include name="gst/app/gstappsrc.h"/>
+  <namespace name="GstApp"
+             version="0.10"
+             shared-library="libgstapp-0.10.so.0"
+             c:identifier-prefixes="Gst"
+             c:symbol-prefixes="gst">
+    <class name="AppBuffer"
+           c:symbol-prefix="app_buffer"
+           c:type="GstAppBuffer"
+           parent="Gst.Buffer"
+           glib:type-name="GstAppBuffer"
+           glib:get-type="gst_app_buffer_get_type"
+           glib:type-struct="AppBufferClass"
+           glib:fundamental="1">
+      <constructor name="new"
+                   c:identifier="gst_app_buffer_new"
+                   introspectable="0">
+        <return-value transfer-ownership="full">
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </return-value>
+        <parameters>
+          <parameter name="data" transfer-ownership="none">
+            <type name="gpointer" c:type="void*"/>
+          </parameter>
+          <parameter name="length" transfer-ownership="none">
+            <type name="gint" c:type="int"/>
+          </parameter>
+          <parameter name="finalize" transfer-ownership="none">
+            <type name="AppBufferFinalizeFunc"
+                  c:type="GstAppBufferFinalizeFunc"/>
+          </parameter>
+          <parameter name="priv" transfer-ownership="none">
+            <type name="gpointer" c:type="void*"/>
+          </parameter>
+        </parameters>
+      </constructor>
+      <field name="buffer">
+        <type name="Gst.Buffer" c:type="GstBuffer"/>
+      </field>
+      <field name="finalize">
+        <type name="AppBufferFinalizeFunc" c:type="GstAppBufferFinalizeFunc"/>
+      </field>
+      <field name="priv">
+        <type name="gpointer" c:type="void*"/>
+      </field>
+    </class>
+    <record name="AppBufferClass"
+            c:type="GstAppBufferClass"
+            glib:is-gtype-struct-for="AppBuffer">
+      <field name="buffer_class">
+        <type name="Gst.BufferClass" c:type="GstBufferClass"/>
+      </field>
+    </record>
+    <callback name="AppBufferFinalizeFunc" c:type="GstAppBufferFinalizeFunc">
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="priv" transfer-ownership="none">
+          <type name="gpointer" c:type="void*"/>
+        </parameter>
+      </parameters>
+    </callback>
+    <class name="AppSink"
+           c:symbol-prefix="app_sink"
+           c:type="GstAppSink"
+           parent="GstBase.BaseSink"
+           glib:type-name="GstAppSink"
+           glib:get-type="gst_app_sink_get_type"
+           glib:type-struct="AppSinkClass">
+      <implements name="Gst.URIHandler"/>
+      <method name="get_caps"
+              c:identifier="gst_app_sink_get_caps"
+              version="0.10.22">
+        <doc xml:whitespace="preserve">Get the configured caps on @appsink.</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">the #GstCaps accepted by the sink. gst_caps_unref() after usage.</doc>
+          <type name="Gst.Caps" c:type="GstCaps*"/>
+        </return-value>
+      </method>
+      <method name="get_drop"
+              c:identifier="gst_app_sink_get_drop"
+              version="0.10.22">
+        <doc xml:whitespace="preserve">Check if @appsink will drop old buffers when the maximum amount of queued
+buffers is reached.
+filled.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE if @appsink is dropping old buffers when the queue is</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </method>
+      <method name="get_emit_signals"
+              c:identifier="gst_app_sink_get_emit_signals"
+              version="0.10.22">
+        <doc xml:whitespace="preserve">Check if appsink will emit the "new-preroll" and "new-buffer" signals.
+signals.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE if @appsink is emiting the "new-preroll" and "new-buffer"</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </method>
+      <method name="get_max_buffers"
+              c:identifier="gst_app_sink_get_max_buffers"
+              version="0.10.22">
+        <doc xml:whitespace="preserve">Get the maximum amount of buffers that can be queued in @appsink.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">The maximum amount of buffers that can be queued.</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </method>
+      <method name="is_eos"
+              c:identifier="gst_app_sink_is_eos"
+              version="0.10.22">
+        <doc xml:whitespace="preserve">Check if @appsink is EOS, which is when no more buffers can be pulled because
+an EOS event was received.
+This function also returns %TRUE when the appsink is not in the PAUSED or
+PLAYING state.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE if no more buffers can be pulled and the appsink is EOS.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </method>
+      <method name="pull_buffer"
+              c:identifier="gst_app_sink_pull_buffer"
+              version="0.10.22"
+              introspectable="0">
+        <doc xml:whitespace="preserve">This function blocks until a buffer or EOS becomes available or the appsink
+element is set to the READY/NULL state. 
+This function will only return buffers when the appsink is in the PLAYING
+state. All rendered buffers will be put in a queue so that the application
+can pull buffers at its own rate. Note that when the application does not
+pull buffers fast enough, the queued buffers could consume a lot of memory,
+especially when dealing with raw video frames.
+If an EOS event was received before any buffers, this function returns
+%NULL. Use gst_app_sink_is_eos () to check for the EOS condition.</doc>
+        <return-value>
+          <doc xml:whitespace="preserve">a #GstBuffer or NULL when the appsink is stopped or EOS.</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </return-value>
+      </method>
+      <method name="pull_buffer_list"
+              c:identifier="gst_app_sink_pull_buffer_list"
+              introspectable="0">
+        <doc xml:whitespace="preserve">This function blocks until a buffer list or EOS becomes available or the
+appsink element is set to the READY/NULL state. 
+This function will only return buffer lists when the appsink is in the
+PLAYING state. All rendered buffer lists will be put in a queue so that
+the application can pull buffer lists at its own rate. Note that when
+the application does not pull buffer lists fast enough, the queued buffer
+lists could consume a lot of memory, especially when dealing with raw
+video frames.
+If an EOS event was received before any buffer lists, this function returns
+%NULL. Use gst_app_sink_is_eos () to check for the EOS condition.</doc>
+        <return-value>
+          <doc xml:whitespace="preserve">a #GstBufferList or NULL when the appsink is stopped or EOS.</doc>
+          <type name="Gst.BufferList" c:type="GstBufferList*"/>
+        </return-value>
+      </method>
+      <method name="pull_preroll"
+              c:identifier="gst_app_sink_pull_preroll"
+              version="0.10.22"
+              introspectable="0">
+        <doc xml:whitespace="preserve">Get the last preroll buffer in @appsink. This was the buffer that caused the
+appsink to preroll in the PAUSED state. This buffer can be pulled many times
+and remains available to the application even after EOS.
+This function is typically used when dealing with a pipeline in the PAUSED
+state. Calling this function after doing a seek will give the buffer right
+after the seek position.
+Note that the preroll buffer will also be returned as the first buffer
+when calling gst_app_sink_pull_buffer().
+If an EOS event was received before any buffers, this function returns
+%NULL. Use gst_app_sink_is_eos () to check for the EOS condition. 
+This function blocks until a preroll buffer or EOS is received or the appsink
+element is set to the READY/NULL state.</doc>
+        <return-value>
+          <doc xml:whitespace="preserve">a #GstBuffer or NULL when the appsink is stopped or EOS.</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </return-value>
+      </method>
+      <method name="set_callbacks"
+              c:identifier="gst_app_sink_set_callbacks"
+              version="0.10.23">
+        <doc xml:whitespace="preserve">Set callbacks which will be executed for each new preroll, new buffer and eos.
+This is an alternative to using the signals, it has lower overhead and is thus
+less expensive, but also less flexible.
+If callbacks are installed, no signals will be emited for performance
+reasons.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="callbacks" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the callbacks</doc>
+            <type name="AppSinkCallbacks" c:type="GstAppSinkCallbacks*"/>
+          </parameter>
+          <parameter name="user_data" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a user_data argument for the callbacks</doc>
+            <type name="gpointer" c:type="gpointer"/>
+          </parameter>
+          <parameter name="notify" transfer-ownership="none" scope="async">
+            <doc xml:whitespace="preserve">a destroy notify function</doc>
+            <type name="GLib.DestroyNotify" c:type="GDestroyNotify"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_caps"
+              c:identifier="gst_app_sink_set_caps"
+              version="0.10.22">
+        <doc xml:whitespace="preserve">Set the capabilities on the appsink element.  This function takes
+a copy of the caps structure. After calling this method, the sink will only
+accept caps that match @caps. If @caps is non-fixed, you must check the caps
+on the buffers to get the actual used caps.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="caps" transfer-ownership="none">
+            <doc xml:whitespace="preserve">caps to set</doc>
+            <type name="Gst.Caps" c:type="GstCaps*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_drop"
+              c:identifier="gst_app_sink_set_drop"
+              version="0.10.22">
+        <doc xml:whitespace="preserve">Instruct @appsink to drop old buffers when the maximum amount of queued
+buffers is reached.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="drop" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the new state</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_emit_signals"
+              c:identifier="gst_app_sink_set_emit_signals"
+              version="0.10.22">
+        <doc xml:whitespace="preserve">Make appsink emit the "new-preroll" and "new-buffer" signals. This option is
+by default disabled because signal emission is expensive and unneeded when
+the application prefers to operate in pull mode.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="emit" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the new state</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_max_buffers"
+              c:identifier="gst_app_sink_set_max_buffers"
+              version="0.10.22">
+        <doc xml:whitespace="preserve">Set the maximum amount of buffers that can be queued in @appsink. After this
+amount of buffers are queued in appsink, any more buffers will block upstream
+elements until a buffer is pulled from @appsink.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="max" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the maximum number of buffers to queue</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <property name="caps" writable="1" transfer-ownership="none">
+        <type name="Gst.Caps"/>
+      </property>
+      <property name="drop" writable="1" transfer-ownership="none">
+        <type name="gboolean"/>
+      </property>
+      <property name="emit-signals" writable="1" transfer-ownership="none">
+        <type name="gboolean"/>
+      </property>
+      <property name="eos" transfer-ownership="none">
+        <type name="gboolean"/>
+      </property>
+      <property name="max-buffers" writable="1" transfer-ownership="none">
+        <type name="guint"/>
+      </property>
+      <field name="basesink">
+        <type name="GstBase.BaseSink" c:type="GstBaseSink"/>
+      </field>
+      <field name="priv">
+        <type name="AppSinkPrivate" c:type="GstAppSinkPrivate*"/>
+      </field>
+      <field name="_gst_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+      <glib:signal name="eos">
+        <doc xml:whitespace="preserve">Signal that the end-of-stream has been reached. This signal is emited from
+the steaming thread.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none"/>
+        </return-value>
+      </glib:signal>
+      <glib:signal name="new-buffer">
+        <doc xml:whitespace="preserve">Signal that a new buffer is available.
+This signal is emited from the steaming thread and only when the
+"emit-signals" property is %TRUE. 
+The new buffer can be retrieved with the "pull-buffer" action
+signal or gst_app_sink_pull_buffer() either from this signal callback
+or from any other thread.
+Note that this signal is only emited when the "emit-signals" property is
+set to %TRUE, which it is not by default for performance reasons.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none"/>
+        </return-value>
+      </glib:signal>
+      <glib:signal name="new-buffer-list">
+        <doc xml:whitespace="preserve">Signal that a new bufferlist is available.
+This signal is emited from the steaming thread and only when the
+"emit-signals" property is %TRUE. 
+The new buffer can be retrieved with the "pull-buffer-list" action
+signal or gst_app_sink_pull_buffer_list() either from this signal callback
+or from any other thread.
+Note that this signal is only emited when the "emit-signals" property is
+set to %TRUE, which it is not by default for performance reasons.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none"/>
+        </return-value>
+      </glib:signal>
+      <glib:signal name="new-preroll">
+        <doc xml:whitespace="preserve">Signal that a new preroll buffer is available. 
+This signal is emited from the steaming thread and only when the
+"emit-signals" property is %TRUE. 
+The new preroll buffer can be retrieved with the "pull-preroll" action
+signal or gst_app_sink_pull_preroll() either from this signal callback
+or from any other thread.
+Note that this signal is only emited when the "emit-signals" property is
+set to %TRUE, which it is not by default for performance reasons.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none"/>
+        </return-value>
+      </glib:signal>
+      <glib:signal name="pull-buffer" introspectable="0">
+        <doc xml:whitespace="preserve">This function blocks until a buffer or EOS becomes available or the appsink
+element is set to the READY/NULL state. 
+This function will only return buffers when the appsink is in the PLAYING
+state. All rendered buffers will be put in a queue so that the application
+can pull buffers at its own rate. 
+Note that when the application does not pull buffers fast enough, the
+queued buffers could consume a lot of memory, especially when dealing with
+raw video frames. It's possible to control the behaviour of the queue with
+the "drop" and "max-buffers" properties.
+If an EOS event was received before any buffers, this function returns
+%NULL. Use gst_app_sink_is_eos () to check for the EOS condition.</doc>
+        <return-value>
+          <doc xml:whitespace="preserve">a #GstBuffer or NULL when the appsink is stopped or EOS.</doc>
+          <type name="Gst.Buffer"/>
+        </return-value>
+      </glib:signal>
+      <glib:signal name="pull-buffer-list" introspectable="0">
+        <doc xml:whitespace="preserve">This function blocks until a buffer list or EOS becomes available or the appsink
+element is set to the READY/NULL state. 
+This function will only return bufferlists when the appsink is in the PLAYING
+state. All rendered bufferlists will be put in a queue so that the application
+can pull bufferlists at its own rate. 
+Note that when the application does not pull bufferlists fast enough, the
+queued bufferlists could consume a lot of memory, especially when dealing with
+raw video frames. It's possible to control the behaviour of the queue with
+the "drop" and "max-buffers" properties.
+If an EOS event was received before any buffers, this function returns
+%NULL. Use gst_app_sink_is_eos () to check for the EOS condition.</doc>
+        <return-value>
+          <doc xml:whitespace="preserve">a #GstBufferList or NULL when the appsink is stopped or EOS.</doc>
+          <type name="Gst.BufferList"/>
+        </return-value>
+      </glib:signal>
+      <glib:signal name="pull-preroll" introspectable="0">
+        <doc xml:whitespace="preserve">Get the last preroll buffer in @appsink. This was the buffer that caused the
+appsink to preroll in the PAUSED state. This buffer can be pulled many times
+and remains available to the application even after EOS.
+This function is typically used when dealing with a pipeline in the PAUSED
+state. Calling this function after doing a seek will give the buffer right
+after the seek position.
+Note that the preroll buffer will also be returned as the first buffer
+when calling gst_app_sink_pull_buffer() or the "pull-buffer" action signal.
+If an EOS event was received before any buffers, this function returns
+%NULL. Use gst_app_sink_is_eos () to check for the EOS condition. 
+This function blocks until a preroll buffer or EOS is received or the appsink
+element is set to the READY/NULL state.</doc>
+        <return-value>
+          <doc xml:whitespace="preserve">a #GstBuffer or NULL when the appsink is stopped or EOS.</doc>
+          <type name="Gst.Buffer"/>
+        </return-value>
+      </glib:signal>
+    </class>
+    <record name="AppSinkCallbacks"
+            c:type="GstAppSinkCallbacks"
+            version="0.10.23">
+      <doc xml:whitespace="preserve">A set of callbacks that can be installed on the appsink with
+gst_app_sink_set_callbacks().</doc>
+      <field name="eos">
+        <callback name="eos">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="sink" transfer-ownership="none">
+              <type name="AppSink" c:type="GstAppSink*"/>
+            </parameter>
+            <parameter name="user_data" transfer-ownership="none" closure="1">
+              <type name="gpointer" c:type="gpointer"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="new_preroll">
+        <callback name="new_preroll">
+          <return-value transfer-ownership="none">
+            <type name="Gst.FlowReturn" c:type="GstFlowReturn"/>
+          </return-value>
+          <parameters>
+            <parameter name="sink" transfer-ownership="none">
+              <type name="AppSink" c:type="GstAppSink*"/>
+            </parameter>
+            <parameter name="user_data" transfer-ownership="none" closure="1">
+              <type name="gpointer" c:type="gpointer"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="new_buffer">
+        <callback name="new_buffer">
+          <return-value transfer-ownership="none">
+            <type name="Gst.FlowReturn" c:type="GstFlowReturn"/>
+          </return-value>
+          <parameters>
+            <parameter name="sink" transfer-ownership="none">
+              <type name="AppSink" c:type="GstAppSink*"/>
+            </parameter>
+            <parameter name="user_data" transfer-ownership="none" closure="1">
+              <type name="gpointer" c:type="gpointer"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="new_buffer_list">
+        <callback name="new_buffer_list">
+          <return-value transfer-ownership="none">
+            <type name="Gst.FlowReturn" c:type="GstFlowReturn"/>
+          </return-value>
+          <parameters>
+            <parameter name="sink" transfer-ownership="none">
+              <type name="AppSink" c:type="GstAppSink*"/>
+            </parameter>
+            <parameter name="user_data" transfer-ownership="none" closure="1">
+              <type name="gpointer" c:type="gpointer"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="_gst_reserved" writable="1">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="3">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </record>
+    <record name="AppSinkClass"
+            c:type="GstAppSinkClass"
+            glib:is-gtype-struct-for="AppSink">
+      <field name="basesink_class">
+        <type name="GstBase.BaseSinkClass" c:type="GstBaseSinkClass"/>
+      </field>
+      <field name="eos">
+        <callback name="eos">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="sink" transfer-ownership="none">
+              <type name="AppSink" c:type="GstAppSink*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="new_preroll">
+        <callback name="new_preroll">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="sink" transfer-ownership="none">
+              <type name="AppSink" c:type="GstAppSink*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="new_buffer">
+        <callback name="new_buffer">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="sink" transfer-ownership="none">
+              <type name="AppSink" c:type="GstAppSink*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="pull_preroll" introspectable="0">
+        <callback name="pull_preroll" introspectable="0">
+          <return-value>
+            <type name="Gst.Buffer" c:type="GstBuffer*"/>
+          </return-value>
+          <parameters>
+            <parameter name="sink" transfer-ownership="none">
+              <type name="AppSink" c:type="GstAppSink*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="pull_buffer" introspectable="0">
+        <callback name="pull_buffer" introspectable="0">
+          <return-value>
+            <type name="Gst.Buffer" c:type="GstBuffer*"/>
+          </return-value>
+          <parameters>
+            <parameter name="sink" transfer-ownership="none">
+              <type name="AppSink" c:type="GstAppSink*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="new_buffer_list" introspectable="0">
+        <callback name="new_buffer_list" introspectable="0">
+          <return-value>
+            <type name="Gst.BufferList" c:type="GstBufferList*"/>
+          </return-value>
+          <parameters>
+            <parameter name="sink" transfer-ownership="none">
+              <type name="AppSink" c:type="GstAppSink*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="pull_buffer_list" introspectable="0">
+        <callback name="pull_buffer_list" introspectable="0">
+          <return-value>
+            <type name="Gst.BufferList" c:type="GstBufferList*"/>
+          </return-value>
+          <parameters>
+            <parameter name="sink" transfer-ownership="none">
+              <type name="AppSink" c:type="GstAppSink*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="_gst_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="2">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </record>
+    <record name="AppSinkPrivate" c:type="GstAppSinkPrivate" disguised="1">
+    </record>
+    <class name="AppSrc"
+           c:symbol-prefix="app_src"
+           c:type="GstAppSrc"
+           parent="GstBase.BaseSrc"
+           glib:type-name="GstAppSrc"
+           glib:get-type="gst_app_src_get_type"
+           glib:type-struct="AppSrcClass">
+      <implements name="Gst.URIHandler"/>
+      <method name="end_of_stream"
+              c:identifier="gst_app_src_end_of_stream"
+              version="0.10.22">
+        <doc xml:whitespace="preserve">Indicates to the appsrc element that the last buffer queued in the
+element is the last buffer of the stream.
+#GST_FLOW_WRONG_STATE when @appsrc is not PAUSED or PLAYING.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_FLOW_OK when the EOS was successfuly queued.</doc>
+          <type name="Gst.FlowReturn" c:type="GstFlowReturn"/>
+        </return-value>
+      </method>
+      <method name="get_caps"
+              c:identifier="gst_app_src_get_caps"
+              version="0.10.22">
+        <doc xml:whitespace="preserve">Get the configured caps on @appsrc.</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">the #GstCaps produced by the source. gst_caps_unref() after usage.</doc>
+          <type name="Gst.Caps" c:type="GstCaps*"/>
+        </return-value>
+      </method>
+      <method name="get_emit_signals"
+              c:identifier="gst_app_src_get_emit_signals"
+              version="0.10.23">
+        <doc xml:whitespace="preserve">Check if appsrc will emit the "new-preroll" and "new-buffer" signals.
+signals.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE if @appsrc is emiting the "new-preroll" and "new-buffer"</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </method>
+      <method name="get_latency"
+              c:identifier="gst_app_src_get_latency"
+              version="0.10.22">
+        <doc xml:whitespace="preserve">Retrieve the min and max latencies in @min and @max respectively.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="min" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the min latency</doc>
+            <type name="guint64" c:type="guint64*"/>
+          </parameter>
+          <parameter name="max" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the min latency</doc>
+            <type name="guint64" c:type="guint64*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="get_max_bytes"
+              c:identifier="gst_app_src_get_max_bytes"
+              version="0.10.22">
+        <doc xml:whitespace="preserve">Get the maximum amount of bytes that can be queued in @appsrc.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">The maximum amount of bytes that can be queued.</doc>
+          <type name="guint64" c:type="guint64"/>
+        </return-value>
+      </method>
+      <method name="get_size"
+              c:identifier="gst_app_src_get_size"
+              version="0.10.22">
+        <doc xml:whitespace="preserve">Get the size of the stream in bytes. A value of -1 means that the size is
+not known.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the size of the stream previously set with gst_app_src_set_size();</doc>
+          <type name="gint64" c:type="gint64"/>
+        </return-value>
+      </method>
+      <method name="get_stream_type"
+              c:identifier="gst_app_src_get_stream_type"
+              version="0.10.22">
+        <doc xml:whitespace="preserve">Get the stream type. Control the stream type of @appsrc
+with gst_app_src_set_stream_type().</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the stream type.</doc>
+          <type name="AppStreamType" c:type="GstAppStreamType"/>
+        </return-value>
+      </method>
+      <method name="push_buffer"
+              c:identifier="gst_app_src_push_buffer"
+              version="0.10.22">
+        <doc xml:whitespace="preserve">Adds a buffer to the queue of buffers that the appsrc element will
+push to its source pad.  This function takes ownership of the buffer.
+When the block property is TRUE, this function can block until free
+space becomes available in the queue.
+#GST_FLOW_WRONG_STATE when @appsrc is not PAUSED or PLAYING.
+#GST_FLOW_UNEXPECTED when EOS occured.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_FLOW_OK when the buffer was successfuly queued.</doc>
+          <type name="Gst.FlowReturn" c:type="GstFlowReturn"/>
+        </return-value>
+        <parameters>
+          <parameter name="buffer" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a #GstBuffer to push</doc>
+            <type name="Gst.Buffer" c:type="GstBuffer*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_callbacks"
+              c:identifier="gst_app_src_set_callbacks"
+              version="0.10.23">
+        <doc xml:whitespace="preserve">Set callbacks which will be executed when data is needed, enough data has
+been collected or when a seek should be performed.
+This is an alternative to using the signals, it has lower overhead and is thus
+less expensive, but also less flexible.
+If callbacks are installed, no signals will be emited for performance
+reasons.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="callbacks" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the callbacks</doc>
+            <type name="AppSrcCallbacks" c:type="GstAppSrcCallbacks*"/>
+          </parameter>
+          <parameter name="user_data" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a user_data argument for the callbacks</doc>
+            <type name="gpointer" c:type="gpointer"/>
+          </parameter>
+          <parameter name="notify" transfer-ownership="none" scope="async">
+            <doc xml:whitespace="preserve">a destroy notify function</doc>
+            <type name="GLib.DestroyNotify" c:type="GDestroyNotify"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_caps"
+              c:identifier="gst_app_src_set_caps"
+              version="0.10.22">
+        <doc xml:whitespace="preserve">Set the capabilities on the appsrc element.  This function takes
+a copy of the caps structure. After calling this method, the source will
+only produce caps that match @caps. @caps must be fixed and the caps on the
+buffers must match the caps or left NULL.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="caps" transfer-ownership="none">
+            <doc xml:whitespace="preserve">caps to set</doc>
+            <type name="Gst.Caps" c:type="GstCaps*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_emit_signals"
+              c:identifier="gst_app_src_set_emit_signals"
+              version="0.10.23">
+        <doc xml:whitespace="preserve">Make appsrc emit the "new-preroll" and "new-buffer" signals. This option is
+by default disabled because signal emission is expensive and unneeded when
+the application prefers to operate in pull mode.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="emit" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the new state</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_latency"
+              c:identifier="gst_app_src_set_latency"
+              version="0.10.22">
+        <doc xml:whitespace="preserve">Configure the @min and @max latency in @src. If @min is set to -1, the
+default latency calculations for pseudo-live sources will be used.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="min" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the min latency</doc>
+            <type name="guint64" c:type="guint64"/>
+          </parameter>
+          <parameter name="max" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the min latency</doc>
+            <type name="guint64" c:type="guint64"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_max_bytes"
+              c:identifier="gst_app_src_set_max_bytes"
+              version="0.10.22">
+        <doc xml:whitespace="preserve">Set the maximum amount of bytes that can be queued in @appsrc.
+After the maximum amount of bytes are queued, @appsrc will emit the
+"enough-data" signal.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="max" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the maximum number of bytes to queue</doc>
+            <type name="guint64" c:type="guint64"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_size"
+              c:identifier="gst_app_src_set_size"
+              version="0.10.22">
+        <doc xml:whitespace="preserve">Set the size of the stream in bytes. A value of -1 means that the size is
+not known.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="size" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the size to set</doc>
+            <type name="gint64" c:type="gint64"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_stream_type"
+              c:identifier="gst_app_src_set_stream_type"
+              version="0.10.22">
+        <doc xml:whitespace="preserve">Set the stream type on @appsrc. For seekable streams, the "seek" signal must
+be connected to.
+A stream_type stream</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="type" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the new state</doc>
+            <type name="AppStreamType" c:type="GstAppStreamType"/>
+          </parameter>
+        </parameters>
+      </method>
+      <property name="block" writable="1" transfer-ownership="none">
+        <type name="gboolean"/>
+      </property>
+      <property name="caps" writable="1" transfer-ownership="none">
+        <type name="Gst.Caps"/>
+      </property>
+      <property name="emit-signals" writable="1" transfer-ownership="none">
+        <type name="gboolean"/>
+      </property>
+      <property name="format"
+                introspectable="0"
+                writable="1"
+                transfer-ownership="none">
+        <type/>
+      </property>
+      <property name="is-live" writable="1" transfer-ownership="none">
+        <type name="gboolean"/>
+      </property>
+      <property name="max-bytes" writable="1" transfer-ownership="none">
+        <type name="guint64"/>
+      </property>
+      <property name="max-latency" writable="1" transfer-ownership="none">
+        <type name="gint64"/>
+      </property>
+      <property name="min-latency" writable="1" transfer-ownership="none">
+        <type name="gint64"/>
+      </property>
+      <property name="min-percent" writable="1" transfer-ownership="none">
+        <type name="guint"/>
+      </property>
+      <property name="size" writable="1" transfer-ownership="none">
+        <type name="gint64"/>
+      </property>
+      <property name="stream-type" writable="1" transfer-ownership="none">
+        <type name="AppStreamType"/>
+      </property>
+      <field name="basesrc">
+        <type name="GstBase.BaseSrc" c:type="GstBaseSrc"/>
+      </field>
+      <field name="priv">
+        <type name="AppSrcPrivate" c:type="GstAppSrcPrivate*"/>
+      </field>
+      <field name="_gst_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+      <glib:signal name="end-of-stream" introspectable="0">
+        <doc xml:whitespace="preserve">Notify @appsrc that no more buffer are available.</doc>
+        <return-value>
+          <type/>
+        </return-value>
+      </glib:signal>
+      <glib:signal name="enough-data">
+        <doc xml:whitespace="preserve">Signal that the source has enough data. It is recommended that the
+application stops calling push-buffer until the need-data signal is
+emited again to avoid excessive buffer queueing.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none"/>
+        </return-value>
+      </glib:signal>
+      <glib:signal name="need-data">
+        <doc xml:whitespace="preserve">Signal that the source needs more data. In the callback or from another
+thread you should call push-buffer or end-of-stream.
+pushed into @appsrc.
+You can call push-buffer multiple times until the enough-data signal is
+fired.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none"/>
+        </return-value>
+        <parameters>
+          <parameter name="object" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the amount of bytes needed.</doc>
+            <type name="guint"/>
+          </parameter>
+        </parameters>
+      </glib:signal>
+      <glib:signal name="push-buffer" introspectable="0">
+        <doc xml:whitespace="preserve">Adds a buffer to the queue of buffers that the appsrc element will
+push to its source pad. This function does not take ownership of the
+buffer so the buffer needs to be unreffed after calling this function.
+When the block property is TRUE, this function can block until free space
+becomes available in the queue.</doc>
+        <return-value>
+          <type/>
+        </return-value>
+        <parameters>
+          <parameter name="object" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a buffer to push</doc>
+            <type name="Gst.Buffer"/>
+          </parameter>
+        </parameters>
+      </glib:signal>
+      <glib:signal name="seek-data">
+        <doc xml:whitespace="preserve">Seek to the given offset. The next push-buffer should produce buffers from
+the new @offset.
+This callback is only called for seekable stream types.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE if the seek succeeded.</doc>
+          <type name="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="object" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the offset to seek to</doc>
+            <type name="guint64"/>
+          </parameter>
+        </parameters>
+      </glib:signal>
+    </class>
+    <record name="AppSrcCallbacks"
+            c:type="GstAppSrcCallbacks"
+            version="0.10.23">
+      <doc xml:whitespace="preserve">A set of callbacks that can be installed on the appsrc with
+gst_app_src_set_callbacks().</doc>
+      <field name="need_data">
+        <callback name="need_data">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="src" transfer-ownership="none">
+              <type name="AppSrc" c:type="GstAppSrc*"/>
+            </parameter>
+            <parameter name="length" transfer-ownership="none">
+              <type name="guint" c:type="guint"/>
+            </parameter>
+            <parameter name="user_data" transfer-ownership="none" closure="2">
+              <type name="gpointer" c:type="gpointer"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="enough_data">
+        <callback name="enough_data">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="src" transfer-ownership="none">
+              <type name="AppSrc" c:type="GstAppSrc*"/>
+            </parameter>
+            <parameter name="user_data" transfer-ownership="none" closure="1">
+              <type name="gpointer" c:type="gpointer"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="seek_data">
+        <callback name="seek_data">
+          <return-value transfer-ownership="none">
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="src" transfer-ownership="none">
+              <type name="AppSrc" c:type="GstAppSrc*"/>
+            </parameter>
+            <parameter name="offset" transfer-ownership="none">
+              <type name="guint64" c:type="guint64"/>
+            </parameter>
+            <parameter name="user_data" transfer-ownership="none" closure="2">
+              <type name="gpointer" c:type="gpointer"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="_gst_reserved" writable="1">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </record>
+    <record name="AppSrcClass"
+            c:type="GstAppSrcClass"
+            glib:is-gtype-struct-for="AppSrc">
+      <field name="basesrc_class">
+        <type name="GstBase.BaseSrcClass" c:type="GstBaseSrcClass"/>
+      </field>
+      <field name="need_data">
+        <callback name="need_data">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="src" transfer-ownership="none">
+              <type name="AppSrc" c:type="GstAppSrc*"/>
+            </parameter>
+            <parameter name="length" transfer-ownership="none">
+              <type name="guint" c:type="guint"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="enough_data">
+        <callback name="enough_data">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="src" transfer-ownership="none">
+              <type name="AppSrc" c:type="GstAppSrc*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="seek_data">
+        <callback name="seek_data">
+          <return-value transfer-ownership="none">
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="src" transfer-ownership="none">
+              <type name="AppSrc" c:type="GstAppSrc*"/>
+            </parameter>
+            <parameter name="offset" transfer-ownership="none">
+              <type name="guint64" c:type="guint64"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="push_buffer">
+        <callback name="push_buffer">
+          <return-value transfer-ownership="none">
+            <type name="Gst.FlowReturn" c:type="GstFlowReturn"/>
+          </return-value>
+          <parameters>
+            <parameter name="src" transfer-ownership="none">
+              <type name="AppSrc" c:type="GstAppSrc*"/>
+            </parameter>
+            <parameter name="buffer" transfer-ownership="none">
+              <type name="Gst.Buffer" c:type="GstBuffer*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="end_of_stream">
+        <callback name="end_of_stream">
+          <return-value transfer-ownership="none">
+            <type name="Gst.FlowReturn" c:type="GstFlowReturn"/>
+          </return-value>
+          <parameters>
+            <parameter name="src" transfer-ownership="none">
+              <type name="AppSrc" c:type="GstAppSrc*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="_gst_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </record>
+    <record name="AppSrcPrivate" c:type="GstAppSrcPrivate" disguised="1">
+    </record>
+    <enumeration name="AppStreamType"
+                 glib:type-name="GstAppStreamType"
+                 glib:get-type="gst_app_stream_type_get_type"
+                 c:type="GstAppStreamType">
+      <doc xml:whitespace="preserve">The stream type.</doc>
+      <member name="stream"
+              value="0"
+              c:identifier="GST_APP_STREAM_TYPE_STREAM"
+              glib:nick="stream"/>
+      <member name="seekable"
+              value="1"
+              c:identifier="GST_APP_STREAM_TYPE_SEEKABLE"
+              glib:nick="seekable"/>
+      <member name="random_access"
+              value="2"
+              c:identifier="GST_APP_STREAM_TYPE_RANDOM_ACCESS"
+              glib:nick="random-access"/>
+    </enumeration>
+  </namespace>
+</repository>
diff --git a/gstreamer/plugins/app/app.factor b/gstreamer/plugins/app/app.factor
new file mode 100644 (file)
index 0000000..ae80d54
--- /dev/null
@@ -0,0 +1,5 @@
+! Copyright (C) 2010 Anton Gorenko.
+! See http://factorcode.org/license.txt for BSD license.
+USING: gstreamer.app.ffi ;
+IN: gstreamer.app
+
diff --git a/gstreamer/plugins/app/ffi/ffi.factor b/gstreamer/plugins/app/ffi/ffi.factor
new file mode 100644 (file)
index 0000000..b92d568
--- /dev/null
@@ -0,0 +1,17 @@
+! Copyright (C) 2010 Anton Gorenko.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.c-types alien.libraries combinators kernel
+system
+gobject-introspection glib.ffi gstreamer.ffi ;
+IN: gstreamer.app.ffi
+
+<<
+"gstreamer.app" {
+    { [ os winnt? ] [ drop ] }
+    { [ os macosx? ] [ drop ] }
+    { [ os unix? ] [ "libgstapp-0.10.so" cdecl add-library ] }
+} cond
+>>
+
+GIR: vocab:gstreamer/app/GstApp-0.10.gir
+
diff --git a/gstreamer/plugins/audio/GstAudio-0.10.gir b/gstreamer/plugins/audio/GstAudio-0.10.gir
new file mode 100644 (file)
index 0000000..17f9ff3
--- /dev/null
@@ -0,0 +1,2594 @@
+<?xml version="1.0"?>
+<!-- This file was automatically generated from C sources - DO NOT EDIT!
+To affect the contents of this file, edit the original C definitions,
+and/or use gtk-doc annotations.  -->
+<repository version="1.2"
+            xmlns="http://www.gtk.org/introspection/core/1.0"
+            xmlns:c="http://www.gtk.org/introspection/c/1.0"
+            xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+  <include name="GLib" version="2.0"/>
+  <include name="GModule" version="2.0"/>
+  <include name="GObject" version="2.0"/>
+  <include name="Gst" version="0.10"/>
+  <include name="GstBase" version="0.10"/>
+  <include name="GstInterfaces" version="0.10"/>
+  <include name="libxml2" version="2.0"/>
+  <package name="gstreamer-audio-0.10"/>
+  <c:include name="gst/audio/audio-enumtypes.h"/>
+  <c:include name="gst/audio/audio.h"/>
+  <c:include name="gst/audio/gstaudioclock.h"/>
+  <c:include name="gst/audio/gstaudiofilter.h"/>
+  <c:include name="gst/audio/gstaudiosink.h"/>
+  <c:include name="gst/audio/gstaudiosrc.h"/>
+  <c:include name="gst/audio/gstbaseaudiosink.h"/>
+  <c:include name="gst/audio/gstbaseaudiosrc.h"/>
+  <c:include name="gst/audio/gstringbuffer.h"/>
+  <c:include name="gst/audio/mixerutils.h"/>
+  <c:include name="gst/audio/multichannel.h"/>
+  <namespace name="GstAudio"
+             version="0.10"
+             shared-library="libgstaudio-0.10.so.0"
+             c:identifier-prefixes="Gst"
+             c:symbol-prefixes="gst">
+    <constant name="AUDIO_DEF_RATE" value="44100">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="AUDIO_FLOAT_PAD_TEMPLATE_CAPS"
+              value="audio/x-raw-float, rate = (int) [ 1, MAX ], channels = (int) [ 1, MAX ], endianness = (int) { LITTLE_ENDIAN , BIG_ENDIAN }, width = (int) { 32, 64 }">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS"
+              value="audio/x-raw-float, width = (int) 32, rate = (int) [ 1, MAX ], channels = (int) 1, endianness = (int) BYTE_ORDER">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="AUDIO_INT_PAD_TEMPLATE_CAPS"
+              value="audio/x-raw-int, rate = (int) [ 1, MAX ], channels = (int) [ 1, MAX ], endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, width = (int) { 8, 16, 24, 32 }, depth = (int) [ 1, 32 ], signed = (boolean) { true, false }">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="AUDIO_INT_STANDARD_PAD_TEMPLATE_CAPS"
+              value="audio/x-raw-int, rate = (int) [ 1, MAX ], channels = (int) 2, endianness = (int) BYTE_ORDER, width = (int) 16, depth = (int) 16, signed = (boolean) true">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <enumeration name="AudioChannelPosition"
+                 glib:type-name="GstAudioChannelPosition"
+                 glib:get-type="gst_audio_channel_position_get_type"
+                 c:type="GstAudioChannelPosition">
+      <member name="invalid"
+              value="-1"
+              c:identifier="GST_AUDIO_CHANNEL_POSITION_INVALID"
+              glib:nick="invalid"/>
+      <member name="front_mono"
+              value="0"
+              c:identifier="GST_AUDIO_CHANNEL_POSITION_FRONT_MONO"
+              glib:nick="front-mono"/>
+      <member name="front_left"
+              value="1"
+              c:identifier="GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT"
+              glib:nick="front-left"/>
+      <member name="front_right"
+              value="2"
+              c:identifier="GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT"
+              glib:nick="front-right"/>
+      <member name="rear_center"
+              value="3"
+              c:identifier="GST_AUDIO_CHANNEL_POSITION_REAR_CENTER"
+              glib:nick="rear-center"/>
+      <member name="rear_left"
+              value="4"
+              c:identifier="GST_AUDIO_CHANNEL_POSITION_REAR_LEFT"
+              glib:nick="rear-left"/>
+      <member name="rear_right"
+              value="5"
+              c:identifier="GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT"
+              glib:nick="rear-right"/>
+      <member name="lfe"
+              value="6"
+              c:identifier="GST_AUDIO_CHANNEL_POSITION_LFE"
+              glib:nick="lfe"/>
+      <member name="front_center"
+              value="7"
+              c:identifier="GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER"
+              glib:nick="front-center"/>
+      <member name="front_left_of_center"
+              value="8"
+              c:identifier="GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER"
+              glib:nick="front-left-of-center"/>
+      <member name="front_right_of_center"
+              value="9"
+              c:identifier="GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER"
+              glib:nick="front-right-of-center"/>
+      <member name="side_left"
+              value="10"
+              c:identifier="GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT"
+              glib:nick="side-left"/>
+      <member name="side_right"
+              value="11"
+              c:identifier="GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT"
+              glib:nick="side-right"/>
+      <member name="none"
+              value="12"
+              c:identifier="GST_AUDIO_CHANNEL_POSITION_NONE"
+              glib:nick="none"/>
+      <member name="num"
+              value="13"
+              c:identifier="GST_AUDIO_CHANNEL_POSITION_NUM"
+              glib:nick="num"/>
+    </enumeration>
+    <class name="AudioClock"
+           c:symbol-prefix="audio_clock"
+           c:type="GstAudioClock"
+           parent="Gst.SystemClock"
+           glib:type-name="GstAudioClock"
+           glib:get-type="gst_audio_clock_get_type"
+           glib:type-struct="AudioClockClass">
+      <doc xml:whitespace="preserve">Opaque #GstAudioClock.</doc>
+      <constructor name="new"
+                   c:identifier="gst_audio_clock_new"
+                   introspectable="0">
+        <doc xml:whitespace="preserve">Create a new #GstAudioClock instance. Whenever the clock time should be
+calculated it will call @func with @user_data. When @func returns
+#GST_CLOCK_TIME_NONE, the clock will return the last reported time.</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">a new #GstAudioClock casted to a #GstClock.</doc>
+          <type name="Gst.Clock" c:type="GstClock*"/>
+        </return-value>
+        <parameters>
+          <parameter name="name" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the name of the clock</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="func" transfer-ownership="none" closure="2">
+            <doc xml:whitespace="preserve">a function</doc>
+            <type name="AudioClockGetTimeFunc"
+                  c:type="GstAudioClockGetTimeFunc"/>
+          </parameter>
+          <parameter name="user_data" transfer-ownership="none">
+            <doc xml:whitespace="preserve">user data</doc>
+            <type name="gpointer" c:type="gpointer"/>
+          </parameter>
+        </parameters>
+      </constructor>
+      <constructor name="new_full"
+                   c:identifier="gst_audio_clock_new_full"
+                   version="0.10.31">
+        <doc xml:whitespace="preserve">Create a new #GstAudioClock instance. Whenever the clock time should be
+calculated it will call @func with @user_data. When @func returns
+#GST_CLOCK_TIME_NONE, the clock will return the last reported time.</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">a new #GstAudioClock casted to a #GstClock.</doc>
+          <type name="Gst.Clock" c:type="GstClock*"/>
+        </return-value>
+        <parameters>
+          <parameter name="name" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the name of the clock</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="func"
+                     transfer-ownership="none"
+                     scope="notified"
+                     closure="2"
+                     destroy="3">
+            <doc xml:whitespace="preserve">a function</doc>
+            <type name="AudioClockGetTimeFunc"
+                  c:type="GstAudioClockGetTimeFunc"/>
+          </parameter>
+          <parameter name="user_data" transfer-ownership="none">
+            <doc xml:whitespace="preserve">user data</doc>
+            <type name="gpointer" c:type="gpointer"/>
+          </parameter>
+          <parameter name="destroy_notify"
+                     transfer-ownership="none"
+                     scope="async">
+            <doc xml:whitespace="preserve">#GDestroyNotify for @user_data</doc>
+            <type name="GLib.DestroyNotify" c:type="GDestroyNotify"/>
+          </parameter>
+        </parameters>
+      </constructor>
+      <function name="adjust"
+                c:identifier="gst_audio_clock_adjust"
+                version="0.10.23">
+        <doc xml:whitespace="preserve">Adjust @time with the internal offset of the audio clock.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">@time adjusted with the internal offset.</doc>
+          <type name="Gst.ClockTime" c:type="GstClockTime"/>
+        </return-value>
+        <parameters>
+          <parameter name="clock" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a #GstAudioClock</doc>
+            <type name="Gst.Clock" c:type="GstClock*"/>
+          </parameter>
+          <parameter name="time" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a #GstClockTime</doc>
+            <type name="Gst.ClockTime" c:type="GstClockTime"/>
+          </parameter>
+        </parameters>
+      </function>
+      <function name="get_time"
+                c:identifier="gst_audio_clock_get_time"
+                version="0.10.23">
+        <doc xml:whitespace="preserve">Report the time as returned by the #GstAudioClockGetTimeFunc without applying
+any offsets.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the time as reported by the time function of the audio clock</doc>
+          <type name="Gst.ClockTime" c:type="GstClockTime"/>
+        </return-value>
+        <parameters>
+          <parameter name="clock" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a #GstAudioClock</doc>
+            <type name="Gst.Clock" c:type="GstClock*"/>
+          </parameter>
+        </parameters>
+      </function>
+      <function name="invalidate"
+                c:identifier="gst_audio_clock_invalidate"
+                version="0.10.31">
+        <doc xml:whitespace="preserve">Invalidate the clock function. Call this function when the provided
+#GstAudioClockGetTimeFunc cannot be called anymore, for example, when the
+user_data becomes invalid.
+After calling this function, @clock will return the last returned time for
+the rest of its lifetime.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="clock" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a #GstAudioClock</doc>
+            <type name="Gst.Clock" c:type="GstClock*"/>
+          </parameter>
+        </parameters>
+      </function>
+      <method name="reset" c:identifier="gst_audio_clock_reset">
+        <doc xml:whitespace="preserve">Inform @clock that future calls to #GstAudioClockGetTimeFunc will return values
+starting from @time. The clock will update an internal offset to make sure that
+future calls to internal_time will return an increasing result as required by
+the #GstClock object.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="time" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a #GstClockTime</doc>
+            <type name="Gst.ClockTime" c:type="GstClockTime"/>
+          </parameter>
+        </parameters>
+      </method>
+      <field name="clock">
+        <type name="Gst.SystemClock" c:type="GstSystemClock"/>
+      </field>
+      <field name="func">
+        <type name="AudioClockGetTimeFunc" c:type="GstAudioClockGetTimeFunc"/>
+      </field>
+      <field name="user_data">
+        <type name="gpointer" c:type="gpointer"/>
+      </field>
+      <field name="last_time">
+        <type name="Gst.ClockTime" c:type="GstClockTime"/>
+      </field>
+      <union name="abidata" c:type="abidata">
+        <record name="ABI" c:type="ABI">
+          <field name="time_offset" writable="1">
+            <type name="Gst.ClockTimeDiff" c:type="GstClockTimeDiff"/>
+          </field>
+          <field name="destroy_notify" writable="1">
+            <type name="GLib.DestroyNotify" c:type="GDestroyNotify"/>
+          </field>
+        </record>
+        <field name="_gst_reserved" writable="1">
+          <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+            <type name="gpointer" c:type="gpointer"/>
+          </array>
+        </field>
+      </union>
+    </class>
+    <record name="AudioClockClass"
+            c:type="GstAudioClockClass"
+            glib:is-gtype-struct-for="AudioClock">
+      <field name="parent_class">
+        <type name="Gst.SystemClockClass" c:type="GstSystemClockClass"/>
+      </field>
+      <field name="_gst_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </record>
+    <callback name="AudioClockGetTimeFunc" c:type="GstAudioClockGetTimeFunc">
+      <doc xml:whitespace="preserve">This function will be called whenever the current clock time needs to be
+calculated. If this function returns #GST_CLOCK_TIME_NONE, the last reported
+time will be returned by the clock.
+be used.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">the current time or #GST_CLOCK_TIME_NONE if the previous time should</doc>
+        <type name="Gst.ClockTime" c:type="GstClockTime"/>
+      </return-value>
+      <parameters>
+        <parameter name="clock" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the #GstAudioClock</doc>
+          <type name="Gst.Clock" c:type="GstClock*"/>
+        </parameter>
+        <parameter name="user_data" transfer-ownership="none" closure="1">
+          <doc xml:whitespace="preserve">user data</doc>
+          <type name="gpointer" c:type="gpointer"/>
+        </parameter>
+      </parameters>
+    </callback>
+    <bitfield name="AudioFieldFlag"
+              deprecated="use gst_structure_set() directly"
+              c:type="GstAudioFieldFlag">
+      <doc xml:whitespace="preserve">Do not use anymore.</doc>
+      <member name="rate" value="1" c:identifier="GST_AUDIO_FIELD_RATE"/>
+      <member name="channels"
+              value="2"
+              c:identifier="GST_AUDIO_FIELD_CHANNELS"/>
+      <member name="endianness"
+              value="4"
+              c:identifier="GST_AUDIO_FIELD_ENDIANNESS"/>
+      <member name="width" value="8" c:identifier="GST_AUDIO_FIELD_WIDTH"/>
+      <member name="depth" value="16" c:identifier="GST_AUDIO_FIELD_DEPTH"/>
+      <member name="signed" value="32" c:identifier="GST_AUDIO_FIELD_SIGNED"/>
+    </bitfield>
+    <class name="AudioFilter"
+           c:symbol-prefix="audio_filter"
+           c:type="GstAudioFilter"
+           version="0.10.12"
+           parent="GstBase.BaseTransform"
+           abstract="1"
+           glib:type-name="GstAudioFilter"
+           glib:get-type="gst_audio_filter_get_type"
+           glib:type-struct="AudioFilterClass">
+      <doc xml:whitespace="preserve">Base class for audio filters with the same format for input and output.</doc>
+      <virtual-method name="setup">
+        <return-value transfer-ownership="none">
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="format" transfer-ownership="none">
+            <type name="RingBufferSpec" c:type="GstRingBufferSpec*"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <field name="basetransform">
+        <type name="GstBase.BaseTransform" c:type="GstBaseTransform"/>
+      </field>
+      <field name="format">
+        <type name="RingBufferSpec" c:type="GstRingBufferSpec"/>
+      </field>
+      <field name="_gst_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </class>
+    <record name="AudioFilterClass"
+            c:type="GstAudioFilterClass"
+            glib:is-gtype-struct-for="AudioFilter"
+            version="0.10.12">
+      <doc xml:whitespace="preserve">In addition to the @setup virtual function, you should also override the
+GstBaseTransform::transform and/or GstBaseTransform::transform_ip virtual
+function.</doc>
+      <field name="basetransformclass">
+        <type name="GstBase.BaseTransformClass"
+              c:type="GstBaseTransformClass"/>
+      </field>
+      <field name="setup">
+        <callback name="setup">
+          <return-value transfer-ownership="none">
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="filter" transfer-ownership="none">
+              <type name="AudioFilter" c:type="GstAudioFilter*"/>
+            </parameter>
+            <parameter name="format" transfer-ownership="none">
+              <type name="RingBufferSpec" c:type="GstRingBufferSpec*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="_gst_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+      <method name="add_pad_templates"
+              c:identifier="gst_audio_filter_class_add_pad_templates"
+              version="0.10.12">
+        <doc xml:whitespace="preserve">Convenience function to add pad templates to this element class, with
+This function is usually used from within a GObject base_init function.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="allowed_caps" transfer-ownership="none">
+            <doc xml:whitespace="preserve">what formats the filter can handle, as #GstCaps</doc>
+            <type name="Gst.Caps" c:type="GstCaps*"/>
+          </parameter>
+        </parameters>
+      </method>
+    </record>
+    <callback name="AudioMixerFilterFunc" c:type="GstAudioMixerFilterFunc">
+      <doc xml:whitespace="preserve">Function that will be called by gst_audio_default_registry_mixer_filter()
+so the caller can decide which mixer elements should be kept and returned.
+When the mixer element is passed to the callback function, it is opened
+and in READY state. If you decide to keep the element, you need to set it
+back to NULL state yourself (unless you want to keep it opened of course).</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if the element should be kept, FALSE otherwise.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="mixer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstElement implementing the #GstMixer interface</doc>
+          <type name="GstInterfaces.Mixer" c:type="GstMixer*"/>
+        </parameter>
+        <parameter name="user_data" transfer-ownership="none" closure="1">
+          <doc xml:whitespace="preserve">user data</doc>
+          <type name="gpointer" c:type="gpointer"/>
+        </parameter>
+      </parameters>
+    </callback>
+    <class name="AudioSink"
+           c:symbol-prefix="audio_sink"
+           c:type="GstAudioSink"
+           parent="BaseAudioSink"
+           glib:type-name="GstAudioSink"
+           glib:get-type="gst_audio_sink_get_type"
+           glib:type-struct="AudioSinkClass">
+      <doc xml:whitespace="preserve">Opaque #GstAudioSink.</doc>
+      <virtual-method name="close">
+        <return-value transfer-ownership="none">
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </virtual-method>
+      <virtual-method name="delay">
+        <return-value transfer-ownership="none">
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </virtual-method>
+      <virtual-method name="open">
+        <return-value transfer-ownership="none">
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </virtual-method>
+      <virtual-method name="prepare">
+        <return-value transfer-ownership="none">
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="spec" transfer-ownership="none">
+            <type name="RingBufferSpec" c:type="GstRingBufferSpec*"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <virtual-method name="reset">
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+      </virtual-method>
+      <virtual-method name="unprepare">
+        <return-value transfer-ownership="none">
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </virtual-method>
+      <virtual-method name="write">
+        <return-value transfer-ownership="none">
+          <type name="guint" c:type="guint"/>
+        </return-value>
+        <parameters>
+          <parameter name="data" transfer-ownership="none">
+            <type name="gpointer" c:type="gpointer"/>
+          </parameter>
+          <parameter name="length" transfer-ownership="none">
+            <type name="guint" c:type="guint"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <field name="element">
+        <type name="BaseAudioSink" c:type="GstBaseAudioSink"/>
+      </field>
+      <field name="thread">
+        <type name="GLib.Thread" c:type="GThread*"/>
+      </field>
+      <field name="_gst_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </class>
+    <record name="AudioSinkClass"
+            c:type="GstAudioSinkClass"
+            glib:is-gtype-struct-for="AudioSink">
+      <doc xml:whitespace="preserve">#GstAudioSink class. Override the vmethods to implement functionality.</doc>
+      <field name="parent_class">
+        <type name="BaseAudioSinkClass" c:type="GstBaseAudioSinkClass"/>
+      </field>
+      <field name="open">
+        <callback name="open">
+          <return-value transfer-ownership="none">
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="sink" transfer-ownership="none">
+              <type name="AudioSink" c:type="GstAudioSink*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="prepare">
+        <callback name="prepare">
+          <return-value transfer-ownership="none">
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="sink" transfer-ownership="none">
+              <type name="AudioSink" c:type="GstAudioSink*"/>
+            </parameter>
+            <parameter name="spec" transfer-ownership="none">
+              <type name="RingBufferSpec" c:type="GstRingBufferSpec*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="unprepare">
+        <callback name="unprepare">
+          <return-value transfer-ownership="none">
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="sink" transfer-ownership="none">
+              <type name="AudioSink" c:type="GstAudioSink*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="close">
+        <callback name="close">
+          <return-value transfer-ownership="none">
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="sink" transfer-ownership="none">
+              <type name="AudioSink" c:type="GstAudioSink*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="write">
+        <callback name="write">
+          <return-value transfer-ownership="none">
+            <type name="guint" c:type="guint"/>
+          </return-value>
+          <parameters>
+            <parameter name="sink" transfer-ownership="none">
+              <type name="AudioSink" c:type="GstAudioSink*"/>
+            </parameter>
+            <parameter name="data" transfer-ownership="none">
+              <type name="gpointer" c:type="gpointer"/>
+            </parameter>
+            <parameter name="length" transfer-ownership="none">
+              <type name="guint" c:type="guint"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="delay">
+        <callback name="delay">
+          <return-value transfer-ownership="none">
+            <type name="guint" c:type="guint"/>
+          </return-value>
+          <parameters>
+            <parameter name="sink" transfer-ownership="none">
+              <type name="AudioSink" c:type="GstAudioSink*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="reset">
+        <callback name="reset">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="sink" transfer-ownership="none">
+              <type name="AudioSink" c:type="GstAudioSink*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="_gst_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </record>
+    <class name="AudioSrc"
+           c:symbol-prefix="audio_src"
+           c:type="GstAudioSrc"
+           parent="BaseAudioSrc"
+           glib:type-name="GstAudioSrc"
+           glib:get-type="gst_audio_src_get_type"
+           glib:type-struct="AudioSrcClass">
+      <doc xml:whitespace="preserve">Base class for simple audio sources.</doc>
+      <virtual-method name="close">
+        <return-value transfer-ownership="none">
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </virtual-method>
+      <virtual-method name="delay">
+        <return-value transfer-ownership="none">
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </virtual-method>
+      <virtual-method name="open">
+        <return-value transfer-ownership="none">
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </virtual-method>
+      <virtual-method name="prepare">
+        <return-value transfer-ownership="none">
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="spec" transfer-ownership="none">
+            <type name="RingBufferSpec" c:type="GstRingBufferSpec*"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <virtual-method name="read">
+        <return-value transfer-ownership="none">
+          <type name="guint" c:type="guint"/>
+        </return-value>
+        <parameters>
+          <parameter name="data" transfer-ownership="none">
+            <type name="gpointer" c:type="gpointer"/>
+          </parameter>
+          <parameter name="length" transfer-ownership="none">
+            <type name="guint" c:type="guint"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <virtual-method name="reset">
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+      </virtual-method>
+      <virtual-method name="unprepare">
+        <return-value transfer-ownership="none">
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </virtual-method>
+      <field name="element">
+        <type name="BaseAudioSrc" c:type="GstBaseAudioSrc"/>
+      </field>
+      <field name="thread">
+        <type name="GLib.Thread" c:type="GThread*"/>
+      </field>
+      <field name="_gst_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </class>
+    <record name="AudioSrcClass"
+            c:type="GstAudioSrcClass"
+            glib:is-gtype-struct-for="AudioSrc">
+      <doc xml:whitespace="preserve">#GstAudioSrc class. Override the vmethod to implement
+functionality.</doc>
+      <field name="parent_class">
+        <type name="BaseAudioSrcClass" c:type="GstBaseAudioSrcClass"/>
+      </field>
+      <field name="open">
+        <callback name="open">
+          <return-value transfer-ownership="none">
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="src" transfer-ownership="none">
+              <type name="AudioSrc" c:type="GstAudioSrc*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="prepare">
+        <callback name="prepare">
+          <return-value transfer-ownership="none">
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="src" transfer-ownership="none">
+              <type name="AudioSrc" c:type="GstAudioSrc*"/>
+            </parameter>
+            <parameter name="spec" transfer-ownership="none">
+              <type name="RingBufferSpec" c:type="GstRingBufferSpec*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="unprepare">
+        <callback name="unprepare">
+          <return-value transfer-ownership="none">
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="src" transfer-ownership="none">
+              <type name="AudioSrc" c:type="GstAudioSrc*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="close">
+        <callback name="close">
+          <return-value transfer-ownership="none">
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="src" transfer-ownership="none">
+              <type name="AudioSrc" c:type="GstAudioSrc*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="read">
+        <callback name="read">
+          <return-value transfer-ownership="none">
+            <type name="guint" c:type="guint"/>
+          </return-value>
+          <parameters>
+            <parameter name="src" transfer-ownership="none">
+              <type name="AudioSrc" c:type="GstAudioSrc*"/>
+            </parameter>
+            <parameter name="data" transfer-ownership="none">
+              <type name="gpointer" c:type="gpointer"/>
+            </parameter>
+            <parameter name="length" transfer-ownership="none">
+              <type name="guint" c:type="guint"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="delay">
+        <callback name="delay">
+          <return-value transfer-ownership="none">
+            <type name="guint" c:type="guint"/>
+          </return-value>
+          <parameters>
+            <parameter name="src" transfer-ownership="none">
+              <type name="AudioSrc" c:type="GstAudioSrc*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="reset">
+        <callback name="reset">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="src" transfer-ownership="none">
+              <type name="AudioSrc" c:type="GstAudioSrc*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="_gst_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </record>
+    <class name="BaseAudioSink"
+           c:symbol-prefix="base_audio_sink"
+           c:type="GstBaseAudioSink"
+           parent="GstBase.BaseSink"
+           glib:type-name="GstBaseAudioSink"
+           glib:get-type="gst_base_audio_sink_get_type"
+           glib:type-struct="BaseAudioSinkClass">
+      <doc xml:whitespace="preserve">Opaque #GstBaseAudioSink.</doc>
+      <virtual-method name="create_ringbuffer"
+                      invoker="create_ringbuffer"
+                      introspectable="0">
+        <doc xml:whitespace="preserve">Create and return the #GstRingBuffer for @sink. This function will call the
+::create_ringbuffer vmethod and will set @sink as the parent of the returned
+buffer (see gst_object_set_parent()).</doc>
+        <return-value>
+          <doc xml:whitespace="preserve">The new ringbuffer of @sink.</doc>
+          <type name="RingBuffer" c:type="GstRingBuffer*"/>
+        </return-value>
+      </virtual-method>
+      <method name="create_ringbuffer"
+              c:identifier="gst_base_audio_sink_create_ringbuffer"
+              introspectable="0">
+        <doc xml:whitespace="preserve">Create and return the #GstRingBuffer for @sink. This function will call the
+::create_ringbuffer vmethod and will set @sink as the parent of the returned
+buffer (see gst_object_set_parent()).</doc>
+        <return-value>
+          <doc xml:whitespace="preserve">The new ringbuffer of @sink.</doc>
+          <type name="RingBuffer" c:type="GstRingBuffer*"/>
+        </return-value>
+      </method>
+      <method name="get_drift_tolerance"
+              c:identifier="gst_base_audio_sink_get_drift_tolerance">
+        <return-value transfer-ownership="none">
+          <type name="gint64" c:type="gint64"/>
+        </return-value>
+      </method>
+      <method name="get_provide_clock"
+              c:identifier="gst_base_audio_sink_get_provide_clock"
+              version="0.10.16">
+        <doc xml:whitespace="preserve">Queries whether @sink will provide a clock or not. See also
+gst_base_audio_sink_set_provide_clock.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE if @sink will provide a clock.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </method>
+      <method name="get_slave_method"
+              c:identifier="gst_base_audio_sink_get_slave_method"
+              version="0.10.16">
+        <doc xml:whitespace="preserve">Get the current slave method used by @sink.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">The current slave method used by @sink.</doc>
+          <type name="BaseAudioSinkSlaveMethod"
+                c:type="GstBaseAudioSinkSlaveMethod"/>
+        </return-value>
+      </method>
+      <method name="set_drift_tolerance"
+              c:identifier="gst_base_audio_sink_set_drift_tolerance"
+              version="0.10.31">
+        <doc xml:whitespace="preserve">Controls the sink's drift tolerance.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="drift_tolerance" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the new drift tolerance in microseconds</doc>
+            <type name="gint64" c:type="gint64"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_provide_clock"
+              c:identifier="gst_base_audio_sink_set_provide_clock"
+              version="0.10.16">
+        <doc xml:whitespace="preserve">Controls whether @sink will provide a clock or not. If @provide is %TRUE,
+gst_element_provide_clock() will return a clock that reflects the datarate
+of @sink. If @provide is %FALSE, gst_element_provide_clock() will return NULL.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="provide" transfer-ownership="none">
+            <doc xml:whitespace="preserve">new state</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_slave_method"
+              c:identifier="gst_base_audio_sink_set_slave_method"
+              version="0.10.16">
+        <doc xml:whitespace="preserve">Controls how clock slaving will be performed in @sink.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="method" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the new slave method</doc>
+            <type name="BaseAudioSinkSlaveMethod"
+                  c:type="GstBaseAudioSinkSlaveMethod"/>
+          </parameter>
+        </parameters>
+      </method>
+      <property name="buffer-time" writable="1" transfer-ownership="none">
+        <type name="gint64"/>
+      </property>
+      <property name="can-activate-pull"
+                writable="1"
+                transfer-ownership="none">
+        <type name="gboolean"/>
+      </property>
+      <property name="drift-tolerance" writable="1" transfer-ownership="none">
+        <type name="gint64"/>
+      </property>
+      <property name="latency-time" writable="1" transfer-ownership="none">
+        <type name="gint64"/>
+      </property>
+      <property name="provide-clock" writable="1" transfer-ownership="none">
+        <type name="gboolean"/>
+      </property>
+      <property name="slave-method" writable="1" transfer-ownership="none">
+        <type name="BaseAudioSinkSlaveMethod"/>
+      </property>
+      <field name="element">
+        <type name="GstBase.BaseSink" c:type="GstBaseSink"/>
+      </field>
+      <field name="ringbuffer">
+        <type name="RingBuffer" c:type="GstRingBuffer*"/>
+      </field>
+      <field name="buffer_time">
+        <type name="guint64" c:type="guint64"/>
+      </field>
+      <field name="latency_time">
+        <type name="guint64" c:type="guint64"/>
+      </field>
+      <field name="next_sample">
+        <type name="guint64" c:type="guint64"/>
+      </field>
+      <field name="provide_clock">
+        <type name="gboolean" c:type="gboolean"/>
+      </field>
+      <field name="provided_clock">
+        <type name="Gst.Clock" c:type="GstClock*"/>
+      </field>
+      <field name="priv">
+        <type name="BaseAudioSinkPrivate" c:type="GstBaseAudioSinkPrivate*"/>
+      </field>
+      <field name="_gst_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="3">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </class>
+    <record name="BaseAudioSinkClass"
+            c:type="GstBaseAudioSinkClass"
+            glib:is-gtype-struct-for="BaseAudioSink">
+      <doc xml:whitespace="preserve">#GstBaseAudioSink class. Override the vmethod to implement
+functionality.</doc>
+      <field name="parent_class">
+        <type name="GstBase.BaseSinkClass" c:type="GstBaseSinkClass"/>
+      </field>
+      <field name="create_ringbuffer" introspectable="0">
+        <callback name="create_ringbuffer" introspectable="0">
+          <return-value>
+            <doc xml:whitespace="preserve">The new ringbuffer of @sink.</doc>
+            <type name="RingBuffer" c:type="GstRingBuffer*"/>
+          </return-value>
+          <parameters>
+            <parameter name="sink" transfer-ownership="none">
+              <type name="BaseAudioSink" c:type="GstBaseAudioSink*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="_gst_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </record>
+    <record name="BaseAudioSinkPrivate"
+            c:type="GstBaseAudioSinkPrivate"
+            disguised="1">
+    </record>
+    <enumeration name="BaseAudioSinkSlaveMethod"
+                 glib:type-name="GstBaseAudioSinkSlaveMethod"
+                 glib:get-type="gst_base_audio_sink_slave_method_get_type"
+                 c:type="GstBaseAudioSinkSlaveMethod">
+      <doc xml:whitespace="preserve">Different possible clock slaving algorithms used when the internal audio
+clock is not selected as the pipeline master clock.</doc>
+      <member name="resample"
+              value="0"
+              c:identifier="GST_BASE_AUDIO_SINK_SLAVE_RESAMPLE"
+              glib:nick="resample"/>
+      <member name="skew"
+              value="1"
+              c:identifier="GST_BASE_AUDIO_SINK_SLAVE_SKEW"
+              glib:nick="skew"/>
+      <member name="none"
+              value="2"
+              c:identifier="GST_BASE_AUDIO_SINK_SLAVE_NONE"
+              glib:nick="none"/>
+    </enumeration>
+    <class name="BaseAudioSrc"
+           c:symbol-prefix="base_audio_src"
+           c:type="GstBaseAudioSrc"
+           parent="GstBase.PushSrc"
+           glib:type-name="GstBaseAudioSrc"
+           glib:get-type="gst_base_audio_src_get_type"
+           glib:type-struct="BaseAudioSrcClass">
+      <doc xml:whitespace="preserve">Opaque #GstBaseAudioSrc.</doc>
+      <virtual-method name="create_ringbuffer"
+                      invoker="create_ringbuffer"
+                      introspectable="0">
+        <doc xml:whitespace="preserve">Create and return the #GstRingBuffer for @src. This function will call the
+::create_ringbuffer vmethod and will set @src as the parent of the returned
+buffer (see gst_object_set_parent()).</doc>
+        <return-value>
+          <doc xml:whitespace="preserve">The new ringbuffer of @src.</doc>
+          <type name="RingBuffer" c:type="GstRingBuffer*"/>
+        </return-value>
+      </virtual-method>
+      <method name="create_ringbuffer"
+              c:identifier="gst_base_audio_src_create_ringbuffer"
+              introspectable="0">
+        <doc xml:whitespace="preserve">Create and return the #GstRingBuffer for @src. This function will call the
+::create_ringbuffer vmethod and will set @src as the parent of the returned
+buffer (see gst_object_set_parent()).</doc>
+        <return-value>
+          <doc xml:whitespace="preserve">The new ringbuffer of @src.</doc>
+          <type name="RingBuffer" c:type="GstRingBuffer*"/>
+        </return-value>
+      </method>
+      <method name="get_provide_clock"
+              c:identifier="gst_base_audio_src_get_provide_clock"
+              version="0.10.16">
+        <doc xml:whitespace="preserve">Queries whether @src will provide a clock or not. See also
+gst_base_audio_src_set_provide_clock.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE if @src will provide a clock.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </method>
+      <method name="get_slave_method"
+              c:identifier="gst_base_audio_src_get_slave_method"
+              version="0.10.20">
+        <doc xml:whitespace="preserve">Get the current slave method used by @src.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">The current slave method used by @src.</doc>
+          <type name="BaseAudioSrcSlaveMethod"
+                c:type="GstBaseAudioSrcSlaveMethod"/>
+        </return-value>
+      </method>
+      <method name="set_provide_clock"
+              c:identifier="gst_base_audio_src_set_provide_clock"
+              version="0.10.16">
+        <doc xml:whitespace="preserve">Controls whether @src will provide a clock or not. If @provide is %TRUE, 
+gst_element_provide_clock() will return a clock that reflects the datarate
+of @src. If @provide is %FALSE, gst_element_provide_clock() will return NULL.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="provide" transfer-ownership="none">
+            <doc xml:whitespace="preserve">new state</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_slave_method"
+              c:identifier="gst_base_audio_src_set_slave_method"
+              version="0.10.20">
+        <doc xml:whitespace="preserve">Controls how clock slaving will be performed in @src.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="method" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the new slave method</doc>
+            <type name="BaseAudioSrcSlaveMethod"
+                  c:type="GstBaseAudioSrcSlaveMethod"/>
+          </parameter>
+        </parameters>
+      </method>
+      <property name="actual-buffer-time"
+                version="0.10.20"
+                transfer-ownership="none">
+        <doc xml:whitespace="preserve">Actual configured size of audio buffer in microseconds.</doc>
+        <type name="gint64"/>
+      </property>
+      <property name="actual-latency-time"
+                version="0.10.20"
+                transfer-ownership="none">
+        <doc xml:whitespace="preserve">Actual configured audio latency in microseconds.</doc>
+        <type name="gint64"/>
+      </property>
+      <property name="buffer-time" writable="1" transfer-ownership="none">
+        <type name="gint64"/>
+      </property>
+      <property name="latency-time" writable="1" transfer-ownership="none">
+        <type name="gint64"/>
+      </property>
+      <property name="provide-clock" writable="1" transfer-ownership="none">
+        <type name="gboolean"/>
+      </property>
+      <property name="slave-method" writable="1" transfer-ownership="none">
+        <type name="BaseAudioSrcSlaveMethod"/>
+      </property>
+      <field name="element">
+        <type name="GstBase.PushSrc" c:type="GstPushSrc"/>
+      </field>
+      <field name="ringbuffer">
+        <type name="RingBuffer" c:type="GstRingBuffer*"/>
+      </field>
+      <field name="buffer_time">
+        <type name="Gst.ClockTime" c:type="GstClockTime"/>
+      </field>
+      <field name="latency_time">
+        <type name="Gst.ClockTime" c:type="GstClockTime"/>
+      </field>
+      <field name="next_sample">
+        <type name="guint64" c:type="guint64"/>
+      </field>
+      <field name="clock">
+        <type name="Gst.Clock" c:type="GstClock*"/>
+      </field>
+      <field name="priv">
+        <type name="BaseAudioSrcPrivate" c:type="GstBaseAudioSrcPrivate*"/>
+      </field>
+      <field name="_gst_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="3">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </class>
+    <record name="BaseAudioSrcClass"
+            c:type="GstBaseAudioSrcClass"
+            glib:is-gtype-struct-for="BaseAudioSrc">
+      <doc xml:whitespace="preserve">#GstBaseAudioSrc class. Override the vmethod to implement
+functionality.</doc>
+      <field name="parent_class">
+        <type name="GstBase.PushSrcClass" c:type="GstPushSrcClass"/>
+      </field>
+      <field name="create_ringbuffer" introspectable="0">
+        <callback name="create_ringbuffer" introspectable="0">
+          <return-value>
+            <doc xml:whitespace="preserve">The new ringbuffer of @src.</doc>
+            <type name="RingBuffer" c:type="GstRingBuffer*"/>
+          </return-value>
+          <parameters>
+            <parameter name="src" transfer-ownership="none">
+              <type name="BaseAudioSrc" c:type="GstBaseAudioSrc*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="_gst_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </record>
+    <record name="BaseAudioSrcPrivate"
+            c:type="GstBaseAudioSrcPrivate"
+            disguised="1">
+    </record>
+    <enumeration name="BaseAudioSrcSlaveMethod"
+                 glib:type-name="GstBaseAudioSrcSlaveMethod"
+                 glib:get-type="gst_base_audio_src_slave_method_get_type"
+                 c:type="GstBaseAudioSrcSlaveMethod">
+      <doc xml:whitespace="preserve">Different possible clock slaving algorithms when the internal audio clock was
+not selected as the pipeline clock.</doc>
+      <member name="resample"
+              value="0"
+              c:identifier="GST_BASE_AUDIO_SRC_SLAVE_RESAMPLE"
+              glib:nick="resample"/>
+      <member name="re_timestamp"
+              value="1"
+              c:identifier="GST_BASE_AUDIO_SRC_SLAVE_RETIMESTAMP"
+              glib:nick="re-timestamp"/>
+      <member name="skew"
+              value="2"
+              c:identifier="GST_BASE_AUDIO_SRC_SLAVE_SKEW"
+              glib:nick="skew"/>
+      <member name="none"
+              value="3"
+              c:identifier="GST_BASE_AUDIO_SRC_SLAVE_NONE"
+              glib:nick="none"/>
+    </enumeration>
+    <enumeration name="BufferFormat"
+                 glib:type-name="GstBufferFormat"
+                 glib:get-type="gst_buffer_format_get_type"
+                 c:type="GstBufferFormat">
+      <member name="unknown"
+              value="0"
+              c:identifier="GST_UNKNOWN"
+              glib:nick="unknown"/>
+      <member name="s8" value="1" c:identifier="GST_S8" glib:nick="s8"/>
+      <member name="u8" value="2" c:identifier="GST_U8" glib:nick="u8"/>
+      <member name="s16_le"
+              value="3"
+              c:identifier="GST_S16_LE"
+              glib:nick="s16-le"/>
+      <member name="s16_be"
+              value="4"
+              c:identifier="GST_S16_BE"
+              glib:nick="s16-be"/>
+      <member name="u16_le"
+              value="5"
+              c:identifier="GST_U16_LE"
+              glib:nick="u16-le"/>
+      <member name="u16_be"
+              value="6"
+              c:identifier="GST_U16_BE"
+              glib:nick="u16-be"/>
+      <member name="s24_le"
+              value="7"
+              c:identifier="GST_S24_LE"
+              glib:nick="s24-le"/>
+      <member name="s24_be"
+              value="8"
+              c:identifier="GST_S24_BE"
+              glib:nick="s24-be"/>
+      <member name="u24_le"
+              value="9"
+              c:identifier="GST_U24_LE"
+              glib:nick="u24-le"/>
+      <member name="u24_be"
+              value="10"
+              c:identifier="GST_U24_BE"
+              glib:nick="u24-be"/>
+      <member name="s32_le"
+              value="11"
+              c:identifier="GST_S32_LE"
+              glib:nick="s32-le"/>
+      <member name="s32_be"
+              value="12"
+              c:identifier="GST_S32_BE"
+              glib:nick="s32-be"/>
+      <member name="u32_le"
+              value="13"
+              c:identifier="GST_U32_LE"
+              glib:nick="u32-le"/>
+      <member name="u32_be"
+              value="14"
+              c:identifier="GST_U32_BE"
+              glib:nick="u32-be"/>
+      <member name="s24_3le"
+              value="15"
+              c:identifier="GST_S24_3LE"
+              glib:nick="s24-3le"/>
+      <member name="s24_3be"
+              value="16"
+              c:identifier="GST_S24_3BE"
+              glib:nick="s24-3be"/>
+      <member name="u24_3le"
+              value="17"
+              c:identifier="GST_U24_3LE"
+              glib:nick="u24-3le"/>
+      <member name="u24_3be"
+              value="18"
+              c:identifier="GST_U24_3BE"
+              glib:nick="u24-3be"/>
+      <member name="s20_3le"
+              value="19"
+              c:identifier="GST_S20_3LE"
+              glib:nick="s20-3le"/>
+      <member name="s20_3be"
+              value="20"
+              c:identifier="GST_S20_3BE"
+              glib:nick="s20-3be"/>
+      <member name="u20_3le"
+              value="21"
+              c:identifier="GST_U20_3LE"
+              glib:nick="u20-3le"/>
+      <member name="u20_3be"
+              value="22"
+              c:identifier="GST_U20_3BE"
+              glib:nick="u20-3be"/>
+      <member name="s18_3le"
+              value="23"
+              c:identifier="GST_S18_3LE"
+              glib:nick="s18-3le"/>
+      <member name="s18_3be"
+              value="24"
+              c:identifier="GST_S18_3BE"
+              glib:nick="s18-3be"/>
+      <member name="u18_3le"
+              value="25"
+              c:identifier="GST_U18_3LE"
+              glib:nick="u18-3le"/>
+      <member name="u18_3be"
+              value="26"
+              c:identifier="GST_U18_3BE"
+              glib:nick="u18-3be"/>
+      <member name="float32_le"
+              value="27"
+              c:identifier="GST_FLOAT32_LE"
+              glib:nick="float32-le"/>
+      <member name="float32_be"
+              value="28"
+              c:identifier="GST_FLOAT32_BE"
+              glib:nick="float32-be"/>
+      <member name="float64_le"
+              value="29"
+              c:identifier="GST_FLOAT64_LE"
+              glib:nick="float64-le"/>
+      <member name="float64_be"
+              value="30"
+              c:identifier="GST_FLOAT64_BE"
+              glib:nick="float64-be"/>
+      <member name="mu_law"
+              value="31"
+              c:identifier="GST_MU_LAW"
+              glib:nick="mu-law"/>
+      <member name="a_law"
+              value="32"
+              c:identifier="GST_A_LAW"
+              glib:nick="a-law"/>
+      <member name="ima_adpcm"
+              value="33"
+              c:identifier="GST_IMA_ADPCM"
+              glib:nick="ima-adpcm"/>
+      <member name="mpeg" value="34" c:identifier="GST_MPEG" glib:nick="mpeg"/>
+      <member name="gsm" value="35" c:identifier="GST_GSM" glib:nick="gsm"/>
+      <member name="iec958"
+              value="36"
+              c:identifier="GST_IEC958"
+              glib:nick="iec958"/>
+      <member name="ac3" value="37" c:identifier="GST_AC3" glib:nick="ac3"/>
+      <member name="eac3" value="38" c:identifier="GST_EAC3" glib:nick="eac3"/>
+      <member name="dts" value="39" c:identifier="GST_DTS" glib:nick="dts"/>
+    </enumeration>
+    <enumeration name="BufferFormatType"
+                 glib:type-name="GstBufferFormatType"
+                 glib:get-type="gst_buffer_format_type_get_type"
+                 c:type="GstBufferFormatType">
+      <doc xml:whitespace="preserve">The format of the samples in the ringbuffer.</doc>
+      <member name="linear"
+              value="0"
+              c:identifier="GST_BUFTYPE_LINEAR"
+              glib:nick="linear"/>
+      <member name="float"
+              value="1"
+              c:identifier="GST_BUFTYPE_FLOAT"
+              glib:nick="float"/>
+      <member name="mu_law"
+              value="2"
+              c:identifier="GST_BUFTYPE_MU_LAW"
+              glib:nick="mu-law"/>
+      <member name="a_law"
+              value="3"
+              c:identifier="GST_BUFTYPE_A_LAW"
+              glib:nick="a-law"/>
+      <member name="ima_adpcm"
+              value="4"
+              c:identifier="GST_BUFTYPE_IMA_ADPCM"
+              glib:nick="ima-adpcm"/>
+      <member name="mpeg"
+              value="5"
+              c:identifier="GST_BUFTYPE_MPEG"
+              glib:nick="mpeg"/>
+      <member name="gsm"
+              value="6"
+              c:identifier="GST_BUFTYPE_GSM"
+              glib:nick="gsm"/>
+      <member name="iec958"
+              value="7"
+              c:identifier="GST_BUFTYPE_IEC958"
+              glib:nick="iec958"/>
+      <member name="ac3"
+              value="8"
+              c:identifier="GST_BUFTYPE_AC3"
+              glib:nick="ac3"/>
+      <member name="eac3"
+              value="9"
+              c:identifier="GST_BUFTYPE_EAC3"
+              glib:nick="eac3"/>
+      <member name="dts"
+              value="10"
+              c:identifier="GST_BUFTYPE_DTS"
+              glib:nick="dts"/>
+    </enumeration>
+    <class name="RingBuffer"
+           c:symbol-prefix="ring_buffer"
+           c:type="GstRingBuffer"
+           parent="Gst.Object"
+           abstract="1"
+           glib:type-name="GstRingBuffer"
+           glib:get-type="gst_ring_buffer_get_type"
+           glib:type-struct="RingBufferClass">
+      <doc xml:whitespace="preserve">The ringbuffer base class structure.</doc>
+      <function name="debug_spec_buff"
+                c:identifier="gst_ring_buffer_debug_spec_buff">
+        <doc xml:whitespace="preserve">Print debug info about the buffer sized in @spec to the debug log.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="spec" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the spec to debug</doc>
+            <type name="RingBufferSpec" c:type="GstRingBufferSpec*"/>
+          </parameter>
+        </parameters>
+      </function>
+      <function name="debug_spec_caps"
+                c:identifier="gst_ring_buffer_debug_spec_caps">
+        <doc xml:whitespace="preserve">Print debug info about the parsed caps in @spec to the debug log.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="spec" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the spec to debug</doc>
+            <type name="RingBufferSpec" c:type="GstRingBufferSpec*"/>
+          </parameter>
+        </parameters>
+      </function>
+      <function name="parse_caps" c:identifier="gst_ring_buffer_parse_caps">
+        <doc xml:whitespace="preserve">Parse @caps into @spec.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">TRUE if the caps could be parsed.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="spec" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a spec</doc>
+            <type name="RingBufferSpec" c:type="GstRingBufferSpec*"/>
+          </parameter>
+          <parameter name="caps" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a #GstCaps</doc>
+            <type name="Gst.Caps" c:type="GstCaps*"/>
+          </parameter>
+        </parameters>
+      </function>
+      <virtual-method name="acquire" invoker="acquire">
+        <doc xml:whitespace="preserve">Allocate the resources for the ringbuffer. This function fills
+in the data pointer of the ring buffer with a valid #GstBuffer
+to which samples can be written.
+MT safe.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">TRUE if the device could be acquired, FALSE on error.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="spec" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the specs of the buffer</doc>
+            <type name="RingBufferSpec" c:type="GstRingBufferSpec*"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <virtual-method name="activate" invoker="activate" version="0.10.22.">
+        <doc xml:whitespace="preserve">Activate @buf to start or stop pulling data.
+MT safe.
+FALSE on error.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">TRUE if the device could be activated in the requested mode,</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="active" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the new mode</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <virtual-method name="clear_all" invoker="clear_all">
+        <doc xml:whitespace="preserve">Fill the ringbuffer with silence.
+MT safe.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+      </virtual-method>
+      <virtual-method name="close_device" invoker="close_device">
+        <doc xml:whitespace="preserve">Close the audio device associated with the ring buffer. The ring buffer
+should already have been released via gst_ring_buffer_release().
+MT safe.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">TRUE if the device could be closed, FALSE on error.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </virtual-method>
+      <virtual-method name="commit">
+        <return-value transfer-ownership="none">
+          <type name="guint" c:type="guint"/>
+        </return-value>
+        <parameters>
+          <parameter name="sample" transfer-ownership="none">
+            <type name="guint64" c:type="guint64*"/>
+          </parameter>
+          <parameter name="data" transfer-ownership="none">
+            <type name="guint8" c:type="guchar*"/>
+          </parameter>
+          <parameter name="in_samples" transfer-ownership="none">
+            <type name="gint" c:type="gint"/>
+          </parameter>
+          <parameter name="out_samples" transfer-ownership="none">
+            <type name="gint" c:type="gint"/>
+          </parameter>
+          <parameter name="accum" transfer-ownership="none">
+            <type name="gint" c:type="gint*"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <virtual-method name="delay" invoker="delay">
+        <doc xml:whitespace="preserve">Get the number of samples queued in the audio device. This is
+usually less than the segment size but can be bigger when the
+implementation uses another internal buffer between the audio
+device.
+For playback ringbuffers this is the amount of samples transfered from the
+ringbuffer to the device but still not played.
+For capture ringbuffers this is the amount of samples in the device that are
+not yet transfered to the ringbuffer.
+MT safe.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">The number of samples queued in the audio device.</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </virtual-method>
+      <virtual-method name="open_device" invoker="open_device">
+        <doc xml:whitespace="preserve">Open the audio device associated with the ring buffer. Does not perform any
+setup on the device. You must open the device before acquiring the ring
+buffer.
+MT safe.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">TRUE if the device could be opened, FALSE on error.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </virtual-method>
+      <virtual-method name="pause" invoker="pause">
+        <doc xml:whitespace="preserve">Pause processing samples from the ringbuffer.
+MT safe.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">TRUE if the device could be paused, FALSE on error.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </virtual-method>
+      <virtual-method name="release" invoker="release">
+        <doc xml:whitespace="preserve">Free the resources of the ringbuffer.
+MT safe.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">TRUE if the device could be released, FALSE on error.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </virtual-method>
+      <virtual-method name="resume">
+        <return-value transfer-ownership="none">
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </virtual-method>
+      <virtual-method name="start" invoker="start">
+        <doc xml:whitespace="preserve">Start processing samples from the ringbuffer.
+MT safe.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">TRUE if the device could be started, FALSE on error.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </virtual-method>
+      <virtual-method name="stop" invoker="stop">
+        <doc xml:whitespace="preserve">Stop processing samples from the ringbuffer.
+MT safe.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">TRUE if the device could be stopped, FALSE on error.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </virtual-method>
+      <method name="acquire" c:identifier="gst_ring_buffer_acquire">
+        <doc xml:whitespace="preserve">Allocate the resources for the ringbuffer. This function fills
+in the data pointer of the ring buffer with a valid #GstBuffer
+to which samples can be written.
+MT safe.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">TRUE if the device could be acquired, FALSE on error.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="spec" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the specs of the buffer</doc>
+            <type name="RingBufferSpec" c:type="GstRingBufferSpec*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="activate"
+              c:identifier="gst_ring_buffer_activate"
+              version="0.10.22.">
+        <doc xml:whitespace="preserve">Activate @buf to start or stop pulling data.
+MT safe.
+FALSE on error.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">TRUE if the device could be activated in the requested mode,</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="active" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the new mode</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="advance" c:identifier="gst_ring_buffer_advance">
+        <doc xml:whitespace="preserve">Subclasses should call this function to notify the fact that 
+MT safe.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="advance" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the number of segments written</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="clear" c:identifier="gst_ring_buffer_clear">
+        <doc xml:whitespace="preserve">Clear the given segment of the buffer with silence samples.
+This function is used by subclasses.
+MT safe.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="segment" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the segment to clear</doc>
+            <type name="gint" c:type="gint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="clear_all" c:identifier="gst_ring_buffer_clear_all">
+        <doc xml:whitespace="preserve">Fill the ringbuffer with silence.
+MT safe.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+      </method>
+      <method name="close_device" c:identifier="gst_ring_buffer_close_device">
+        <doc xml:whitespace="preserve">Close the audio device associated with the ring buffer. The ring buffer
+should already have been released via gst_ring_buffer_release().
+MT safe.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">TRUE if the device could be closed, FALSE on error.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </method>
+      <method name="commit" c:identifier="gst_ring_buffer_commit">
+        <doc xml:whitespace="preserve">Same as gst_ring_buffer_commit_full() but with a in_samples and out_samples
+equal to @len, ignoring accum.
+error.
+MT safe.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">The number of samples written to the ringbuffer or -1 on</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+        <parameters>
+          <parameter name="sample" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the sample position of the data</doc>
+            <type name="guint64" c:type="guint64"/>
+          </parameter>
+          <parameter name="data" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the data to commit</doc>
+            <type name="guint8" c:type="guchar*"/>
+          </parameter>
+          <parameter name="len" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the number of samples in the data to commit</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="commit_full"
+              c:identifier="gst_ring_buffer_commit_full"
+              version="0.10.11.">
+        <doc xml:whitespace="preserve">Commit @in_samples samples pointed to by @data to the ringbuffer @buf. 
+samples in @data. For negative rates, @out_samples must be negative and
+When @out_samples is positive, the first sample will be written at position @sample
+in the ringbuffer. When @out_samples is negative, the last sample will be written to
+although it is recommended for optimal performance. 
+set to 0 when this function is first called. In case the commit operation is
+interrupted, one can resume the processing by passing the previously returned
+MT safe.
+number of samples written can be less than @out_samples when @buf was interrupted
+with a flush or stop.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">The number of samples written to the ringbuffer or -1 on error. The</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+        <parameters>
+          <parameter name="sample" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the sample position of the data</doc>
+            <type name="guint64" c:type="guint64*"/>
+          </parameter>
+          <parameter name="data" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the data to commit</doc>
+            <type name="guint8" c:type="guchar*"/>
+          </parameter>
+          <parameter name="in_samples" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the number of samples in the data to commit</doc>
+            <type name="gint" c:type="gint"/>
+          </parameter>
+          <parameter name="out_samples" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the number of samples to write to the ringbuffer</doc>
+            <type name="gint" c:type="gint"/>
+          </parameter>
+          <parameter name="accum" transfer-ownership="none">
+            <doc xml:whitespace="preserve">accumulator for rate conversion.</doc>
+            <type name="gint" c:type="gint*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="convert"
+              c:identifier="gst_ring_buffer_convert"
+              version="0.10.22.">
+        <doc xml:whitespace="preserve">Convert @src_val in @src_fmt to the equivalent value in @dest_fmt. The result
+will be put in @dest_val.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">TRUE if the conversion succeeded.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="src_fmt" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the source format</doc>
+            <type name="Gst.Format" c:type="GstFormat"/>
+          </parameter>
+          <parameter name="src_val" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the source value</doc>
+            <type name="gint64" c:type="gint64"/>
+          </parameter>
+          <parameter name="dest_fmt" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the destination format</doc>
+            <type name="Gst.Format" c:type="GstFormat"/>
+          </parameter>
+          <parameter name="dest_val" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a location to store the converted value</doc>
+            <type name="gint64" c:type="gint64*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="delay" c:identifier="gst_ring_buffer_delay">
+        <doc xml:whitespace="preserve">Get the number of samples queued in the audio device. This is
+usually less than the segment size but can be bigger when the
+implementation uses another internal buffer between the audio
+device.
+For playback ringbuffers this is the amount of samples transfered from the
+ringbuffer to the device but still not played.
+For capture ringbuffers this is the amount of samples in the device that are
+not yet transfered to the ringbuffer.
+MT safe.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">The number of samples queued in the audio device.</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </method>
+      <method name="device_is_open"
+              c:identifier="gst_ring_buffer_device_is_open">
+        <doc xml:whitespace="preserve">Checks the status of the device associated with the ring buffer.
+MT safe.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">TRUE if the device was open, FALSE if it was closed.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </method>
+      <method name="is_acquired" c:identifier="gst_ring_buffer_is_acquired">
+        <doc xml:whitespace="preserve">Check if the ringbuffer is acquired and ready to use.
+MT safe.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">TRUE if the ringbuffer is acquired, FALSE on error.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </method>
+      <method name="is_active"
+              c:identifier="gst_ring_buffer_is_active"
+              version="0.10.22.">
+        <doc xml:whitespace="preserve">Check if @buf is activated.
+MT safe.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">TRUE if the device is active.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </method>
+      <method name="may_start"
+              c:identifier="gst_ring_buffer_may_start"
+              version="0.10.6">
+        <doc xml:whitespace="preserve">Tell the ringbuffer that it is allowed to start playback when
+the ringbuffer is filled with samples. 
+MT safe.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="allowed" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the new value</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="open_device" c:identifier="gst_ring_buffer_open_device">
+        <doc xml:whitespace="preserve">Open the audio device associated with the ring buffer. Does not perform any
+setup on the device. You must open the device before acquiring the ring
+buffer.
+MT safe.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">TRUE if the device could be opened, FALSE on error.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </method>
+      <method name="pause" c:identifier="gst_ring_buffer_pause">
+        <doc xml:whitespace="preserve">Pause processing samples from the ringbuffer.
+MT safe.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">TRUE if the device could be paused, FALSE on error.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </method>
+      <method name="prepare_read" c:identifier="gst_ring_buffer_prepare_read">
+        <doc xml:whitespace="preserve">Returns a pointer to memory where the data from segment @segment
+can be found. This function is mostly used by subclasses.
+MT safe.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">FALSE if the buffer is not started.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="segment" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the segment to read</doc>
+            <type name="gint" c:type="gint*"/>
+          </parameter>
+          <parameter name="readptr" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the pointer to the memory where samples can be read</doc>
+            <type name="guint8" c:type="guint8**"/>
+          </parameter>
+          <parameter name="len" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the number of bytes to read</doc>
+            <type name="gint" c:type="gint*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="read" c:identifier="gst_ring_buffer_read">
+        <doc xml:whitespace="preserve">Read @len samples from the ringbuffer into the memory pointed 
+to by @data.
+The first sample should be read from position @sample in
+the ringbuffer.
+although it is recommended.
+error.
+MT safe.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">The number of samples read from the ringbuffer or -1 on</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+        <parameters>
+          <parameter name="sample" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the sample position of the data</doc>
+            <type name="guint64" c:type="guint64"/>
+          </parameter>
+          <parameter name="data" transfer-ownership="none">
+            <doc xml:whitespace="preserve">where the data should be read</doc>
+            <type name="guint8" c:type="guchar*"/>
+          </parameter>
+          <parameter name="len" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the number of samples in data to read</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="release" c:identifier="gst_ring_buffer_release">
+        <doc xml:whitespace="preserve">Free the resources of the ringbuffer.
+MT safe.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">TRUE if the device could be released, FALSE on error.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </method>
+      <method name="samples_done" c:identifier="gst_ring_buffer_samples_done">
+        <doc xml:whitespace="preserve">Get the number of samples that were processed by the ringbuffer
+since it was last started. This does not include the number of samples not
+yet processed (see gst_ring_buffer_delay()).
+MT safe.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">The number of samples processed by the ringbuffer.</doc>
+          <type name="guint64" c:type="guint64"/>
+        </return-value>
+      </method>
+      <method name="set_callback"
+              c:identifier="gst_ring_buffer_set_callback"
+              introspectable="0">
+        <doc xml:whitespace="preserve">Sets the given callback function on the buffer. This function
+will be called every time a segment has been written to a device.
+MT safe.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="cb" transfer-ownership="none" closure="1">
+            <doc xml:whitespace="preserve">the callback to set</doc>
+            <type name="RingBufferCallback" c:type="GstRingBufferCallback"/>
+          </parameter>
+          <parameter name="user_data" transfer-ownership="none">
+            <doc xml:whitespace="preserve">user data passed to the callback</doc>
+            <type name="gpointer" c:type="gpointer"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_flushing" c:identifier="gst_ring_buffer_set_flushing">
+        <doc xml:whitespace="preserve">Set the ringbuffer to flushing mode or normal mode.
+MT safe.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="flushing" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the new mode</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_sample" c:identifier="gst_ring_buffer_set_sample">
+        <doc xml:whitespace="preserve">Make sure that the next sample written to the device is
+accounted for as being the @sample sample written to the
+device. This value will be used in reporting the current
+sample position of the ringbuffer.
+This function will also clear the buffer with silence.
+MT safe.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="sample" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the sample number to set</doc>
+            <type name="guint64" c:type="guint64"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="start" c:identifier="gst_ring_buffer_start">
+        <doc xml:whitespace="preserve">Start processing samples from the ringbuffer.
+MT safe.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">TRUE if the device could be started, FALSE on error.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </method>
+      <method name="stop" c:identifier="gst_ring_buffer_stop">
+        <doc xml:whitespace="preserve">Stop processing samples from the ringbuffer.
+MT safe.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">TRUE if the device could be stopped, FALSE on error.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </method>
+      <field name="object">
+        <type name="Gst.Object" c:type="GstObject"/>
+      </field>
+      <field name="cond">
+        <type name="GLib.Cond" c:type="GCond*"/>
+      </field>
+      <field name="open">
+        <type name="gboolean" c:type="gboolean"/>
+      </field>
+      <field name="acquired">
+        <type name="gboolean" c:type="gboolean"/>
+      </field>
+      <field name="data">
+        <type name="Gst.Buffer" c:type="GstBuffer*"/>
+      </field>
+      <field name="spec">
+        <type name="RingBufferSpec" c:type="GstRingBufferSpec"/>
+      </field>
+      <field name="segstate">
+        <type name="RingBufferSegState" c:type="GstRingBufferSegState*"/>
+      </field>
+      <field name="samples_per_seg">
+        <type name="gint" c:type="gint"/>
+      </field>
+      <field name="empty_seg">
+        <type name="guint8" c:type="guint8*"/>
+      </field>
+      <field name="state">
+        <type name="gint" c:type="gint"/>
+      </field>
+      <field name="segdone">
+        <type name="gint" c:type="gint"/>
+      </field>
+      <field name="segbase">
+        <type name="gint" c:type="gint"/>
+      </field>
+      <field name="waiting">
+        <type name="gint" c:type="gint"/>
+      </field>
+      <field name="callback">
+        <type name="RingBufferCallback" c:type="GstRingBufferCallback"/>
+      </field>
+      <field name="cb_data">
+        <type name="gpointer" c:type="gpointer"/>
+      </field>
+      <union name="abidata" c:type="abidata">
+        <record name="ABI" c:type="ABI">
+          <field name="flushing" writable="1">
+            <type name="gboolean" c:type="gboolean"/>
+          </field>
+          <field name="may_start" writable="1">
+            <type name="gint" c:type="gint"/>
+          </field>
+          <field name="active" writable="1">
+            <type name="gboolean" c:type="gboolean"/>
+          </field>
+        </record>
+        <field name="_gst_reserved" writable="1">
+          <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+            <type name="gpointer" c:type="gpointer"/>
+          </array>
+        </field>
+      </union>
+    </class>
+    <callback name="RingBufferCallback" c:type="GstRingBufferCallback">
+      <doc xml:whitespace="preserve">This function is set with gst_ring_buffer_set_callback() and is
+called to fill the memory at @data with @len bytes of samples.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="rbuf" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstRingBuffer</doc>
+          <type name="RingBuffer" c:type="GstRingBuffer*"/>
+        </parameter>
+        <parameter name="data" transfer-ownership="none">
+          <doc xml:whitespace="preserve">target to fill</doc>
+          <type name="guint8" c:type="guint8*"/>
+        </parameter>
+        <parameter name="len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">amount to fill</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+        <parameter name="user_data" transfer-ownership="none" closure="3">
+          <doc xml:whitespace="preserve">user data</doc>
+          <type name="gpointer" c:type="gpointer"/>
+        </parameter>
+      </parameters>
+    </callback>
+    <record name="RingBufferClass"
+            c:type="GstRingBufferClass"
+            glib:is-gtype-struct-for="RingBuffer">
+      <doc xml:whitespace="preserve">The vmethods that subclasses can override to implement the ringbuffer.</doc>
+      <field name="parent_class">
+        <type name="Gst.ObjectClass" c:type="GstObjectClass"/>
+      </field>
+      <field name="open_device">
+        <callback name="open_device">
+          <return-value transfer-ownership="none">
+            <doc xml:whitespace="preserve">TRUE if the device could be opened, FALSE on error.</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="buf" transfer-ownership="none">
+              <type name="RingBuffer" c:type="GstRingBuffer*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="acquire">
+        <callback name="acquire">
+          <return-value transfer-ownership="none">
+            <doc xml:whitespace="preserve">TRUE if the device could be acquired, FALSE on error.</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="buf" transfer-ownership="none">
+              <type name="RingBuffer" c:type="GstRingBuffer*"/>
+            </parameter>
+            <parameter name="spec" transfer-ownership="none">
+              <doc xml:whitespace="preserve">the specs of the buffer</doc>
+              <type name="RingBufferSpec" c:type="GstRingBufferSpec*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="release">
+        <callback name="release">
+          <return-value transfer-ownership="none">
+            <doc xml:whitespace="preserve">TRUE if the device could be released, FALSE on error.</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="buf" transfer-ownership="none">
+              <type name="RingBuffer" c:type="GstRingBuffer*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="close_device">
+        <callback name="close_device">
+          <return-value transfer-ownership="none">
+            <doc xml:whitespace="preserve">TRUE if the device could be closed, FALSE on error.</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="buf" transfer-ownership="none">
+              <type name="RingBuffer" c:type="GstRingBuffer*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="start">
+        <callback name="start">
+          <return-value transfer-ownership="none">
+            <doc xml:whitespace="preserve">TRUE if the device could be started, FALSE on error.</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="buf" transfer-ownership="none">
+              <type name="RingBuffer" c:type="GstRingBuffer*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="pause">
+        <callback name="pause">
+          <return-value transfer-ownership="none">
+            <doc xml:whitespace="preserve">TRUE if the device could be paused, FALSE on error.</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="buf" transfer-ownership="none">
+              <type name="RingBuffer" c:type="GstRingBuffer*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="resume">
+        <callback name="resume">
+          <return-value transfer-ownership="none">
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="buf" transfer-ownership="none">
+              <type name="RingBuffer" c:type="GstRingBuffer*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="stop">
+        <callback name="stop">
+          <return-value transfer-ownership="none">
+            <doc xml:whitespace="preserve">TRUE if the device could be stopped, FALSE on error.</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="buf" transfer-ownership="none">
+              <type name="RingBuffer" c:type="GstRingBuffer*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="delay">
+        <callback name="delay">
+          <return-value transfer-ownership="none">
+            <doc xml:whitespace="preserve">The number of samples queued in the audio device.</doc>
+            <type name="guint" c:type="guint"/>
+          </return-value>
+          <parameters>
+            <parameter name="buf" transfer-ownership="none">
+              <type name="RingBuffer" c:type="GstRingBuffer*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="activate">
+        <callback name="activate">
+          <return-value transfer-ownership="none">
+            <doc xml:whitespace="preserve">TRUE if the device could be activated in the requested mode,</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="buf" transfer-ownership="none">
+              <type name="RingBuffer" c:type="GstRingBuffer*"/>
+            </parameter>
+            <parameter name="active" transfer-ownership="none">
+              <doc xml:whitespace="preserve">the new mode</doc>
+              <type name="gboolean" c:type="gboolean"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="commit">
+        <callback name="commit">
+          <return-value transfer-ownership="none">
+            <type name="guint" c:type="guint"/>
+          </return-value>
+          <parameters>
+            <parameter name="buf" transfer-ownership="none">
+              <type name="RingBuffer" c:type="GstRingBuffer*"/>
+            </parameter>
+            <parameter name="sample" transfer-ownership="none">
+              <type name="guint64" c:type="guint64*"/>
+            </parameter>
+            <parameter name="data" transfer-ownership="none">
+              <type name="guint8" c:type="guchar*"/>
+            </parameter>
+            <parameter name="in_samples" transfer-ownership="none">
+              <type name="gint" c:type="gint"/>
+            </parameter>
+            <parameter name="out_samples" transfer-ownership="none">
+              <type name="gint" c:type="gint"/>
+            </parameter>
+            <parameter name="accum" transfer-ownership="none">
+              <type name="gint" c:type="gint*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="clear_all">
+        <callback name="clear_all">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="buf" transfer-ownership="none">
+              <type name="RingBuffer" c:type="GstRingBuffer*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="_gst_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="1">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </record>
+    <enumeration name="RingBufferSegState"
+                 glib:type-name="GstRingBufferSegState"
+                 glib:get-type="gst_ring_buffer_seg_state_get_type"
+                 c:type="GstRingBufferSegState">
+      <doc xml:whitespace="preserve">The state of a segment in the ringbuffer.</doc>
+      <member name="invalid"
+              value="0"
+              c:identifier="GST_SEGSTATE_INVALID"
+              glib:nick="invalid"/>
+      <member name="empty"
+              value="1"
+              c:identifier="GST_SEGSTATE_EMPTY"
+              glib:nick="empty"/>
+      <member name="filled"
+              value="2"
+              c:identifier="GST_SEGSTATE_FILLED"
+              glib:nick="filled"/>
+      <member name="partial"
+              value="3"
+              c:identifier="GST_SEGSTATE_PARTIAL"
+              glib:nick="partial"/>
+    </enumeration>
+    <record name="RingBufferSpec" c:type="GstRingBufferSpec">
+      <doc xml:whitespace="preserve">The structure containing the format specification of the ringbuffer.</doc>
+      <field name="caps" writable="1">
+        <type name="Gst.Caps" c:type="GstCaps*"/>
+      </field>
+      <field name="type" writable="1">
+        <type name="BufferFormatType" c:type="GstBufferFormatType"/>
+      </field>
+      <field name="format" writable="1">
+        <type name="BufferFormat" c:type="GstBufferFormat"/>
+      </field>
+      <field name="sign" writable="1">
+        <type name="gboolean" c:type="gboolean"/>
+      </field>
+      <field name="bigend" writable="1">
+        <type name="gboolean" c:type="gboolean"/>
+      </field>
+      <field name="width" writable="1">
+        <type name="gint" c:type="gint"/>
+      </field>
+      <field name="depth" writable="1">
+        <type name="gint" c:type="gint"/>
+      </field>
+      <field name="rate" writable="1">
+        <type name="gint" c:type="gint"/>
+      </field>
+      <field name="channels" writable="1">
+        <type name="gint" c:type="gint"/>
+      </field>
+      <field name="latency_time" writable="1">
+        <type name="guint64" c:type="guint64"/>
+      </field>
+      <field name="buffer_time" writable="1">
+        <type name="guint64" c:type="guint64"/>
+      </field>
+      <field name="segsize" writable="1">
+        <type name="gint" c:type="gint"/>
+      </field>
+      <field name="segtotal" writable="1">
+        <type name="gint" c:type="gint"/>
+      </field>
+      <field name="bytes_per_sample" writable="1">
+        <type name="gint" c:type="gint"/>
+      </field>
+      <field name="silence_sample" writable="1">
+        <array zero-terminated="0" c:type="guint8" fixed-size="32">
+          <type name="guint8" c:type="guint8"/>
+        </array>
+      </field>
+      <field name="seglatency" writable="1">
+        <type name="gint" c:type="gint"/>
+      </field>
+      <field name="_gst_reserved" writable="1">
+        <array zero-terminated="0" c:type="guint8" fixed-size="0">
+          <type name="guint8" c:type="guint8"/>
+        </array>
+      </field>
+    </record>
+    <enumeration name="RingBufferState"
+                 glib:type-name="GstRingBufferState"
+                 glib:get-type="gst_ring_buffer_state_get_type"
+                 c:type="GstRingBufferState">
+      <doc xml:whitespace="preserve">The state of the ringbuffer.</doc>
+      <member name="stopped"
+              value="0"
+              c:identifier="GST_RING_BUFFER_STATE_STOPPED"
+              glib:nick="stopped"/>
+      <member name="paused"
+              value="1"
+              c:identifier="GST_RING_BUFFER_STATE_PAUSED"
+              glib:nick="paused"/>
+      <member name="started"
+              value="2"
+              c:identifier="GST_RING_BUFFER_STATE_STARTED"
+              glib:nick="started"/>
+    </enumeration>
+    <function name="audio_buffer_clip"
+              c:identifier="gst_audio_buffer_clip"
+              version="0.10.14"
+              introspectable="0">
+      <doc xml:whitespace="preserve">Clip the the buffer to the given %GstSegment.
+After calling this function the caller does not own a reference to 
+otherwise the clipped buffer is returned.
+If the buffer has no timestamp, it is assumed to be inside the segment and
+is not clipped</doc>
+      <return-value>
+        <doc xml:whitespace="preserve">%NULL if the buffer is completely outside the configured segment,</doc>
+        <type name="Gst.Buffer" c:type="GstBuffer*"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">The buffer to clip.</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="segment" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Segment in %GST_FORMAT_TIME or %GST_FORMAT_DEFAULT to which the buffer should be clipped.</doc>
+          <type name="Gst.Segment" c:type="GstSegment*"/>
+        </parameter>
+        <parameter name="rate" transfer-ownership="none">
+          <doc xml:whitespace="preserve">sample rate.</doc>
+          <type name="gint" c:type="gint"/>
+        </parameter>
+        <parameter name="frame_size" transfer-ownership="none">
+          <doc xml:whitespace="preserve">size of one audio frame in bytes.</doc>
+          <type name="gint" c:type="gint"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="audio_check_channel_positions"
+              c:identifier="gst_audio_check_channel_positions"
+              version="0.10.20">
+      <doc xml:whitespace="preserve">This functions checks if the given channel positions are valid. Channel
+positions are valid if:
+&lt;itemizedlist&gt;
+&lt;listitem&gt;&lt;para&gt;No channel positions appears twice or all positions are %GST_AUDIO_CHANNEL_POSITION_NONE.
+&lt;/para&gt;&lt;/listitem&gt;
+&lt;listitem&gt;&lt;para&gt;Either all or none of the channel positions are %GST_AUDIO_CHANNEL_POSITION_NONE.
+&lt;/para&gt;&lt;/listitem&gt;
+&lt;listitem&gt;&lt;para&gt;%GST_AUDIO_CHANNEL_POSITION_FRONT_MONO and %GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT or %GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT don't appear together in the given positions.
+&lt;/para&gt;&lt;/listitem&gt;
+&lt;/itemizedlist&gt;
+and %FALSE otherwise.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">%TRUE if the given channel positions are valid</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="pos" transfer-ownership="none">
+          <doc xml:whitespace="preserve">An array of #GstAudioChannelPosition.</doc>
+          <type name="AudioChannelPosition" c:type="GstAudioChannelPosition*"/>
+        </parameter>
+        <parameter name="channels" transfer-ownership="none">
+          <doc xml:whitespace="preserve">The number of elements in @pos.</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="audio_default_registry_mixer_filter"
+              c:identifier="gst_audio_default_registry_mixer_filter"
+              version="0.10.2"
+              introspectable="0">
+      <doc xml:whitespace="preserve">Utility function to find audio mixer elements.
+Will traverse the default plugin registry in order of plugin rank and
+find usable audio mixer elements. The caller may optionally fine-tune
+the selection by specifying a filter function.
+element in the list by setting it to NULL state and calling
+gst_object_unref(). After that the list itself should be freed
+using g_list_free().</doc>
+      <return-value>
+        <doc xml:whitespace="preserve">a #GList of audio mixer #GstElement&lt;!-- --&gt;s. You must free each</doc>
+        <type name="GLib.List" c:type="GList*">
+          <type name="gpointer" c:type="gpointer"/>
+        </type>
+      </return-value>
+      <parameters>
+        <parameter name="filter_func" transfer-ownership="none" closure="2">
+          <doc xml:whitespace="preserve">filter function, or #NULL</doc>
+          <type name="AudioMixerFilterFunc" c:type="GstAudioMixerFilterFunc"/>
+        </parameter>
+        <parameter name="first" transfer-ownership="none">
+          <doc xml:whitespace="preserve">set to #TRUE if you only want the first suitable mixer element</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </parameter>
+        <parameter name="user_data" transfer-ownership="none">
+          <doc xml:whitespace="preserve">user data to pass to the filter function</doc>
+          <type name="gpointer" c:type="gpointer"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="audio_duration_from_pad_buffer"
+              c:identifier="gst_audio_duration_from_pad_buffer">
+      <doc xml:whitespace="preserve">Calculate length in nanoseconds of audio buffer @buf based on capabilities of</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">the length.</doc>
+        <type name="Gst.ClockTime" c:type="GstClockTime"/>
+      </return-value>
+      <parameters>
+        <parameter name="pad" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the #GstPad to get the caps from</doc>
+          <type name="Gst.Pad" c:type="GstPad*"/>
+        </parameter>
+        <parameter name="buf" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the #GstBuffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="audio_fixate_channel_positions"
+              c:identifier="gst_audio_fixate_channel_positions">
+      <doc xml:whitespace="preserve">Custom fixate function. Elements that implement some sort of
+channel conversion algorithm should use this function for
+fixating on GstAudioChannelPosition properties. It will take
+care of equal channel positioning (left/right). Caller g_free()s
+the return value. The input properties may be (and are supposed
+to be) unfixed.
+Note that this function is mostly a hack because we currently
+have no way to add default fixation functions for new GTypes.
+set of #GstAudioChannelPosition values.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">fixed values that the caller could use as a fixed</doc>
+        <type name="AudioChannelPosition" c:type="GstAudioChannelPosition*"/>
+      </return-value>
+      <parameters>
+        <parameter name="str" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstStructure containing a (possibly unfixed) "channel-positions" field.</doc>
+          <type name="Gst.Structure" c:type="GstStructure*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="audio_frame_byte_size"
+              c:identifier="gst_audio_frame_byte_size">
+      <doc xml:whitespace="preserve">Calculate byte size of an audio frame.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">the byte size, or 0 if there was an error</doc>
+        <type name="gint" c:type="int"/>
+      </return-value>
+      <parameters>
+        <parameter name="pad" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the #GstPad to get the caps from</doc>
+          <type name="Gst.Pad" c:type="GstPad*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="audio_frame_length" c:identifier="gst_audio_frame_length">
+      <doc xml:whitespace="preserve">Calculate length of buffer in frames.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">0 if there's an error, or the number of frames if everything's ok</doc>
+        <type name="glong" c:type="long"/>
+      </return-value>
+      <parameters>
+        <parameter name="pad" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the #GstPad to get the caps from</doc>
+          <type name="Gst.Pad" c:type="GstPad*"/>
+        </parameter>
+        <parameter name="buf" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the #GstBuffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="audio_get_channel_positions"
+              c:identifier="gst_audio_get_channel_positions">
+      <doc xml:whitespace="preserve">Retrieves a number of (fixed!) audio channel positions from
+the provided #GstStructure and returns it as a newly allocated
+array. The caller should g_free () this array. The caller
+should also check that the members in this #GstStructure are
+indeed "fixed" before calling this function.
+positions as provided in the given #GstStructure. Returns
+NULL on error.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">a newly allocated array containing the channel</doc>
+        <type name="AudioChannelPosition" c:type="GstAudioChannelPosition*"/>
+      </return-value>
+      <parameters>
+        <parameter name="str" transfer-ownership="none">
+          <doc xml:whitespace="preserve">A #GstStructure to retrieve channel positions from.</doc>
+          <type name="Gst.Structure" c:type="GstStructure*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="audio_is_buffer_framed"
+              c:identifier="gst_audio_is_buffer_framed">
+      <doc xml:whitespace="preserve">Check if the buffer size is a whole multiple of the frame size.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">%TRUE if buffer size is multiple.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="pad" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the #GstPad to get the caps from</doc>
+          <type name="Gst.Pad" c:type="GstPad*"/>
+        </parameter>
+        <parameter name="buf" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the #GstBuffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="audio_set_caps_channel_positions_list"
+              c:identifier="gst_audio_set_caps_channel_positions_list">
+      <doc xml:whitespace="preserve">Sets a (possibly non-fixed) list of possible audio channel
+positions (given in pos) on the given caps. Each of the
+structures of the caps, after this function has been called,
+will contain a "channel-positions" field with an array.
+Each value in the array will contain each of the values given
+in the pos array. Note that the size of the caps might be
+increased by this, since each structure with a "channel-
+positions" field needs to have a fixed "channels" field.
+The input caps is not required to have this.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="caps" transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GstCaps to set the list of channel positions on.</doc>
+          <type name="Gst.Caps" c:type="GstCaps*"/>
+        </parameter>
+        <parameter name="pos" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the array containing one or more possible audio channel positions that we should add in each value of the array in the given structure.</doc>
+          <type name="AudioChannelPosition" c:type="GstAudioChannelPosition*"/>
+        </parameter>
+        <parameter name="num_positions" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the number of values in pos.</doc>
+          <type name="gint" c:type="gint"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="audio_set_channel_positions"
+              c:identifier="gst_audio_set_channel_positions">
+      <doc xml:whitespace="preserve">Adds a "channel-positions" field to the given #GstStructure,
+which will represent the channel positions as given in the
+provided #GstAudioChannelPosition array.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="str" transfer-ownership="none">
+          <doc xml:whitespace="preserve">A #GstStructure to set channel positions on.</doc>
+          <type name="Gst.Structure" c:type="GstStructure*"/>
+        </parameter>
+        <parameter name="pos" transfer-ownership="none">
+          <doc xml:whitespace="preserve">an array of channel positions. The number of members in this array should be equal to the (fixed!) number of the "channels" field in the given #GstStructure.</doc>
+          <type name="AudioChannelPosition" c:type="GstAudioChannelPosition*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="audio_set_structure_channel_positions_list"
+              c:identifier="gst_audio_set_structure_channel_positions_list">
+      <doc xml:whitespace="preserve">Sets a (possibly non-fixed) list of possible audio channel
+positions (given in pos) on the given structure. The
+structure, after this function has been called, will contain
+a "channel-positions" field with an array of the size of
+the "channels" field value in the given structure (note
+that this means that the channels field in the provided
+structure should be fixed!). Each value in the array will
+contain each of the values given in the pos array.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="str" transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GstStructure to set the list of channel positions on.</doc>
+          <type name="Gst.Structure" c:type="GstStructure*"/>
+        </parameter>
+        <parameter name="pos" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the array containing one or more possible audio channel positions that we should add in each value of the array in the given structure.</doc>
+          <type name="AudioChannelPosition" c:type="GstAudioChannelPosition*"/>
+        </parameter>
+        <parameter name="num_positions" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the number of values in pos.</doc>
+          <type name="gint" c:type="gint"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="audio_structure_set_int"
+              c:identifier="gst_audio_structure_set_int"
+              deprecated="use gst_structure_set()">
+      <doc xml:whitespace="preserve">Do not use anymore.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="structure" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstStructure</doc>
+          <type name="Gst.Structure" c:type="GstStructure*"/>
+        </parameter>
+        <parameter name="flag" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a set of #GstAudioFieldFlag</doc>
+          <type name="AudioFieldFlag" c:type="GstAudioFieldFlag"/>
+        </parameter>
+      </parameters>
+    </function>
+  </namespace>
+</repository>
diff --git a/gstreamer/plugins/audio/audio.factor b/gstreamer/plugins/audio/audio.factor
new file mode 100644 (file)
index 0000000..1495be4
--- /dev/null
@@ -0,0 +1,5 @@
+! Copyright (C) 2010 Anton Gorenko.
+! See http://factorcode.org/license.txt for BSD license.
+USING: gstreamer.audio.ffi ;
+IN: gstreamer.audio
+
diff --git a/gstreamer/plugins/audio/ffi/ffi.factor b/gstreamer/plugins/audio/ffi/ffi.factor
new file mode 100644 (file)
index 0000000..5b0be1d
--- /dev/null
@@ -0,0 +1,18 @@
+! Copyright (C) 2010 Anton Gorenko.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.c-types alien.libraries combinators kernel
+system
+gobject-introspection glib.ffi gstreamer.ffi gstreamer.base.ffi
+gstreamer.interfaces.ffi ;
+IN: gstreamer.audio.ffi
+
+<<
+"gstreamer.audio" {
+    { [ os winnt? ] [ drop ] }
+    { [ os macosx? ] [ drop ] }
+    { [ os unix? ] [ "libgstaudio-0.10.so" cdecl add-library ] }
+} cond
+>>
+
+GIR: vocab:gstreamer/audio/GstAudio-0.10.gir
+
diff --git a/gstreamer/plugins/fft/GstFft-0.10.gir b/gstreamer/plugins/fft/GstFft-0.10.gir
new file mode 100644 (file)
index 0000000..8bb49f3
--- /dev/null
@@ -0,0 +1,480 @@
+<?xml version="1.0"?>
+<!-- This file was automatically generated from C sources - DO NOT EDIT!
+To affect the contents of this file, edit the original C definitions,
+and/or use gtk-doc annotations.  -->
+<repository version="1.2"
+            xmlns="http://www.gtk.org/introspection/core/1.0"
+            xmlns:c="http://www.gtk.org/introspection/c/1.0"
+            xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+  <include name="GLib" version="2.0"/>
+  <include name="GModule" version="2.0"/>
+  <include name="GObject" version="2.0"/>
+  <include name="Gst" version="0.10"/>
+  <include name="libxml2" version="2.0"/>
+  <package name="gstreamer-fft-0.10"/>
+  <c:include name="gst/fft/gstfft.h"/>
+  <c:include name="gst/fft/gstfftf32.h"/>
+  <c:include name="gst/fft/gstfftf64.h"/>
+  <c:include name="gst/fft/gstffts16.h"/>
+  <c:include name="gst/fft/gstffts32.h"/>
+  <namespace name="GstFft"
+             version="0.10"
+             shared-library="libgstfft-0.10.so.0"
+             c:identifier-prefixes="Gst"
+             c:symbol-prefixes="gst">
+    <record name="FFTF32" c:type="GstFFTF32">
+      <doc xml:whitespace="preserve">Instance structure for #GstFFTF32.</doc>
+      <field name="cfg" readable="0" private="1">
+        <type name="gpointer" c:type="void*"/>
+      </field>
+      <field name="inverse" readable="0" private="1">
+        <type name="gboolean" c:type="gboolean"/>
+      </field>
+      <field name="len" readable="0" private="1">
+        <type name="gint" c:type="gint"/>
+      </field>
+      <field name="_padding" readable="0" private="1">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+      <method name="fft" c:identifier="gst_fft_f32_fft">
+        <doc xml:whitespace="preserve">This performs the FFT on @timedata and puts the result in @freqdata.
+allocating the #GstFFTF32 instance with gst_fft_f32_new().
+domain samples.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="timedata" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Buffer of the samples in the time domain</doc>
+            <type name="gfloat" c:type="gfloat*"/>
+          </parameter>
+          <parameter name="freqdata" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Target buffer for the samples in the frequency domain</doc>
+            <type name="FFTF32Complex" c:type="GstFFTF32Complex*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="free" c:identifier="gst_fft_f32_free">
+        <doc xml:whitespace="preserve">This frees the memory allocated for @self.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+      </method>
+      <method name="inverse_fft" c:identifier="gst_fft_f32_inverse_fft">
+        <doc xml:whitespace="preserve">This performs the inverse FFT on @freqdata and puts the result in @timedata.
+while allocating the #GstFFTF32 instance with gst_fft_f32_new().</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="freqdata" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Buffer of the samples in the frequency domain</doc>
+            <type name="FFTF32Complex" c:type="GstFFTF32Complex*"/>
+          </parameter>
+          <parameter name="timedata" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Target buffer for the samples in the time domain</doc>
+            <type name="gfloat" c:type="gfloat*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="window" c:identifier="gst_fft_f32_window">
+        <doc xml:whitespace="preserve">This calls the window function @window on the @timedata sample buffer.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="timedata" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Time domain samples</doc>
+            <type name="gfloat" c:type="gfloat*"/>
+          </parameter>
+          <parameter name="window" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Window function to apply</doc>
+            <type name="FFTWindow" c:type="GstFFTWindow"/>
+          </parameter>
+        </parameters>
+      </method>
+    </record>
+    <record name="FFTF32Complex" c:type="GstFFTF32Complex">
+      <doc xml:whitespace="preserve">Data type for complex numbers composed of
+32 bit float.</doc>
+      <field name="r" writable="1">
+        <type name="gfloat" c:type="gfloat"/>
+      </field>
+      <field name="i" writable="1">
+        <type name="gfloat" c:type="gfloat"/>
+      </field>
+    </record>
+    <record name="FFTF64" c:type="GstFFTF64">
+      <doc xml:whitespace="preserve">Instance structure for #GstFFTF64.</doc>
+      <field name="cfg" readable="0" private="1">
+        <type name="gpointer" c:type="void*"/>
+      </field>
+      <field name="inverse" readable="0" private="1">
+        <type name="gboolean" c:type="gboolean"/>
+      </field>
+      <field name="len" readable="0" private="1">
+        <type name="gint" c:type="gint"/>
+      </field>
+      <field name="_padding" readable="0" private="1">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+      <method name="fft" c:identifier="gst_fft_f64_fft">
+        <doc xml:whitespace="preserve">This performs the FFT on @timedata and puts the result in @freqdata.
+allocating the #GstFFTF64 instance with gst_fft_f64_new().
+domain samples.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="timedata" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Buffer of the samples in the time domain</doc>
+            <type name="gdouble" c:type="gdouble*"/>
+          </parameter>
+          <parameter name="freqdata" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Target buffer for the samples in the frequency domain</doc>
+            <type name="FFTF64Complex" c:type="GstFFTF64Complex*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="free" c:identifier="gst_fft_f64_free">
+        <doc xml:whitespace="preserve">This frees the memory allocated for @self.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+      </method>
+      <method name="inverse_fft" c:identifier="gst_fft_f64_inverse_fft">
+        <doc xml:whitespace="preserve">This performs the inverse FFT on @freqdata and puts the result in @timedata.
+while allocating the #GstFFTF64 instance with gst_fft_f64_new().</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="freqdata" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Buffer of the samples in the frequency domain</doc>
+            <type name="FFTF64Complex" c:type="GstFFTF64Complex*"/>
+          </parameter>
+          <parameter name="timedata" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Target buffer for the samples in the time domain</doc>
+            <type name="gdouble" c:type="gdouble*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="window" c:identifier="gst_fft_f64_window">
+        <doc xml:whitespace="preserve">This calls the window function @window on the @timedata sample buffer.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="timedata" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Time domain samples</doc>
+            <type name="gdouble" c:type="gdouble*"/>
+          </parameter>
+          <parameter name="window" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Window function to apply</doc>
+            <type name="FFTWindow" c:type="GstFFTWindow"/>
+          </parameter>
+        </parameters>
+      </method>
+    </record>
+    <record name="FFTF64Complex" c:type="GstFFTF64Complex">
+      <doc xml:whitespace="preserve">Data type for complex numbers composed of
+64 bit float.</doc>
+      <field name="r" writable="1">
+        <type name="gdouble" c:type="gdouble"/>
+      </field>
+      <field name="i" writable="1">
+        <type name="gdouble" c:type="gdouble"/>
+      </field>
+    </record>
+    <record name="FFTS16" c:type="GstFFTS16">
+      <doc xml:whitespace="preserve">Instance structure for #GstFFTS16.</doc>
+      <field name="cfg" readable="0" private="1">
+        <type name="gpointer" c:type="void*"/>
+      </field>
+      <field name="inverse" readable="0" private="1">
+        <type name="gboolean" c:type="gboolean"/>
+      </field>
+      <field name="len" readable="0" private="1">
+        <type name="gint" c:type="gint"/>
+      </field>
+      <field name="_padding" readable="0" private="1">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+      <method name="fft" c:identifier="gst_fft_s16_fft">
+        <doc xml:whitespace="preserve">This performs the FFT on @timedata and puts the result in @freqdata.
+allocating the #GstFFTS16 instance with gst_fft_s16_new().
+domain samples.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="timedata" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Buffer of the samples in the time domain</doc>
+            <type name="gint16" c:type="gint16*"/>
+          </parameter>
+          <parameter name="freqdata" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Target buffer for the samples in the frequency domain</doc>
+            <type name="FFTS16Complex" c:type="GstFFTS16Complex*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="free" c:identifier="gst_fft_s16_free">
+        <doc xml:whitespace="preserve">This frees the memory allocated for @self.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+      </method>
+      <method name="inverse_fft" c:identifier="gst_fft_s16_inverse_fft">
+        <doc xml:whitespace="preserve">This performs the inverse FFT on @freqdata and puts the result in @timedata.
+while allocating the #GstFFTS16 instance with gst_fft_s16_new().</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="freqdata" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Buffer of the samples in the frequency domain</doc>
+            <type name="FFTS16Complex" c:type="GstFFTS16Complex*"/>
+          </parameter>
+          <parameter name="timedata" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Target buffer for the samples in the time domain</doc>
+            <type name="gint16" c:type="gint16*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="window" c:identifier="gst_fft_s16_window">
+        <doc xml:whitespace="preserve">This calls the window function @window on the @timedata sample buffer.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="timedata" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Time domain samples</doc>
+            <type name="gint16" c:type="gint16*"/>
+          </parameter>
+          <parameter name="window" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Window function to apply</doc>
+            <type name="FFTWindow" c:type="GstFFTWindow"/>
+          </parameter>
+        </parameters>
+      </method>
+    </record>
+    <record name="FFTS16Complex" c:type="GstFFTS16Complex">
+      <doc xml:whitespace="preserve">Data type for complex numbers composed of
+signed 16 bit integers.</doc>
+      <field name="r" writable="1">
+        <type name="gint16" c:type="gint16"/>
+      </field>
+      <field name="i" writable="1">
+        <type name="gint16" c:type="gint16"/>
+      </field>
+    </record>
+    <record name="FFTS32" c:type="GstFFTS32">
+      <doc xml:whitespace="preserve">Instance structure for #GstFFTS32.</doc>
+      <field name="cfg" readable="0" private="1">
+        <type name="gpointer" c:type="void*"/>
+      </field>
+      <field name="inverse" readable="0" private="1">
+        <type name="gboolean" c:type="gboolean"/>
+      </field>
+      <field name="len" readable="0" private="1">
+        <type name="gint" c:type="gint"/>
+      </field>
+      <field name="_padding" readable="0" private="1">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+      <method name="fft" c:identifier="gst_fft_s32_fft">
+        <doc xml:whitespace="preserve">This performs the FFT on @timedata and puts the result in @freqdata.
+allocating the #GstFFTS32 instance with gst_fft_s32_new().
+domain samples.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="timedata" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Buffer of the samples in the time domain</doc>
+            <type name="gint32" c:type="gint32*"/>
+          </parameter>
+          <parameter name="freqdata" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Target buffer for the samples in the frequency domain</doc>
+            <type name="FFTS32Complex" c:type="GstFFTS32Complex*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="free" c:identifier="gst_fft_s32_free">
+        <doc xml:whitespace="preserve">This frees the memory allocated for @self.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+      </method>
+      <method name="inverse_fft" c:identifier="gst_fft_s32_inverse_fft">
+        <doc xml:whitespace="preserve">This performs the inverse FFT on @freqdata and puts the result in @timedata.
+while allocating the #GstFFTS32 instance with gst_fft_s32_new().</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="freqdata" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Buffer of the samples in the frequency domain</doc>
+            <type name="FFTS32Complex" c:type="GstFFTS32Complex*"/>
+          </parameter>
+          <parameter name="timedata" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Target buffer for the samples in the time domain</doc>
+            <type name="gint32" c:type="gint32*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="window" c:identifier="gst_fft_s32_window">
+        <doc xml:whitespace="preserve">This calls the window function @window on the @timedata sample buffer.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="timedata" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Time domain samples</doc>
+            <type name="gint32" c:type="gint32*"/>
+          </parameter>
+          <parameter name="window" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Window function to apply</doc>
+            <type name="FFTWindow" c:type="GstFFTWindow"/>
+          </parameter>
+        </parameters>
+      </method>
+    </record>
+    <record name="FFTS32Complex" c:type="GstFFTS32Complex">
+      <doc xml:whitespace="preserve">Data type for complex numbers composed of
+signed 32 bit integers.</doc>
+      <field name="r" writable="1">
+        <type name="gint32" c:type="gint32"/>
+      </field>
+      <field name="i" writable="1">
+        <type name="gint32" c:type="gint32"/>
+      </field>
+    </record>
+    <enumeration name="FFTWindow" c:type="GstFFTWindow">
+      <doc xml:whitespace="preserve">The various window functions available.</doc>
+      <member name="rectangular"
+              value="0"
+              c:identifier="GST_FFT_WINDOW_RECTANGULAR"/>
+      <member name="hamming" value="1" c:identifier="GST_FFT_WINDOW_HAMMING"/>
+      <member name="hann" value="2" c:identifier="GST_FFT_WINDOW_HANN"/>
+      <member name="bartlett"
+              value="3"
+              c:identifier="GST_FFT_WINDOW_BARTLETT"/>
+      <member name="blackman"
+              value="4"
+              c:identifier="GST_FFT_WINDOW_BLACKMAN"/>
+    </enumeration>
+    <function name="fft_f32_new"
+              c:identifier="gst_fft_f32_new"
+              introspectable="0">
+      <doc xml:whitespace="preserve">This returns a new #GstFFTF32 instance with the given parameters. It makes
+sense to keep one instance for several calls for speed reasons.
+2, 3 and 5. To get the next number with this characteristics use
+gst_fft_next_fast_length().</doc>
+      <return-value>
+        <doc xml:whitespace="preserve">a new #GstFFTF32 instance.</doc>
+        <type name="FFTF32" c:type="GstFFTF32*"/>
+      </return-value>
+      <parameters>
+        <parameter name="len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Length of the FFT in the time domain</doc>
+          <type name="gint" c:type="gint"/>
+        </parameter>
+        <parameter name="inverse" transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE if the #GstFFTF32 instance should be used for the inverse FFT</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="fft_f64_new"
+              c:identifier="gst_fft_f64_new"
+              introspectable="0">
+      <doc xml:whitespace="preserve">This returns a new #GstFFTF64 instance with the given parameters. It makes
+sense to keep one instance for several calls for speed reasons.
+2, 3 and 5. To get the next number with this characteristics use
+gst_fft_next_fast_length().</doc>
+      <return-value>
+        <doc xml:whitespace="preserve">a new #GstFFTF64 instance.</doc>
+        <type name="FFTF64" c:type="GstFFTF64*"/>
+      </return-value>
+      <parameters>
+        <parameter name="len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Length of the FFT in the time domain</doc>
+          <type name="gint" c:type="gint"/>
+        </parameter>
+        <parameter name="inverse" transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE if the #GstFFTF64 instance should be used for the inverse FFT</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="fft_next_fast_length"
+              c:identifier="gst_fft_next_fast_length">
+      <doc xml:whitespace="preserve">Returns the next number to @n that is entirely a product
+of 2, 3 and 5. Using this as the @len parameter for
+the different GstFFT types will provide the best performance.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">the next fast FFT length.</doc>
+        <type name="gint" c:type="gint"/>
+      </return-value>
+      <parameters>
+        <parameter name="n" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Number for which the next fast length should be returned</doc>
+          <type name="gint" c:type="gint"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="fft_s16_new"
+              c:identifier="gst_fft_s16_new"
+              introspectable="0">
+      <doc xml:whitespace="preserve">This returns a new #GstFFTS16 instance with the given parameters. It makes
+sense to keep one instance for several calls for speed reasons.
+2, 3 and 5. To get the next number with this characteristics use
+gst_fft_next_fast_length().</doc>
+      <return-value>
+        <doc xml:whitespace="preserve">a new #GstFFTS16 instance.</doc>
+        <type name="FFTS16" c:type="GstFFTS16*"/>
+      </return-value>
+      <parameters>
+        <parameter name="len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Length of the FFT in the time domain</doc>
+          <type name="gint" c:type="gint"/>
+        </parameter>
+        <parameter name="inverse" transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE if the #GstFFTS16 instance should be used for the inverse FFT</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="fft_s32_new"
+              c:identifier="gst_fft_s32_new"
+              introspectable="0">
+      <doc xml:whitespace="preserve">This returns a new #GstFFTS32 instance with the given parameters. It makes
+sense to keep one instance for several calls for speed reasons.
+2, 3 and 5. To get the next number with this characteristics use
+gst_fft_next_fast_length().</doc>
+      <return-value>
+        <doc xml:whitespace="preserve">a new #GstFFTS32 instance.</doc>
+        <type name="FFTS32" c:type="GstFFTS32*"/>
+      </return-value>
+      <parameters>
+        <parameter name="len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Length of the FFT in the time domain</doc>
+          <type name="gint" c:type="gint"/>
+        </parameter>
+        <parameter name="inverse" transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE if the #GstFFTS32 instance should be used for the inverse FFT</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </parameter>
+      </parameters>
+    </function>
+  </namespace>
+</repository>
diff --git a/gstreamer/plugins/fft/ffi/ffi.factor b/gstreamer/plugins/fft/ffi/ffi.factor
new file mode 100644 (file)
index 0000000..77fd0e3
--- /dev/null
@@ -0,0 +1,17 @@
+! Copyright (C) 2010 Anton Gorenko.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.c-types alien.libraries combinators kernel
+system
+gobject-introspection glib.ffi gstreamer.ffi ;
+IN: gstreamer.fft.ffi
+
+<<
+"gstreamer.fft" {
+    { [ os winnt? ] [ drop ] }
+    { [ os macosx? ] [ drop ] }
+    { [ os unix? ] [ "libgstfft-0.10.so" cdecl add-library ] }
+} cond
+>>
+
+GIR: vocab:gstreamer/fft/GstFft-0.10.gir
+
diff --git a/gstreamer/plugins/fft/fft.factor b/gstreamer/plugins/fft/fft.factor
new file mode 100644 (file)
index 0000000..4ddb102
--- /dev/null
@@ -0,0 +1,5 @@
+! Copyright (C) 2010 Anton Gorenko.
+! See http://factorcode.org/license.txt for BSD license.
+USING: gstreamer.fft.ffi ;
+IN: gstreamer.fft
+
diff --git a/gstreamer/plugins/interfaces/GstInterfaces-0.10.gir b/gstreamer/plugins/interfaces/GstInterfaces-0.10.gir
new file mode 100644 (file)
index 0000000..7387a81
--- /dev/null
@@ -0,0 +1,3754 @@
+<?xml version="1.0"?>
+<!-- This file was automatically generated from C sources - DO NOT EDIT!
+To affect the contents of this file, edit the original C definitions,
+and/or use gtk-doc annotations.  -->
+<repository version="1.2"
+            xmlns="http://www.gtk.org/introspection/core/1.0"
+            xmlns:c="http://www.gtk.org/introspection/c/1.0"
+            xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+  <include name="GLib" version="2.0"/>
+  <include name="GModule" version="2.0"/>
+  <include name="GObject" version="2.0"/>
+  <include name="Gst" version="0.10"/>
+  <include name="libxml2" version="2.0"/>
+  <package name="gstreamer-interfaces-0.10"/>
+  <c:include name="gst/interfaces/colorbalance.h"/>
+  <c:include name="gst/interfaces/colorbalancechannel.h"/>
+  <c:include name="gst/interfaces/interfaces-enumtypes.h"/>
+  <c:include name="gst/interfaces/mixer.h"/>
+  <c:include name="gst/interfaces/mixeroptions.h"/>
+  <c:include name="gst/interfaces/mixertrack.h"/>
+  <c:include name="gst/interfaces/navigation.h"/>
+  <c:include name="gst/interfaces/propertyprobe.h"/>
+  <c:include name="gst/interfaces/streamvolume.h"/>
+  <c:include name="gst/interfaces/tuner.h"/>
+  <c:include name="gst/interfaces/tunerchannel.h"/>
+  <c:include name="gst/interfaces/tunernorm.h"/>
+  <c:include name="gst/interfaces/videoorientation.h"/>
+  <c:include name="gst/interfaces/xoverlay.h"/>
+  <namespace name="GstInterfaces"
+             version="0.10"
+             shared-library="libgstinterfaces-0.10.so.0"
+             c:identifier-prefixes="Gst"
+             c:symbol-prefixes="gst">
+    <interface name="ColorBalance"
+               c:symbol-prefix="color_balance"
+               c:type="GstColorBalance"
+               glib:type-name="GstColorBalance"
+               glib:get-type="gst_color_balance_get_type">
+      <prerequisite name="Gst.Element"/>
+      <prerequisite name="Gst.ImplementsInterface"/>
+      <method name="get_balance_type"
+              c:identifier="gst_color_balance_get_balance_type"
+              version="0.10.24">
+        <doc xml:whitespace="preserve">Get the #GstColorBalanceType of this implementation.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">A the #GstColorBalanceType.</doc>
+          <type name="ColorBalanceType" c:type="GstColorBalanceType"/>
+        </return-value>
+      </method>
+      <method name="get_value" c:identifier="gst_color_balance_get_value">
+        <doc xml:whitespace="preserve">Retrieve the current value of the indicated channel, between min_value
+and max_value.
+#GstColorBalanceChannel::max_value members of the
+#GstColorBalanceChannel object.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">The current value of the channel.</doc>
+          <type name="gint" c:type="gint"/>
+        </return-value>
+        <parameters>
+          <parameter name="channel" transfer-ownership="none">
+            <doc xml:whitespace="preserve">A #GstColorBalanceChannel instance</doc>
+            <type name="ColorBalanceChannel" c:type="GstColorBalanceChannel*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="list_channels"
+              c:identifier="gst_color_balance_list_channels">
+        <doc xml:whitespace="preserve">Retrieve a list of the available channels.
+The list is owned by the #GstColorBalance instance and must not
+be freed.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">A GList containing pointers to #GstColorBalanceChannel objects.</doc>
+          <type name="GLib.List" c:type="GList*">
+            <type name="gpointer" c:type="gpointer"/>
+          </type>
+        </return-value>
+      </method>
+      <method name="set_value" c:identifier="gst_color_balance_set_value">
+        <doc xml:whitespace="preserve">Sets the current value of the channel to the passed value, which must
+be between min_value and max_value.
+#GstColorBalanceChannel::max_value members of the
+#GstColorBalanceChannel object.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="channel" transfer-ownership="none">
+            <doc xml:whitespace="preserve">A #GstColorBalanceChannel instance</doc>
+            <type name="ColorBalanceChannel" c:type="GstColorBalanceChannel*"/>
+          </parameter>
+          <parameter name="value" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The new value for the channel.</doc>
+            <type name="gint" c:type="gint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="value_changed"
+              c:identifier="gst_color_balance_value_changed">
+        <doc xml:whitespace="preserve">A helper function called by implementations of the GstColorBalance
+interface. It fires the #GstColorBalance::value-changed signal on the
+instance, and the #GstColorBalanceChannel::value-changed signal on the
+channel object.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="channel" transfer-ownership="none">
+            <doc xml:whitespace="preserve">A #GstColorBalanceChannel whose value has changed</doc>
+            <type name="ColorBalanceChannel" c:type="GstColorBalanceChannel*"/>
+          </parameter>
+          <parameter name="value" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The new value of the channel</doc>
+            <type name="gint" c:type="gint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <glib:signal name="value-changed">
+        <doc xml:whitespace="preserve">Fired when the value of the indicated channel has changed.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none"/>
+        </return-value>
+        <parameters>
+          <parameter name="object" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The #GstColorBalanceChannel</doc>
+            <type name="ColorBalanceChannel"/>
+          </parameter>
+          <parameter name="p0" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The new value</doc>
+            <type name="gint"/>
+          </parameter>
+        </parameters>
+      </glib:signal>
+    </interface>
+    <class name="ColorBalanceChannel"
+           c:symbol-prefix="color_balance_channel"
+           c:type="GstColorBalanceChannel"
+           parent="GObject.Object"
+           glib:type-name="GstColorBalanceChannel"
+           glib:get-type="gst_color_balance_channel_get_type"
+           glib:type-struct="ColorBalanceChannelClass">
+      <field name="parent">
+        <type name="GObject.Object" c:type="GObject"/>
+      </field>
+      <field name="label">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <field name="min_value">
+        <type name="gint" c:type="gint"/>
+      </field>
+      <field name="max_value">
+        <type name="gint" c:type="gint"/>
+      </field>
+      <glib:signal name="value-changed">
+        <doc xml:whitespace="preserve">Fired when the value of the indicated channel has changed.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none"/>
+        </return-value>
+        <parameters>
+          <parameter name="object" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The new value</doc>
+            <type name="gint"/>
+          </parameter>
+        </parameters>
+      </glib:signal>
+    </class>
+    <record name="ColorBalanceChannelClass"
+            c:type="GstColorBalanceChannelClass"
+            glib:is-gtype-struct-for="ColorBalanceChannel">
+      <field name="parent">
+        <type name="GObject.ObjectClass" c:type="GObjectClass"/>
+      </field>
+      <field name="value_changed">
+        <callback name="value_changed">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="channel" transfer-ownership="none">
+              <type name="ColorBalanceChannel"
+                    c:type="GstColorBalanceChannel*"/>
+            </parameter>
+            <parameter name="value" transfer-ownership="none">
+              <type name="gint" c:type="gint"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="_gst_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </record>
+    <record name="ColorBalanceClass" c:type="GstColorBalanceClass">
+      <field name="klass" writable="1">
+        <type name="GObject.TypeInterface" c:type="GTypeInterface"/>
+      </field>
+      <field name="balance_type" writable="1">
+        <type name="ColorBalanceType" c:type="GstColorBalanceType"/>
+      </field>
+      <field name="list_channels">
+        <callback name="list_channels">
+          <return-value transfer-ownership="none">
+            <type name="GLib.List" c:type="GList*">
+              <type name="gpointer" c:type="gpointer"/>
+            </type>
+          </return-value>
+          <parameters>
+            <parameter name="balance" transfer-ownership="none">
+              <type name="ColorBalance" c:type="GstColorBalance*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="set_value">
+        <callback name="set_value">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="balance" transfer-ownership="none">
+              <type name="ColorBalance" c:type="GstColorBalance*"/>
+            </parameter>
+            <parameter name="channel" transfer-ownership="none">
+              <type name="ColorBalanceChannel"
+                    c:type="GstColorBalanceChannel*"/>
+            </parameter>
+            <parameter name="value" transfer-ownership="none">
+              <type name="gint" c:type="gint"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="get_value">
+        <callback name="get_value">
+          <return-value transfer-ownership="none">
+            <type name="gint" c:type="gint"/>
+          </return-value>
+          <parameters>
+            <parameter name="balance" transfer-ownership="none">
+              <type name="ColorBalance" c:type="GstColorBalance*"/>
+            </parameter>
+            <parameter name="channel" transfer-ownership="none">
+              <type name="ColorBalanceChannel"
+                    c:type="GstColorBalanceChannel*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="value_changed">
+        <callback name="value_changed">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="balance" transfer-ownership="none">
+              <type name="ColorBalance" c:type="GstColorBalance*"/>
+            </parameter>
+            <parameter name="channel" transfer-ownership="none">
+              <type name="ColorBalanceChannel"
+                    c:type="GstColorBalanceChannel*"/>
+            </parameter>
+            <parameter name="value" transfer-ownership="none">
+              <type name="gint" c:type="gint"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="_gst_reserved" writable="1">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </record>
+    <enumeration name="ColorBalanceType"
+                 glib:type-name="GstColorBalanceType"
+                 glib:get-type="gst_color_balance_type_get_type"
+                 c:type="GstColorBalanceType">
+      <doc xml:whitespace="preserve">An enumeration indicating whether an element implements color balancing
+operations in software or in dedicated hardware. In general, dedicated
+hardware implementations (such as those provided by xvimagesink) are
+preferred.</doc>
+      <member name="hardware"
+              value="0"
+              c:identifier="GST_COLOR_BALANCE_HARDWARE"
+              glib:nick="hardware"/>
+      <member name="software"
+              value="1"
+              c:identifier="GST_COLOR_BALANCE_SOFTWARE"
+              glib:nick="software"/>
+    </enumeration>
+    <interface name="Mixer"
+               c:symbol-prefix="mixer"
+               c:type="GstMixer"
+               glib:type-name="GstMixer"
+               glib:get-type="gst_mixer_get_type">
+      <prerequisite name="Gst.Element"/>
+      <prerequisite name="Gst.ImplementsInterface"/>
+      <method name="get_mixer_flags" c:identifier="gst_mixer_get_mixer_flags">
+        <doc xml:whitespace="preserve">Get the set of supported flags for this mixer implementation.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">A set of or-ed GstMixerFlags for supported features.</doc>
+          <type name="MixerFlags" c:type="GstMixerFlags"/>
+        </return-value>
+      </method>
+      <method name="get_mixer_type"
+              c:identifier="gst_mixer_get_mixer_type"
+              version="0.10.24">
+        <doc xml:whitespace="preserve">Get the #GstMixerType of this mixer implementation.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">A the #GstMixerType.</doc>
+          <type name="MixerType" c:type="GstMixerType"/>
+        </return-value>
+      </method>
+      <method name="get_option" c:identifier="gst_mixer_get_option">
+        <doc xml:whitespace="preserve">Get the current value of a name/value option in the mixer.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">current value of the name/value option.</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </return-value>
+        <parameters>
+          <parameter name="opts" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The #GstMixerOptions that we operate on.</doc>
+            <type name="MixerOptions" c:type="GstMixerOptions*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="get_volume" c:identifier="gst_mixer_get_volume">
+        <doc xml:whitespace="preserve">Get the current volume(s) on the given track.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="track" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the GstMixerTrack to get the volume from.</doc>
+            <type name="MixerTrack" c:type="GstMixerTrack*"/>
+          </parameter>
+          <parameter name="volumes" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a pre-allocated array of integers (of size track-&gt;num_channels) to store the current volume of each channel in the given track in.</doc>
+            <type name="gint" c:type="gint*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="list_tracks" c:identifier="gst_mixer_list_tracks">
+        <doc xml:whitespace="preserve">Returns a list of available tracks for this mixer/element. Note
+that it is allowed for sink (output) elements to only provide
+the output tracks in this list. Likewise, for sources (inputs),
+it is allowed to only provide input elements in this list.
+The list is owned by the #GstMixer instance and must not be freed
+or modified.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">A #GList consisting of zero or more #GstMixerTracks.</doc>
+          <type name="GLib.List" c:type="GList*">
+            <type name="gpointer" c:type="gpointer"/>
+          </type>
+        </return-value>
+      </method>
+      <method name="mixer_changed"
+              c:identifier="gst_mixer_mixer_changed"
+              version="0.10.18">
+        <doc xml:whitespace="preserve">This function is called by the mixer implementation to produce
+a notification message on the bus indicating that the list of available
+mixer tracks for a given mixer object has changed. Applications should
+rebuild their interface when they receive this message.
+This function only works for GstElements that are implementing the
+GstMixer interface, and the element needs to have been provided a bus.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+      </method>
+      <method name="mute_toggled" c:identifier="gst_mixer_mute_toggled">
+        <doc xml:whitespace="preserve">This function is called by the mixer implementation to produce
+a notification message on the bus indicating that the given track
+has changed mute state.
+This function only works for GstElements that are implementing the
+GstMixer interface, and the element needs to have been provided a bus.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="track" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the GstMixerTrack that has change mute state.</doc>
+            <type name="MixerTrack" c:type="GstMixerTrack*"/>
+          </parameter>
+          <parameter name="mute" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the new state of the mute flag on the track</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="option_changed" c:identifier="gst_mixer_option_changed">
+        <doc xml:whitespace="preserve">This function is called by the mixer implementation to produce
+a notification message on the bus indicating that the given options
+object has changed state. 
+This function only works for GstElements that are implementing the
+GstMixer interface, and the element needs to have been provided a bus.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="opts" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the GstMixerOptions that has changed value.</doc>
+            <type name="MixerOptions" c:type="GstMixerOptions*"/>
+          </parameter>
+          <parameter name="value" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the new value of the GstMixerOptions.</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="options_list_changed"
+              c:identifier="gst_mixer_options_list_changed"
+              version="0.10.18">
+        <doc xml:whitespace="preserve">This function is called by the mixer implementation to produce
+a notification message on the bus indicating that the list of possible
+options of a given options object has changed.
+The new options are not contained in the message on purpose. Applications
+should call gst_mixer_option_get_values() on @opts to make @opts update
+its internal state and obtain the new list of values.
+This function only works for GstElements that are implementing the
+GstMixer interface, and the element needs to have been provided a bus
+for this to work.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="opts" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the GstMixerOptions whose list of values has changed</doc>
+            <type name="MixerOptions" c:type="GstMixerOptions*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="record_toggled" c:identifier="gst_mixer_record_toggled">
+        <doc xml:whitespace="preserve">This function is called by the mixer implementation to produce
+a notification message on the bus indicating that the given track
+has changed recording state.
+This function only works for GstElements that are implementing the
+GstMixer interface, and the element needs to have been provided a bus.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="track" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the GstMixerTrack that has changed recording state.</doc>
+            <type name="MixerTrack" c:type="GstMixerTrack*"/>
+          </parameter>
+          <parameter name="record" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the new state of the record flag on the track</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_mute" c:identifier="gst_mixer_set_mute">
+        <doc xml:whitespace="preserve">Mutes or unmutes the given channel. To find out whether a
+track is currently muted, use GST_MIXER_TRACK_HAS_FLAG ().</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="track" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the #GstMixerTrack to operate on.</doc>
+            <type name="MixerTrack" c:type="GstMixerTrack*"/>
+          </parameter>
+          <parameter name="mute" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a boolean value indicating whether to turn on or off muting.</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_option" c:identifier="gst_mixer_set_option">
+        <doc xml:whitespace="preserve">Sets a name/value option in the mixer to the requested value.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="opts" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The #GstMixerOptions that we operate on.</doc>
+            <type name="MixerOptions" c:type="GstMixerOptions*"/>
+          </parameter>
+          <parameter name="value" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The requested new option value.</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_record" c:identifier="gst_mixer_set_record">
+        <doc xml:whitespace="preserve">Enables or disables recording on the given track. Note that
+this is only possible on input tracks, not on output tracks
+(see GST_MIXER_TRACK_HAS_FLAG () and the GST_MIXER_TRACK_INPUT
+flag).</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="track" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the #GstMixerTrack to operate on.</doc>
+            <type name="MixerTrack" c:type="GstMixerTrack*"/>
+          </parameter>
+          <parameter name="record" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a boolean value that indicates whether to turn on or off recording.</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_volume" c:identifier="gst_mixer_set_volume">
+        <doc xml:whitespace="preserve">Sets the volume on each channel in a track. Short note about
+the mixer/element, such as 'Line-in' or 'Microphone'. A
+channel is said to be a mono-stream inside this track. A
+stereo track thus contains two channels.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="track" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The #GstMixerTrack to set the volume on.</doc>
+            <type name="MixerTrack" c:type="GstMixerTrack*"/>
+          </parameter>
+          <parameter name="volumes" transfer-ownership="none">
+            <doc xml:whitespace="preserve">an array of integers (of size track-&gt;num_channels) that gives the wanted volume for each channel in this track.</doc>
+            <type name="gint" c:type="gint*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="volume_changed" c:identifier="gst_mixer_volume_changed">
+        <doc xml:whitespace="preserve">This function is called by the mixer implementation to produce
+a notification message on the bus indicating that the volume(s) for the
+given track have changed.
+This function only works for GstElements that are implementing the
+GstMixer interface, and the element needs to have been provided a bus.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="track" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the GstMixerTrack that has changed.</doc>
+            <type name="MixerTrack" c:type="GstMixerTrack*"/>
+          </parameter>
+          <parameter name="volumes" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Array of volume values, one per channel on the mixer track.</doc>
+            <type name="gint" c:type="gint*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <glib:signal name="mute-toggled">
+        <return-value transfer-ownership="none">
+          <type name="none"/>
+        </return-value>
+        <parameters>
+          <parameter name="object" transfer-ownership="none">
+            <type name="MixerTrack"/>
+          </parameter>
+          <parameter name="p0" transfer-ownership="none">
+            <type name="gboolean"/>
+          </parameter>
+        </parameters>
+      </glib:signal>
+      <glib:signal name="option-changed">
+        <return-value transfer-ownership="none">
+          <type name="none"/>
+        </return-value>
+        <parameters>
+          <parameter name="object" transfer-ownership="none">
+            <type name="MixerOptions"/>
+          </parameter>
+          <parameter name="p0" transfer-ownership="none">
+            <type name="utf8"/>
+          </parameter>
+        </parameters>
+      </glib:signal>
+      <glib:signal name="record-toggled">
+        <return-value transfer-ownership="none">
+          <type name="none"/>
+        </return-value>
+        <parameters>
+          <parameter name="object" transfer-ownership="none">
+            <type name="MixerTrack"/>
+          </parameter>
+          <parameter name="p0" transfer-ownership="none">
+            <type name="gboolean"/>
+          </parameter>
+        </parameters>
+      </glib:signal>
+      <glib:signal name="volume-changed">
+        <return-value transfer-ownership="none">
+          <type name="none"/>
+        </return-value>
+        <parameters>
+          <parameter name="object" transfer-ownership="none">
+            <type name="MixerTrack"/>
+          </parameter>
+          <parameter name="p0" transfer-ownership="none">
+            <type name="gpointer"/>
+          </parameter>
+        </parameters>
+      </glib:signal>
+    </interface>
+    <record name="MixerClass" c:type="GstMixerClass">
+      <field name="klass" writable="1">
+        <type name="GObject.TypeInterface" c:type="GTypeInterface"/>
+      </field>
+      <field name="mixer_type" writable="1">
+        <type name="MixerType" c:type="GstMixerType"/>
+      </field>
+      <field name="list_tracks">
+        <callback name="list_tracks">
+          <return-value transfer-ownership="none">
+            <type name="GLib.List" c:type="GList*">
+              <type name="gpointer" c:type="gpointer"/>
+            </type>
+          </return-value>
+          <parameters>
+            <parameter name="mixer" transfer-ownership="none">
+              <type name="Mixer" c:type="GstMixer*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="set_volume">
+        <callback name="set_volume">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="mixer" transfer-ownership="none">
+              <type name="Mixer" c:type="GstMixer*"/>
+            </parameter>
+            <parameter name="track" transfer-ownership="none">
+              <type name="MixerTrack" c:type="GstMixerTrack*"/>
+            </parameter>
+            <parameter name="volumes" transfer-ownership="none">
+              <type name="gint" c:type="gint*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="get_volume">
+        <callback name="get_volume">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="mixer" transfer-ownership="none">
+              <type name="Mixer" c:type="GstMixer*"/>
+            </parameter>
+            <parameter name="track" transfer-ownership="none">
+              <type name="MixerTrack" c:type="GstMixerTrack*"/>
+            </parameter>
+            <parameter name="volumes" transfer-ownership="none">
+              <type name="gint" c:type="gint*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="set_mute">
+        <callback name="set_mute">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="mixer" transfer-ownership="none">
+              <type name="Mixer" c:type="GstMixer*"/>
+            </parameter>
+            <parameter name="track" transfer-ownership="none">
+              <type name="MixerTrack" c:type="GstMixerTrack*"/>
+            </parameter>
+            <parameter name="mute" transfer-ownership="none">
+              <type name="gboolean" c:type="gboolean"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="set_record">
+        <callback name="set_record">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="mixer" transfer-ownership="none">
+              <type name="Mixer" c:type="GstMixer*"/>
+            </parameter>
+            <parameter name="track" transfer-ownership="none">
+              <type name="MixerTrack" c:type="GstMixerTrack*"/>
+            </parameter>
+            <parameter name="record" transfer-ownership="none">
+              <type name="gboolean" c:type="gboolean"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="mute_toggled">
+        <callback name="mute_toggled">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="mixer" transfer-ownership="none">
+              <type name="Mixer" c:type="GstMixer*"/>
+            </parameter>
+            <parameter name="channel" transfer-ownership="none">
+              <type name="MixerTrack" c:type="GstMixerTrack*"/>
+            </parameter>
+            <parameter name="mute" transfer-ownership="none">
+              <type name="gboolean" c:type="gboolean"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="record_toggled">
+        <callback name="record_toggled">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="mixer" transfer-ownership="none">
+              <type name="Mixer" c:type="GstMixer*"/>
+            </parameter>
+            <parameter name="channel" transfer-ownership="none">
+              <type name="MixerTrack" c:type="GstMixerTrack*"/>
+            </parameter>
+            <parameter name="record" transfer-ownership="none">
+              <type name="gboolean" c:type="gboolean"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="volume_changed">
+        <callback name="volume_changed">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="mixer" transfer-ownership="none">
+              <type name="Mixer" c:type="GstMixer*"/>
+            </parameter>
+            <parameter name="channel" transfer-ownership="none">
+              <type name="MixerTrack" c:type="GstMixerTrack*"/>
+            </parameter>
+            <parameter name="volumes" transfer-ownership="none">
+              <type name="gint" c:type="gint*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="set_option">
+        <callback name="set_option">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="mixer" transfer-ownership="none">
+              <type name="Mixer" c:type="GstMixer*"/>
+            </parameter>
+            <parameter name="opts" transfer-ownership="none">
+              <type name="MixerOptions" c:type="GstMixerOptions*"/>
+            </parameter>
+            <parameter name="value" transfer-ownership="none">
+              <type name="utf8" c:type="gchar*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="get_option">
+        <callback name="get_option">
+          <return-value transfer-ownership="none">
+            <type name="utf8" c:type="gchar*"/>
+          </return-value>
+          <parameters>
+            <parameter name="mixer" transfer-ownership="none">
+              <type name="Mixer" c:type="GstMixer*"/>
+            </parameter>
+            <parameter name="opts" transfer-ownership="none">
+              <type name="MixerOptions" c:type="GstMixerOptions*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="option_changed">
+        <callback name="option_changed">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="mixer" transfer-ownership="none">
+              <type name="Mixer" c:type="GstMixer*"/>
+            </parameter>
+            <parameter name="opts" transfer-ownership="none">
+              <type name="MixerOptions" c:type="GstMixerOptions*"/>
+            </parameter>
+            <parameter name="option" transfer-ownership="none">
+              <type name="utf8" c:type="gchar*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="get_mixer_flags">
+        <callback name="get_mixer_flags">
+          <return-value transfer-ownership="none">
+            <type name="MixerFlags" c:type="GstMixerFlags"/>
+          </return-value>
+          <parameters>
+            <parameter name="mixer" transfer-ownership="none">
+              <type name="Mixer" c:type="GstMixer*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="_gst_reserved" writable="1">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="3">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </record>
+    <bitfield name="MixerFlags"
+              version="0.10.14"
+              glib:type-name="GstMixerFlags"
+              glib:get-type="gst_mixer_flags_get_type"
+              c:type="GstMixerFlags">
+      <doc xml:whitespace="preserve">Flags indicating which optional features are supported by a mixer
+implementation.</doc>
+      <member name="none"
+              value="0"
+              c:identifier="GST_MIXER_FLAG_NONE"
+              glib:nick="none"/>
+      <member name="auto_notifications"
+              value="1"
+              c:identifier="GST_MIXER_FLAG_AUTO_NOTIFICATIONS"
+              glib:nick="auto-notifications"/>
+      <member name="has_whitelist"
+              value="2"
+              c:identifier="GST_MIXER_FLAG_HAS_WHITELIST"
+              glib:nick="has-whitelist"/>
+      <member name="grouping"
+              value="4"
+              c:identifier="GST_MIXER_FLAG_GROUPING"
+              glib:nick="grouping"/>
+    </bitfield>
+    <enumeration name="MixerMessageType"
+                 version="0.10.14"
+                 glib:type-name="GstMixerMessageType"
+                 glib:get-type="gst_mixer_message_type_get_type"
+                 c:type="GstMixerMessageType">
+      <doc xml:whitespace="preserve">An enumeration for the type of a GstMixer message received on the bus</doc>
+      <member name="invalid"
+              value="0"
+              c:identifier="GST_MIXER_MESSAGE_INVALID"
+              glib:nick="invalid"/>
+      <member name="mute_toggled"
+              value="1"
+              c:identifier="GST_MIXER_MESSAGE_MUTE_TOGGLED"
+              glib:nick="mute-toggled"/>
+      <member name="record_toggled"
+              value="2"
+              c:identifier="GST_MIXER_MESSAGE_RECORD_TOGGLED"
+              glib:nick="record-toggled"/>
+      <member name="volume_changed"
+              value="3"
+              c:identifier="GST_MIXER_MESSAGE_VOLUME_CHANGED"
+              glib:nick="volume-changed"/>
+      <member name="option_changed"
+              value="4"
+              c:identifier="GST_MIXER_MESSAGE_OPTION_CHANGED"
+              glib:nick="option-changed"/>
+      <member name="options_list_changed"
+              value="5"
+              c:identifier="GST_MIXER_MESSAGE_OPTIONS_LIST_CHANGED"
+              glib:nick="options-list-changed"/>
+      <member name="mixer_changed"
+              value="6"
+              c:identifier="GST_MIXER_MESSAGE_MIXER_CHANGED"
+              glib:nick="mixer-changed"/>
+    </enumeration>
+    <class name="MixerOptions"
+           c:symbol-prefix="mixer_options"
+           c:type="GstMixerOptions"
+           parent="MixerTrack"
+           glib:type-name="GstMixerOptions"
+           glib:get-type="gst_mixer_options_get_type"
+           glib:type-struct="MixerOptionsClass">
+      <virtual-method name="get_values"
+                      invoker="get_values"
+                      introspectable="0">
+        <doc xml:whitespace="preserve">Get the values for the mixer option.
+option. You must not free or modify the list or its contents, it belongs
+to the @mixer_options object.</doc>
+        <return-value>
+          <doc xml:whitespace="preserve">A list of strings with all the possible values for the mixer</doc>
+          <type name="GLib.List" c:type="GList*">
+            <type name="gpointer" c:type="gpointer"/>
+          </type>
+        </return-value>
+      </virtual-method>
+      <method name="get_values"
+              c:identifier="gst_mixer_options_get_values"
+              introspectable="0">
+        <doc xml:whitespace="preserve">Get the values for the mixer option.
+option. You must not free or modify the list or its contents, it belongs
+to the @mixer_options object.</doc>
+        <return-value>
+          <doc xml:whitespace="preserve">A list of strings with all the possible values for the mixer</doc>
+          <type name="GLib.List" c:type="GList*">
+            <type name="gpointer" c:type="gpointer"/>
+          </type>
+        </return-value>
+      </method>
+      <field name="parent">
+        <type name="MixerTrack" c:type="GstMixerTrack"/>
+      </field>
+      <field name="values">
+        <type name="GLib.List" c:type="GList*">
+          <type name="gpointer" c:type="gpointer"/>
+        </type>
+      </field>
+      <field name="_gst_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </class>
+    <record name="MixerOptionsClass"
+            c:type="GstMixerOptionsClass"
+            glib:is-gtype-struct-for="MixerOptions">
+      <field name="parent">
+        <type name="MixerTrackClass" c:type="GstMixerTrackClass"/>
+      </field>
+      <field name="get_values" introspectable="0">
+        <callback name="get_values" introspectable="0">
+          <return-value>
+            <doc xml:whitespace="preserve">A list of strings with all the possible values for the mixer</doc>
+            <type name="GLib.List" c:type="GList*">
+              <type name="gpointer" c:type="gpointer"/>
+            </type>
+          </return-value>
+          <parameters>
+            <parameter name="opts" transfer-ownership="none">
+              <type name="MixerOptions" c:type="GstMixerOptions*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="_gst_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="3">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </record>
+    <class name="MixerTrack"
+           c:symbol-prefix="mixer_track"
+           c:type="GstMixerTrack"
+           parent="GObject.Object"
+           glib:type-name="GstMixerTrack"
+           glib:get-type="gst_mixer_track_get_type"
+           glib:type-struct="MixerTrackClass">
+      <property name="flags" transfer-ownership="none">
+        <type name="guint"/>
+      </property>
+      <property name="index"
+                writable="1"
+                construct-only="1"
+                transfer-ownership="none">
+        <type name="guint"/>
+      </property>
+      <property name="label" transfer-ownership="none">
+        <type name="utf8"/>
+      </property>
+      <property name="max-volume" transfer-ownership="none">
+        <type name="gint"/>
+      </property>
+      <property name="min-volume" transfer-ownership="none">
+        <type name="gint"/>
+      </property>
+      <property name="num-channels" transfer-ownership="none">
+        <type name="gint"/>
+      </property>
+      <property name="untranslated-label"
+                writable="1"
+                construct-only="1"
+                transfer-ownership="none">
+        <type name="utf8"/>
+      </property>
+      <field name="parent">
+        <type name="GObject.Object" c:type="GObject"/>
+      </field>
+      <field name="label">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <field name="flags">
+        <type name="MixerTrackFlags" c:type="GstMixerTrackFlags"/>
+      </field>
+      <field name="num_channels">
+        <type name="gint" c:type="gint"/>
+      </field>
+      <field name="min_volume">
+        <type name="gint" c:type="gint"/>
+      </field>
+      <field name="max_volume">
+        <type name="gint" c:type="gint"/>
+      </field>
+    </class>
+    <record name="MixerTrackClass"
+            c:type="GstMixerTrackClass"
+            glib:is-gtype-struct-for="MixerTrack">
+      <field name="parent">
+        <type name="GObject.ObjectClass" c:type="GObjectClass"/>
+      </field>
+      <field name="_gst_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </record>
+    <bitfield name="MixerTrackFlags"
+              glib:type-name="GstMixerTrackFlags"
+              glib:get-type="gst_mixer_track_flags_get_type"
+              c:type="GstMixerTrackFlags">
+      <doc xml:whitespace="preserve">Mixer track flags.</doc>
+      <member name="input"
+              value="1"
+              c:identifier="GST_MIXER_TRACK_INPUT"
+              glib:nick="input"/>
+      <member name="output"
+              value="2"
+              c:identifier="GST_MIXER_TRACK_OUTPUT"
+              glib:nick="output"/>
+      <member name="mute"
+              value="4"
+              c:identifier="GST_MIXER_TRACK_MUTE"
+              glib:nick="mute"/>
+      <member name="record"
+              value="8"
+              c:identifier="GST_MIXER_TRACK_RECORD"
+              glib:nick="record"/>
+      <member name="master"
+              value="16"
+              c:identifier="GST_MIXER_TRACK_MASTER"
+              glib:nick="master"/>
+      <member name="software"
+              value="32"
+              c:identifier="GST_MIXER_TRACK_SOFTWARE"
+              glib:nick="software"/>
+      <member name="no_record"
+              value="64"
+              c:identifier="GST_MIXER_TRACK_NO_RECORD"
+              glib:nick="no-record"/>
+      <member name="no_mute"
+              value="128"
+              c:identifier="GST_MIXER_TRACK_NO_MUTE"
+              glib:nick="no-mute"/>
+      <member name="whitelist"
+              value="256"
+              c:identifier="GST_MIXER_TRACK_WHITELIST"
+              glib:nick="whitelist"/>
+      <member name="readonly"
+              value="512"
+              c:identifier="GST_MIXER_TRACK_READONLY"
+              glib:nick="readonly"/>
+      <member name="writeonly"
+              value="1024"
+              c:identifier="GST_MIXER_TRACK_WRITEONLY"
+              glib:nick="writeonly"/>
+    </bitfield>
+    <enumeration name="MixerType"
+                 glib:type-name="GstMixerType"
+                 glib:get-type="gst_mixer_type_get_type"
+                 c:type="GstMixerType">
+      <member name="hardware"
+              value="0"
+              c:identifier="GST_MIXER_HARDWARE"
+              glib:nick="hardware"/>
+      <member name="software"
+              value="1"
+              c:identifier="GST_MIXER_SOFTWARE"
+              glib:nick="software"/>
+    </enumeration>
+    <interface name="Navigation"
+               c:symbol-prefix="navigation"
+               c:type="GstNavigation"
+               glib:type-name="GstNavigation"
+               glib:get-type="gst_navigation_get_type"
+               glib:type-struct="NavigationInterface">
+      <virtual-method name="send_event" invoker="send_event">
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="structure" transfer-ownership="none">
+            <type name="Gst.Structure" c:type="GstStructure*"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <method name="send_command"
+              c:identifier="gst_navigation_send_command"
+              version="0.10.23">
+        <doc xml:whitespace="preserve">Sends the indicated command to the navigation interface.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="command" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The command to issue</doc>
+            <type name="NavigationCommand" c:type="GstNavigationCommand"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="send_event" c:identifier="gst_navigation_send_event">
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="structure" transfer-ownership="none">
+            <type name="Gst.Structure" c:type="GstStructure*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="send_key_event"
+              c:identifier="gst_navigation_send_key_event">
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="event" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The type of the key event. Recognised values are "key-press" and "key-release"</doc>
+            <type name="utf8" c:type="char*"/>
+          </parameter>
+          <parameter name="key" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Character representation of the key. This is typically as produced by XKeysymToString.</doc>
+            <type name="utf8" c:type="char*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="send_mouse_event"
+              c:identifier="gst_navigation_send_mouse_event">
+        <doc xml:whitespace="preserve">Sends a mouse event to the navigation interface. Mouse event coordinates
+are sent relative to the display space of the related output area. This is
+usually the size in pixels of the window associated with the element
+implementing the #GstNavigation interface.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="event" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The type of mouse event, as a text string. Recognised values are "mouse-button-press", "mouse-button-release" and "mouse-move".</doc>
+            <type name="utf8" c:type="char*"/>
+          </parameter>
+          <parameter name="button" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The button number of the button being pressed or released. Pass 0 for mouse-move events.</doc>
+            <type name="gint" c:type="int"/>
+          </parameter>
+          <parameter name="x" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The x coordinate of the mouse event.</doc>
+            <type name="gdouble" c:type="double"/>
+          </parameter>
+          <parameter name="y" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The y coordinate of the mouse event.</doc>
+            <type name="gdouble" c:type="double"/>
+          </parameter>
+        </parameters>
+      </method>
+    </interface>
+    <enumeration name="NavigationCommand"
+                 version="0.10.23"
+                 glib:type-name="GstNavigationCommand"
+                 glib:get-type="gst_navigation_command_get_type"
+                 c:type="GstNavigationCommand">
+      <doc xml:whitespace="preserve">A set of commands that may be issued to an element providing the
+#GstNavigation interface. The available commands can be queried via
+the gst_navigation_query_new_commands() query.
+For convenience in handling DVD navigation, the MENU commands are aliased as:
+GST_NAVIGATION_COMMAND_DVD_MENU            = @GST_NAVIGATION_COMMAND_MENU1
+GST_NAVIGATION_COMMAND_DVD_TITLE_MENU      = @GST_NAVIGATION_COMMAND_MENU2
+GST_NAVIGATION_COMMAND_DVD_ROOT_MENU       = @GST_NAVIGATION_COMMAND_MENU3
+GST_NAVIGATION_COMMAND_DVD_SUBPICTURE_MENU = @GST_NAVIGATION_COMMAND_MENU4
+GST_NAVIGATION_COMMAND_DVD_AUDIO_MENU      = @GST_NAVIGATION_COMMAND_MENU5
+GST_NAVIGATION_COMMAND_DVD_ANGLE_MENU      = @GST_NAVIGATION_COMMAND_MENU6
+GST_NAVIGATION_COMMAND_DVD_CHAPTER_MENU    = @GST_NAVIGATION_COMMAND_MENU7</doc>
+      <member name="invalid"
+              value="0"
+              c:identifier="GST_NAVIGATION_COMMAND_INVALID"
+              glib:nick="invalid"/>
+      <member name="menu1"
+              value="1"
+              c:identifier="GST_NAVIGATION_COMMAND_MENU1"
+              glib:nick="menu1"/>
+      <member name="menu2"
+              value="2"
+              c:identifier="GST_NAVIGATION_COMMAND_MENU2"
+              glib:nick="menu2"/>
+      <member name="menu3"
+              value="3"
+              c:identifier="GST_NAVIGATION_COMMAND_MENU3"
+              glib:nick="menu3"/>
+      <member name="menu4"
+              value="4"
+              c:identifier="GST_NAVIGATION_COMMAND_MENU4"
+              glib:nick="menu4"/>
+      <member name="menu5"
+              value="5"
+              c:identifier="GST_NAVIGATION_COMMAND_MENU5"
+              glib:nick="menu5"/>
+      <member name="menu6"
+              value="6"
+              c:identifier="GST_NAVIGATION_COMMAND_MENU6"
+              glib:nick="menu6"/>
+      <member name="menu7"
+              value="7"
+              c:identifier="GST_NAVIGATION_COMMAND_MENU7"
+              glib:nick="menu7"/>
+      <member name="left"
+              value="20"
+              c:identifier="GST_NAVIGATION_COMMAND_LEFT"
+              glib:nick="left"/>
+      <member name="right"
+              value="21"
+              c:identifier="GST_NAVIGATION_COMMAND_RIGHT"
+              glib:nick="right"/>
+      <member name="up"
+              value="22"
+              c:identifier="GST_NAVIGATION_COMMAND_UP"
+              glib:nick="up"/>
+      <member name="down"
+              value="23"
+              c:identifier="GST_NAVIGATION_COMMAND_DOWN"
+              glib:nick="down"/>
+      <member name="activate"
+              value="24"
+              c:identifier="GST_NAVIGATION_COMMAND_ACTIVATE"
+              glib:nick="activate"/>
+      <member name="prev_angle"
+              value="30"
+              c:identifier="GST_NAVIGATION_COMMAND_PREV_ANGLE"
+              glib:nick="prev-angle"/>
+      <member name="next_angle"
+              value="31"
+              c:identifier="GST_NAVIGATION_COMMAND_NEXT_ANGLE"
+              glib:nick="next-angle"/>
+    </enumeration>
+    <enumeration name="NavigationEventType"
+                 version="0.10.23"
+                 glib:type-name="GstNavigationEventType"
+                 glib:get-type="gst_navigation_event_type_get_type"
+                 c:type="GstNavigationEventType">
+      <doc xml:whitespace="preserve">Enum values for the various events that an element implementing the
+GstNavigation interface might send up the pipeline.</doc>
+      <member name="invalid"
+              value="0"
+              c:identifier="GST_NAVIGATION_EVENT_INVALID"
+              glib:nick="invalid"/>
+      <member name="key_press"
+              value="1"
+              c:identifier="GST_NAVIGATION_EVENT_KEY_PRESS"
+              glib:nick="key-press"/>
+      <member name="key_release"
+              value="2"
+              c:identifier="GST_NAVIGATION_EVENT_KEY_RELEASE"
+              glib:nick="key-release"/>
+      <member name="mouse_button_press"
+              value="3"
+              c:identifier="GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS"
+              glib:nick="mouse-button-press"/>
+      <member name="mouse_button_release"
+              value="4"
+              c:identifier="GST_NAVIGATION_EVENT_MOUSE_BUTTON_RELEASE"
+              glib:nick="mouse-button-release"/>
+      <member name="mouse_move"
+              value="5"
+              c:identifier="GST_NAVIGATION_EVENT_MOUSE_MOVE"
+              glib:nick="mouse-move"/>
+      <member name="command"
+              value="6"
+              c:identifier="GST_NAVIGATION_EVENT_COMMAND"
+              glib:nick="command"/>
+    </enumeration>
+    <record name="NavigationInterface"
+            c:type="GstNavigationInterface"
+            glib:is-gtype-struct-for="Navigation">
+      <field name="g_iface">
+        <type name="GObject.TypeInterface" c:type="GTypeInterface"/>
+      </field>
+      <field name="send_event">
+        <callback name="send_event">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="navigation" transfer-ownership="none">
+              <type name="Navigation" c:type="GstNavigation*"/>
+            </parameter>
+            <parameter name="structure" transfer-ownership="none">
+              <type name="Gst.Structure" c:type="GstStructure*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="_gst_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </record>
+    <enumeration name="NavigationMessageType"
+                 version="0.10.23"
+                 glib:type-name="GstNavigationMessageType"
+                 glib:get-type="gst_navigation_message_type_get_type"
+                 c:type="GstNavigationMessageType">
+      <doc xml:whitespace="preserve">A set of notifications that may be received on the bus when navigation
+related status changes.</doc>
+      <member name="invalid"
+              value="0"
+              c:identifier="GST_NAVIGATION_MESSAGE_INVALID"
+              glib:nick="invalid"/>
+      <member name="mouse_over"
+              value="1"
+              c:identifier="GST_NAVIGATION_MESSAGE_MOUSE_OVER"
+              glib:nick="mouse-over"/>
+      <member name="commands_changed"
+              value="2"
+              c:identifier="GST_NAVIGATION_MESSAGE_COMMANDS_CHANGED"
+              glib:nick="commands-changed"/>
+      <member name="angles_changed"
+              value="3"
+              c:identifier="GST_NAVIGATION_MESSAGE_ANGLES_CHANGED"
+              glib:nick="angles-changed"/>
+    </enumeration>
+    <enumeration name="NavigationQueryType"
+                 glib:type-name="GstNavigationQueryType"
+                 glib:get-type="gst_navigation_query_type_get_type"
+                 c:type="GstNavigationQueryType">
+      <member name="invalid"
+              value="0"
+              c:identifier="GST_NAVIGATION_QUERY_INVALID"
+              glib:nick="invalid"/>
+      <member name="commands"
+              value="1"
+              c:identifier="GST_NAVIGATION_QUERY_COMMANDS"
+              glib:nick="commands"/>
+      <member name="angles"
+              value="2"
+              c:identifier="GST_NAVIGATION_QUERY_ANGLES"
+              glib:nick="angles"/>
+    </enumeration>
+    <interface name="PropertyProbe"
+               c:symbol-prefix="property_probe"
+               c:type="GstPropertyProbe"
+               glib:type-name="GstPropertyProbe"
+               glib:get-type="gst_property_probe_get_type"
+               glib:type-struct="PropertyProbeInterface">
+      <doc xml:whitespace="preserve">Opaque #GstPropertyProbe data structure.</doc>
+      <virtual-method name="get_properties" invoker="get_properties">
+        <doc xml:whitespace="preserve">Get a list of properties for which probing is supported.
+by this element.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the list of properties for which probing is supported</doc>
+          <type name="GLib.List" c:type="GList*">
+            <type name="gpointer" c:type="gpointer"/>
+          </type>
+        </return-value>
+      </virtual-method>
+      <virtual-method name="get_values">
+        <return-value transfer-ownership="full">
+          <type name="GObject.ValueArray" c:type="GValueArray*"/>
+        </return-value>
+        <parameters>
+          <parameter name="prop_id" transfer-ownership="none">
+            <type name="guint" c:type="guint"/>
+          </parameter>
+          <parameter name="pspec" transfer-ownership="none">
+            <type name="GObject.ParamSpec" c:type="GParamSpec*"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <virtual-method name="needs_probe">
+        <return-value transfer-ownership="none">
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="prop_id" transfer-ownership="none">
+            <type name="guint" c:type="guint"/>
+          </parameter>
+          <parameter name="pspec" transfer-ownership="none">
+            <type name="GObject.ParamSpec" c:type="GParamSpec*"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <virtual-method name="probe_property">
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="prop_id" transfer-ownership="none">
+            <type name="guint" c:type="guint"/>
+          </parameter>
+          <parameter name="pspec" transfer-ownership="none">
+            <type name="GObject.ParamSpec" c:type="GParamSpec*"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <method name="get_properties"
+              c:identifier="gst_property_probe_get_properties">
+        <doc xml:whitespace="preserve">Get a list of properties for which probing is supported.
+by this element.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the list of properties for which probing is supported</doc>
+          <type name="GLib.List" c:type="GList*">
+            <type name="gpointer" c:type="gpointer"/>
+          </type>
+        </return-value>
+      </method>
+      <method name="get_property"
+              c:identifier="gst_property_probe_get_property">
+        <doc xml:whitespace="preserve">Get #GParamSpec for a property for which probing is supported.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the #GParamSpec of %NULL.</doc>
+          <type name="GObject.ParamSpec" c:type="GParamSpec*"/>
+        </return-value>
+        <parameters>
+          <parameter name="name" transfer-ownership="none">
+            <doc xml:whitespace="preserve">name of the property.</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="get_values" c:identifier="gst_property_probe_get_values">
+        <doc xml:whitespace="preserve">Gets the possible (probed) values for the given property,
+requires the property to have been probed before.</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">A list of valid values for the given property.</doc>
+          <type name="GObject.ValueArray" c:type="GValueArray*"/>
+        </return-value>
+        <parameters>
+          <parameter name="pspec" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the #GParamSpec property identifier.</doc>
+            <type name="GObject.ParamSpec" c:type="GParamSpec*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="get_values_name"
+              c:identifier="gst_property_probe_get_values_name">
+        <doc xml:whitespace="preserve">Same as gst_property_probe_get_values ().</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">A list of valid values for the given property.</doc>
+          <type name="GObject.ValueArray" c:type="GValueArray*"/>
+        </return-value>
+        <parameters>
+          <parameter name="name" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the name of the property to get values for.</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="needs_probe" c:identifier="gst_property_probe_needs_probe">
+        <doc xml:whitespace="preserve">Checks whether a property needs a probe. This might be because
+the property wasn't initialized before, or because host setup
+changed. This might be, for example, because a new device was
+added, and thus device probing needs to be refreshed to display
+the new device.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">TRUE if the property needs a new probe, FALSE if not.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="pspec" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a #GParamSpec that identifies the property to check.</doc>
+            <type name="GObject.ParamSpec" c:type="GParamSpec*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="needs_probe_name"
+              c:identifier="gst_property_probe_needs_probe_name">
+        <doc xml:whitespace="preserve">Same as gst_property_probe_needs_probe ().</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">TRUE if the property needs a new probe, FALSE if not.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="name" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the name of the property to check.</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="probe_and_get_values"
+              c:identifier="gst_property_probe_probe_and_get_values">
+        <doc xml:whitespace="preserve">Check whether the given property requires a new probe. If so,
+fo the probe. After that, retrieve a value list. Meant as a
+utility function that wraps the above functions.</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">the list of valid values for this property.</doc>
+          <type name="GObject.ValueArray" c:type="GValueArray*"/>
+        </return-value>
+        <parameters>
+          <parameter name="pspec" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The #GParamSpec property identifier.</doc>
+            <type name="GObject.ParamSpec" c:type="GParamSpec*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="probe_and_get_values_name"
+              c:identifier="gst_property_probe_probe_and_get_values_name">
+        <doc xml:whitespace="preserve">Same as gst_property_probe_probe_and_get_values ().</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">the list of valid values for this property.</doc>
+          <type name="GObject.ValueArray" c:type="GValueArray*"/>
+        </return-value>
+        <parameters>
+          <parameter name="name" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the name of the property to get values for.</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="probe_property"
+              c:identifier="gst_property_probe_probe_property">
+        <doc xml:whitespace="preserve">Runs a probe on the property specified by @pspec</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="pspec" transfer-ownership="none">
+            <doc xml:whitespace="preserve">#GParamSpec of the property.</doc>
+            <type name="GObject.ParamSpec" c:type="GParamSpec*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="probe_property_name"
+              c:identifier="gst_property_probe_probe_property_name">
+        <doc xml:whitespace="preserve">Runs a probe on the property specified by @name.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="name" transfer-ownership="none">
+            <doc xml:whitespace="preserve">name of the property.</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <glib:signal name="probe-needed">
+        <return-value transfer-ownership="none">
+          <type name="none"/>
+        </return-value>
+        <parameters>
+          <parameter name="object" transfer-ownership="none">
+            <type name="gpointer"/>
+          </parameter>
+        </parameters>
+      </glib:signal>
+    </interface>
+    <record name="PropertyProbeInterface"
+            c:type="GstPropertyProbeInterface"
+            glib:is-gtype-struct-for="PropertyProbe">
+      <doc xml:whitespace="preserve">#GstPropertyProbe interface.</doc>
+      <field name="klass">
+        <type name="GObject.TypeInterface" c:type="GTypeInterface"/>
+      </field>
+      <field name="probe_needed">
+        <callback name="probe_needed">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="probe" transfer-ownership="none">
+              <type name="PropertyProbe" c:type="GstPropertyProbe*"/>
+            </parameter>
+            <parameter name="pspec" transfer-ownership="none">
+              <type name="GObject.ParamSpec" c:type="GParamSpec*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="get_properties">
+        <callback name="get_properties">
+          <return-value transfer-ownership="none">
+            <doc xml:whitespace="preserve">the list of properties for which probing is supported</doc>
+            <type name="GLib.List" c:type="GList*">
+              <type name="gpointer" c:type="gpointer"/>
+            </type>
+          </return-value>
+          <parameters>
+            <parameter name="probe" transfer-ownership="none">
+              <type name="PropertyProbe" c:type="GstPropertyProbe*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="needs_probe">
+        <callback name="needs_probe">
+          <return-value transfer-ownership="none">
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="probe" transfer-ownership="none">
+              <type name="PropertyProbe" c:type="GstPropertyProbe*"/>
+            </parameter>
+            <parameter name="prop_id" transfer-ownership="none">
+              <type name="guint" c:type="guint"/>
+            </parameter>
+            <parameter name="pspec" transfer-ownership="none">
+              <type name="GObject.ParamSpec" c:type="GParamSpec*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="probe_property">
+        <callback name="probe_property">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="probe" transfer-ownership="none">
+              <type name="PropertyProbe" c:type="GstPropertyProbe*"/>
+            </parameter>
+            <parameter name="prop_id" transfer-ownership="none">
+              <type name="guint" c:type="guint"/>
+            </parameter>
+            <parameter name="pspec" transfer-ownership="none">
+              <type name="GObject.ParamSpec" c:type="GParamSpec*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="get_values">
+        <callback name="get_values">
+          <return-value transfer-ownership="full">
+            <type name="GObject.ValueArray" c:type="GValueArray*"/>
+          </return-value>
+          <parameters>
+            <parameter name="probe" transfer-ownership="none">
+              <type name="PropertyProbe" c:type="GstPropertyProbe*"/>
+            </parameter>
+            <parameter name="prop_id" transfer-ownership="none">
+              <type name="guint" c:type="guint"/>
+            </parameter>
+            <parameter name="pspec" transfer-ownership="none">
+              <type name="GObject.ParamSpec" c:type="GParamSpec*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="_gst_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </record>
+    <interface name="StreamVolume"
+               c:symbol-prefix="stream_volume"
+               c:type="GstStreamVolume"
+               glib:type-name="GstStreamVolume"
+               glib:get-type="gst_stream_volume_get_type"
+               glib:type-struct="StreamVolumeInterface">
+      <method name="get_mute"
+              c:identifier="gst_stream_volume_get_mute"
+              version="0.10.25">
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">Returns %TRUE if the stream is muted</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </method>
+      <method name="get_volume"
+              c:identifier="gst_stream_volume_get_volume"
+              version="0.10.25">
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">The current stream volume as linear factor</doc>
+          <type name="gdouble" c:type="gdouble"/>
+        </return-value>
+        <parameters>
+          <parameter name="format" transfer-ownership="none">
+            <doc xml:whitespace="preserve">#GstStreamVolumeFormat which should be returned</doc>
+            <type name="StreamVolumeFormat" c:type="GstStreamVolumeFormat"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_mute"
+              c:identifier="gst_stream_volume_set_mute"
+              version="0.10.25">
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="mute" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Mute state that should be set</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_volume"
+              c:identifier="gst_stream_volume_set_volume"
+              version="0.10.25">
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="format" transfer-ownership="none">
+            <doc xml:whitespace="preserve">#GstStreamVolumeFormat of @val</doc>
+            <type name="StreamVolumeFormat" c:type="GstStreamVolumeFormat"/>
+          </parameter>
+          <parameter name="val" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Linear volume factor that should be set</doc>
+            <type name="gdouble" c:type="gdouble"/>
+          </parameter>
+        </parameters>
+      </method>
+      <property name="mute" writable="1" transfer-ownership="none">
+        <type name="gboolean"/>
+      </property>
+      <property name="volume" writable="1" transfer-ownership="none">
+        <type name="gdouble"/>
+      </property>
+    </interface>
+    <enumeration name="StreamVolumeFormat"
+                 version="0.10.25"
+                 glib:type-name="GstStreamVolumeFormat"
+                 glib:get-type="gst_stream_volume_format_get_type"
+                 c:type="GstStreamVolumeFormat">
+      <doc xml:whitespace="preserve">Different representations of a stream volume. gst_stream_volume_convert()
+allows to convert between the different representations.
+Formulas to convert from a linear to a cubic or dB volume are
+cbrt(val) and 20 * log10 (val).</doc>
+      <member name="linear"
+              value="0"
+              c:identifier="GST_STREAM_VOLUME_FORMAT_LINEAR"
+              glib:nick="linear"/>
+      <member name="cubic"
+              value="1"
+              c:identifier="GST_STREAM_VOLUME_FORMAT_CUBIC"
+              glib:nick="cubic"/>
+      <member name="db"
+              value="2"
+              c:identifier="GST_STREAM_VOLUME_FORMAT_DB"
+              glib:nick="db"/>
+    </enumeration>
+    <record name="StreamVolumeInterface"
+            c:type="GstStreamVolumeInterface"
+            glib:is-gtype-struct-for="StreamVolume">
+      <field name="parent">
+        <type name="GObject.TypeInterface" c:type="GTypeInterface"/>
+      </field>
+      <field name="_gst_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </record>
+    <interface name="Tuner"
+               c:symbol-prefix="tuner"
+               c:type="GstTuner"
+               glib:type-name="GstTuner"
+               glib:get-type="gst_tuner_get_type">
+      <prerequisite name="Gst.Element"/>
+      <prerequisite name="Gst.ImplementsInterface"/>
+      <method name="channel_changed" c:identifier="gst_tuner_channel_changed">
+        <doc xml:whitespace="preserve">Called by elements implementing the #GstTuner interface when the
+current channel changes. Fires the #GstTuner::channel-changed signal.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="channel" transfer-ownership="none">
+            <doc xml:whitespace="preserve">A #GstTunerChannel instance</doc>
+            <type name="TunerChannel" c:type="GstTunerChannel*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="find_channel_by_name"
+              c:identifier="gst_tuner_find_channel_by_name"
+              introspectable="0">
+        <doc xml:whitespace="preserve">Look up a #GstTunerChannel by name.
+is available.</doc>
+        <return-value>
+          <doc xml:whitespace="preserve">A #GstTunerChannel, or NULL if no channel with the provided name</doc>
+          <type name="TunerChannel" c:type="GstTunerChannel*"/>
+        </return-value>
+        <parameters>
+          <parameter name="channel" transfer-ownership="none">
+            <doc xml:whitespace="preserve">A string containing the name of a #GstTunerChannel</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="find_norm_by_name"
+              c:identifier="gst_tuner_find_norm_by_name"
+              introspectable="0">
+        <doc xml:whitespace="preserve">Look up a #GstTunerNorm by name.
+is available.</doc>
+        <return-value>
+          <doc xml:whitespace="preserve">A #GstTunerNorm, or NULL if no norm with the provided name</doc>
+          <type name="TunerNorm" c:type="GstTunerNorm*"/>
+        </return-value>
+        <parameters>
+          <parameter name="norm" transfer-ownership="none">
+            <doc xml:whitespace="preserve">A string containing the name of a #GstTunerNorm</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="frequency_changed"
+              c:identifier="gst_tuner_frequency_changed">
+        <doc xml:whitespace="preserve">Called by elements implementing the #GstTuner interface when the
+configured frequency changes. Fires the #GstTuner::frequency-changed
+signal on the tuner, and the #GstTunerChannel::frequency-changed signal
+on the channel.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="channel" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The current #GstTunerChannel</doc>
+            <type name="TunerChannel" c:type="GstTunerChannel*"/>
+          </parameter>
+          <parameter name="frequency" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The new frequency setting</doc>
+            <type name="gulong" c:type="gulong"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="get_channel"
+              c:identifier="gst_tuner_get_channel"
+              introspectable="0">
+        <doc xml:whitespace="preserve">Retrieve the current channel from the tuner.</doc>
+        <return-value>
+          <doc xml:whitespace="preserve">the current channel of the tuner object.</doc>
+          <type name="TunerChannel" c:type="GstTunerChannel*"/>
+        </return-value>
+      </method>
+      <method name="get_frequency" c:identifier="gst_tuner_get_frequency">
+        <doc xml:whitespace="preserve">Retrieve the current frequency from the given channel. As for
+gst_tuner_set_frequency(), the #GstTunerChannel must support frequency
+operations, as indicated by the GST_TUNER_CHANNEL_FREQUENCY flag.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">The current frequency, or 0 on error.</doc>
+          <type name="gulong" c:type="gulong"/>
+        </return-value>
+        <parameters>
+          <parameter name="channel" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The #GstTunerChannel to retrieve the frequency from.</doc>
+            <type name="TunerChannel" c:type="GstTunerChannel*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="get_norm"
+              c:identifier="gst_tuner_get_norm"
+              introspectable="0">
+        <doc xml:whitespace="preserve">Get the current video norm from the given tuner object for the
+currently selected channel.</doc>
+        <return-value>
+          <doc xml:whitespace="preserve">the current norm.</doc>
+          <type name="TunerNorm" c:type="GstTunerNorm*"/>
+        </return-value>
+      </method>
+      <method name="list_channels" c:identifier="gst_tuner_list_channels">
+        <doc xml:whitespace="preserve">Retrieve a #GList of #GstTunerChannels available
+(e.g. 'composite', 's-video', ...) from the given tuner object.
+owned by the GstTuner and must not be freed.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">A list of channels available on this tuner. The list is</doc>
+          <type name="GLib.List" c:type="GList*">
+            <type name="gpointer" c:type="gpointer"/>
+          </type>
+        </return-value>
+      </method>
+      <method name="list_norms" c:identifier="gst_tuner_list_norms">
+        <doc xml:whitespace="preserve">Retrieve a GList of available #GstTunerNorm settings for the currently
+tuned channel on the given tuner object.
+tuner object. The list is owned by the GstTuner and must not
+be freed.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">A list of norms available on the current channel for this</doc>
+          <type name="GLib.List" c:type="GList*">
+            <type name="gpointer" c:type="gpointer"/>
+          </type>
+        </return-value>
+      </method>
+      <method name="norm_changed" c:identifier="gst_tuner_norm_changed">
+        <doc xml:whitespace="preserve">Called by elements implementing the #GstTuner interface when the
+current norm changes. Fires the #GstTuner::norm-changed signal.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="norm" transfer-ownership="none">
+            <doc xml:whitespace="preserve">A #GstTunerNorm instance</doc>
+            <type name="TunerNorm" c:type="GstTunerNorm*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_channel" c:identifier="gst_tuner_set_channel">
+        <doc xml:whitespace="preserve">Tunes the object to the given channel, which should be one of the
+channels returned by gst_tuner_list_channels().</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="channel" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the channel to tune to.</doc>
+            <type name="TunerChannel" c:type="GstTunerChannel*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_frequency" c:identifier="gst_tuner_set_frequency">
+        <doc xml:whitespace="preserve">Sets a tuning frequency on the given tuner/channel. Note that this
+requires the given channel to be a "tuning" channel, which can be
+checked using GST_TUNER_CHANNEL_HAS_FLAG (), with the proper flag
+being GST_TUNER_CHANNEL_FREQUENCY.
+The frequency is in Hz, with minimum steps indicated by the 
+frequency_multiplicator provided in the #GstTunerChannel. The
+valid range is provided in the min_frequency and max_frequency properties
+of the #GstTunerChannel.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="channel" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The #GstTunerChannel to set the frequency on.</doc>
+            <type name="TunerChannel" c:type="GstTunerChannel*"/>
+          </parameter>
+          <parameter name="frequency" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The frequency to tune in to.</doc>
+            <type name="gulong" c:type="gulong"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_norm" c:identifier="gst_tuner_set_norm">
+        <doc xml:whitespace="preserve">Changes the video norm on this tuner to the given norm, which should be
+one of the norms returned by gst_tuner_list_norms().</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="norm" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the norm to use for the current channel.</doc>
+            <type name="TunerNorm" c:type="GstTunerNorm*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="signal_changed" c:identifier="gst_tuner_signal_changed">
+        <doc xml:whitespace="preserve">Called by elements implementing the #GstTuner interface when the
+incoming signal strength changes. Fires the #GstTuner::signal-changed
+signal on the tuner and the #GstTunerChannel::signal-changed signal on 
+the channel.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="channel" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The current #GstTunerChannel</doc>
+            <type name="TunerChannel" c:type="GstTunerChannel*"/>
+          </parameter>
+          <parameter name="signal" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The new signal strength</doc>
+            <type name="gint" c:type="gint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="signal_strength" c:identifier="gst_tuner_signal_strength">
+        <doc xml:whitespace="preserve">Get the strength of the signal on this channel. Note that this
+requires the current channel to be a "tuning" channel, i.e. a
+channel on which frequency can be set. This can be checked using
+GST_TUNER_CHANNEL_HAS_FLAG (), and the appropriate flag to check
+for is GST_TUNER_CHANNEL_FREQUENCY.
+The valid range of the signal strength is indicated in the 
+min_signal and max_signal properties of the #GstTunerChannel.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">Signal strength, or 0 on error.</doc>
+          <type name="gint" c:type="gint"/>
+        </return-value>
+        <parameters>
+          <parameter name="channel" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the #GstTunerChannel to get the signal strength from.</doc>
+            <type name="TunerChannel" c:type="GstTunerChannel*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <glib:signal name="channel-changed">
+        <doc xml:whitespace="preserve">Reports that the current #GstTunerChannel has changed.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none"/>
+        </return-value>
+        <parameters>
+          <parameter name="object" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The new configured channel.</doc>
+            <type name="TunerChannel"/>
+          </parameter>
+        </parameters>
+      </glib:signal>
+      <glib:signal name="frequency-changed">
+        <doc xml:whitespace="preserve">Reports that the current frequency has changed.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none"/>
+        </return-value>
+        <parameters>
+          <parameter name="object" transfer-ownership="none">
+            <type name="TunerChannel"/>
+          </parameter>
+          <parameter name="p0" transfer-ownership="none">
+            <type name="gulong"/>
+          </parameter>
+        </parameters>
+      </glib:signal>
+      <glib:signal name="norm-changed">
+        <doc xml:whitespace="preserve">Reports that the current #GstTunerNorm has changed.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none"/>
+        </return-value>
+        <parameters>
+          <parameter name="object" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The new configured norm.</doc>
+            <type name="TunerNorm"/>
+          </parameter>
+        </parameters>
+      </glib:signal>
+      <glib:signal name="signal-changed">
+        <doc xml:whitespace="preserve">Reports that the signal strength has changed.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none"/>
+        </return-value>
+        <parameters>
+          <parameter name="object" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The current #GstTunerChannel</doc>
+            <type name="TunerChannel"/>
+          </parameter>
+          <parameter name="p0" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The new signal strength (an integer)</doc>
+            <type name="gint"/>
+          </parameter>
+        </parameters>
+      </glib:signal>
+    </interface>
+    <class name="TunerChannel"
+           c:symbol-prefix="tuner_channel"
+           c:type="GstTunerChannel"
+           parent="GObject.Object"
+           glib:type-name="GstTunerChannel"
+           glib:get-type="gst_tuner_channel_get_type"
+           glib:type-struct="TunerChannelClass">
+      <field name="parent">
+        <type name="GObject.Object" c:type="GObject"/>
+      </field>
+      <field name="label">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <field name="flags">
+        <type name="TunerChannelFlags" c:type="GstTunerChannelFlags"/>
+      </field>
+      <field name="freq_multiplicator">
+        <type name="gfloat" c:type="gfloat"/>
+      </field>
+      <field name="min_frequency">
+        <type name="gulong" c:type="gulong"/>
+      </field>
+      <field name="max_frequency">
+        <type name="gulong" c:type="gulong"/>
+      </field>
+      <field name="min_signal">
+        <type name="gint" c:type="gint"/>
+      </field>
+      <field name="max_signal">
+        <type name="gint" c:type="gint"/>
+      </field>
+      <glib:signal name="frequency-changed">
+        <doc xml:whitespace="preserve">Reports that the current frequency has changed.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none"/>
+        </return-value>
+        <parameters>
+          <parameter name="object" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The new frequency (an unsigned long)</doc>
+            <type name="gulong"/>
+          </parameter>
+        </parameters>
+      </glib:signal>
+      <glib:signal name="signal-changed">
+        <doc xml:whitespace="preserve">Reports that the signal strength has changed.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none"/>
+        </return-value>
+        <parameters>
+          <parameter name="object" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The new signal strength (an integer)</doc>
+            <type name="gint"/>
+          </parameter>
+        </parameters>
+      </glib:signal>
+    </class>
+    <record name="TunerChannelClass"
+            c:type="GstTunerChannelClass"
+            glib:is-gtype-struct-for="TunerChannel">
+      <field name="parent">
+        <type name="GObject.ObjectClass" c:type="GObjectClass"/>
+      </field>
+      <field name="frequency_changed">
+        <callback name="frequency_changed">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="channel" transfer-ownership="none">
+              <type name="TunerChannel" c:type="GstTunerChannel*"/>
+            </parameter>
+            <parameter name="frequency" transfer-ownership="none">
+              <type name="gulong" c:type="gulong"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="signal_changed">
+        <callback name="signal_changed">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="channel" transfer-ownership="none">
+              <type name="TunerChannel" c:type="GstTunerChannel*"/>
+            </parameter>
+            <parameter name="signal" transfer-ownership="none">
+              <type name="gint" c:type="gint"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="_gst_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </record>
+    <bitfield name="TunerChannelFlags"
+              glib:type-name="GstTunerChannelFlags"
+              glib:get-type="gst_tuner_channel_flags_get_type"
+              c:type="GstTunerChannelFlags">
+      <doc xml:whitespace="preserve">An enumeration for flags indicating the available capabilities
+of a #GstTunerChannel.</doc>
+      <member name="input"
+              value="1"
+              c:identifier="GST_TUNER_CHANNEL_INPUT"
+              glib:nick="input"/>
+      <member name="output"
+              value="2"
+              c:identifier="GST_TUNER_CHANNEL_OUTPUT"
+              glib:nick="output"/>
+      <member name="frequency"
+              value="4"
+              c:identifier="GST_TUNER_CHANNEL_FREQUENCY"
+              glib:nick="frequency"/>
+      <member name="audio"
+              value="8"
+              c:identifier="GST_TUNER_CHANNEL_AUDIO"
+              glib:nick="audio"/>
+    </bitfield>
+    <record name="TunerClass" c:type="GstTunerClass">
+      <field name="klass" writable="1">
+        <type name="GObject.TypeInterface" c:type="GTypeInterface"/>
+      </field>
+      <field name="list_channels">
+        <callback name="list_channels">
+          <return-value transfer-ownership="none">
+            <type name="GLib.List" c:type="GList*">
+              <type name="gpointer" c:type="gpointer"/>
+            </type>
+          </return-value>
+          <parameters>
+            <parameter name="tuner" transfer-ownership="none">
+              <type name="Tuner" c:type="GstTuner*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="set_channel">
+        <callback name="set_channel">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="tuner" transfer-ownership="none">
+              <type name="Tuner" c:type="GstTuner*"/>
+            </parameter>
+            <parameter name="channel" transfer-ownership="none">
+              <type name="TunerChannel" c:type="GstTunerChannel*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="get_channel" introspectable="0">
+        <callback name="get_channel" introspectable="0">
+          <return-value>
+            <type name="TunerChannel" c:type="GstTunerChannel*"/>
+          </return-value>
+          <parameters>
+            <parameter name="tuner" transfer-ownership="none">
+              <type name="Tuner" c:type="GstTuner*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="list_norms">
+        <callback name="list_norms">
+          <return-value transfer-ownership="none">
+            <type name="GLib.List" c:type="GList*">
+              <type name="gpointer" c:type="gpointer"/>
+            </type>
+          </return-value>
+          <parameters>
+            <parameter name="tuner" transfer-ownership="none">
+              <type name="Tuner" c:type="GstTuner*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="set_norm">
+        <callback name="set_norm">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="tuner" transfer-ownership="none">
+              <type name="Tuner" c:type="GstTuner*"/>
+            </parameter>
+            <parameter name="norm" transfer-ownership="none">
+              <type name="TunerNorm" c:type="GstTunerNorm*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="get_norm" introspectable="0">
+        <callback name="get_norm" introspectable="0">
+          <return-value>
+            <type name="TunerNorm" c:type="GstTunerNorm*"/>
+          </return-value>
+          <parameters>
+            <parameter name="tuner" transfer-ownership="none">
+              <type name="Tuner" c:type="GstTuner*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="set_frequency">
+        <callback name="set_frequency">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="tuner" transfer-ownership="none">
+              <type name="Tuner" c:type="GstTuner*"/>
+            </parameter>
+            <parameter name="channel" transfer-ownership="none">
+              <type name="TunerChannel" c:type="GstTunerChannel*"/>
+            </parameter>
+            <parameter name="frequency" transfer-ownership="none">
+              <type name="gulong" c:type="gulong"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="get_frequency">
+        <callback name="get_frequency">
+          <return-value transfer-ownership="none">
+            <type name="gulong" c:type="gulong"/>
+          </return-value>
+          <parameters>
+            <parameter name="tuner" transfer-ownership="none">
+              <type name="Tuner" c:type="GstTuner*"/>
+            </parameter>
+            <parameter name="channel" transfer-ownership="none">
+              <type name="TunerChannel" c:type="GstTunerChannel*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="signal_strength">
+        <callback name="signal_strength">
+          <return-value transfer-ownership="none">
+            <type name="gint" c:type="gint"/>
+          </return-value>
+          <parameters>
+            <parameter name="tuner" transfer-ownership="none">
+              <type name="Tuner" c:type="GstTuner*"/>
+            </parameter>
+            <parameter name="channel" transfer-ownership="none">
+              <type name="TunerChannel" c:type="GstTunerChannel*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="channel_changed">
+        <callback name="channel_changed">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="tuner" transfer-ownership="none">
+              <type name="Tuner" c:type="GstTuner*"/>
+            </parameter>
+            <parameter name="channel" transfer-ownership="none">
+              <type name="TunerChannel" c:type="GstTunerChannel*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="norm_changed">
+        <callback name="norm_changed">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="tuner" transfer-ownership="none">
+              <type name="Tuner" c:type="GstTuner*"/>
+            </parameter>
+            <parameter name="norm" transfer-ownership="none">
+              <type name="TunerNorm" c:type="GstTunerNorm*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="frequency_changed">
+        <callback name="frequency_changed">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="tuner" transfer-ownership="none">
+              <type name="Tuner" c:type="GstTuner*"/>
+            </parameter>
+            <parameter name="channel" transfer-ownership="none">
+              <type name="TunerChannel" c:type="GstTunerChannel*"/>
+            </parameter>
+            <parameter name="frequency" transfer-ownership="none">
+              <type name="gulong" c:type="gulong"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="signal_changed">
+        <callback name="signal_changed">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="tuner" transfer-ownership="none">
+              <type name="Tuner" c:type="GstTuner*"/>
+            </parameter>
+            <parameter name="channel" transfer-ownership="none">
+              <type name="TunerChannel" c:type="GstTunerChannel*"/>
+            </parameter>
+            <parameter name="signal" transfer-ownership="none">
+              <type name="gint" c:type="gint"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="_gst_reserved" writable="1">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </record>
+    <class name="TunerNorm"
+           c:symbol-prefix="tuner_norm"
+           c:type="GstTunerNorm"
+           parent="GObject.Object"
+           glib:type-name="GstTunerNorm"
+           glib:get-type="gst_tuner_norm_get_type"
+           glib:type-struct="TunerNormClass">
+      <field name="parent">
+        <type name="GObject.Object" c:type="GObject"/>
+      </field>
+      <field name="label">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <field name="framerate">
+        <type name="GObject.Value" c:type="GValue"/>
+      </field>
+    </class>
+    <record name="TunerNormClass"
+            c:type="GstTunerNormClass"
+            glib:is-gtype-struct-for="TunerNorm">
+      <field name="parent">
+        <type name="GObject.ObjectClass" c:type="GObjectClass"/>
+      </field>
+      <field name="_gst_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </record>
+    <interface name="VideoOrientation"
+               c:symbol-prefix="video_orientation"
+               c:type="GstVideoOrientation"
+               glib:type-name="GstVideoOrientation"
+               glib:get-type="gst_video_orientation_get_type"
+               glib:type-struct="VideoOrientationInterface">
+      <doc xml:whitespace="preserve">Opaque #GstVideoOrientation data structure.</doc>
+      <prerequisite name="Gst.Element"/>
+      <prerequisite name="Gst.ImplementsInterface"/>
+      <virtual-method name="get_hcenter"
+                      invoker="get_hcenter"
+                      version="0.10.11">
+        <doc xml:whitespace="preserve">Get the horizontal centering offset from the given object.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE in case the element supports centering</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="center" transfer-ownership="none">
+            <doc xml:whitespace="preserve">return location for the result</doc>
+            <type name="gint" c:type="gint*"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <virtual-method name="get_hflip" invoker="get_hflip" version="0.10.11">
+        <doc xml:whitespace="preserve">Get the horizontal flipping state (%TRUE for flipped) from the given object.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE in case the element supports flipping</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="flip" transfer-ownership="none">
+            <doc xml:whitespace="preserve">return location for the result</doc>
+            <type name="gboolean" c:type="gboolean*"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <virtual-method name="get_vcenter"
+                      invoker="get_vcenter"
+                      version="0.10.11">
+        <doc xml:whitespace="preserve">Get the vertical centering offset from the given object.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE in case the element supports centering</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="center" transfer-ownership="none">
+            <doc xml:whitespace="preserve">return location for the result</doc>
+            <type name="gint" c:type="gint*"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <virtual-method name="get_vflip" invoker="get_vflip" version="0.10.11">
+        <doc xml:whitespace="preserve">Get the vertical flipping state (%TRUE for flipped) from the given object.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE in case the element supports flipping</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="flip" transfer-ownership="none">
+            <doc xml:whitespace="preserve">return location for the result</doc>
+            <type name="gboolean" c:type="gboolean*"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <virtual-method name="set_hcenter"
+                      invoker="set_hcenter"
+                      version="0.10.11">
+        <doc xml:whitespace="preserve">Set the horizontal centering offset for the given object.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE in case the element supports centering</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="center" transfer-ownership="none">
+            <doc xml:whitespace="preserve">centering offset</doc>
+            <type name="gint" c:type="gint"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <virtual-method name="set_hflip" invoker="set_hflip" version="0.10.11">
+        <doc xml:whitespace="preserve">Set the horizontal flipping state (%TRUE for flipped) for the given object.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE in case the element supports flipping</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="flip" transfer-ownership="none">
+            <doc xml:whitespace="preserve">use flipping</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <virtual-method name="set_vcenter"
+                      invoker="set_vcenter"
+                      version="0.10.11">
+        <doc xml:whitespace="preserve">Set the vertical centering offset for the given object.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE in case the element supports centering</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="center" transfer-ownership="none">
+            <doc xml:whitespace="preserve">centering offset</doc>
+            <type name="gint" c:type="gint"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <virtual-method name="set_vflip" invoker="set_vflip" version="0.10.11">
+        <doc xml:whitespace="preserve">Set the vertical flipping state (%TRUE for flipped) for the given object.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE in case the element supports flipping</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="flip" transfer-ownership="none">
+            <doc xml:whitespace="preserve">use flipping</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <method name="get_hcenter"
+              c:identifier="gst_video_orientation_get_hcenter"
+              version="0.10.11">
+        <doc xml:whitespace="preserve">Get the horizontal centering offset from the given object.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE in case the element supports centering</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="center" transfer-ownership="none">
+            <doc xml:whitespace="preserve">return location for the result</doc>
+            <type name="gint" c:type="gint*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="get_hflip"
+              c:identifier="gst_video_orientation_get_hflip"
+              version="0.10.11">
+        <doc xml:whitespace="preserve">Get the horizontal flipping state (%TRUE for flipped) from the given object.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE in case the element supports flipping</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="flip" transfer-ownership="none">
+            <doc xml:whitespace="preserve">return location for the result</doc>
+            <type name="gboolean" c:type="gboolean*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="get_vcenter"
+              c:identifier="gst_video_orientation_get_vcenter"
+              version="0.10.11">
+        <doc xml:whitespace="preserve">Get the vertical centering offset from the given object.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE in case the element supports centering</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="center" transfer-ownership="none">
+            <doc xml:whitespace="preserve">return location for the result</doc>
+            <type name="gint" c:type="gint*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="get_vflip"
+              c:identifier="gst_video_orientation_get_vflip"
+              version="0.10.11">
+        <doc xml:whitespace="preserve">Get the vertical flipping state (%TRUE for flipped) from the given object.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE in case the element supports flipping</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="flip" transfer-ownership="none">
+            <doc xml:whitespace="preserve">return location for the result</doc>
+            <type name="gboolean" c:type="gboolean*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_hcenter"
+              c:identifier="gst_video_orientation_set_hcenter"
+              version="0.10.11">
+        <doc xml:whitespace="preserve">Set the horizontal centering offset for the given object.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE in case the element supports centering</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="center" transfer-ownership="none">
+            <doc xml:whitespace="preserve">centering offset</doc>
+            <type name="gint" c:type="gint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_hflip"
+              c:identifier="gst_video_orientation_set_hflip"
+              version="0.10.11">
+        <doc xml:whitespace="preserve">Set the horizontal flipping state (%TRUE for flipped) for the given object.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE in case the element supports flipping</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="flip" transfer-ownership="none">
+            <doc xml:whitespace="preserve">use flipping</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_vcenter"
+              c:identifier="gst_video_orientation_set_vcenter"
+              version="0.10.11">
+        <doc xml:whitespace="preserve">Set the vertical centering offset for the given object.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE in case the element supports centering</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="center" transfer-ownership="none">
+            <doc xml:whitespace="preserve">centering offset</doc>
+            <type name="gint" c:type="gint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_vflip"
+              c:identifier="gst_video_orientation_set_vflip"
+              version="0.10.11">
+        <doc xml:whitespace="preserve">Set the vertical flipping state (%TRUE for flipped) for the given object.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE in case the element supports flipping</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="flip" transfer-ownership="none">
+            <doc xml:whitespace="preserve">use flipping</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </parameter>
+        </parameters>
+      </method>
+    </interface>
+    <record name="VideoOrientationInterface"
+            c:type="GstVideoOrientationInterface"
+            glib:is-gtype-struct-for="VideoOrientation">
+      <doc xml:whitespace="preserve">#GstVideoOrientationInterface interface.</doc>
+      <field name="parent">
+        <type name="GObject.TypeInterface" c:type="GTypeInterface"/>
+      </field>
+      <field name="get_hflip">
+        <callback name="get_hflip">
+          <return-value transfer-ownership="none">
+            <doc xml:whitespace="preserve">%TRUE in case the element supports flipping</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="video_orientation" transfer-ownership="none">
+              <type name="VideoOrientation" c:type="GstVideoOrientation*"/>
+            </parameter>
+            <parameter name="flip" transfer-ownership="none">
+              <doc xml:whitespace="preserve">return location for the result</doc>
+              <type name="gboolean" c:type="gboolean*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="get_vflip">
+        <callback name="get_vflip">
+          <return-value transfer-ownership="none">
+            <doc xml:whitespace="preserve">%TRUE in case the element supports flipping</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="video_orientation" transfer-ownership="none">
+              <type name="VideoOrientation" c:type="GstVideoOrientation*"/>
+            </parameter>
+            <parameter name="flip" transfer-ownership="none">
+              <doc xml:whitespace="preserve">return location for the result</doc>
+              <type name="gboolean" c:type="gboolean*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="get_hcenter">
+        <callback name="get_hcenter">
+          <return-value transfer-ownership="none">
+            <doc xml:whitespace="preserve">%TRUE in case the element supports centering</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="video_orientation" transfer-ownership="none">
+              <type name="VideoOrientation" c:type="GstVideoOrientation*"/>
+            </parameter>
+            <parameter name="center" transfer-ownership="none">
+              <doc xml:whitespace="preserve">return location for the result</doc>
+              <type name="gint" c:type="gint*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="get_vcenter">
+        <callback name="get_vcenter">
+          <return-value transfer-ownership="none">
+            <doc xml:whitespace="preserve">%TRUE in case the element supports centering</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="video_orientation" transfer-ownership="none">
+              <type name="VideoOrientation" c:type="GstVideoOrientation*"/>
+            </parameter>
+            <parameter name="center" transfer-ownership="none">
+              <doc xml:whitespace="preserve">return location for the result</doc>
+              <type name="gint" c:type="gint*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="set_hflip">
+        <callback name="set_hflip">
+          <return-value transfer-ownership="none">
+            <doc xml:whitespace="preserve">%TRUE in case the element supports flipping</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="video_orientation" transfer-ownership="none">
+              <type name="VideoOrientation" c:type="GstVideoOrientation*"/>
+            </parameter>
+            <parameter name="flip" transfer-ownership="none">
+              <doc xml:whitespace="preserve">use flipping</doc>
+              <type name="gboolean" c:type="gboolean"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="set_vflip">
+        <callback name="set_vflip">
+          <return-value transfer-ownership="none">
+            <doc xml:whitespace="preserve">%TRUE in case the element supports flipping</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="video_orientation" transfer-ownership="none">
+              <type name="VideoOrientation" c:type="GstVideoOrientation*"/>
+            </parameter>
+            <parameter name="flip" transfer-ownership="none">
+              <doc xml:whitespace="preserve">use flipping</doc>
+              <type name="gboolean" c:type="gboolean"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="set_hcenter">
+        <callback name="set_hcenter">
+          <return-value transfer-ownership="none">
+            <doc xml:whitespace="preserve">%TRUE in case the element supports centering</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="video_orientation" transfer-ownership="none">
+              <type name="VideoOrientation" c:type="GstVideoOrientation*"/>
+            </parameter>
+            <parameter name="center" transfer-ownership="none">
+              <doc xml:whitespace="preserve">centering offset</doc>
+              <type name="gint" c:type="gint"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="set_vcenter">
+        <callback name="set_vcenter">
+          <return-value transfer-ownership="none">
+            <doc xml:whitespace="preserve">%TRUE in case the element supports centering</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="video_orientation" transfer-ownership="none">
+              <type name="VideoOrientation" c:type="GstVideoOrientation*"/>
+            </parameter>
+            <parameter name="center" transfer-ownership="none">
+              <doc xml:whitespace="preserve">centering offset</doc>
+              <type name="gint" c:type="gint"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="_gst_reserved" readable="0" private="1">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </record>
+    <interface name="XOverlay"
+               c:symbol-prefix="x_overlay"
+               c:type="GstXOverlay"
+               glib:type-name="GstXOverlay"
+               glib:get-type="gst_x_overlay_get_type">
+      <doc xml:whitespace="preserve">Opaque #GstXOverlay data structure.</doc>
+      <prerequisite name="Gst.Element"/>
+      <prerequisite name="Gst.ImplementsInterface"/>
+    </interface>
+    <record name="XOverlayClass" c:type="GstXOverlayClass">
+      <doc xml:whitespace="preserve">#GstXOverlay interface</doc>
+      <field name="klass" writable="1">
+        <type name="GObject.TypeInterface" c:type="GTypeInterface"/>
+      </field>
+      <field name="set_xwindow_id">
+        <callback name="set_xwindow_id">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="overlay" transfer-ownership="none">
+              <type name="XOverlay" c:type="GstXOverlay*"/>
+            </parameter>
+            <parameter name="xwindow_id" transfer-ownership="none">
+              <type name="gulong" c:type="gulong"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="expose">
+        <callback name="expose">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="overlay" transfer-ownership="none">
+              <type name="XOverlay" c:type="GstXOverlay*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="handle_events">
+        <callback name="handle_events">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="overlay" transfer-ownership="none">
+              <type name="XOverlay" c:type="GstXOverlay*"/>
+            </parameter>
+            <parameter name="handle_events" transfer-ownership="none">
+              <type name="gboolean" c:type="gboolean"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="set_render_rectangle">
+        <callback name="set_render_rectangle">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="overlay" transfer-ownership="none">
+              <type name="XOverlay" c:type="GstXOverlay*"/>
+            </parameter>
+            <parameter name="x" transfer-ownership="none">
+              <type name="gint" c:type="gint"/>
+            </parameter>
+            <parameter name="y" transfer-ownership="none">
+              <type name="gint" c:type="gint"/>
+            </parameter>
+            <parameter name="width" transfer-ownership="none">
+              <type name="gint" c:type="gint"/>
+            </parameter>
+            <parameter name="height" transfer-ownership="none">
+              <type name="gint" c:type="gint"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="set_window_handle" introspectable="0">
+        <callback name="set_window_handle" introspectable="0">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="overlay" transfer-ownership="none">
+              <type name="XOverlay" c:type="GstXOverlay*"/>
+            </parameter>
+            <parameter name="handle" transfer-ownership="none">
+              <type c:type="guintptr"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="_gst_reserved" writable="1">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="1">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </record>
+    <function name="interfaces_marshal_VOID__OBJECT_BOOLEAN"
+              c:identifier="gst_interfaces_marshal_VOID__OBJECT_BOOLEAN">
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="closure" transfer-ownership="none">
+          <type name="GObject.Closure" c:type="GClosure*"/>
+        </parameter>
+        <parameter name="return_value" transfer-ownership="none">
+          <type name="GObject.Value" c:type="GValue*"/>
+        </parameter>
+        <parameter name="n_param_values" transfer-ownership="none">
+          <type name="guint" c:type="guint"/>
+        </parameter>
+        <parameter name="param_values" transfer-ownership="none">
+          <type name="GObject.Value" c:type="GValue*"/>
+        </parameter>
+        <parameter name="invocation_hint" transfer-ownership="none">
+          <type name="gpointer" c:type="gpointer"/>
+        </parameter>
+        <parameter name="marshal_data" transfer-ownership="none">
+          <type name="gpointer" c:type="gpointer"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="interfaces_marshal_VOID__OBJECT_INT"
+              c:identifier="gst_interfaces_marshal_VOID__OBJECT_INT">
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="closure" transfer-ownership="none">
+          <type name="GObject.Closure" c:type="GClosure*"/>
+        </parameter>
+        <parameter name="return_value" transfer-ownership="none">
+          <type name="GObject.Value" c:type="GValue*"/>
+        </parameter>
+        <parameter name="n_param_values" transfer-ownership="none">
+          <type name="guint" c:type="guint"/>
+        </parameter>
+        <parameter name="param_values" transfer-ownership="none">
+          <type name="GObject.Value" c:type="GValue*"/>
+        </parameter>
+        <parameter name="invocation_hint" transfer-ownership="none">
+          <type name="gpointer" c:type="gpointer"/>
+        </parameter>
+        <parameter name="marshal_data" transfer-ownership="none">
+          <type name="gpointer" c:type="gpointer"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="interfaces_marshal_VOID__OBJECT_POINTER"
+              c:identifier="gst_interfaces_marshal_VOID__OBJECT_POINTER">
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="closure" transfer-ownership="none">
+          <type name="GObject.Closure" c:type="GClosure*"/>
+        </parameter>
+        <parameter name="return_value" transfer-ownership="none">
+          <type name="GObject.Value" c:type="GValue*"/>
+        </parameter>
+        <parameter name="n_param_values" transfer-ownership="none">
+          <type name="guint" c:type="guint"/>
+        </parameter>
+        <parameter name="param_values" transfer-ownership="none">
+          <type name="GObject.Value" c:type="GValue*"/>
+        </parameter>
+        <parameter name="invocation_hint" transfer-ownership="none">
+          <type name="gpointer" c:type="gpointer"/>
+        </parameter>
+        <parameter name="marshal_data" transfer-ownership="none">
+          <type name="gpointer" c:type="gpointer"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="interfaces_marshal_VOID__OBJECT_STRING"
+              c:identifier="gst_interfaces_marshal_VOID__OBJECT_STRING">
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="closure" transfer-ownership="none">
+          <type name="GObject.Closure" c:type="GClosure*"/>
+        </parameter>
+        <parameter name="return_value" transfer-ownership="none">
+          <type name="GObject.Value" c:type="GValue*"/>
+        </parameter>
+        <parameter name="n_param_values" transfer-ownership="none">
+          <type name="guint" c:type="guint"/>
+        </parameter>
+        <parameter name="param_values" transfer-ownership="none">
+          <type name="GObject.Value" c:type="GValue*"/>
+        </parameter>
+        <parameter name="invocation_hint" transfer-ownership="none">
+          <type name="gpointer" c:type="gpointer"/>
+        </parameter>
+        <parameter name="marshal_data" transfer-ownership="none">
+          <type name="gpointer" c:type="gpointer"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="interfaces_marshal_VOID__OBJECT_ULONG"
+              c:identifier="gst_interfaces_marshal_VOID__OBJECT_ULONG">
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="closure" transfer-ownership="none">
+          <type name="GObject.Closure" c:type="GClosure*"/>
+        </parameter>
+        <parameter name="return_value" transfer-ownership="none">
+          <type name="GObject.Value" c:type="GValue*"/>
+        </parameter>
+        <parameter name="n_param_values" transfer-ownership="none">
+          <type name="guint" c:type="guint"/>
+        </parameter>
+        <parameter name="param_values" transfer-ownership="none">
+          <type name="GObject.Value" c:type="GValue*"/>
+        </parameter>
+        <parameter name="invocation_hint" transfer-ownership="none">
+          <type name="gpointer" c:type="gpointer"/>
+        </parameter>
+        <parameter name="marshal_data" transfer-ownership="none">
+          <type name="gpointer" c:type="gpointer"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="mixer_message_get_type"
+              c:identifier="gst_mixer_message_get_type"
+              version="0.10.14">
+      <doc xml:whitespace="preserve">Check a bus message to see if it is a GstMixer notification
+message and return the GstMixerMessageType identifying which
+type of notification it is.
+if the message is not a GstMixer notification.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">The type of the GstMixerMessage, or GST_MIXER_MESSAGE_INVALID</doc>
+        <type name="MixerMessageType" c:type="GstMixerMessageType"/>
+      </return-value>
+      <parameters>
+        <parameter name="message" transfer-ownership="none">
+          <doc xml:whitespace="preserve">A GstMessage to inspect.</doc>
+          <type name="Gst.Message" c:type="GstMessage*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="mixer_message_parse_mute_toggled"
+              c:identifier="gst_mixer_message_parse_mute_toggled"
+              version="0.10.14">
+      <doc xml:whitespace="preserve">Extracts the contents of a mute-toggled bus message. Reads
+the GstMixerTrack that has changed, and the new value of the mute
+flag.
+The GstMixerTrack remains valid until the message is freed.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="message" transfer-ownership="none">
+          <doc xml:whitespace="preserve">A mute-toggled change notification message.</doc>
+          <type name="Gst.Message" c:type="GstMessage*"/>
+        </parameter>
+        <parameter name="track" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Pointer to hold a GstMixerTrack object, or NULL.</doc>
+          <type name="MixerTrack" c:type="GstMixerTrack**"/>
+        </parameter>
+        <parameter name="mute" transfer-ownership="none">
+          <doc xml:whitespace="preserve">A pointer to a gboolean variable, or NULL.</doc>
+          <type name="gboolean" c:type="gboolean*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="mixer_message_parse_option_changed"
+              c:identifier="gst_mixer_message_parse_option_changed"
+              version="0.10.14">
+      <doc xml:whitespace="preserve">Extracts the GstMixerOptions and new value from a option-changed bus notification
+message.
+The options and value returned remain valid until the message is freed.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="message" transfer-ownership="none">
+          <doc xml:whitespace="preserve">A volume-changed change notification message.</doc>
+          <type name="Gst.Message" c:type="GstMessage*"/>
+        </parameter>
+        <parameter name="options" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Pointer to hold a GstMixerOptions object, or NULL.</doc>
+          <type name="MixerOptions" c:type="GstMixerOptions**"/>
+        </parameter>
+        <parameter name="value" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Result location to receive the new options value, or NULL.</doc>
+          <type name="utf8" c:type="gchar**"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="mixer_message_parse_options_list_changed"
+              c:identifier="gst_mixer_message_parse_options_list_changed"
+              version="0.10.18">
+      <doc xml:whitespace="preserve">Extracts the GstMixerOptions whose value list has changed from an
+options-list-changed bus notification message.
+The options object returned remains valid until the message is freed. You
+do not need to unref it.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="message" transfer-ownership="none">
+          <doc xml:whitespace="preserve">A volume-changed change notification message.</doc>
+          <type name="Gst.Message" c:type="GstMessage*"/>
+        </parameter>
+        <parameter name="options" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Pointer to hold a GstMixerOptions object, or NULL.</doc>
+          <type name="MixerOptions" c:type="GstMixerOptions**"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="mixer_message_parse_record_toggled"
+              c:identifier="gst_mixer_message_parse_record_toggled"
+              version="0.10.14">
+      <doc xml:whitespace="preserve">Extracts the contents of a record-toggled bus message. Reads
+the GstMixerTrack that has changed, and the new value of the 
+recording flag.
+The GstMixerTrack remains valid until the message is freed.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="message" transfer-ownership="none">
+          <doc xml:whitespace="preserve">A record-toggled change notification message.</doc>
+          <type name="Gst.Message" c:type="GstMessage*"/>
+        </parameter>
+        <parameter name="track" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Pointer to hold a GstMixerTrack object, or NULL.</doc>
+          <type name="MixerTrack" c:type="GstMixerTrack**"/>
+        </parameter>
+        <parameter name="record" transfer-ownership="none">
+          <doc xml:whitespace="preserve">A pointer to a gboolean variable, or NULL.</doc>
+          <type name="gboolean" c:type="gboolean*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="mixer_message_parse_volume_changed"
+              c:identifier="gst_mixer_message_parse_volume_changed"
+              version="0.10.14">
+      <doc xml:whitespace="preserve">Parses a volume-changed notification message and extracts the track object
+it refers to, as well as an array of volumes and the size of the volumes array.
+The track object remains valid until the message is freed.
+The caller must free the array returned in the volumes parameter using g_free
+when they are done with it.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="message" transfer-ownership="none">
+          <doc xml:whitespace="preserve">A volume-changed change notification message.</doc>
+          <type name="Gst.Message" c:type="GstMessage*"/>
+        </parameter>
+        <parameter name="track" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Pointer to hold a GstMixerTrack object, or NULL.</doc>
+          <type name="MixerTrack" c:type="GstMixerTrack**"/>
+        </parameter>
+        <parameter name="volumes" transfer-ownership="none">
+          <doc xml:whitespace="preserve">A pointer to receive an array of gint values, or NULL.</doc>
+          <type name="gint" c:type="gint**"/>
+        </parameter>
+        <parameter name="num_channels" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Result location to receive the number of channels, or NULL.</doc>
+          <type name="gint" c:type="gint*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="navigation_event_get_type"
+              c:identifier="gst_navigation_event_get_type"
+              version="0.10.23">
+      <doc xml:whitespace="preserve">Inspect a #GstEvent and return the #GstNavigationEventType of the event, or
+#GST_NAVIGATION_EVENT_INVALID if the event is not a #GstNavigation event.</doc>
+      <return-value transfer-ownership="none">
+        <type name="NavigationEventType" c:type="GstNavigationEventType"/>
+      </return-value>
+      <parameters>
+        <parameter name="event" transfer-ownership="none">
+          <doc xml:whitespace="preserve">A #GstEvent to inspect.</doc>
+          <type name="Gst.Event" c:type="GstEvent*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="navigation_event_parse_command"
+              c:identifier="gst_navigation_event_parse_command"
+              version="0.10.23">
+      <doc xml:whitespace="preserve">Inspect a #GstNavigation command event and retrieve the enum value of the
+associated command.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if the navigation command could be extracted, otherwise FALSE.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="event" transfer-ownership="none">
+          <doc xml:whitespace="preserve">A #GstEvent to inspect.</doc>
+          <type name="Gst.Event" c:type="GstEvent*"/>
+        </parameter>
+        <parameter name="command" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Pointer to GstNavigationCommand to receive the type of the navigation event.</doc>
+          <type name="NavigationCommand" c:type="GstNavigationCommand*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="navigation_event_parse_key_event"
+              c:identifier="gst_navigation_event_parse_key_event"
+              version="0.10.23">
+      <return-value transfer-ownership="none">
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="event" transfer-ownership="none">
+          <doc xml:whitespace="preserve">A #GstEvent to inspect.</doc>
+          <type name="Gst.Event" c:type="GstEvent*"/>
+        </parameter>
+        <parameter name="key" transfer-ownership="none">
+          <doc xml:whitespace="preserve">A pointer to a location to receive the string identifying the key press. The returned string is owned by the event, and valid only until the event is unreffed.</doc>
+          <type name="utf8" c:type="gchar**"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="navigation_event_parse_mouse_button_event"
+              c:identifier="gst_navigation_event_parse_mouse_button_event"
+              version="0.10.23">
+      <doc xml:whitespace="preserve">Retrieve the details of either a #GstNavigation mouse button press event or
+a mouse button release event. Determine which type the event is using
+gst_navigation_event_get_type() to retrieve the #GstNavigationEventType.
+otherwise FALSE.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if the button number and both coordinates could be extracted,</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="event" transfer-ownership="none">
+          <doc xml:whitespace="preserve">A #GstEvent to inspect.</doc>
+          <type name="Gst.Event" c:type="GstEvent*"/>
+        </parameter>
+        <parameter name="button" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Pointer to a gint that will receive the button number associated with the event.</doc>
+          <type name="gint" c:type="gint*"/>
+        </parameter>
+        <parameter name="x" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Pointer to a gdouble to receive the x coordinate of the mouse button event.</doc>
+          <type name="gdouble" c:type="gdouble*"/>
+        </parameter>
+        <parameter name="y" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Pointer to a gdouble to receive the y coordinate of the mouse button event.</doc>
+          <type name="gdouble" c:type="gdouble*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="navigation_event_parse_mouse_move_event"
+              c:identifier="gst_navigation_event_parse_mouse_move_event"
+              version="0.10.23">
+      <doc xml:whitespace="preserve">Inspect a #GstNavigation mouse movement event and extract the coordinates
+of the event.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if both coordinates could be extracted, otherwise FALSE.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="event" transfer-ownership="none">
+          <doc xml:whitespace="preserve">A #GstEvent to inspect.</doc>
+          <type name="Gst.Event" c:type="GstEvent*"/>
+        </parameter>
+        <parameter name="x" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Pointer to a gdouble to receive the x coordinate of the mouse movement.</doc>
+          <type name="gdouble" c:type="gdouble*"/>
+        </parameter>
+        <parameter name="y" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Pointer to a gdouble to receive the y coordinate of the mouse movement.</doc>
+          <type name="gdouble" c:type="gdouble*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="navigation_message_get_type"
+              c:identifier="gst_navigation_message_get_type"
+              version="0.10.23">
+      <doc xml:whitespace="preserve">Check a bus message to see if it is a #GstNavigation event, and return
+the #GstNavigationMessageType identifying the type of the message if so.
+#GST_NAVIGATION_MESSAGE_INVALID if the message is not a #GstNavigation
+notification.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">The type of the #GstNavigationMessage, or</doc>
+        <type name="NavigationMessageType" c:type="GstNavigationMessageType"/>
+      </return-value>
+      <parameters>
+        <parameter name="message" transfer-ownership="none">
+          <doc xml:whitespace="preserve">A #GstMessage to inspect.</doc>
+          <type name="Gst.Message" c:type="GstMessage*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="navigation_message_new_angles_changed"
+              c:identifier="gst_navigation_message_new_angles_changed"
+              version="0.10.23"
+              introspectable="0">
+      <doc xml:whitespace="preserve">Creates a new #GstNavigation message with type
+#GST_NAVIGATION_MESSAGE_ANGLES_CHANGED for notifying an application
+that the current angle, or current number of angles available in a
+multiangle video has changed.</doc>
+      <return-value>
+        <doc xml:whitespace="preserve">The new #GstMessage.</doc>
+        <type name="Gst.Message" c:type="GstMessage*"/>
+      </return-value>
+      <parameters>
+        <parameter name="src" transfer-ownership="none">
+          <doc xml:whitespace="preserve">A #GstObject to set as source of the new message.</doc>
+          <type name="Gst.Object" c:type="GstObject*"/>
+        </parameter>
+        <parameter name="cur_angle" transfer-ownership="none">
+          <doc xml:whitespace="preserve">The currently selected angle.</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+        <parameter name="n_angles" transfer-ownership="none">
+          <doc xml:whitespace="preserve">The number of viewing angles now available.</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="navigation_message_new_commands_changed"
+              c:identifier="gst_navigation_message_new_commands_changed"
+              version="0.10.23"
+              introspectable="0">
+      <doc xml:whitespace="preserve">Creates a new #GstNavigation message with type
+#GST_NAVIGATION_MESSAGE_COMMANDS_CHANGED</doc>
+      <return-value>
+        <doc xml:whitespace="preserve">The new #GstMessage.</doc>
+        <type name="Gst.Message" c:type="GstMessage*"/>
+      </return-value>
+      <parameters>
+        <parameter name="src" transfer-ownership="none">
+          <doc xml:whitespace="preserve">A #GstObject to set as source of the new message.</doc>
+          <type name="Gst.Object" c:type="GstObject*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="navigation_message_new_mouse_over"
+              c:identifier="gst_navigation_message_new_mouse_over"
+              version="0.10.23"
+              introspectable="0">
+      <doc xml:whitespace="preserve">Creates a new #GstNavigation message with type
+#GST_NAVIGATION_MESSAGE_MOUSE_OVER.</doc>
+      <return-value>
+        <doc xml:whitespace="preserve">The new #GstMessage.</doc>
+        <type name="Gst.Message" c:type="GstMessage*"/>
+      </return-value>
+      <parameters>
+        <parameter name="src" transfer-ownership="none">
+          <doc xml:whitespace="preserve">A #GstObject to set as source of the new message.</doc>
+          <type name="Gst.Object" c:type="GstObject*"/>
+        </parameter>
+        <parameter name="active" transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE if the mouse has entered a clickable area of the display. %FALSE if it over a non-clickable area.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="navigation_message_parse_angles_changed"
+              c:identifier="gst_navigation_message_parse_angles_changed"
+              version="0.10.23">
+      <doc xml:whitespace="preserve">Parse a #GstNavigation message of type GST_NAVIGATION_MESSAGE_ANGLES_CHANGED
+and extract the @cur_angle and @n_angles parameters.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">%TRUE if the message could be successfully parsed. %FALSE if not.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="message" transfer-ownership="none">
+          <doc xml:whitespace="preserve">A #GstMessage to inspect.</doc>
+          <type name="Gst.Message" c:type="GstMessage*"/>
+        </parameter>
+        <parameter name="cur_angle" transfer-ownership="none">
+          <doc xml:whitespace="preserve">A pointer to a #guint to receive the new current angle number, or NULL</doc>
+          <type name="guint" c:type="guint*"/>
+        </parameter>
+        <parameter name="n_angles" transfer-ownership="none">
+          <doc xml:whitespace="preserve">A pointer to a #guint to receive the new angle count, or NULL.</doc>
+          <type name="guint" c:type="guint*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="navigation_message_parse_mouse_over"
+              c:identifier="gst_navigation_message_parse_mouse_over"
+              version="0.10.23">
+      <doc xml:whitespace="preserve">Parse a #GstNavigation message of type #GST_NAVIGATION_MESSAGE_MOUSE_OVER
+and extract the active/inactive flag. If the mouse over event is marked
+active, it indicates that the mouse is over a clickable area.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">%TRUE if the message could be successfully parsed. %FALSE if not.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="message" transfer-ownership="none">
+          <doc xml:whitespace="preserve">A #GstMessage to inspect.</doc>
+          <type name="Gst.Message" c:type="GstMessage*"/>
+        </parameter>
+        <parameter name="active" transfer-ownership="none">
+          <doc xml:whitespace="preserve">A pointer to a gboolean to receive the active/inactive state, or NULL.</doc>
+          <type name="gboolean" c:type="gboolean*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="navigation_query_get_type"
+              c:identifier="gst_navigation_query_get_type"
+              version="0.10.23">
+      <doc xml:whitespace="preserve">Inspect a #GstQuery and return the #GstNavigationQueryType associated with
+it if it is a #GstNavigation query.
+#GST_NAVIGATION_QUERY_INVALID</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">The #GstNavigationQueryType of the query, or</doc>
+        <type name="NavigationQueryType" c:type="GstNavigationQueryType"/>
+      </return-value>
+      <parameters>
+        <parameter name="query" transfer-ownership="none">
+          <doc xml:whitespace="preserve">The query to inspect</doc>
+          <type name="Gst.Query" c:type="GstQuery*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="navigation_query_new_angles"
+              c:identifier="gst_navigation_query_new_angles"
+              version="0.10.23"
+              introspectable="0">
+      <doc xml:whitespace="preserve">Create a new #GstNavigation angles query. When executed, it will
+query the pipeline for the set of currently available angles, which may be
+greater than one in a multiangle video.</doc>
+      <return-value>
+        <doc xml:whitespace="preserve">The new query.</doc>
+        <type name="Gst.Query" c:type="GstQuery*"/>
+      </return-value>
+    </function>
+    <function name="navigation_query_new_commands"
+              c:identifier="gst_navigation_query_new_commands"
+              version="0.10.23"
+              introspectable="0">
+      <doc xml:whitespace="preserve">Create a new #GstNavigation commands query. When executed, it will
+query the pipeline for the set of currently available commands.</doc>
+      <return-value>
+        <doc xml:whitespace="preserve">The new query.</doc>
+        <type name="Gst.Query" c:type="GstQuery*"/>
+      </return-value>
+    </function>
+    <function name="navigation_query_parse_angles"
+              c:identifier="gst_navigation_query_parse_angles"
+              version="0.10.23">
+      <doc xml:whitespace="preserve">Parse the current angle number in the #GstNavigation angles @query into the
+#guint pointed to by the @cur_angle variable, and the number of available
+angles into the #guint pointed to by the @n_angles variable.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">%TRUE if the query could be successfully parsed. %FALSE if not.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="query" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstQuery</doc>
+          <type name="Gst.Query" c:type="GstQuery*"/>
+        </parameter>
+        <parameter name="cur_angle" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Pointer to a #guint into which to store the currently selected angle value from the query, or NULL</doc>
+          <type name="guint" c:type="guint*"/>
+        </parameter>
+        <parameter name="n_angles" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Pointer to a #guint into which to store the number of angles value from the query, or NULL</doc>
+          <type name="guint" c:type="guint*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="navigation_query_parse_commands_length"
+              c:identifier="gst_navigation_query_parse_commands_length"
+              version="0.10.23">
+      <doc xml:whitespace="preserve">Parse the number of commands in the #GstNavigation commands @query.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">%TRUE if the query could be successfully parsed. %FALSE if not.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="query" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstQuery</doc>
+          <type name="Gst.Query" c:type="GstQuery*"/>
+        </parameter>
+        <parameter name="n_cmds" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the number of commands in this query.</doc>
+          <type name="guint" c:type="guint*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="navigation_query_parse_commands_nth"
+              c:identifier="gst_navigation_query_parse_commands_nth"
+              version="0.10.23">
+      <doc xml:whitespace="preserve">Parse the #GstNavigation command query and retrieve the @nth command from
+it into @cmd. If the list contains less elements than @nth, @cmd will be
+set to #GST_NAVIGATION_COMMAND_INVALID.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">%TRUE if the query could be successfully parsed. %FALSE if not.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="query" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstQuery</doc>
+          <type name="Gst.Query" c:type="GstQuery*"/>
+        </parameter>
+        <parameter name="nth" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the nth command to retrieve.</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+        <parameter name="cmd" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a pointer to store the nth command into.</doc>
+          <type name="NavigationCommand" c:type="GstNavigationCommand*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="navigation_query_set_angles"
+              c:identifier="gst_navigation_query_set_angles"
+              version="0.10.23">
+      <doc xml:whitespace="preserve">Set the #GstNavigation angles query result field in @query.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="query" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstQuery</doc>
+          <type name="Gst.Query" c:type="GstQuery*"/>
+        </parameter>
+        <parameter name="cur_angle" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the current viewing angle to set.</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+        <parameter name="n_angles" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the number of viewing angles to set.</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="navigation_query_set_commands"
+              c:identifier="gst_navigation_query_set_commands"
+              version="0.10.23"
+              introspectable="0">
+      <doc xml:whitespace="preserve">Set the #GstNavigation command query result fields in @query. The number
+of commands passed must be equal to @n_commands.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="query" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstQuery</doc>
+          <type name="Gst.Query" c:type="GstQuery*"/>
+        </parameter>
+        <parameter name="n_cmds" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the number of commands to set.</doc>
+          <type name="gint" c:type="gint"/>
+        </parameter>
+        <parameter transfer-ownership="none">
+          <varargs>
+          </varargs>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="navigation_query_set_commandsv"
+              c:identifier="gst_navigation_query_set_commandsv"
+              version="0.10.23">
+      <doc xml:whitespace="preserve">Set the #GstNavigation command query result fields in @query. The number
+of commands passed must be equal to @n_commands.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="query" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstQuery</doc>
+          <type name="Gst.Query" c:type="GstQuery*"/>
+        </parameter>
+        <parameter name="n_cmds" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the number of commands to set.</doc>
+          <type name="gint" c:type="gint"/>
+        </parameter>
+        <parameter name="cmds" transfer-ownership="none">
+          <doc xml:whitespace="preserve">An array containing @n_cmds @GstNavigationCommand values.</doc>
+          <type name="NavigationCommand" c:type="GstNavigationCommand*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="stream_volume_convert_volume"
+              c:identifier="gst_stream_volume_convert_volume"
+              version="0.10.25">
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">the converted volume</doc>
+        <type name="gdouble" c:type="gdouble"/>
+      </return-value>
+      <parameters>
+        <parameter name="from" transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GstStreamVolumeFormat to convert from</doc>
+          <type name="StreamVolumeFormat" c:type="GstStreamVolumeFormat"/>
+        </parameter>
+        <parameter name="to" transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GstStreamVolumeFormat to convert to</doc>
+          <type name="StreamVolumeFormat" c:type="GstStreamVolumeFormat"/>
+        </parameter>
+        <parameter name="val" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Volume in @from format that should be converted</doc>
+          <type name="gdouble" c:type="gdouble"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="x_overlay_expose" c:identifier="gst_x_overlay_expose">
+      <doc xml:whitespace="preserve">Tell an overlay that it has been exposed. This will redraw the current frame
+in the drawable even if the pipeline is PAUSED.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="overlay" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstXOverlay to expose.</doc>
+          <type name="XOverlay" c:type="GstXOverlay*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="x_overlay_got_window_handle"
+              c:identifier="gst_x_overlay_got_window_handle"
+              introspectable="0">
+      <doc xml:whitespace="preserve">This will post a "have-xwindow-id" element message on the bus.
+This function should only be used by video overlay plugin developers.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="overlay" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstXOverlay which got a window</doc>
+          <type name="XOverlay" c:type="GstXOverlay*"/>
+        </parameter>
+        <parameter name="handle" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a platform-specific handle referencing the window</doc>
+          <type c:type="guintptr"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="x_overlay_got_xwindow_id"
+              c:identifier="gst_x_overlay_got_xwindow_id"
+              deprecated="Use gst_x_overlay_got_window_handle() instead.">
+      <doc xml:whitespace="preserve">This will post a "have-xwindow-id" element message on the bus.
+This function should only be used by video overlay plugin developers.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="overlay" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstXOverlay which got a XWindow.</doc>
+          <type name="XOverlay" c:type="GstXOverlay*"/>
+        </parameter>
+        <parameter name="xwindow_id" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #XID referencing the XWindow.</doc>
+          <type name="gulong" c:type="gulong"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="x_overlay_handle_events"
+              c:identifier="gst_x_overlay_handle_events"
+              version="0.10.12">
+      <doc xml:whitespace="preserve">Tell an overlay that it should handle events from the window system. These
+events are forwared upstream as navigation events. In some window system,
+events are not propagated in the window hierarchy if a client is listening
+for them. This method allows you to disable events handling completely
+from the XOverlay.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="overlay" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstXOverlay to expose.</doc>
+          <type name="XOverlay" c:type="GstXOverlay*"/>
+        </parameter>
+        <parameter name="handle_events" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #gboolean indicating if events should be handled or not.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="x_overlay_prepare_xwindow_id"
+              c:identifier="gst_x_overlay_prepare_xwindow_id">
+      <doc xml:whitespace="preserve">This will post a "prepare-xwindow-id" element message on the bus
+to give applications an opportunity to call 
+gst_x_overlay_set_xwindow_id() before a plugin creates its own
+window.
+This function should only be used by video overlay plugin developers.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="overlay" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstXOverlay which does not yet have an XWindow.</doc>
+          <type name="XOverlay" c:type="GstXOverlay*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="x_overlay_set_render_rectangle"
+              c:identifier="gst_x_overlay_set_render_rectangle"
+              version="0.10.29">
+      <doc xml:whitespace="preserve">Configure a subregion as a video target within the window set by
+gst_x_overlay_set_window_handle(). If this is not used or not supported
+the video will fill the area of the window set as the overlay to 100%.
+By specifying the rectangle, the video can be overlayed to a specific region
+of that window only. After setting the new rectangle one should call
+gst_x_overlay_expose() to force a redraw. To unset the region pass -1 for
+the @width and @height parameters.
+This method is needed for non fullscreen video overlay in UI toolkits that
+do not support subwindows.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">%FALSE if not supported by the sink.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="overlay" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstXOverlay</doc>
+          <type name="XOverlay" c:type="GstXOverlay*"/>
+        </parameter>
+        <parameter name="x" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the horizontal offset of the render area inside the window</doc>
+          <type name="gint" c:type="gint"/>
+        </parameter>
+        <parameter name="y" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the vertical offset of the render area inside the window</doc>
+          <type name="gint" c:type="gint"/>
+        </parameter>
+        <parameter name="width" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the width of the render area inside the window</doc>
+          <type name="gint" c:type="gint"/>
+        </parameter>
+        <parameter name="height" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the height of the render area inside the window</doc>
+          <type name="gint" c:type="gint"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="x_overlay_set_window_handle"
+              c:identifier="gst_x_overlay_set_window_handle"
+              version="0.10.31"
+              introspectable="0">
+      <doc xml:whitespace="preserve">This will call the video overlay's set_window_handle method. You
+should use this method to tell to a XOverlay to display video output to a
+specific XWindow. Passing 0 as the xwindow_id will tell the overlay to
+stop using that window and create an internal one.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="overlay" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstXOverlay to set the XWindow on.</doc>
+          <type name="XOverlay" c:type="GstXOverlay*"/>
+        </parameter>
+        <parameter name="handle" transfer-ownership="none">
+          <type c:type="guintptr"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="x_overlay_set_xwindow_id"
+              c:identifier="gst_x_overlay_set_xwindow_id"
+              deprecated="Use gst_x_overlay_set_window_handle() instead.">
+      <doc xml:whitespace="preserve">This will call the video overlay's set_xwindow_id method. You should
+use this method to tell to a XOverlay to display video output to a
+specific XWindow. Passing 0 as the xwindow_id will tell the overlay to
+stop using that window and create an internal one.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="overlay" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstXOverlay to set the XWindow on.</doc>
+          <type name="XOverlay" c:type="GstXOverlay*"/>
+        </parameter>
+        <parameter name="xwindow_id" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #XID referencing the XWindow.</doc>
+          <type name="gulong" c:type="gulong"/>
+        </parameter>
+      </parameters>
+    </function>
+  </namespace>
+</repository>
diff --git a/gstreamer/plugins/interfaces/ffi/ffi.factor b/gstreamer/plugins/interfaces/ffi/ffi.factor
new file mode 100644 (file)
index 0000000..45d57d2
--- /dev/null
@@ -0,0 +1,17 @@
+! Copyright (C) 2010 Anton Gorenko.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.c-types alien.libraries combinators kernel
+system
+gobject-introspection glib.ffi gobject.ffi gstreamer.ffi ;
+IN: gstreamer.interfaces.ffi
+
+<<
+"gstreamer.interfaces" {
+    { [ os winnt? ] [ drop ] }
+    { [ os macosx? ] [ drop ] }
+    { [ os unix? ] [ "libgstinterfaces-0.10.so" cdecl add-library ] }
+} cond
+>>
+
+GIR: vocab:gstreamer/interfaces/GstInterfaces-0.10.gir
+
diff --git a/gstreamer/plugins/interfaces/interfaces.factor b/gstreamer/plugins/interfaces/interfaces.factor
new file mode 100644 (file)
index 0000000..b9b57f6
--- /dev/null
@@ -0,0 +1,5 @@
+! Copyright (C) 2010 Anton Gorenko.
+! See http://factorcode.org/license.txt for BSD license.
+USING: gstreamer.interfaces.ffi ;
+IN: gstreamer.interfaces
+
diff --git a/gstreamer/plugins/netbuffer/GstNetbuffer-0.10.gir b/gstreamer/plugins/netbuffer/GstNetbuffer-0.10.gir
new file mode 100644 (file)
index 0000000..c9f1f5b
--- /dev/null
@@ -0,0 +1,306 @@
+<?xml version="1.0"?>
+<!-- This file was automatically generated from C sources - DO NOT EDIT!
+To affect the contents of this file, edit the original C definitions,
+and/or use gtk-doc annotations.  -->
+<repository version="1.2"
+            xmlns="http://www.gtk.org/introspection/core/1.0"
+            xmlns:c="http://www.gtk.org/introspection/c/1.0"
+            xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+  <include name="GLib" version="2.0"/>
+  <include name="GModule" version="2.0"/>
+  <include name="GObject" version="2.0"/>
+  <include name="Gst" version="0.10"/>
+  <include name="libxml2" version="2.0"/>
+  <package name="gstreamer-netbuffer-0.10"/>
+  <c:include name="gst/netbuffer/gstnetbuffer.h"/>
+  <namespace name="GstNetbuffer"
+             version="0.10"
+             shared-library="libgstnetbuffer-0.10.so.0"
+             c:identifier-prefixes="Gst"
+             c:symbol-prefixes="gst">
+    <record name="NetAddress" c:type="GstNetAddress">
+      <doc xml:whitespace="preserve">An opaque network address as used in #GstNetBuffer.</doc>
+      <field name="type" writable="1">
+        <type name="NetType" c:type="GstNetType"/>
+      </field>
+      <union name="address" c:type="address">
+        <field name="ip6" writable="1">
+          <array zero-terminated="0" c:type="guint8" fixed-size="16">
+            <type name="guint8" c:type="guint8"/>
+          </array>
+        </field>
+        <field name="ip4" writable="1">
+          <type name="guint32" c:type="guint32"/>
+        </field>
+      </union>
+      <field name="port" writable="1">
+        <type name="guint16" c:type="guint16"/>
+      </field>
+      <field name="_gst_reserved" writable="1">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </record>
+    <class name="NetBuffer"
+           c:symbol-prefix="netbuffer"
+           c:type="GstNetBuffer"
+           parent="Gst.Buffer"
+           glib:type-name="GstNetBuffer"
+           glib:get-type="gst_netbuffer_get_type"
+           glib:type-struct="NetBufferClass"
+           glib:fundamental="1">
+      <doc xml:whitespace="preserve">buffer for use in network sources and sinks.
+It contains the source or destination address of the buffer.</doc>
+      <constructor name="new" c:identifier="gst_netbuffer_new">
+        <doc xml:whitespace="preserve">Create a new network buffer.</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">a new #GstNetBuffer.</doc>
+          <type name="NetBuffer" c:type="GstNetBuffer*"/>
+        </return-value>
+      </constructor>
+      <field name="buffer">
+        <type name="Gst.Buffer" c:type="GstBuffer"/>
+      </field>
+      <field name="from">
+        <type name="NetAddress" c:type="GstNetAddress"/>
+      </field>
+      <field name="to">
+        <type name="NetAddress" c:type="GstNetAddress"/>
+      </field>
+      <field name="_gst_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </class>
+    <record name="NetBufferClass"
+            c:type="GstNetBufferClass"
+            glib:is-gtype-struct-for="NetBuffer">
+      <field name="buffer_class">
+        <type name="Gst.BufferClass" c:type="GstBufferClass"/>
+      </field>
+      <field name="_gst_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </record>
+    <enumeration name="NetType" c:type="GstNetType">
+      <doc xml:whitespace="preserve">The Address type used in #GstNetAddress.</doc>
+      <member name="unknown" value="0" c:identifier="GST_NET_TYPE_UNKNOWN"/>
+      <member name="ip4" value="1" c:identifier="GST_NET_TYPE_IP4"/>
+      <member name="ip6" value="2" c:identifier="GST_NET_TYPE_IP6"/>
+    </enumeration>
+    <function name="netaddress_equal"
+              c:identifier="gst_netaddress_equal"
+              version="0.10.18">
+      <doc xml:whitespace="preserve">Compare two #GstNetAddress structures</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if they are identical, FALSE otherwise</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="naddr1" transfer-ownership="none">
+          <doc xml:whitespace="preserve">The first #GstNetAddress</doc>
+          <type name="NetAddress" c:type="GstNetAddress*"/>
+        </parameter>
+        <parameter name="naddr2" transfer-ownership="none">
+          <doc xml:whitespace="preserve">The second #GstNetAddress</doc>
+          <type name="NetAddress" c:type="GstNetAddress*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="netaddress_get_address_bytes"
+              c:identifier="gst_netaddress_get_address_bytes"
+              version="0.10.22">
+      <doc xml:whitespace="preserve">Get just the address bytes stored in @naddr into @address.
+Note that @port is expressed in network byte order, use g_ntohs() to convert
+it to host order. IP4 addresses are also stored in network byte order.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">number of bytes actually copied</doc>
+        <type name="gint" c:type="gint"/>
+      </return-value>
+      <parameters>
+        <parameter name="naddr" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a network address</doc>
+          <type name="NetAddress" c:type="GstNetAddress*"/>
+        </parameter>
+        <parameter name="address" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a location to store the result.</doc>
+          <type name="guint8" c:type="guint8"/>
+        </parameter>
+        <parameter name="port" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a location to store the port.</doc>
+          <type name="guint16" c:type="guint16*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="netaddress_get_ip4_address"
+              c:identifier="gst_netaddress_get_ip4_address">
+      <doc xml:whitespace="preserve">Get the IPv4 address stored in @naddr into @address. This function requires
+that the address type of @naddr is of type #GST_NET_TYPE_IP4.
+Note that @port and @address are expressed in network byte order, use
+g_ntohs() and g_ntohl() to convert them to host order.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if the address could be retrieved.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="naddr" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a network address</doc>
+          <type name="NetAddress" c:type="GstNetAddress*"/>
+        </parameter>
+        <parameter name="address" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a location to store the address.</doc>
+          <type name="guint32" c:type="guint32*"/>
+        </parameter>
+        <parameter name="port" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a location to store the port.</doc>
+          <type name="guint16" c:type="guint16*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="netaddress_get_ip6_address"
+              c:identifier="gst_netaddress_get_ip6_address">
+      <doc xml:whitespace="preserve">Get the IPv6 address stored in @naddr into @address.
+If @naddr is of type GST_NET_TYPE_IP4, the transitional IP6 address is
+returned.
+Note that @port is expressed in network byte order, use g_ntohs() to convert
+it to host order.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if the address could be retrieved.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="naddr" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a network address</doc>
+          <type name="NetAddress" c:type="GstNetAddress*"/>
+        </parameter>
+        <parameter name="address" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a location to store the result.</doc>
+          <type name="guint8" c:type="guint8"/>
+        </parameter>
+        <parameter name="port" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a location to store the port.</doc>
+          <type name="guint16" c:type="guint16*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="netaddress_get_net_type"
+              c:identifier="gst_netaddress_get_net_type">
+      <doc xml:whitespace="preserve">Get the type of address stored in @naddr.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">the network type stored in @naddr.</doc>
+        <type name="NetType" c:type="GstNetType"/>
+      </return-value>
+      <parameters>
+        <parameter name="naddr" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a network address</doc>
+          <type name="NetAddress" c:type="GstNetAddress*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="netaddress_set_address_bytes"
+              c:identifier="gst_netaddress_set_address_bytes"
+              version="0.10.22">
+      <doc xml:whitespace="preserve">Set just the address bytes stored in @naddr into @address.
+Note that @port must be expressed in network byte order, use g_htons() to
+convert it to network byte order order. IP4 address bytes must also be
+stored in network byte order.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">number of bytes actually copied</doc>
+        <type name="gint" c:type="gint"/>
+      </return-value>
+      <parameters>
+        <parameter name="naddr" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a network address</doc>
+          <type name="NetAddress" c:type="GstNetAddress*"/>
+        </parameter>
+        <parameter name="type" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the address type (IPv4 or IPV6)</doc>
+          <type name="NetType" c:type="GstNetType"/>
+        </parameter>
+        <parameter name="address" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a location to store the result.</doc>
+          <type name="guint8" c:type="guint8"/>
+        </parameter>
+        <parameter name="port" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a location to store the port.</doc>
+          <type name="guint16" c:type="guint16"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="netaddress_set_ip4_address"
+              c:identifier="gst_netaddress_set_ip4_address">
+      <doc xml:whitespace="preserve">Set @naddr with the IPv4 @address and @port pair.
+Note that @port and @address must be expressed in network byte order,
+use g_htons() and g_htonl() to convert them to network byte order.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="naddr" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a network address</doc>
+          <type name="NetAddress" c:type="GstNetAddress*"/>
+        </parameter>
+        <parameter name="address" transfer-ownership="none">
+          <doc xml:whitespace="preserve">an IPv4 network address.</doc>
+          <type name="guint32" c:type="guint32"/>
+        </parameter>
+        <parameter name="port" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a port number to set.</doc>
+          <type name="guint16" c:type="guint16"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="netaddress_set_ip6_address"
+              c:identifier="gst_netaddress_set_ip6_address">
+      <doc xml:whitespace="preserve">Set @naddr with the IPv6 @address and @port pair.
+Note that @port must be expressed in network byte order, use g_htons() to convert
+it to network byte order.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="naddr" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a network address</doc>
+          <type name="NetAddress" c:type="GstNetAddress*"/>
+        </parameter>
+        <parameter name="address" transfer-ownership="none">
+          <doc xml:whitespace="preserve">an IPv6 network address.</doc>
+          <type name="guint8" c:type="guint8"/>
+        </parameter>
+        <parameter name="port" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a port number to set.</doc>
+          <type name="guint16" c:type="guint16"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="netaddress_to_string"
+              c:identifier="gst_netaddress_to_string"
+              version="0.10.24">
+      <doc xml:whitespace="preserve">Copies a string representation of @naddr into @dest. Up to @len bytes are
+copied.
+enough</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">the number of bytes which would be produced if the buffer was large</doc>
+        <type name="gint" c:type="gint"/>
+      </return-value>
+      <parameters>
+        <parameter name="naddr" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstNetAddress</doc>
+          <type name="NetAddress" c:type="GstNetAddress*"/>
+        </parameter>
+        <parameter name="dest" transfer-ownership="none">
+          <doc xml:whitespace="preserve">destination</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+        <parameter name="len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">len of @dest</doc>
+          <type name="gulong" c:type="gulong"/>
+        </parameter>
+      </parameters>
+    </function>
+  </namespace>
+</repository>
diff --git a/gstreamer/plugins/netbuffer/ffi/ffi.factor b/gstreamer/plugins/netbuffer/ffi/ffi.factor
new file mode 100644 (file)
index 0000000..c291a8b
--- /dev/null
@@ -0,0 +1,16 @@
+! Copyright (C) 2010 Anton Gorenko.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.libraries combinators kernel system
+gobject-introspection glib.ffi ;
+IN: gstreamer.netbuffer.ffi
+
+<<
+"gstreamer.netbuffer" {
+    { [ os winnt? ] [ drop ] }
+    { [ os macosx? ] [ drop ] }
+    { [ os unix? ] [ "libgstnetbuffer-0.10.so" cdecl add-library ] }
+} cond
+>>
+
+GIR: vocab:gstreamer/netbuffer/GstNetbuffer-0.10.gir
+
diff --git a/gstreamer/plugins/netbuffer/netbuffer.factor b/gstreamer/plugins/netbuffer/netbuffer.factor
new file mode 100644 (file)
index 0000000..7273c3a
--- /dev/null
@@ -0,0 +1,5 @@
+! Copyright (C) 2010 Anton Gorenko.
+! See http://factorcode.org/license.txt for BSD license.
+USING: gstreamer.netbuffer.ffi ;
+IN: gstreamer.netbuffer
+
diff --git a/gstreamer/plugins/pbutils/GstPbutils-0.10.gir b/gstreamer/plugins/pbutils/GstPbutils-0.10.gir
new file mode 100644 (file)
index 0000000..99d8f89
--- /dev/null
@@ -0,0 +1,2336 @@
+<?xml version="1.0"?>
+<!-- This file was automatically generated from C sources - DO NOT EDIT!
+To affect the contents of this file, edit the original C definitions,
+and/or use gtk-doc annotations.  -->
+<repository version="1.2"
+            xmlns="http://www.gtk.org/introspection/core/1.0"
+            xmlns:c="http://www.gtk.org/introspection/c/1.0"
+            xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+  <include name="GLib" version="2.0"/>
+  <include name="GModule" version="2.0"/>
+  <include name="GObject" version="2.0"/>
+  <include name="Gst" version="0.10"/>
+  <include name="libxml2" version="2.0"/>
+  <package name="gstreamer-pbutils-0.10"/>
+  <c:include name="gst/pbutils/codec-utils.h"/>
+  <c:include name="gst/pbutils/descriptions.h"/>
+  <c:include name="gst/pbutils/encoding-profile.h"/>
+  <c:include name="gst/pbutils/encoding-target.h"/>
+  <c:include name="gst/pbutils/gstdiscoverer.h"/>
+  <c:include name="gst/pbutils/gstpluginsbaseversion.h"/>
+  <c:include name="gst/pbutils/install-plugins.h"/>
+  <c:include name="gst/pbutils/missing-plugins.h"/>
+  <c:include name="gst/pbutils/pbutils-enumtypes.h"/>
+  <c:include name="gst/pbutils/pbutils.h"/>
+  <namespace name="GstPbutils"
+             version="0.10"
+             shared-library="libgstpbutils-0.10.so.0,libgstreamer-0.10.so.0"
+             c:identifier-prefixes="Gst"
+             c:symbol-prefixes="gst">
+    <alias name="DiscovererAudioInfoClass"
+           c:type="GstDiscovererAudioInfoClass">
+      <type name="Gst.MiniObjectClass" c:type="GstMiniObjectClass"/>
+    </alias>
+    <alias name="DiscovererContainerInfoClass"
+           c:type="GstDiscovererContainerInfoClass">
+      <type name="Gst.MiniObjectClass" c:type="GstMiniObjectClass"/>
+    </alias>
+    <alias name="DiscovererInfoClass" c:type="GstDiscovererInfoClass">
+      <type name="Gst.MiniObjectClass" c:type="GstMiniObjectClass"/>
+    </alias>
+    <alias name="DiscovererStreamInfoClass"
+           c:type="GstDiscovererStreamInfoClass">
+      <type name="Gst.MiniObjectClass" c:type="GstMiniObjectClass"/>
+    </alias>
+    <alias name="DiscovererVideoInfoClass"
+           c:type="GstDiscovererVideoInfoClass">
+      <type name="Gst.MiniObjectClass" c:type="GstMiniObjectClass"/>
+    </alias>
+    <alias name="EncodingAudioProfileClass"
+           c:type="GstEncodingAudioProfileClass">
+      <type name="EncodingProfileClass" c:type="GstEncodingProfileClass"/>
+    </alias>
+    <alias name="EncodingContainerProfileClass"
+           c:type="GstEncodingContainerProfileClass">
+      <type name="EncodingProfileClass" c:type="GstEncodingProfileClass"/>
+    </alias>
+    <alias name="EncodingProfileClass" c:type="GstEncodingProfileClass">
+      <type name="Gst.MiniObjectClass" c:type="GstMiniObjectClass"/>
+    </alias>
+    <alias name="EncodingTargetClass" c:type="GstEncodingTargetClass">
+      <type name="Gst.MiniObjectClass" c:type="GstMiniObjectClass"/>
+    </alias>
+    <alias name="EncodingVideoProfileClass"
+           c:type="GstEncodingVideoProfileClass">
+      <type name="EncodingProfileClass" c:type="GstEncodingProfileClass"/>
+    </alias>
+    <class name="Discoverer"
+           c:symbol-prefix="discoverer"
+           c:type="GstDiscoverer"
+           version="0.10.31"
+           parent="GObject.Object"
+           glib:type-name="GstDiscoverer"
+           glib:get-type="gst_discoverer_get_type"
+           glib:type-struct="DiscovererClass">
+      <doc xml:whitespace="preserve">The #GstDiscoverer structure.</doc>
+      <constructor name="new"
+                   c:identifier="gst_discoverer_new"
+                   version="0.10.31"
+                   throws="1">
+        <doc xml:whitespace="preserve">Creates a new #GstDiscoverer with the provided timeout.
+If an error occurred when creating the discoverer, @err will be set
+accordingly and %NULL will be returned. If @err is set, the caller must
+free it when no longer needed using g_error_free().</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">The new #GstDiscoverer.</doc>
+          <type name="Discoverer" c:type="GstDiscoverer*"/>
+        </return-value>
+        <parameters>
+          <parameter name="timeout" transfer-ownership="none">
+            <doc xml:whitespace="preserve">timeout per file, in nanoseconds. Allowed are values between one second (#GST_SECOND) and one hour (3600 * #GST_SECOND)</doc>
+            <type name="Gst.ClockTime" c:type="GstClockTime"/>
+          </parameter>
+        </parameters>
+      </constructor>
+      <method name="discover_uri"
+              c:identifier="gst_discoverer_discover_uri"
+              version="0.10.31"
+              throws="1">
+        <doc xml:whitespace="preserve">Synchronously discovers the given @uri.
+A copy of @uri will be made internally, so the caller can safely g_free()
+afterwards.
+error occurred.</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">the result of the scanning. Can be %NULL if an</doc>
+          <type name="DiscovererInfo" c:type="GstDiscovererInfo*"/>
+        </return-value>
+        <parameters>
+          <parameter name="uri" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The URI to run on.</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="discover_uri_async"
+              c:identifier="gst_discoverer_discover_uri_async"
+              version="0.10.31">
+        <doc xml:whitespace="preserve">Appends the given @uri to the list of URIs to discoverer. The actual
+discovery of the @uri will only take place if gst_discoverer_start() has
+been called.
+A copy of @uri will be made internally, so the caller can safely g_free()
+afterwards.
+uris, else %FALSE</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE if the @uri was succesfully appended to the list of pending</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="uri" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the URI to add.</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="start"
+              c:identifier="gst_discoverer_start"
+              version="0.10.31">
+        <doc xml:whitespace="preserve">Allow asynchronous discovering of URIs to take place.
+A #GMainLoop must be available for #GstDiscoverer to properly work in
+asynchronous mode.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+      </method>
+      <method name="stop" c:identifier="gst_discoverer_stop" version="0.10.31">
+        <doc xml:whitespace="preserve">Stop the discovery of any pending URIs and clears the list of
+pending URIS (if any).</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+      </method>
+      <property name="timeout"
+                writable="1"
+                construct="1"
+                transfer-ownership="none">
+        <type name="guint64"/>
+      </property>
+      <field name="parent">
+        <type name="GObject.Object" c:type="GObject"/>
+      </field>
+      <field name="priv">
+        <type name="DiscovererPrivate" c:type="GstDiscovererPrivate*"/>
+      </field>
+      <field name="_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+      <glib:signal name="discovered">
+        <doc xml:whitespace="preserve">Will be emitted when all information on a URI could be discovered.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none"/>
+        </return-value>
+        <parameters>
+          <parameter name="object" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the results #GstDiscovererInfo</doc>
+            <type name="DiscovererInfo"/>
+          </parameter>
+          <parameter name="p0" transfer-ownership="none">
+            <doc xml:whitespace="preserve">#GError, which will be non-NULL if an error occurred during discovery</doc>
+            <type name="GLib.Error"/>
+          </parameter>
+        </parameters>
+      </glib:signal>
+      <glib:signal name="finished">
+        <doc xml:whitespace="preserve">Will be emitted when all pending URIs have been processed.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none"/>
+        </return-value>
+      </glib:signal>
+      <glib:signal name="starting">
+        <doc xml:whitespace="preserve">Will be emitted when the discover starts analyzing the pending URIs</doc>
+        <return-value transfer-ownership="none">
+          <type name="none"/>
+        </return-value>
+      </glib:signal>
+    </class>
+    <class name="DiscovererAudioInfo"
+           c:symbol-prefix="discoverer_audio_info"
+           c:type="GstDiscovererAudioInfo"
+           version="0.10.31"
+           parent="DiscovererStreamInfo"
+           glib:type-name="GstDiscovererAudioInfo"
+           glib:get-type="gst_discoverer_audio_info_get_type"
+           glib:fundamental="1">
+      <doc xml:whitespace="preserve">#GstDiscovererStreamInfo specific to audio streams.</doc>
+      <method name="get_bitrate"
+              c:identifier="gst_discoverer_audio_info_get_bitrate"
+              version="0.10.31">
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the average or nominal bitrate of the stream in bits/second.</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </method>
+      <method name="get_channels"
+              c:identifier="gst_discoverer_audio_info_get_channels"
+              version="0.10.31">
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the number of channels in the stream.</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </method>
+      <method name="get_depth"
+              c:identifier="gst_discoverer_audio_info_get_depth"
+              version="0.10.31">
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the number of bits used per sample in each channel.</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </method>
+      <method name="get_max_bitrate"
+              c:identifier="gst_discoverer_audio_info_get_max_bitrate"
+              version="0.10.31">
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the maximum bitrate of the stream in bits/second.</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </method>
+      <method name="get_sample_rate"
+              c:identifier="gst_discoverer_audio_info_get_sample_rate"
+              version="0.10.31">
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the sample rate of the stream in Hertz.</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </method>
+    </class>
+    <record name="DiscovererClass"
+            c:type="GstDiscovererClass"
+            glib:is-gtype-struct-for="Discoverer">
+      <field name="parentclass">
+        <type name="GObject.ObjectClass" c:type="GObjectClass"/>
+      </field>
+      <field name="finished">
+        <callback name="finished">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="discoverer" transfer-ownership="none">
+              <type name="Discoverer" c:type="GstDiscoverer*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="starting">
+        <callback name="starting">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="discoverer" transfer-ownership="none">
+              <type name="Discoverer" c:type="GstDiscoverer*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="discovered">
+        <callback name="discovered">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="discoverer" transfer-ownership="none">
+              <type name="Discoverer" c:type="GstDiscoverer*"/>
+            </parameter>
+            <parameter name="info" transfer-ownership="none">
+              <type name="DiscovererInfo" c:type="GstDiscovererInfo*"/>
+            </parameter>
+            <parameter name="err" transfer-ownership="none">
+              <type name="GLib.Error" c:type="GError*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </record>
+    <class name="DiscovererContainerInfo"
+           c:symbol-prefix="discoverer_container_info"
+           c:type="GstDiscovererContainerInfo"
+           version="0.10.31"
+           parent="DiscovererStreamInfo"
+           glib:type-name="GstDiscovererContainerInfo"
+           glib:get-type="gst_discoverer_container_info_get_type"
+           glib:fundamental="1">
+      <doc xml:whitespace="preserve">#GstDiscovererStreamInfo specific to container streams.</doc>
+      <method name="get_streams"
+              c:identifier="gst_discoverer_container_info_get_streams"
+              version="0.10.31"
+              introspectable="0">
+        <doc xml:whitespace="preserve">#GstDiscovererStreamInfo this container stream offers.
+Free with gst_discoverer_stream_info_list_free() after usage.</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">the list of</doc>
+          <type name="GLib.List" c:type="GList*">
+            <type name="Gst.DiscovererStreamInfo"/>
+          </type>
+        </return-value>
+      </method>
+    </class>
+    <class name="DiscovererInfo"
+           c:symbol-prefix="discoverer_info"
+           c:type="GstDiscovererInfo"
+           version="0.10.31"
+           parent="Gst.MiniObject"
+           glib:type-name="GstDiscovererInfo"
+           glib:get-type="gst_discoverer_info_get_type"
+           glib:fundamental="1">
+      <doc xml:whitespace="preserve">Structure containing the information of a URI analyzed by #GstDiscoverer.</doc>
+      <method name="copy"
+              c:identifier="gst_discoverer_info_copy"
+              introspectable="0">
+        <return-value>
+          <type name="DiscovererInfo" c:type="GstDiscovererInfo*"/>
+        </return-value>
+      </method>
+      <method name="get_audio_streams"
+              c:identifier="gst_discoverer_info_get_audio_streams"
+              version="0.10.31"
+              introspectable="0">
+        <doc xml:whitespace="preserve">Finds all the #GstDiscovererAudioInfo contained in @info
+matching #GstDiscovererStreamInfo. The caller should free it with
+gst_discoverer_stream_info_list_free().</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">A #GList of</doc>
+          <type name="GLib.List" c:type="GList*">
+            <type name="Gst.DiscovererStreamInfo"/>
+          </type>
+        </return-value>
+      </method>
+      <method name="get_container_streams"
+              c:identifier="gst_discoverer_info_get_container_streams"
+              version="0.10.31"
+              introspectable="0">
+        <doc xml:whitespace="preserve">Finds all the #GstDiscovererContainerInfo contained in @info
+matching #GstDiscovererStreamInfo. The caller should free it with
+gst_discoverer_stream_info_list_free().</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">A #GList of</doc>
+          <type name="GLib.List" c:type="GList*">
+            <type name="Gst.DiscovererStreamInfo"/>
+          </type>
+        </return-value>
+      </method>
+      <method name="get_duration"
+              c:identifier="gst_discoverer_info_get_duration"
+              version="0.10.31">
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the duration of the URI in #GstClockTime (nanoseconds).</doc>
+          <type name="Gst.ClockTime" c:type="GstClockTime"/>
+        </return-value>
+      </method>
+      <method name="get_misc"
+              c:identifier="gst_discoverer_info_get_misc"
+              version="0.10.31">
+        <doc xml:whitespace="preserve">(for example: information about missing plugins). If you wish to use the
+#GstStructure after the life-time of @info, you will need to copy it.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">Miscellaneous information stored as a #GstStructure</doc>
+          <type name="Gst.Structure" c:type="GstStructure*"/>
+        </return-value>
+      </method>
+      <method name="get_result"
+              c:identifier="gst_discoverer_info_get_result"
+              version="0.10.31">
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the result of the discovery as a #GstDiscovererResult.</doc>
+          <type name="DiscovererResult" c:type="GstDiscovererResult"/>
+        </return-value>
+      </method>
+      <method name="get_seekable"
+              c:identifier="gst_discoverer_info_get_seekable"
+              version="0.10.32">
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the wheter the URI is seekable.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </method>
+      <method name="get_stream_info"
+              c:identifier="gst_discoverer_info_get_stream_info"
+              version="0.10.31">
+        <doc xml:whitespace="preserve">#GstDiscovererStreamInfo.
+This structure can be traversed to see the original hierarchy. Unref with
+gst_discoverer_stream_info_unref() after usage.</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">the structure (or topology) of the URI as a</doc>
+          <type name="DiscovererStreamInfo" c:type="GstDiscovererStreamInfo*"/>
+        </return-value>
+      </method>
+      <method name="get_stream_list"
+              c:identifier="gst_discoverer_info_get_stream_list"
+              version="0.10.31"
+              introspectable="0">
+        <doc xml:whitespace="preserve">all streams contained in the #info. Free after usage
+with gst_discoverer_stream_info_list_free().</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">the list of</doc>
+          <type name="GLib.List" c:type="GList*">
+            <type name="Gst.DiscovererStreamInfo"/>
+          </type>
+        </return-value>
+      </method>
+      <method name="get_streams"
+              c:identifier="gst_discoverer_info_get_streams"
+              version="0.10.31"
+              introspectable="0">
+        <doc xml:whitespace="preserve">Finds the #GstDiscovererStreamInfo contained in @info that match the
+given @streamtype.
+matching #GstDiscovererStreamInfo. The caller should free it with
+gst_discoverer_stream_info_list_free().</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">A #GList of</doc>
+          <type name="GLib.List" c:type="GList*">
+            <type name="Gst.DiscovererStreamInfo"/>
+          </type>
+        </return-value>
+        <parameters>
+          <parameter name="streamtype" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a #GType derived from #GstDiscovererStreamInfo</doc>
+            <type name="GType" c:type="GType"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="get_tags"
+              c:identifier="gst_discoverer_info_get_tags"
+              version="0.10.31">
+        <doc xml:whitespace="preserve">the tags after the life-time of @info, you will need to copy them.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">all tags contained in the %URI. If you wish to use</doc>
+          <type name="Gst.TagList" c:type="GstTagList*"/>
+        </return-value>
+      </method>
+      <method name="get_uri"
+              c:identifier="gst_discoverer_info_get_uri"
+              version="0.10.31">
+        <doc xml:whitespace="preserve">Copy it if you wish to use it after the life-time of @info.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the URI to which this information corresponds to.</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </return-value>
+      </method>
+      <method name="get_video_streams"
+              c:identifier="gst_discoverer_info_get_video_streams"
+              version="0.10.31"
+              introspectable="0">
+        <doc xml:whitespace="preserve">Finds all the #GstDiscovererVideoInfo contained in @info
+matching #GstDiscovererStreamInfo. The caller should free it with
+gst_discoverer_stream_info_list_free().</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">A #GList of</doc>
+          <type name="GLib.List" c:type="GList*">
+            <type name="Gst.DiscovererStreamInfo"/>
+          </type>
+        </return-value>
+      </method>
+    </class>
+    <record name="DiscovererPrivate"
+            c:type="GstDiscovererPrivate"
+            disguised="1">
+    </record>
+    <enumeration name="DiscovererResult"
+                 version="0.10.31"
+                 glib:type-name="GstDiscovererResult"
+                 glib:get-type="gst_discoverer_result_get_type"
+                 c:type="GstDiscovererResult">
+      <doc xml:whitespace="preserve">Result values for the discovery process.</doc>
+      <member name="ok"
+              value="0"
+              c:identifier="GST_DISCOVERER_OK"
+              glib:nick="ok"/>
+      <member name="uri_invalid"
+              value="1"
+              c:identifier="GST_DISCOVERER_URI_INVALID"
+              glib:nick="uri-invalid"/>
+      <member name="error"
+              value="2"
+              c:identifier="GST_DISCOVERER_ERROR"
+              glib:nick="error"/>
+      <member name="timeout"
+              value="3"
+              c:identifier="GST_DISCOVERER_TIMEOUT"
+              glib:nick="timeout"/>
+      <member name="busy"
+              value="4"
+              c:identifier="GST_DISCOVERER_BUSY"
+              glib:nick="busy"/>
+      <member name="missing_plugins"
+              value="5"
+              c:identifier="GST_DISCOVERER_MISSING_PLUGINS"
+              glib:nick="missing-plugins"/>
+    </enumeration>
+    <class name="DiscovererStreamInfo"
+           c:symbol-prefix="discoverer_stream_info"
+           c:type="GstDiscovererStreamInfo"
+           version="0.10.31"
+           parent="Gst.MiniObject"
+           glib:type-name="GstDiscovererStreamInfo"
+           glib:get-type="gst_discoverer_stream_info_get_type"
+           glib:fundamental="1">
+      <doc xml:whitespace="preserve">Base structure for information concerning a media stream. Depending on the
+stream type, one can find more media-specific information in
+#GstDiscovererAudioInfo, #GstDiscovererVideoInfo, and
+#GstDiscovererContainerInfo.
+The #GstDiscovererStreamInfo represents the topology of the stream. Siblings
+can be iterated over with gst_discoverer_stream_info_get_next() and
+gst_discoverer_stream_info_get_previous(). Children (sub-streams) of a
+stream can be accessed using the #GstDiscovererContainerInfo API.
+As a simple example, if you run #GstDiscoverer on an AVI file with one audio
+and one video stream, you will get a #GstDiscovererContainerInfo
+corresponding to the AVI container, which in turn will have a
+#GstDiscovererAudioInfo sub-stream and a #GstDiscovererVideoInfo sub-stream
+for the audio and video streams respectively.</doc>
+      <function name="list_free"
+                c:identifier="gst_discoverer_stream_info_list_free">
+        <doc xml:whitespace="preserve">Decrements the reference count of all contained #GstDiscovererStreamInfo
+and fress the #GList.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="infos" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a #GList of #GstDiscovererStreamInfo</doc>
+            <type name="GLib.List" c:type="GList*">
+              <type name="gpointer" c:type="gpointer"/>
+            </type>
+          </parameter>
+        </parameters>
+      </function>
+      <method name="get_caps"
+              c:identifier="gst_discoverer_stream_info_get_caps"
+              version="0.10.31">
+        <doc xml:whitespace="preserve">#gst_caps_unref after usage.</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">the #GstCaps of the stream. Unref with</doc>
+          <type name="Gst.Caps" c:type="GstCaps*"/>
+        </return-value>
+      </method>
+      <method name="get_misc"
+              c:identifier="gst_discoverer_stream_info_get_misc"
+              version="0.10.31">
+        <doc xml:whitespace="preserve">example codec version, profile, etc..). If you wish to use the #GstStructure
+after the life-time of @info you will need to copy it.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">additional information regarding the stream (for</doc>
+          <type name="Gst.Structure" c:type="GstStructure*"/>
+        </return-value>
+      </method>
+      <method name="get_next"
+              c:identifier="gst_discoverer_stream_info_get_next"
+              version="0.10.31">
+        <doc xml:whitespace="preserve">for final streams.
+Unref with #gst_discoverer_stream_info_unref after usage.</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">the next #GstDiscovererStreamInfo in a chain. %NULL</doc>
+          <type name="DiscovererStreamInfo" c:type="GstDiscovererStreamInfo*"/>
+        </return-value>
+      </method>
+      <method name="get_previous"
+              c:identifier="gst_discoverer_stream_info_get_previous"
+              version="0.10.31">
+        <doc xml:whitespace="preserve">%NULL for starting points. Unref with #gst_discoverer_stream_info_unref
+after usage.</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">the previous #GstDiscovererStreamInfo in a chain.</doc>
+          <type name="DiscovererStreamInfo" c:type="GstDiscovererStreamInfo*"/>
+        </return-value>
+      </method>
+      <method name="get_stream_type_nick"
+              c:identifier="gst_discoverer_stream_info_get_stream_type_nick"
+              version="0.10.31">
+        <doc xml:whitespace="preserve">"container",...).</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a human readable name for the stream type of the given @info (ex : "audio",</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </return-value>
+      </method>
+      <method name="get_tags"
+              c:identifier="gst_discoverer_stream_info_get_tags"
+              version="0.10.31">
+        <doc xml:whitespace="preserve">use the tags after the life-time of @info you will need to copy them.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the tags contained in this stream. If you wish to</doc>
+          <type name="Gst.TagList" c:type="GstTagList*"/>
+        </return-value>
+      </method>
+    </class>
+    <class name="DiscovererVideoInfo"
+           c:symbol-prefix="discoverer_video_info"
+           c:type="GstDiscovererVideoInfo"
+           version="0.10.31"
+           parent="DiscovererStreamInfo"
+           glib:type-name="GstDiscovererVideoInfo"
+           glib:get-type="gst_discoverer_video_info_get_type"
+           glib:fundamental="1">
+      <doc xml:whitespace="preserve">#GstDiscovererStreamInfo specific to video streams (this includes images).</doc>
+      <method name="get_bitrate"
+              c:identifier="gst_discoverer_video_info_get_bitrate"
+              version="0.10.31">
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the average or nominal bitrate of the video stream in bits/second.</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </method>
+      <method name="get_depth"
+              c:identifier="gst_discoverer_video_info_get_depth"
+              version="0.10.31">
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the depth in bits of the video stream.</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </method>
+      <method name="get_framerate_denom"
+              c:identifier="gst_discoverer_video_info_get_framerate_denom"
+              version="0.10.31">
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the framerate of the video stream (denominator).</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </method>
+      <method name="get_framerate_num"
+              c:identifier="gst_discoverer_video_info_get_framerate_num"
+              version="0.10.31">
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the framerate of the video stream (numerator).</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </method>
+      <method name="get_height"
+              c:identifier="gst_discoverer_video_info_get_height"
+              version="0.10.31">
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the height of the video stream in pixels.</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </method>
+      <method name="get_max_bitrate"
+              c:identifier="gst_discoverer_video_info_get_max_bitrate"
+              version="0.10.31">
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the maximum bitrate of the video stream in bits/second.</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </method>
+      <method name="get_par_denom"
+              c:identifier="gst_discoverer_video_info_get_par_denom"
+              version="0.10.31">
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the Pixel Aspect Ratio (PAR) of the video stream (denominator).</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </method>
+      <method name="get_par_num"
+              c:identifier="gst_discoverer_video_info_get_par_num"
+              version="0.10.31">
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the Pixel Aspect Ratio (PAR) of the video stream (numerator).</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </method>
+      <method name="get_width"
+              c:identifier="gst_discoverer_video_info_get_width"
+              version="0.10.31">
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the width of the video stream in pixels.</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </method>
+      <method name="is_image"
+              c:identifier="gst_discoverer_video_info_is_image"
+              version="0.10.31">
+        <doc xml:whitespace="preserve">one frame).</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#TRUE if the video stream corresponds to an image (i.e. only contains</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </method>
+      <method name="is_interlaced"
+              c:identifier="gst_discoverer_video_info_is_interlaced"
+              version="0.10.31">
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE if the stream is interlaced, else %FALSE.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </method>
+    </class>
+    <constant name="ENCODING_CATEGORY_CAPTURE" value="capture">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="ENCODING_CATEGORY_DEVICE" value="device">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="ENCODING_CATEGORY_ONLINE_SERVICE" value="online-service">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="ENCODING_CATEGORY_STORAGE_EDITING" value="storage-editing">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <class name="EncodingAudioProfile"
+           c:symbol-prefix="encoding_audio_profile"
+           c:type="GstEncodingAudioProfile"
+           version="0.10.32"
+           parent="EncodingProfile"
+           glib:type-name="GstEncodingAudioProfile"
+           glib:get-type="gst_encoding_audio_profile_get_type"
+           glib:fundamental="1">
+      <doc xml:whitespace="preserve">Variant of #GstEncodingProfile for audio streams.</doc>
+      <constructor name="new"
+                   c:identifier="gst_encoding_audio_profile_new"
+                   version="0.10.32">
+        <doc xml:whitespace="preserve">Creates a new #GstEncodingAudioProfile
+All provided allocatable arguments will be internally copied, so can be
+safely freed/unreferenced after calling this method.</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">the newly created #GstEncodingAudioProfile.</doc>
+          <type name="EncodingAudioProfile" c:type="GstEncodingAudioProfile*"/>
+        </return-value>
+        <parameters>
+          <parameter name="format" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the #GstCaps</doc>
+            <type name="Gst.Caps" c:type="GstCaps*"/>
+          </parameter>
+          <parameter name="preset" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the preset(s) to use on the encoder, can be #NULL</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="restriction" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the #GstCaps used to restrict the input to the encoder, can be NULL. See gst_encoding_profile_get_restriction() for more details.</doc>
+            <type name="Gst.Caps" c:type="GstCaps*"/>
+          </parameter>
+          <parameter name="presence" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the number of time this stream must be used. 0 means any number of times (including never)</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+        </parameters>
+      </constructor>
+    </class>
+    <class name="EncodingContainerProfile"
+           c:symbol-prefix="encoding_container_profile"
+           c:type="GstEncodingContainerProfile"
+           version="0.10.32"
+           parent="EncodingProfile"
+           glib:type-name="GstEncodingContainerProfile"
+           glib:get-type="gst_encoding_container_profile_get_type"
+           glib:fundamental="1">
+      <doc xml:whitespace="preserve">Encoding profiles for containers. Keeps track of a list of #GstEncodingProfile</doc>
+      <constructor name="new"
+                   c:identifier="gst_encoding_container_profile_new"
+                   version="0.10.32">
+        <doc xml:whitespace="preserve">Creates a new #GstEncodingContainerProfile.</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">The newly created #GstEncodingContainerProfile.</doc>
+          <type name="EncodingContainerProfile"
+                c:type="GstEncodingContainerProfile*"/>
+        </return-value>
+        <parameters>
+          <parameter name="name" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The name of the container profile, can be %NULL</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="description" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The description of the container profile, can be %NULL</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="format" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The format to use for this profile</doc>
+            <type name="Gst.Caps" c:type="GstCaps*"/>
+          </parameter>
+          <parameter name="preset" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The preset to use for this profile</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </constructor>
+      <method name="add_profile"
+              c:identifier="gst_encoding_container_profile_add_profile"
+              version="0.10.32">
+        <doc xml:whitespace="preserve">Add a #GstEncodingProfile to the list of profiles handled by @container.
+No copy of @profile will be made, if you wish to use it elsewhere after this
+method you should increment its reference count.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE if the @stream was properly added, else %FALSE.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="profile" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the #GstEncodingProfile to add.</doc>
+            <type name="EncodingProfile" c:type="GstEncodingProfile*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="contains_profile"
+              c:identifier="gst_encoding_container_profile_contains_profile"
+              version="0.10.32">
+        <doc xml:whitespace="preserve">Checks if @container contains a #GstEncodingProfile identical to
+to @profile, else %FALSE.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE if @container contains a #GstEncodingProfile identical</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="profile" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a #GstEncodingProfile</doc>
+            <type name="EncodingProfile" c:type="GstEncodingProfile*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="get_profiles"
+              c:identifier="gst_encoding_container_profile_get_profiles">
+        <return-value transfer-ownership="none">
+          <type name="GLib.List" c:type="GList*">
+            <type name="gpointer" c:type="gpointer"/>
+          </type>
+        </return-value>
+      </method>
+    </class>
+    <class name="EncodingProfile"
+           c:symbol-prefix="encoding_profile"
+           c:type="GstEncodingProfile"
+           version="0.10.32"
+           parent="Gst.MiniObject"
+           glib:type-name="GstEncodingProfile"
+           glib:get-type="gst_encoding_profile_get_type"
+           glib:fundamental="1">
+      <doc xml:whitespace="preserve">The opaque base class object for all encoding profiles. This contains generic
+information like name, description, format and preset.</doc>
+      <function name="find"
+                c:identifier="gst_encoding_profile_find"
+                version="0.10.32">
+        <doc xml:whitespace="preserve">Find the #GstEncodingProfile with the specified name and category.</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">The matching #GstEncodingProfile or %NULL.</doc>
+          <type name="EncodingProfile" c:type="GstEncodingProfile*"/>
+        </return-value>
+        <parameters>
+          <parameter name="targetname" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The name of the target</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="profilename" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The name of the profile</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="category" transfer-ownership="none" allow-none="1">
+            <doc xml:whitespace="preserve">The target category. Can be %NULL</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </function>
+      <method name="get_description"
+              c:identifier="gst_encoding_profile_get_description"
+              version="0.10.32">
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the description of the profile, can be %NULL.</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </return-value>
+      </method>
+      <method name="get_format"
+              c:identifier="gst_encoding_profile_get_format"
+              version="0.10.32">
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the #GstCaps corresponding to the media format used in the profile.</doc>
+          <type name="Gst.Caps" c:type="GstCaps*"/>
+        </return-value>
+      </method>
+      <method name="get_input_caps"
+              c:identifier="gst_encoding_profile_get_input_caps"
+              version="0.10.32">
+        <doc xml:whitespace="preserve">Computes the full output caps that this @profile will be able to consume.
+when you are done with the caps.</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">The full caps the given @profile can consume. Call gst_caps_unref()</doc>
+          <type name="Gst.Caps" c:type="GstCaps*"/>
+        </return-value>
+      </method>
+      <method name="get_name"
+              c:identifier="gst_encoding_profile_get_name"
+              version="0.10.32">
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the name of the profile, can be %NULL.</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </return-value>
+      </method>
+      <method name="get_presence"
+              c:identifier="gst_encoding_profile_get_presence"
+              version="0.10.32">
+        <doc xml:whitespace="preserve">container profile. If 0, it is not a mandatory stream.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">The number of times the profile is used in its parent</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </method>
+      <method name="get_preset"
+              c:identifier="gst_encoding_profile_get_preset"
+              version="0.10.32">
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the name of the #GstPreset to be used in the profile.</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </return-value>
+      </method>
+      <method name="get_restriction"
+              c:identifier="gst_encoding_profile_get_restriction"
+              version="0.10.32">
+        <doc xml:whitespace="preserve">that will be used in the profile. The fields present in restriction caps are
+properties of the raw stream (that is before encoding), such as height and
+width for video and depth and sampling rate for audio. Does not apply to
+#GstEncodingContainerProfile (since there is no corresponding raw stream).
+Can be %NULL.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">The restriction #GstCaps to apply before the encoder</doc>
+          <type name="Gst.Caps" c:type="GstCaps*"/>
+        </return-value>
+      </method>
+      <method name="get_type_nick"
+              c:identifier="gst_encoding_profile_get_type_nick"
+              version="0.10.32">
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the human-readable name of the type of @profile.</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </return-value>
+      </method>
+      <method name="is_equal"
+              c:identifier="gst_encoding_profile_is_equal"
+              version="0.10.32">
+        <doc xml:whitespace="preserve">Checks whether the two #GstEncodingProfile are equal</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE if @a and @b are equal, else %FALSE.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="b" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a #GstEncodingProfile</doc>
+            <type name="EncodingProfile" c:type="GstEncodingProfile*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_description"
+              c:identifier="gst_encoding_profile_set_description"
+              version="0.10.32">
+        <doc xml:whitespace="preserve">Set @description as the given description for the @profile. A copy of @description will be made
+internally.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="description" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the description to set on the profile</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_format"
+              c:identifier="gst_encoding_profile_set_format"
+              version="0.10.32">
+        <doc xml:whitespace="preserve">Sets the media format used in the profile.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="format" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the media format to use in the profile.</doc>
+            <type name="Gst.Caps" c:type="GstCaps*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_name"
+              c:identifier="gst_encoding_profile_set_name"
+              version="0.10.32">
+        <doc xml:whitespace="preserve">Set @name as the given name for the @profile. A copy of @name will be made
+internally.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="name" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the name to set on the profile</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_presence"
+              c:identifier="gst_encoding_profile_set_presence"
+              version="0.10.32">
+        <doc xml:whitespace="preserve">Set the number of time the profile is used in its parent
+container profile. If 0, it is not a mandatory stream</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="presence" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the number of time the profile can be used</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_preset"
+              c:identifier="gst_encoding_profile_set_preset"
+              version="0.10.32">
+        <doc xml:whitespace="preserve">Sets the preset to use for the profile.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="preset" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the element preset to use</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_restriction"
+              c:identifier="gst_encoding_profile_set_restriction"
+              version="0.10.32">
+        <doc xml:whitespace="preserve">Set the restriction #GstCaps to apply before the encoder
+that will be used in the profile. See gst_encoding_profile_set_restriction()
+for more about restrictions. Does not apply to #GstEncodingContainerProfile.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="restriction" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the restriction to apply</doc>
+            <type name="Gst.Caps" c:type="GstCaps*"/>
+          </parameter>
+        </parameters>
+      </method>
+    </class>
+    <class name="EncodingTarget"
+           c:symbol-prefix="encoding_target"
+           c:type="GstEncodingTarget"
+           version="0.10.32"
+           parent="Gst.MiniObject"
+           glib:type-name="GstEncodingTarget"
+           glib:get-type="gst_encoding_target_get_type"
+           glib:fundamental="1">
+      <doc xml:whitespace="preserve">Collection of #GstEncodingProfile for a specific target or use-case.
+When being stored/loaded, targets come from a specific category, like
+#GST_ENCODING_CATEGORY_DEVICE.</doc>
+      <constructor name="new"
+                   c:identifier="gst_encoding_target_new"
+                   version="0.10.32"
+                   introspectable="0">
+        <doc xml:whitespace="preserve">Creates a new #GstEncodingTarget.
+The name and category can only consist of lowercase ASCII letters for the
+first character, followed by either lowercase ASCII letters, digits or
+hyphens ('-').
+The @category &lt;emphasis&gt;should&lt;/emphasis&gt; be one of the existing
+well-defined categories, like #GST_ENCODING_CATEGORY_DEVICE, but it
+&lt;emphasis&gt;can&lt;/emphasis&gt; be a application or user specific category if
+needed.
+there was an error.</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">The newly created #GstEncodingTarget or %NULL if</doc>
+          <type name="EncodingTarget" c:type="GstEncodingTarget*"/>
+        </return-value>
+        <parameters>
+          <parameter name="name" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The name of the target.</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="category" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The name of the category to which this @target belongs. For example: #GST_ENCODING_CATEGORY_DEVICE.</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="description" transfer-ownership="none">
+            <doc xml:whitespace="preserve">A description of #GstEncodingTarget in the current locale.</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="profiles" transfer-ownership="none">
+            <doc xml:whitespace="preserve">A #GList of #GstEncodingProfile.</doc>
+            <type name="GLib.List" c:type="GList*">
+              <type name="Gst.EncodingProfile"/>
+            </type>
+          </parameter>
+        </parameters>
+      </constructor>
+      <function name="load"
+                c:identifier="gst_encoding_target_load"
+                version="0.10.32"
+                throws="1">
+        <doc xml:whitespace="preserve">Searches for the #GstEncodingTarget with the given name, loads it
+and returns it.
+If the category name is specified only targets from that category will be
+searched for.</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">The #GstEncodingTarget if available, else %NULL.</doc>
+          <type name="EncodingTarget" c:type="GstEncodingTarget*"/>
+        </return-value>
+        <parameters>
+          <parameter name="name" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the name of the #GstEncodingTarget to load.</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="category" transfer-ownership="none" allow-none="1">
+            <doc xml:whitespace="preserve">the name of the target category, like #GST_ENCODING_CATEGORY_DEVICE. Can be %NULL</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </function>
+      <function name="load_from_file"
+                c:identifier="gst_encoding_target_load_from_file"
+                version="0.10.32"
+                throws="1">
+        <doc xml:whitespace="preserve">Opens the provided file and returns the contained #GstEncodingTarget.
+%NULL</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">The #GstEncodingTarget contained in the file, else</doc>
+          <type name="EncodingTarget" c:type="GstEncodingTarget*"/>
+        </return-value>
+        <parameters>
+          <parameter name="filepath" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The file location to load the #GstEncodingTarget from</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </function>
+      <method name="add_profile"
+              c:identifier="gst_encoding_target_add_profile"
+              version="0.10.32">
+        <doc xml:whitespace="preserve">Adds the given @profile to the @target. Each added profile must have
+a unique name within the profile.
+The @target will steal a reference to the @profile. If you wish to use
+the profile after calling this method, you should increase its reference
+count.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE if the profile was added, else %FALSE.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="profile" transfer-ownership="full">
+            <doc xml:whitespace="preserve">the #GstEncodingProfile to add</doc>
+            <type name="EncodingProfile" c:type="GstEncodingProfile*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="get_category"
+              c:identifier="gst_encoding_target_get_category"
+              version="0.10.32">
+        <doc xml:whitespace="preserve">#GST_ENCODING_CATEGORY_DEVICE.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">The category of the @target. For example:</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </return-value>
+      </method>
+      <method name="get_description"
+              c:identifier="gst_encoding_target_get_description"
+              version="0.10.32">
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">The description of the @target.</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </return-value>
+      </method>
+      <method name="get_name"
+              c:identifier="gst_encoding_target_get_name"
+              version="0.10.32">
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">The name of the @target.</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </return-value>
+      </method>
+      <method name="get_profile"
+              c:identifier="gst_encoding_target_get_profile"
+              version="0.10.32">
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">The matching #GstEncodingProfile, or %NULL.</doc>
+          <type name="EncodingProfile" c:type="GstEncodingProfile*"/>
+        </return-value>
+        <parameters>
+          <parameter name="name" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the name of the profile to retrieve</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="get_profiles"
+              c:identifier="gst_encoding_target_get_profiles"
+              version="0.10.32"
+              introspectable="0">
+        <doc xml:whitespace="preserve">#GstEncodingProfile(s) this @target handles.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">A list of</doc>
+          <type name="GLib.List" c:type="GList*">
+            <type name="Gst.EncodingProfile"/>
+          </type>
+        </return-value>
+      </method>
+      <method name="save"
+              c:identifier="gst_encoding_target_save"
+              version="0.10.32"
+              throws="1">
+        <doc xml:whitespace="preserve">Saves the @target to a default user-local directory.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE if the target was correctly saved, else %FALSE.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </method>
+      <method name="save_to_file"
+              c:identifier="gst_encoding_target_save_to_file"
+              version="0.10.32"
+              throws="1">
+        <doc xml:whitespace="preserve">Saves the @target to the provided file location.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE if the target was correctly saved, else %FALSE.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="filepath" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the location to store the @target at.</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+    </class>
+    <class name="EncodingVideoProfile"
+           c:symbol-prefix="encoding_video_profile"
+           c:type="GstEncodingVideoProfile"
+           version="0.10.32"
+           parent="EncodingProfile"
+           glib:type-name="GstEncodingVideoProfile"
+           glib:get-type="gst_encoding_video_profile_get_type"
+           glib:fundamental="1">
+      <doc xml:whitespace="preserve">Variant of #GstEncodingProfile for video streams, allows specifying the @pass.</doc>
+      <constructor name="new"
+                   c:identifier="gst_encoding_video_profile_new"
+                   version="0.10.32">
+        <doc xml:whitespace="preserve">Creates a new #GstEncodingVideoProfile
+All provided allocatable arguments will be internally copied, so can be
+safely freed/unreferenced after calling this method.
+If you wish to control the pass number (in case of multi-pass scenarios),
+please refer to the gst_encoding_video_profile_set_pass() documentation.
+If you wish to use/force a constant framerate please refer to the
+gst_encoding_video_profile_set_variableframerate() documentation.</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">the newly created #GstEncodingVideoProfile.</doc>
+          <type name="EncodingVideoProfile" c:type="GstEncodingVideoProfile*"/>
+        </return-value>
+        <parameters>
+          <parameter name="format" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the #GstCaps</doc>
+            <type name="Gst.Caps" c:type="GstCaps*"/>
+          </parameter>
+          <parameter name="preset" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the preset(s) to use on the encoder, can be #NULL</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="restriction" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the #GstCaps used to restrict the input to the encoder, can be NULL. See gst_encoding_profile_get_restriction() for more details.</doc>
+            <type name="Gst.Caps" c:type="GstCaps*"/>
+          </parameter>
+          <parameter name="presence" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the number of time this stream must be used. 0 means any number of times (including never)</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+        </parameters>
+      </constructor>
+      <method name="get_pass"
+              c:identifier="gst_encoding_video_profile_get_pass"
+              version="0.10.32">
+        <doc xml:whitespace="preserve">1 for multi-pass. 0 if this is not a multi-pass profile</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">The pass number if this is part of a multi-pass profile. Starts at</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </method>
+      <method name="get_variableframerate"
+              c:identifier="gst_encoding_video_profile_get_variableframerate"
+              version="0.10.32">
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">Whether non-constant video framerate is allowed for encoding.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </method>
+      <method name="set_pass"
+              c:identifier="gst_encoding_video_profile_set_pass"
+              version="0.10.32">
+        <doc xml:whitespace="preserve">Sets the pass number of this video profile. The first pass profile should have
+this value set to 1. If this video profile isn't part of a multi-pass profile,
+you may set it to 0 (the default value).</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="pass" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the pass number for this profile</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_variableframerate"
+              c:identifier="gst_encoding_video_profile_set_variableframerate"
+              version="0.10.32">
+        <doc xml:whitespace="preserve">If set to %TRUE, then the incoming streamm will be allowed to have non-constant
+framerate. If set to %FALSE (default value), then the incoming stream will
+be normalized by dropping/duplicating frames in order to produce a
+constance framerate.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="variableframerate" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a boolean</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </parameter>
+        </parameters>
+      </method>
+    </class>
+    <record name="InstallPluginsContext"
+            c:type="GstInstallPluginsContext"
+            version="0.10.12"
+            glib:type-name="GstInstallPluginsContext"
+            glib:get-type="gst_install_plugins_context_get_type"
+            c:symbol-prefix="install_plugins_context">
+      <doc xml:whitespace="preserve">Opaque context structure for the plugin installation. Use the provided
+API to set details on it.</doc>
+      <constructor name="new"
+                   c:identifier="gst_install_plugins_context_new"
+                   version="0.10.12">
+        <doc xml:whitespace="preserve">Creates a new #GstInstallPluginsContext.
+gst_install_plugins_context_free() when no longer needed</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">a new #GstInstallPluginsContext. Free with</doc>
+          <type name="InstallPluginsContext"
+                c:type="GstInstallPluginsContext*"/>
+        </return-value>
+      </constructor>
+      <method name="free"
+              c:identifier="gst_install_plugins_context_free"
+              version="0.10.12">
+        <doc xml:whitespace="preserve">Frees a #GstInstallPluginsContext.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+      </method>
+      <method name="set_xid"
+              c:identifier="gst_install_plugins_context_set_xid"
+              version="0.10.12">
+        <doc xml:whitespace="preserve">This function is for X11-based applications (such as most Gtk/Qt
+applications on linux/unix) only. You can use it to tell the external
+installer the XID of your main application window. That way the installer
+can make its own window transient to your application window during the
+installation.
+If set, the XID will be passed to the installer via a --transient-for=XID
+command line option.
+Gtk+/Gnome application should be able to obtain the XID of the top-level
+window like this:
+&lt;programlisting&gt;
+##include &amp;lt;gtk/gtk.h&amp;gt;
+##ifdef GDK_WINDOWING_X11
+##include &amp;lt;gdk/gdkx.h&amp;gt;
+##endif
+...
+##ifdef GDK_WINDOWING_X11
+xid = GDK_WINDOW_XWINDOW (GTK_WIDGET (application_window)-&amp;gt;window);
+##endif
+...
+&lt;/programlisting&gt;</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="xid" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the XWindow ID (XID) of the top-level application</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+        </parameters>
+      </method>
+    </record>
+    <callback name="InstallPluginsResultFunc"
+              c:type="GstInstallPluginsResultFunc"
+              version="0.10.12">
+      <doc xml:whitespace="preserve">The prototype of the callback function that will be called once the
+external plugin installer program has returned. You only need to provide
+a callback function if you are using the asynchronous interface.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="result" transfer-ownership="none">
+          <doc xml:whitespace="preserve">whether the installation of the requested plugins succeeded or not</doc>
+          <type name="InstallPluginsReturn" c:type="GstInstallPluginsReturn"/>
+        </parameter>
+        <parameter name="user_data" transfer-ownership="none" closure="1">
+          <doc xml:whitespace="preserve">the user data passed to gst_install_plugins_async()</doc>
+          <type name="gpointer" c:type="gpointer"/>
+        </parameter>
+      </parameters>
+    </callback>
+    <enumeration name="InstallPluginsReturn"
+                 version="0.10.12"
+                 glib:type-name="GstInstallPluginsReturn"
+                 glib:get-type="gst_install_plugins_return_get_type"
+                 c:type="GstInstallPluginsReturn">
+      <doc xml:whitespace="preserve">Result codes returned by gst_install_plugins_async() and
+gst_install_plugins_sync(), and also the result code passed to the
+#GstInstallPluginsResultFunc specified with gst_install_plugin_async().
+These codes indicate success or failure of starting an external installer
+program and to what extent the requested plugins could be installed.</doc>
+      <member name="success"
+              value="0"
+              c:identifier="GST_INSTALL_PLUGINS_SUCCESS"
+              glib:nick="success"/>
+      <member name="not_found"
+              value="1"
+              c:identifier="GST_INSTALL_PLUGINS_NOT_FOUND"
+              glib:nick="not-found"/>
+      <member name="error"
+              value="2"
+              c:identifier="GST_INSTALL_PLUGINS_ERROR"
+              glib:nick="error"/>
+      <member name="partial_success"
+              value="3"
+              c:identifier="GST_INSTALL_PLUGINS_PARTIAL_SUCCESS"
+              glib:nick="partial-success"/>
+      <member name="user_abort"
+              value="4"
+              c:identifier="GST_INSTALL_PLUGINS_USER_ABORT"
+              glib:nick="user-abort"/>
+      <member name="crashed"
+              value="100"
+              c:identifier="GST_INSTALL_PLUGINS_CRASHED"
+              glib:nick="crashed"/>
+      <member name="invalid"
+              value="101"
+              c:identifier="GST_INSTALL_PLUGINS_INVALID"
+              glib:nick="invalid"/>
+      <member name="started_ok"
+              value="200"
+              c:identifier="GST_INSTALL_PLUGINS_STARTED_OK"
+              glib:nick="started-ok"/>
+      <member name="internal_failure"
+              value="201"
+              c:identifier="GST_INSTALL_PLUGINS_INTERNAL_FAILURE"
+              glib:nick="internal-failure"/>
+      <member name="helper_missing"
+              value="202"
+              c:identifier="GST_INSTALL_PLUGINS_HELPER_MISSING"
+              glib:nick="helper-missing"/>
+      <member name="install_in_progress"
+              value="203"
+              c:identifier="GST_INSTALL_PLUGINS_INSTALL_IN_PROGRESS"
+              glib:nick="install-in-progress"/>
+    </enumeration>
+    <constant name="PLUGINS_BASE_VERSION_MAJOR" value="0">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="PLUGINS_BASE_VERSION_MICRO" value="32">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="PLUGINS_BASE_VERSION_MINOR" value="10">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="PLUGINS_BASE_VERSION_NANO" value="0">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <function name="codec_utils_aac_caps_set_level_and_profile"
+              c:identifier="gst_codec_utils_aac_caps_set_level_and_profile"
+              version="0.10.31">
+      <doc xml:whitespace="preserve">Sets the level and profile on @caps if it can be determined from
+gst_codec_utils_aac_get_profile() for more details on the parameters.
+If mpegversion is 4, the "base-profile" field is also set in @caps.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">%TRUE if the level and profile could be set, %FALSE otherwise.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="caps" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the #GstCaps to which level and profile fields are to be added</doc>
+          <type name="Gst.Caps" c:type="GstCaps*"/>
+        </parameter>
+        <parameter name="audio_config" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a pointer to the AudioSpecificConfig as specified in the Elementary Stream Descriptor (esds) in ISO/IEC 14496-1 (see below for a more details).</doc>
+          <type name="guint8" c:type="guint8*"/>
+        </parameter>
+        <parameter name="len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Length of @audio_config in bytes</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="codec_utils_aac_get_level"
+              c:identifier="gst_codec_utils_aac_get_level"
+              version="0.10.31">
+      <doc xml:whitespace="preserve">Determines the level of a stream as defined in ISO/IEC 14496-3. For AAC LC
+streams, the constraints from the AAC audio profile are applied. For AAC
+Main, LTP, SSR and others, the Main profile is used.
+The @audio_config parameter follows the following format, starting from the
+most significant bit of the first byte:
+&lt;itemizedlist&gt;
+&lt;listitem&gt;&lt;para&gt;
+Bit 0:4 contains the AudioObjectType
+&lt;/para&gt;&lt;/listitem&gt;
+&lt;listitem&gt;&lt;para&gt;
+Bit 5:8 contains the sample frequency index (if this is 0xf, then the
+next 24 bits define the actual sample frequency, and subsequent
+fields are appropriately shifted).
+&lt;/para&gt;&lt;/listitem&gt;
+&lt;listitem&gt;&lt;para&gt;
+Bit 9:12 contains the channel configuration
+&lt;/para&gt;&lt;/listitem&gt;
+&lt;/itemizedlist&gt;
+&lt;note&gt;
+HE-AAC support has not yet been implemented.
+&lt;/note&gt;
+determined.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">The level as a const string and %NULL if the level could not be</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="audio_config" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a pointer to the AudioSpecificConfig as specified in the Elementary Stream Descriptor (esds) in ISO/IEC 14496-1.</doc>
+          <type name="guint8" c:type="guint8*"/>
+        </parameter>
+        <parameter name="len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Length of @audio_config in bytes</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="codec_utils_aac_get_profile"
+              c:identifier="gst_codec_utils_aac_get_profile"
+              version="0.10.31">
+      <doc xml:whitespace="preserve">Returns the profile of the given AAC stream as a string. The profile is
+determined using the AudioObjectType field which is in the first 5 bits of
+&lt;note&gt;
+HE-AAC support has not yet been implemented.
+&lt;/note&gt;
+determined.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">The profile as a const string and %NULL if the profile could not be</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="audio_config" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a pointer to the AudioSpecificConfig as specified in the Elementary Stream Descriptor (esds) in ISO/IEC 14496-1 (see gst_codec_utils_aac_get_level() for a more details).</doc>
+          <type name="guint8" c:type="guint8*"/>
+        </parameter>
+        <parameter name="len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Length of @audio_config in bytes</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="codec_utils_aac_get_sample_rate_from_index"
+              c:identifier="gst_codec_utils_aac_get_sample_rate_from_index"
+              version="0.10.31">
+      <doc xml:whitespace="preserve">Translates the sample rate index found in AAC headers to the actual sample
+rate.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">The sample rate if @sr_idx is valid, 0 otherwise.</doc>
+        <type name="guint" c:type="guint"/>
+      </return-value>
+      <parameters>
+        <parameter name="sr_idx" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Sample rate index as from the AudioSpecificConfig (MPEG-4 container) or ADTS frame header</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="codec_utils_h264_caps_set_level_and_profile"
+              c:identifier="gst_codec_utils_h264_caps_set_level_and_profile"
+              version="0.10.31">
+      <doc xml:whitespace="preserve">Sets the level and profile in @caps if it can be determined from @sps. See
+gst_codec_utils_h264_get_level() and gst_codec_utils_h264_get_profile()
+for more details on the parameters.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">%TRUE if the level and profile could be set, %FALSE otherwise.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="caps" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the #GstCaps to which the level and profile are to be added</doc>
+          <type name="Gst.Caps" c:type="GstCaps*"/>
+        </parameter>
+        <parameter name="sps" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Pointer to the sequence parameter set for the stream.</doc>
+          <type name="guint8" c:type="guint8*"/>
+        </parameter>
+        <parameter name="len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Length of the data available in @sps.</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="codec_utils_h264_get_level"
+              c:identifier="gst_codec_utils_h264_get_level"
+              version="0.10.31">
+      <doc xml:whitespace="preserve">Converts the level indication (level_idc) in the stream's
+sequence parameter set into a string. The SPS is expected to have the
+same format as for gst_codec_utils_h264_get_profile().</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">The level as a const string, or %NULL if there is an error.</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="sps" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Pointer to the sequence parameter set for the stream.</doc>
+          <type name="guint8" c:type="guint8*"/>
+        </parameter>
+        <parameter name="len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Length of the data available in @sps.</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="codec_utils_h264_get_profile"
+              c:identifier="gst_codec_utils_h264_get_profile"
+              version="0.10.31">
+      <doc xml:whitespace="preserve">Converts the profile indication (profile_idc) in the stream's
+sequence parameter set into a string. The SPS is expected to have the
+following format, as defined in the H.264 specification. The SPS is viewed
+as a bitstream here, with bit 0 being the most significant bit of the first
+byte.
+&lt;itemizedlist&gt;
+&lt;listitem&gt;&lt;para&gt;Bit 0:7   - Profile indication&lt;/para&gt;&lt;/listitem&gt;
+&lt;listitem&gt;&lt;para&gt;Bit 8     - constraint_set0_flag&lt;/para&gt;&lt;/listitem&gt;
+&lt;listitem&gt;&lt;para&gt;Bit 9     - constraint_set1_flag&lt;/para&gt;&lt;/listitem&gt;
+&lt;listitem&gt;&lt;para&gt;Bit 10    - constraint_set2_flag&lt;/para&gt;&lt;/listitem&gt;
+&lt;listitem&gt;&lt;para&gt;Bit 11    - constraint_set3_flag&lt;/para&gt;&lt;/listitem&gt;
+&lt;listitem&gt;&lt;para&gt;Bit 12    - constraint_set3_flag&lt;/para&gt;&lt;/listitem&gt;
+&lt;listitem&gt;&lt;para&gt;Bit 13:15 - Reserved&lt;/para&gt;&lt;/listitem&gt;
+&lt;listitem&gt;&lt;para&gt;Bit 16:24 - Level indication&lt;/para&gt;&lt;/listitem&gt;
+&lt;/itemizedlist&gt;</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">The profile as a const string, or %NULL if there is an error.</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="sps" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Pointer to the sequence parameter set for the stream.</doc>
+          <type name="guint8" c:type="guint8*"/>
+        </parameter>
+        <parameter name="len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Length of the data available in @sps.</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="codec_utils_mpeg4video_caps_set_level_and_profile"
+              c:identifier="gst_codec_utils_mpeg4video_caps_set_level_and_profile"
+              version="0.10.31">
+      <doc xml:whitespace="preserve">Sets the level and profile in @caps if it can be determined from
+gst_codec_utils_mpeg4video_get_profile() for more details on the
+parameters.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">%TRUE if the level and profile could be set, %FALSE otherwise.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="caps" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the #GstCaps to which the level and profile are to be added</doc>
+          <type name="Gst.Caps" c:type="GstCaps*"/>
+        </parameter>
+        <parameter name="vis_obj_seq" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Pointer to the visual object sequence for the stream.</doc>
+          <type name="guint8" c:type="guint8*"/>
+        </parameter>
+        <parameter name="len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Length of the data available in @sps.</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="codec_utils_mpeg4video_get_level"
+              c:identifier="gst_codec_utils_mpeg4video_get_level"
+              version="0.10.31">
+      <doc xml:whitespace="preserve">Converts the level indication in the stream's visual object sequence into
+a string. @vis_obj_seq is expected to be the data following the visual
+object sequence start code. Only the first byte
+(profile_and_level_indication) is used.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">The level as a const string, or NULL if there is an error.</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="vis_obj_seq" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Pointer to the visual object sequence for the stream.</doc>
+          <type name="guint8" c:type="guint8*"/>
+        </parameter>
+        <parameter name="len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Length of the data available in @sps.</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="codec_utils_mpeg4video_get_profile"
+              c:identifier="gst_codec_utils_mpeg4video_get_profile"
+              version="0.10.31">
+      <doc xml:whitespace="preserve">Converts the profile indication in the stream's visual object sequence into
+a string. @vis_obj_seq is expected to be the data following the visual
+object sequence start code. Only the first byte
+(profile_and_level_indication) is used.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">The profile as a const string, or NULL if there is an error.</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="vis_obj_seq" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Pointer to the visual object sequence for the stream.</doc>
+          <type name="guint8" c:type="guint8*"/>
+        </parameter>
+        <parameter name="len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Length of the data available in @sps.</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="encoding_list_all_targets"
+              c:identifier="gst_encoding_list_all_targets"
+              version="0.10.32">
+      <doc xml:whitespace="preserve">List all available #GstEncodingTarget for the specified category, or all categories
+if @categoryname is %NULL.</doc>
+      <return-value transfer-ownership="full">
+        <doc xml:whitespace="preserve">The list of #GstEncodingTarget</doc>
+        <type name="GLib.List" c:type="GList*">
+          <type name="EncodingTarget"/>
+        </type>
+      </return-value>
+      <parameters>
+        <parameter name="categoryname"
+                   transfer-ownership="none"
+                   allow-none="1">
+          <doc xml:whitespace="preserve">The category, for ex: #GST_ENCODING_CATEGORY_DEVICE. Can be %NULL.</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="encoding_list_available_categories"
+              c:identifier="gst_encoding_list_available_categories"
+              version="0.10.32">
+      <doc xml:whitespace="preserve">Lists all #GstEncodingTarget categories present on disk.
+of #GstEncodingTarget categories.</doc>
+      <return-value transfer-ownership="full">
+        <doc xml:whitespace="preserve">A list</doc>
+        <type name="GLib.List" c:type="GList*">
+          <type name="utf8"/>
+        </type>
+      </return-value>
+    </function>
+    <function name="install_plugins_async"
+              c:identifier="gst_install_plugins_async"
+              version="0.10.12">
+      <doc xml:whitespace="preserve">Requests plugin installation without blocking. Once the plugins have been
+installed or installation has failed, @func will be called with the result
+of the installation and your provided @user_data pointer.
+This function requires a running GLib/Gtk main loop. If you are not
+running a GLib/Gtk main loop, make sure to regularly call
+g_main_context_iteration(NULL,FALSE).
+The installer strings that make up @detail are typically obtained by
+calling gst_missing_plugin_message_get_installer_detail() on missing-plugin
+messages that have been caught on a pipeline's bus or created by the
+application via the provided API, such as gst_missing_element_message_new().
+It is possible to request the installation of multiple missing plugins in
+one go (as might be required if there is a demuxer for a certain format
+installed but no suitable video decoder and no suitable audio decoder).</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">result code whether an external installer could be started</doc>
+        <type name="InstallPluginsReturn" c:type="GstInstallPluginsReturn"/>
+      </return-value>
+      <parameters>
+        <parameter name="details" transfer-ownership="none">
+          <doc xml:whitespace="preserve">NULL-terminated array of installer string details (see below)</doc>
+          <type name="utf8" c:type="gchar**"/>
+        </parameter>
+        <parameter name="ctx" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstInstallPluginsContext, or NULL</doc>
+          <type name="InstallPluginsContext"
+                c:type="GstInstallPluginsContext*"/>
+        </parameter>
+        <parameter name="func"
+                   transfer-ownership="none"
+                   scope="async"
+                   closure="3">
+          <doc xml:whitespace="preserve">the function to call when the installer program returns</doc>
+          <type name="InstallPluginsResultFunc"
+                c:type="GstInstallPluginsResultFunc"/>
+        </parameter>
+        <parameter name="user_data" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the user data to pass to @func when called, or NULL</doc>
+          <type name="gpointer" c:type="gpointer"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="install_plugins_installation_in_progress"
+              c:identifier="gst_install_plugins_installation_in_progress"
+              version="0.10.12">
+      <doc xml:whitespace="preserve">Checks whether plugin installation (initiated by this application only)
+is currently in progress.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if plugin installation is in progress, otherwise FALSE</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+    </function>
+    <function name="install_plugins_return_get_name"
+              c:identifier="gst_install_plugins_return_get_name"
+              version="0.10.12">
+      <doc xml:whitespace="preserve">Convenience function to return the descriptive string associated
+with a status code.  This function returns English strings and
+should not be used for user messages. It is here only to assist
+in debugging.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">a descriptive string for the status code in @ret</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="ret" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the return status code</doc>
+          <type name="InstallPluginsReturn" c:type="GstInstallPluginsReturn"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="install_plugins_supported"
+              c:identifier="gst_install_plugins_supported"
+              version="0.10.15">
+      <doc xml:whitespace="preserve">Checks whether plugin installation is likely to be supported by the
+current environment. This currently only checks whether the helper script
+that is to be provided by the distribution or operating system vendor
+exists.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if plugin installation is likely to be supported.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+    </function>
+    <function name="install_plugins_sync"
+              c:identifier="gst_install_plugins_sync"
+              version="0.10.12">
+      <doc xml:whitespace="preserve">Requests plugin installation and block until the plugins have been
+installed or installation has failed.
+This function should almost never be used, it only exists for cases where
+a non-GLib main loop is running and the user wants to run it in a separate
+thread and marshal the result back asynchronously into the main thread
+using the other non-GLib main loop. You should almost always use
+gst_install_plugins_async() instead of this function.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">the result of the installation.</doc>
+        <type name="InstallPluginsReturn" c:type="GstInstallPluginsReturn"/>
+      </return-value>
+      <parameters>
+        <parameter name="details" transfer-ownership="none">
+          <doc xml:whitespace="preserve">NULL-terminated array of installer string details</doc>
+          <type name="utf8" c:type="gchar**"/>
+        </parameter>
+        <parameter name="ctx" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstInstallPluginsContext, or NULL</doc>
+          <type name="InstallPluginsContext"
+                c:type="GstInstallPluginsContext*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="is_missing_plugin_message"
+              c:identifier="gst_is_missing_plugin_message">
+      <doc xml:whitespace="preserve">Checks whether @msg is a missing plugins message.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">%TRUE if @msg is a missing-plugins message, otherwise %FALSE.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="msg" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstMessage</doc>
+          <type name="Gst.Message" c:type="GstMessage*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="missing_decoder_installer_detail_new"
+              c:identifier="gst_missing_decoder_installer_detail_new"
+              version="0.10.15">
+      <doc xml:whitespace="preserve">Returns an opaque string containing all the details about the missing
+element to be passed to an external installer called via
+gst_install_plugins_async() or gst_install_plugins_sync().
+This function is mainly for applications that call external plugin
+installation mechanisms using one of the two above-mentioned functions in
+the case where the application knows exactly what kind of plugin it is
+missing.
+with g_free() when not needed any longer.</doc>
+      <return-value transfer-ownership="full">
+        <doc xml:whitespace="preserve">a newly-allocated detail string, or NULL on error. Free string</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="decode_caps" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the (fixed) caps for which a decoder element is needed</doc>
+          <type name="Gst.Caps" c:type="GstCaps*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="missing_decoder_message_new"
+              c:identifier="gst_missing_decoder_message_new">
+      <doc xml:whitespace="preserve">Creates a missing-plugin message for @element to notify the application
+that a decoder element for a particular set of (fixed) caps is missing.
+This function is mainly for use in plugins.</doc>
+      <return-value transfer-ownership="full">
+        <doc xml:whitespace="preserve">a new #GstMessage, or NULL on error</doc>
+        <type name="Gst.Message" c:type="GstMessage*"/>
+      </return-value>
+      <parameters>
+        <parameter name="element" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the #GstElement posting the message</doc>
+          <type name="Gst.Element" c:type="GstElement*"/>
+        </parameter>
+        <parameter name="decode_caps" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the (fixed) caps for which a decoder element is needed</doc>
+          <type name="Gst.Caps" c:type="GstCaps*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="missing_element_installer_detail_new"
+              c:identifier="gst_missing_element_installer_detail_new"
+              version="0.10.15">
+      <doc xml:whitespace="preserve">Returns an opaque string containing all the details about the missing
+element to be passed to an external installer called via
+gst_install_plugins_async() or gst_install_plugins_sync().
+This function is mainly for applications that call external plugin
+installation mechanisms using one of the two above-mentioned functions in
+the case where the application knows exactly what kind of plugin it is
+missing.
+with g_free() when not needed any longer.</doc>
+      <return-value transfer-ownership="full">
+        <doc xml:whitespace="preserve">a newly-allocated detail string, or NULL on error. Free string</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="factory_name" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the name of the missing element (element factory), e.g. "videoscale" or "cdparanoiasrc"</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="missing_element_message_new"
+              c:identifier="gst_missing_element_message_new">
+      <doc xml:whitespace="preserve">Creates a missing-plugin message for @element to notify the application
+that a certain required element is missing. This function is mainly for
+use in plugins.</doc>
+      <return-value transfer-ownership="full">
+        <doc xml:whitespace="preserve">a new #GstMessage, or NULL on error</doc>
+        <type name="Gst.Message" c:type="GstMessage*"/>
+      </return-value>
+      <parameters>
+        <parameter name="element" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the #GstElement posting the message</doc>
+          <type name="Gst.Element" c:type="GstElement*"/>
+        </parameter>
+        <parameter name="factory_name" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the name of the missing element (element factory), e.g. "videoscale" or "cdparanoiasrc"</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="missing_encoder_installer_detail_new"
+              c:identifier="gst_missing_encoder_installer_detail_new"
+              version="0.10.15">
+      <doc xml:whitespace="preserve">Returns an opaque string containing all the details about the missing
+element to be passed to an external installer called via
+gst_install_plugins_async() or gst_install_plugins_sync().
+This function is mainly for applications that call external plugin
+installation mechanisms using one of the two above-mentioned functions in
+the case where the application knows exactly what kind of plugin it is
+missing.
+with g_free() when not needed any longer.</doc>
+      <return-value transfer-ownership="full">
+        <doc xml:whitespace="preserve">a newly-allocated detail string, or NULL on error. Free string</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="encode_caps" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the (fixed) caps for which an encoder element is needed</doc>
+          <type name="Gst.Caps" c:type="GstCaps*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="missing_encoder_message_new"
+              c:identifier="gst_missing_encoder_message_new">
+      <doc xml:whitespace="preserve">Creates a missing-plugin message for @element to notify the application
+that an encoder element for a particular set of (fixed) caps is missing.
+This function is mainly for use in plugins.</doc>
+      <return-value transfer-ownership="full">
+        <doc xml:whitespace="preserve">a new #GstMessage, or NULL on error</doc>
+        <type name="Gst.Message" c:type="GstMessage*"/>
+      </return-value>
+      <parameters>
+        <parameter name="element" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the #GstElement posting the message</doc>
+          <type name="Gst.Element" c:type="GstElement*"/>
+        </parameter>
+        <parameter name="encode_caps" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the (fixed) caps for which an encoder element is needed</doc>
+          <type name="Gst.Caps" c:type="GstCaps*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="missing_plugin_message_get_description"
+              c:identifier="gst_missing_plugin_message_get_description">
+      <doc xml:whitespace="preserve">Returns a localised string describing the missing feature, for use in
+error dialogs and the like. Should never return NULL unless @msg is not
+a valid missing-plugin message.
+This function is mainly for applications that need a human-readable string
+describing a missing plugin, given a previously collected missing-plugin
+message
+string with g_free() when not needed any longer.</doc>
+      <return-value transfer-ownership="full">
+        <doc xml:whitespace="preserve">a newly-allocated description string, or NULL on error. Free</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="msg" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a missing-plugin #GstMessage of type #GST_MESSAGE_ELEMENT</doc>
+          <type name="Gst.Message" c:type="GstMessage*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="missing_plugin_message_get_installer_detail"
+              c:identifier="gst_missing_plugin_message_get_installer_detail">
+      <doc xml:whitespace="preserve">Returns an opaque string containing all the details about the missing
+element to be passed to an external installer called via
+gst_install_plugins_async() or gst_install_plugins_sync().
+This function is mainly for applications that call external plugin
+installation mechanisms using one of the two above-mentioned functions.
+with g_free() when not needed any longer.</doc>
+      <return-value transfer-ownership="full">
+        <doc xml:whitespace="preserve">a newly-allocated detail string, or NULL on error. Free string</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="msg" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a missing-plugin #GstMessage of type #GST_MESSAGE_ELEMENT</doc>
+          <type name="Gst.Message" c:type="GstMessage*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="missing_uri_sink_installer_detail_new"
+              c:identifier="gst_missing_uri_sink_installer_detail_new"
+              version="0.10.15">
+      <doc xml:whitespace="preserve">Returns an opaque string containing all the details about the missing
+element to be passed to an external installer called via
+gst_install_plugins_async() or gst_install_plugins_sync().
+This function is mainly for applications that call external plugin
+installation mechanisms using one of the two above-mentioned functions in
+the case where the application knows exactly what kind of plugin it is
+missing.
+with g_free() when not needed any longer.</doc>
+      <return-value transfer-ownership="full">
+        <doc xml:whitespace="preserve">a newly-allocated detail string, or NULL on error. Free string</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="protocol" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the URI protocol the missing source needs to implement, e.g. "http" or "mms"</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="missing_uri_sink_message_new"
+              c:identifier="gst_missing_uri_sink_message_new">
+      <doc xml:whitespace="preserve">Creates a missing-plugin message for @element to notify the application
+that a sink element for a particular URI protocol is missing. This
+function is mainly for use in plugins.</doc>
+      <return-value transfer-ownership="full">
+        <doc xml:whitespace="preserve">a new #GstMessage, or NULL on error</doc>
+        <type name="Gst.Message" c:type="GstMessage*"/>
+      </return-value>
+      <parameters>
+        <parameter name="element" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the #GstElement posting the message</doc>
+          <type name="Gst.Element" c:type="GstElement*"/>
+        </parameter>
+        <parameter name="protocol" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the URI protocol the missing sink needs to implement, e.g. "http" or "smb"</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="missing_uri_source_installer_detail_new"
+              c:identifier="gst_missing_uri_source_installer_detail_new"
+              version="0.10.15">
+      <doc xml:whitespace="preserve">Returns an opaque string containing all the details about the missing
+element to be passed to an external installer called via
+gst_install_plugins_async() or gst_install_plugins_sync().
+This function is mainly for applications that call external plugin
+installation mechanisms using one of the two above-mentioned functions in
+the case where the application knows exactly what kind of plugin it is
+missing.
+with g_free() when not needed any longer.</doc>
+      <return-value transfer-ownership="full">
+        <doc xml:whitespace="preserve">a newly-allocated detail string, or NULL on error. Free string</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="protocol" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the URI protocol the missing source needs to implement, e.g. "http" or "mms"</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="missing_uri_source_message_new"
+              c:identifier="gst_missing_uri_source_message_new">
+      <doc xml:whitespace="preserve">Creates a missing-plugin message for @element to notify the application
+that a source element for a particular URI protocol is missing. This
+function is mainly for use in plugins.</doc>
+      <return-value transfer-ownership="full">
+        <doc xml:whitespace="preserve">a new #GstMessage, or NULL on error</doc>
+        <type name="Gst.Message" c:type="GstMessage*"/>
+      </return-value>
+      <parameters>
+        <parameter name="element" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the #GstElement posting the message</doc>
+          <type name="Gst.Element" c:type="GstElement*"/>
+        </parameter>
+        <parameter name="protocol" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the URI protocol the missing source needs to implement, e.g. "http" or "mms"</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="pb_utils_add_codec_description_to_tag_list"
+              c:identifier="gst_pb_utils_add_codec_description_to_tag_list">
+      <doc xml:whitespace="preserve">Adds a codec tag describing the format specified by @caps to @taglist.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if a codec tag was added, FALSE otherwise.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="taglist" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstTagList</doc>
+          <type name="Gst.TagList" c:type="GstTagList*"/>
+        </parameter>
+        <parameter name="codec_tag" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a GStreamer codec tag such as #GST_TAG_AUDIO_CODEC, #GST_TAG_VIDEO_CODEC or #GST_TAG_CODEC</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+        <parameter name="caps" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the (fixed) #GstCaps for which a codec tag should be added.</doc>
+          <type name="Gst.Caps" c:type="GstCaps*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="pb_utils_get_codec_description"
+              c:identifier="gst_pb_utils_get_codec_description">
+      <doc xml:whitespace="preserve">Returns a localised (as far as this is possible) string describing the
+media format specified in @caps, for use in error dialogs or other messages
+to be seen by the user. Should never return NULL unless @caps is invalid.
+Also see the convenience function
+gst_pb_utils_add_codec_description_to_tag_list().
+string with g_free() when not needed any longer.</doc>
+      <return-value transfer-ownership="full">
+        <doc xml:whitespace="preserve">a newly-allocated description string, or NULL on error. Free</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="caps" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the (fixed) #GstCaps for which an format description is needed</doc>
+          <type name="Gst.Caps" c:type="GstCaps*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="pb_utils_get_decoder_description"
+              c:identifier="gst_pb_utils_get_decoder_description">
+      <doc xml:whitespace="preserve">Returns a localised string describing an decoder for the format specified
+in @caps, for use in error dialogs or other messages to be seen by the user.
+Should never return NULL unless @factory_name or @caps are invalid.
+This function is mainly for internal use, applications would typically
+use gst_missing_plugin_message_get_description() to get a description of
+a missing feature from a missing-plugin message.
+string with g_free() when not needed any longer.</doc>
+      <return-value transfer-ownership="full">
+        <doc xml:whitespace="preserve">a newly-allocated description string, or NULL on error. Free</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="caps" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the (fixed) #GstCaps for which an decoder description is needed</doc>
+          <type name="Gst.Caps" c:type="GstCaps*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="pb_utils_get_element_description"
+              c:identifier="gst_pb_utils_get_element_description">
+      <doc xml:whitespace="preserve">Returns a localised string describing the given element, for use in
+error dialogs or other messages to be seen by the user. Should never
+return NULL unless @factory_name is invalid.
+This function is mainly for internal use, applications would typically
+use gst_missing_plugin_message_get_description() to get a description of
+a missing feature from a missing-plugin message.
+string with g_free() when not needed any longer.</doc>
+      <return-value transfer-ownership="full">
+        <doc xml:whitespace="preserve">a newly-allocated description string, or NULL on error. Free</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="factory_name" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the name of the element, e.g. "gnomevfssrc"</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="pb_utils_get_encoder_description"
+              c:identifier="gst_pb_utils_get_encoder_description">
+      <doc xml:whitespace="preserve">Returns a localised string describing an encoder for the format specified
+in @caps, for use in error dialogs or other messages to be seen by the user.
+Should never return NULL unless @factory_name or @caps are invalid.
+This function is mainly for internal use, applications would typically
+use gst_missing_plugin_message_get_description() to get a description of
+a missing feature from a missing-plugin message.
+string with g_free() when not needed any longer.</doc>
+      <return-value transfer-ownership="full">
+        <doc xml:whitespace="preserve">a newly-allocated description string, or NULL on error. Free</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="caps" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the (fixed) #GstCaps for which an encoder description is needed</doc>
+          <type name="Gst.Caps" c:type="GstCaps*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="pb_utils_get_sink_description"
+              c:identifier="gst_pb_utils_get_sink_description">
+      <doc xml:whitespace="preserve">Returns a localised string describing a sink element handling the protocol
+specified in @protocol, for use in error dialogs or other messages to be
+seen by the user. Should never return NULL unless @protocol is invalid.
+This function is mainly for internal use, applications would typically
+use gst_missing_plugin_message_get_description() to get a description of
+a missing feature from a missing-plugin message.
+string with g_free() when not needed any longer.</doc>
+      <return-value transfer-ownership="full">
+        <doc xml:whitespace="preserve">a newly-allocated description string, or NULL on error. Free</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="protocol" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the protocol the sink element needs to handle, e.g. "http"</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="pb_utils_get_source_description"
+              c:identifier="gst_pb_utils_get_source_description">
+      <doc xml:whitespace="preserve">Returns a localised string describing a source element handling the protocol
+specified in @protocol, for use in error dialogs or other messages to be
+seen by the user. Should never return NULL unless @protocol is invalid.
+This function is mainly for internal use, applications would typically
+use gst_missing_plugin_message_get_description() to get a description of
+a missing feature from a missing-plugin message.
+string with g_free() when not needed any longer.</doc>
+      <return-value transfer-ownership="full">
+        <doc xml:whitespace="preserve">a newly-allocated description string, or NULL on error. Free</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="protocol" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the protocol the source element needs to handle, e.g. "http"</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="pb_utils_init"
+              c:identifier="gst_pb_utils_init"
+              version="0.10.12">
+      <doc xml:whitespace="preserve">Initialises the base utils support library. This function is not
+thread-safe. Applications should call it after calling gst_init(),
+plugins should call it from their plugin_init function.
+This function may be called multiple times. It will do nothing if the
+library has already been initialised.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+    </function>
+    <function name="plugins_base_version"
+              c:identifier="gst_plugins_base_version"
+              version="0.10.31">
+      <doc xml:whitespace="preserve">Gets the version number of the GStreamer Plugins Base libraries.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="major"
+                   direction="out"
+                   caller-allocates="0"
+                   transfer-ownership="full">
+          <doc xml:whitespace="preserve">pointer to a guint to store the major version number, or %NULL</doc>
+          <type name="guint" c:type="guint*"/>
+        </parameter>
+        <parameter name="minor"
+                   direction="out"
+                   caller-allocates="0"
+                   transfer-ownership="full">
+          <doc xml:whitespace="preserve">pointer to a guint to store the minor version number, or %NULL</doc>
+          <type name="guint" c:type="guint*"/>
+        </parameter>
+        <parameter name="micro"
+                   direction="out"
+                   caller-allocates="0"
+                   transfer-ownership="full">
+          <doc xml:whitespace="preserve">pointer to a guint to store the micro version number, or %NULL</doc>
+          <type name="guint" c:type="guint*"/>
+        </parameter>
+        <parameter name="nano"
+                   direction="out"
+                   caller-allocates="0"
+                   transfer-ownership="full">
+          <doc xml:whitespace="preserve">pointer to a guint to store the nano version number, or %NULL</doc>
+          <type name="guint" c:type="guint*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="plugins_base_version_string"
+              c:identifier="gst_plugins_base_version_string"
+              version="0.10.31">
+      <doc xml:whitespace="preserve">This function returns a string that is useful for describing this version
+strings, logging, about dialogs ...</doc>
+      <return-value transfer-ownership="full">
+        <doc xml:whitespace="preserve">a newly allocated string describing this version of gst-plugins-base</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+    </function>
+  </namespace>
+</repository>
diff --git a/gstreamer/plugins/pbutils/ffi/ffi.factor b/gstreamer/plugins/pbutils/ffi/ffi.factor
new file mode 100644 (file)
index 0000000..f494c51
--- /dev/null
@@ -0,0 +1,16 @@
+! Copyright (C) 2010 Anton Gorenko.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.libraries combinators kernel system
+gobject-introspection glib.ffi gstreamer.ffi ;
+IN: gstreamer.pbutils.ffi
+
+<<
+"gstreamer.pbutils" {
+    { [ os winnt? ] [ drop ] }
+    { [ os macosx? ] [ drop ] }
+    { [ os unix? ] [ "libgstpbutils-0.10.so" cdecl add-library ] }
+} cond
+>>
+
+GIR: vocab:gstreamer/pbutils/GstPbutils-0.10.gir
+
diff --git a/gstreamer/plugins/pbutils/pbutils.factor b/gstreamer/plugins/pbutils/pbutils.factor
new file mode 100644 (file)
index 0000000..9010553
--- /dev/null
@@ -0,0 +1,5 @@
+! Copyright (C) 2010 Anton Gorenko.
+! See http://factorcode.org/license.txt for BSD license.
+USING: gstreamer.pbutils.ffi ;
+IN: gstreamer.pbutils
+
diff --git a/gstreamer/plugins/riff/GstRiff-0.10.gir b/gstreamer/plugins/riff/GstRiff-0.10.gir
new file mode 100644 (file)
index 0000000..7e1aa30
--- /dev/null
@@ -0,0 +1,834 @@
+<?xml version="1.0"?>
+<!-- This file was automatically generated from C sources - DO NOT EDIT!
+To affect the contents of this file, edit the original C definitions,
+and/or use gtk-doc annotations.  -->
+<repository version="1.2"
+            xmlns="http://www.gtk.org/introspection/core/1.0"
+            xmlns:c="http://www.gtk.org/introspection/c/1.0"
+            xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+  <include name="GLib" version="2.0"/>
+  <include name="GModule" version="2.0"/>
+  <include name="GObject" version="2.0"/>
+  <include name="Gst" version="0.10"/>
+  <include name="GstAudio" version="0.10"/>
+  <include name="GstBase" version="0.10"/>
+  <include name="GstInterfaces" version="0.10"/>
+  <include name="GstTag" version="0.10"/>
+  <include name="libxml2" version="2.0"/>
+  <package name="gstreamer-riff-0.10"/>
+  <c:include name="gst/riff/riff-ids.h"/>
+  <c:include name="gst/riff/riff-media.h"/>
+  <c:include name="gst/riff/riff-read.h"/>
+  <namespace name="GstRiff"
+             version="0.10"
+             shared-library="libgstriff-0.10.so.0"
+             c:identifier-prefixes="Gst"
+             c:symbol-prefixes="gst">
+    <constant name="RIFF_IBM_FORMAT_ADPCM" value="259">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_IBM_FORMAT_ALAW" value="258">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_IBM_FORMAT_MULAW" value="257">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_IF_KEYFRAME" value="16">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_IF_LIST" value="1">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_IF_NO_TIME" value="256">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_STRH_DISABLED" value="1">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_STRH_VIDEOPALCHANGES" value="65536">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_A52" value="8192">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_AAC" value="255">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_AAC_AC" value="16707">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_AAC_pm" value="28781">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_ADPCM" value="2">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_ADPCM_IMA_DK3" value="98">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_ADPCM_IMA_DK4" value="97">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_ADPCM_IMA_WAV" value="105">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_ALAW" value="6">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_AMR_NB" value="87">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_AMR_WB" value="88">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_APTX" value="37">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_AUDIOFILE_AF10" value="38">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_AUDIOFILE_AF36" value="36">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_BTV_DIGITAL" value="1024">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_CANOPUS_ATRAC" value="99">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_CIRRUS" value="96">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_CONTROL_RES_CR10" value="55">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_CONTROL_RES_VQLPC" value="52">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_CREATIVE_ADPCM" value="512">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_CREATIVE_FASTSPEECH10" value="515">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_CREATIVE_FASTSPEECH8" value="514">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_CS2" value="608">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_CS_IMAADPCM" value="57">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_CU_CODEC" value="25">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_DF_G726" value="133">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_DF_GSM610" value="134">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_DIALOGIC_OKI_ADPCM" value="23">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_DIGIADPCM" value="54">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_DIGIFIX" value="22">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_DIGIREAL" value="53">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_DIGISTD" value="21">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_DIGITAL_G723" value="291">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_DOLBY_AC2" value="48">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_DOLBY_AC3_SPDIF" value="146">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_DSAT_DISPLAY" value="103">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_DSP_TRUESPEECH" value="34">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_DTS" value="8193">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_DVI_ADPCM" value="17">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_ECHOSC1" value="35">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_ECHOSC3" value="58">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_ESPCM" value="97">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_EXTENSIBLE" value="65534">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_FLAC" value="61868">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_FM_TOWNS_SND" value="768">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_G722_ADPCM" value="101">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_G723_ADPCM" value="20">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_G726ADPCM" value="320">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_G726_ADPCM" value="100">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_G728_CELP" value="65">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_G729A" value="131">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_GSM610" value="49">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_GSM_AMR_CBR" value="31265">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_GSM_AMR_VBR" value="31266">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_IBM_CVSD" value="5">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_IEEE_FLOAT" value="3">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_ILINK_VC" value="560">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_IMC" value="1025">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_IPI_HSX" value="592">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_IPI_RPELP" value="593">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_ISIAUDIO" value="136">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_ITU_G721_ADPCM" value="64">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_LH_CODEC" value="4352">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_LRC" value="40">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_LUCENT_G723" value="89">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_MALDEN_PHONYTALK" value="160">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_MEDIASONIC_G723" value="147">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_MEDIASPACE_ADPCM" value="18">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_MEDIAVISION_ADPCM" value="24">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_MPEGL12" value="80">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_MPEGL3" value="85">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_MSG723" value="66">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_MSN" value="50">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_MSRT24" value="130">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_MULAW" value="7">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_MVI_MVI2" value="132">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_NMS_VBXADPCM" value="56">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_NORRIS" value="5120">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_OKI_ADPCM" value="16">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_OLIADPCM" value="4097">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_OLICELP" value="4098">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_OLIGSM" value="4096">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_OLIOPR" value="4100">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_OLISBC" value="4099">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_ONLIVE" value="137">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_PAC" value="83">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_PACKED" value="153">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_PCM" value="1">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_PHILIPS_LPCBB" value="152">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_PROSODY_1612" value="39">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_PROSODY_8KBPS" value="148">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_QDESIGN_MUSIC" value="1104">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_QUALCOMM_HALFRATE" value="337">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_QUALCOMM_PUREVOICE" value="336">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_QUARTERDECK" value="544">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_RAW_SPORT" value="576">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_RHETOREX_ADPCM" value="256">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_ROCKWELL_ADPCM" value="59">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_ROCKWELL_DIGITALK" value="60">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_RT24" value="82">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_SANYO_LD_ADPCM" value="293">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_SBC24" value="145">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_SIERRA_ADPCM" value="19">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_SIPROLAB_ACELP4800" value="305">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_SIPROLAB_ACELP8V3" value="306">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_SIPROLAB_ACEPLNET" value="304">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_SIPROLAB_G729" value="307">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_SIPROLAB_G729A" value="308">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_SIPROLAB_KELVIN" value="309">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_SIREN" value="654">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_SOFTSOUND" value="128">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_SONARC" value="33">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_SONIC" value="8264">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_SONIC_LS" value="8264">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_SONY_ATRAC3" value="624">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_SOUNDSPACE_MUSICOMPRESS" value="5376">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_TPC" value="1665">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_TUBGSM" value="341">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_UHER_ADPCM" value="528">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_UNKNOWN" value="0">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_VIVO_G723" value="273">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_VIVO_SIREN" value="274">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_VME_VMPCM" value="1664">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_VORBIS1" value="26447">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_VORBIS1PLUS" value="26479">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_VORBIS2" value="26448">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_VORBIS2PLUS" value="26480">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_VORBIS3" value="26449">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_VORBIS3PLUS" value="26481">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_VOXWARE" value="98">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_VOXWARE_AC10" value="113">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_VOXWARE_AC16" value="114">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_VOXWARE_AC20" value="115">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_VOXWARE_AC8" value="112">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_VOXWARE_BYTE_ALIGNED" value="105">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_VOXWARE_METASOUND" value="117">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_VOXWARE_METAVOICE" value="116">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_VOXWARE_RT29HW" value="118">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_VOXWARE_TQ40" value="121">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_VOXWARE_TQ60" value="129">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_VOXWARE_VR12" value="119">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_VOXWARE_VR18" value="120">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_VSELP" value="4">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_WMAV1" value="352">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_WMAV2" value="353">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_WMAV3" value="354">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_WMAV3_L" value="355">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_WMS" value="10">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_XEBEC" value="61">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_YAMAHA_ADPCM" value="32">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RIFF_WAVE_FORMAT_ZYXEL_ADPCM" value="151">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <function name="riff_create_audio_caps"
+              c:identifier="gst_riff_create_audio_caps"
+              introspectable="0">
+      <return-value transfer-ownership="full">
+        <type name="Gst.Caps" c:type="GstCaps*"/>
+      </return-value>
+      <parameters>
+        <parameter name="codec_id" transfer-ownership="none">
+          <type name="guint16" c:type="guint16"/>
+        </parameter>
+        <parameter name="strh" transfer-ownership="none">
+          <type c:type="gst_riff_strh*"/>
+        </parameter>
+        <parameter name="strf" transfer-ownership="none">
+          <type c:type="gst_riff_strf_auds*"/>
+        </parameter>
+        <parameter name="strf_data" transfer-ownership="none">
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="strd_data" transfer-ownership="none">
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="codec_name" transfer-ownership="none">
+          <type name="utf8" c:type="char**"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="riff_create_audio_template_caps"
+              c:identifier="gst_riff_create_audio_template_caps">
+      <return-value transfer-ownership="full">
+        <type name="Gst.Caps" c:type="GstCaps*"/>
+      </return-value>
+    </function>
+    <function name="riff_create_iavs_caps"
+              c:identifier="gst_riff_create_iavs_caps"
+              introspectable="0">
+      <return-value transfer-ownership="full">
+        <type name="Gst.Caps" c:type="GstCaps*"/>
+      </return-value>
+      <parameters>
+        <parameter name="codec_fcc" transfer-ownership="none">
+          <type name="guint32" c:type="guint32"/>
+        </parameter>
+        <parameter name="strh" transfer-ownership="none">
+          <type c:type="gst_riff_strh*"/>
+        </parameter>
+        <parameter name="strf" transfer-ownership="none">
+          <type c:type="gst_riff_strf_iavs*"/>
+        </parameter>
+        <parameter name="strf_data" transfer-ownership="none">
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="strd_data" transfer-ownership="none">
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="codec_name" transfer-ownership="none">
+          <type name="utf8" c:type="char**"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="riff_create_iavs_template_caps"
+              c:identifier="gst_riff_create_iavs_template_caps">
+      <return-value transfer-ownership="full">
+        <type name="Gst.Caps" c:type="GstCaps*"/>
+      </return-value>
+    </function>
+    <function name="riff_create_video_caps"
+              c:identifier="gst_riff_create_video_caps"
+              introspectable="0">
+      <return-value transfer-ownership="full">
+        <type name="Gst.Caps" c:type="GstCaps*"/>
+      </return-value>
+      <parameters>
+        <parameter name="codec_fcc" transfer-ownership="none">
+          <doc xml:whitespace="preserve">fourCC codec for this codec.</doc>
+          <type name="guint32" c:type="guint32"/>
+        </parameter>
+        <parameter name="strh" transfer-ownership="none">
+          <doc xml:whitespace="preserve">pointer to the strh stream header structure.</doc>
+          <type c:type="gst_riff_strh*"/>
+        </parameter>
+        <parameter name="strf" transfer-ownership="none">
+          <doc xml:whitespace="preserve">pointer to the strf stream header structure, including any data that is within the range of strf.size, but excluding any additional data withint this chunk but outside strf.size.</doc>
+          <type c:type="gst_riff_strf_vids*"/>
+        </parameter>
+        <parameter name="strf_data" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstBuffer containing the additional data in the strf chunk outside reach of strf.size. Ususally a palette.</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="strd_data" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstBuffer containing the data in the strd stream header chunk. Usually codec initialization data.</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="codec_name" transfer-ownership="none">
+          <doc xml:whitespace="preserve">if given, will be filled with a human-readable codec name.</doc>
+          <type name="utf8" c:type="char**"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="riff_create_video_template_caps"
+              c:identifier="gst_riff_create_video_template_caps">
+      <return-value transfer-ownership="full">
+        <type name="Gst.Caps" c:type="GstCaps*"/>
+      </return-value>
+    </function>
+    <function name="riff_init" c:identifier="gst_riff_init">
+      <doc xml:whitespace="preserve">Initialize riff library.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+    </function>
+    <function name="riff_parse_chunk" c:identifier="gst_riff_parse_chunk">
+      <doc xml:whitespace="preserve">Reads a single chunk.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">FALSE on error, TRUE otherwise</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="element" transfer-ownership="none">
+          <doc xml:whitespace="preserve">caller element (used for debugging).</doc>
+          <type name="Gst.Element" c:type="GstElement*"/>
+        </parameter>
+        <parameter name="buf" transfer-ownership="none">
+          <doc xml:whitespace="preserve">input buffer.</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="offset" transfer-ownership="none">
+          <doc xml:whitespace="preserve">offset in the buffer in the caller. Is incremented by the read size by this function.</doc>
+          <type name="guint" c:type="guint*"/>
+        </parameter>
+        <parameter name="fourcc" transfer-ownership="none">
+          <doc xml:whitespace="preserve">fourcc (returned by this function0 of the chunk.</doc>
+          <type name="guint32" c:type="guint32*"/>
+        </parameter>
+        <parameter name="chunk_data" transfer-ownership="none">
+          <doc xml:whitespace="preserve">buffer (returned by the function) containing the chunk data, which may be NULL if chunksize == 0</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer**"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="riff_parse_file_header"
+              c:identifier="gst_riff_parse_file_header">
+      <doc xml:whitespace="preserve">Reads the first few bytes from the provided buffer, checks
+if this stream is a RIFF stream, and determines document type.
+This function takes ownership of @buf so it should not be used anymore
+after calling this function.
+caller should error out; we already throw an error), or TRUE
+if it is.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">FALSE if this is not a RIFF stream (in which case the</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="element" transfer-ownership="none">
+          <doc xml:whitespace="preserve">caller element (used for debugging/error).</doc>
+          <type name="Gst.Element" c:type="GstElement*"/>
+        </parameter>
+        <parameter name="buf" transfer-ownership="none">
+          <doc xml:whitespace="preserve">input buffer from which the file header will be parsed, should be at least 12 bytes long.</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="doctype" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a fourcc (returned by this function) to indicate the type of document (according to the header).</doc>
+          <type name="guint32" c:type="guint32*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="riff_parse_info" c:identifier="gst_riff_parse_info">
+      <doc xml:whitespace="preserve">Parses stream metadata from input data.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="element" transfer-ownership="none">
+          <doc xml:whitespace="preserve">caller element (used for debugging/error).</doc>
+          <type name="Gst.Element" c:type="GstElement*"/>
+        </parameter>
+        <parameter name="buf" transfer-ownership="none">
+          <doc xml:whitespace="preserve">input data to be used for parsing, stripped from header.</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="taglist" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a pointer to a taglist (returned by this function) containing information about this stream. May be NULL if no supported tags were found.</doc>
+          <type name="Gst.TagList" c:type="GstTagList**"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="riff_parse_strf_auds"
+              c:identifier="gst_riff_parse_strf_auds"
+              introspectable="0">
+      <doc xml:whitespace="preserve">Parses an audio stream´s strf structure plus optionally some
+extradata from input data. This function takes ownership of @buf.
+use.
+should be skipped on error, but it is not fatal.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if parsing succeeded, otherwise FALSE. The stream</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="element" transfer-ownership="none">
+          <doc xml:whitespace="preserve">caller element (used for debugging/error).</doc>
+          <type name="Gst.Element" c:type="GstElement*"/>
+        </parameter>
+        <parameter name="buf" transfer-ownership="none">
+          <doc xml:whitespace="preserve">input data to be used for parsing, stripped from header.</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="strf" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a pointer (returned by this function) to a filled-in strf/auds structure. Caller should free it.</doc>
+          <type c:type="gst_riff_strf_auds**"/>
+        </parameter>
+        <parameter name="data" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a pointer (returned by this function) to a buffer containing extradata for this particular stream (e.g. codec initialization data).</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer**"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="riff_parse_strf_iavs"
+              c:identifier="gst_riff_parse_strf_iavs"
+              introspectable="0">
+      <doc xml:whitespace="preserve">Parses a interleaved (also known as "complex")  stream´s strf
+structure plus optionally some extradata from input data. This 
+function takes ownership of @buf.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if parsing succeeded, otherwise FALSE.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="element" transfer-ownership="none">
+          <doc xml:whitespace="preserve">caller element (used for debugging/error).</doc>
+          <type name="Gst.Element" c:type="GstElement*"/>
+        </parameter>
+        <parameter name="buf" transfer-ownership="none">
+          <doc xml:whitespace="preserve">input data to be used for parsing, stripped from header.</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="strf" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a pointer (returned by this function) to a filled-in strf/iavs structure. Caller should free it.</doc>
+          <type c:type="gst_riff_strf_iavs**"/>
+        </parameter>
+        <parameter name="data" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a pointer (returned by this function) to a buffer containing extradata for this particular stream (e.g. codec initialization data).</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer**"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="riff_parse_strf_vids"
+              c:identifier="gst_riff_parse_strf_vids"
+              introspectable="0">
+      <doc xml:whitespace="preserve">Parses a video stream´s strf structure plus optionally some
+extradata from input data. This function takes ownership of @buf.
+should be skipped on error, but it is not fatal.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if parsing succeeded, otherwise FALSE. The stream</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="element" transfer-ownership="none">
+          <doc xml:whitespace="preserve">caller element (used for debugging/error).</doc>
+          <type name="Gst.Element" c:type="GstElement*"/>
+        </parameter>
+        <parameter name="buf" transfer-ownership="none">
+          <doc xml:whitespace="preserve">input data to be used for parsing, stripped from header.</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="strf" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a pointer (returned by this function) to a filled-in strf/vids structure. Caller should free it.</doc>
+          <type c:type="gst_riff_strf_vids**"/>
+        </parameter>
+        <parameter name="data" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a pointer (returned by this function) to a buffer containing extradata for this particular stream (e.g. palette, codec initialization data).</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer**"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="riff_parse_strh"
+              c:identifier="gst_riff_parse_strh"
+              introspectable="0">
+      <doc xml:whitespace="preserve">Parses a strh structure from input data. Takes ownership of @buf.
+should be skipped on error, but it is not fatal.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if parsing succeeded, otherwise FALSE. The stream</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="element" transfer-ownership="none">
+          <doc xml:whitespace="preserve">caller element (used for debugging/error).</doc>
+          <type name="Gst.Element" c:type="GstElement*"/>
+        </parameter>
+        <parameter name="buf" transfer-ownership="none">
+          <doc xml:whitespace="preserve">input data to be used for parsing, stripped from header.</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="strh" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a pointer (returned by this function) to a filled-in strh structure. Caller should free it.</doc>
+          <type c:type="gst_riff_strh**"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="riff_read_chunk" c:identifier="gst_riff_read_chunk">
+      <doc xml:whitespace="preserve">Reads a single chunk of data. Since 0.10.8 'JUNK' chunks
+are skipped automatically.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">flow status.</doc>
+        <type name="Gst.FlowReturn" c:type="GstFlowReturn"/>
+      </return-value>
+      <parameters>
+        <parameter name="element" transfer-ownership="none">
+          <doc xml:whitespace="preserve">caller element (used for debugging).</doc>
+          <type name="Gst.Element" c:type="GstElement*"/>
+        </parameter>
+        <parameter name="pad" transfer-ownership="none">
+          <doc xml:whitespace="preserve">pad to pull data from.</doc>
+          <type name="Gst.Pad" c:type="GstPad*"/>
+        </parameter>
+        <parameter name="offset" transfer-ownership="none">
+          <doc xml:whitespace="preserve">offset to pull from, incremented by this function.</doc>
+          <type name="guint64" c:type="guint64*"/>
+        </parameter>
+        <parameter name="tag" transfer-ownership="none">
+          <doc xml:whitespace="preserve">fourcc of the chunk (returned by this function).</doc>
+          <type name="guint32" c:type="guint32*"/>
+        </parameter>
+        <parameter name="chunk_data" transfer-ownership="none">
+          <doc xml:whitespace="preserve">buffer (returned by this function).</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer**"/>
+        </parameter>
+      </parameters>
+    </function>
+  </namespace>
+</repository>
diff --git a/gstreamer/plugins/riff/ffi/ffi.factor b/gstreamer/plugins/riff/ffi/ffi.factor
new file mode 100644 (file)
index 0000000..ac31e7d
--- /dev/null
@@ -0,0 +1,27 @@
+! Copyright (C) 2010 Anton Gorenko.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.syntax alien.libraries combinators kernel
+system
+gobject-introspection glib.ffi gmodule.ffi gobject.ffi ;
+EXCLUDE: alien.c-types => pointer ;
+IN: gstreamer.ffi
+
+<<
+"gstreamer" {
+    { [ os winnt? ] [ drop ] }
+    { [ os macosx? ] [ drop ] }
+    { [ os unix? ] [ "libgstreamer-0.10.so" cdecl add-library ] }
+} cond
+>>
+
+TYPEDEF: gpointer GstClockID
+TYPEDEF: guint64 GstClockTime
+TYPEDEF: gint64 GstClockTimeDiff
+
+! types from libxml2
+TYPEDEF: void* xmlNodePtr
+TYPEDEF: void* xmlDocPtr
+TYPEDEF: void* xmlNsPtr
+
+GIR: vocab:gstreamer/Gst-0.10.gir
+
diff --git a/gstreamer/plugins/riff/riff.factor b/gstreamer/plugins/riff/riff.factor
new file mode 100644 (file)
index 0000000..174fbc6
--- /dev/null
@@ -0,0 +1,5 @@
+! Copyright (C) 2010 Anton Gorenko.
+! See http://factorcode.org/license.txt for BSD license.
+USING: gstreamer.ffi ;
+IN: gstreamer
+
diff --git a/gstreamer/plugins/rtp/GstRtp-0.10.gir b/gstreamer/plugins/rtp/GstRtp-0.10.gir
new file mode 100644 (file)
index 0000000..818c907
--- /dev/null
@@ -0,0 +1,3195 @@
+<?xml version="1.0"?>
+<!-- This file was automatically generated from C sources - DO NOT EDIT!
+To affect the contents of this file, edit the original C definitions,
+and/or use gtk-doc annotations.  -->
+<repository version="1.2"
+            xmlns="http://www.gtk.org/introspection/core/1.0"
+            xmlns:c="http://www.gtk.org/introspection/c/1.0"
+            xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+  <include name="GLib" version="2.0"/>
+  <include name="GModule" version="2.0"/>
+  <include name="GObject" version="2.0"/>
+  <include name="Gst" version="0.10"/>
+  <include name="GstBase" version="0.10"/>
+  <include name="libxml2" version="2.0"/>
+  <package name="gstreamer-rtp-0.10"/>
+  <c:include name="gst/rtp/gstbasertpaudiopayload.h"/>
+  <c:include name="gst/rtp/gstbasertpdepayload.h"/>
+  <c:include name="gst/rtp/gstbasertppayload.h"/>
+  <c:include name="gst/rtp/gstrtcpbuffer.h"/>
+  <c:include name="gst/rtp/gstrtpbuffer.h"/>
+  <c:include name="gst/rtp/gstrtppayloads.h"/>
+  <namespace name="GstRtp"
+             version="0.10"
+             shared-library="libgstrtp-0.10.so.0"
+             c:identifier-prefixes="Gst"
+             c:symbol-prefixes="gst">
+    <class name="BaseRTPAudioPayload"
+           c:symbol-prefix="base_rtp_audio_payload"
+           c:type="GstBaseRTPAudioPayload"
+           parent="BaseRTPPayload"
+           glib:type-name="GstBaseRTPAudioPayload"
+           glib:get-type="gst_base_rtp_audio_payload_get_type"
+           glib:type-struct="BaseRTPAudioPayloadClass">
+      <method name="flush"
+              c:identifier="gst_base_rtp_audio_payload_flush"
+              version="0.10.25">
+        <doc xml:whitespace="preserve">Create an RTP buffer and store @payload_len bytes of the adapter as the
+payload. Set the timestamp on the new buffer to @timestamp before pushing
+the buffer downstream.
+If @payload_len is -1, all pending bytes will be flushed. If @timestamp is
+-1, the timestamp will be calculated automatically.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstFlowReturn</doc>
+          <type name="Gst.FlowReturn" c:type="GstFlowReturn"/>
+        </return-value>
+        <parameters>
+          <parameter name="payload_len" transfer-ownership="none">
+            <doc xml:whitespace="preserve">length of payload</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+          <parameter name="timestamp" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a #GstClockTime</doc>
+            <type name="Gst.ClockTime" c:type="GstClockTime"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="get_adapter"
+              c:identifier="gst_base_rtp_audio_payload_get_adapter"
+              version="0.10.13"
+              introspectable="0">
+        <doc xml:whitespace="preserve">Gets the internal adapter used by the depayloader.</doc>
+        <return-value>
+          <doc xml:whitespace="preserve">a #GstAdapter.</doc>
+          <type name="GstBase.Adapter" c:type="GstAdapter*"/>
+        </return-value>
+      </method>
+      <method name="push"
+              c:identifier="gst_base_rtp_audio_payload_push"
+              version="0.10.13">
+        <doc xml:whitespace="preserve">Create an RTP buffer and store @payload_len bytes of @data as the
+payload. Set the timestamp on the new buffer to @timestamp before pushing
+the buffer downstream.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstFlowReturn</doc>
+          <type name="Gst.FlowReturn" c:type="GstFlowReturn"/>
+        </return-value>
+        <parameters>
+          <parameter name="data" transfer-ownership="none">
+            <doc xml:whitespace="preserve">data to set as payload</doc>
+            <type name="guint8" c:type="guint8*"/>
+          </parameter>
+          <parameter name="payload_len" transfer-ownership="none">
+            <doc xml:whitespace="preserve">length of payload</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+          <parameter name="timestamp" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a #GstClockTime</doc>
+            <type name="Gst.ClockTime" c:type="GstClockTime"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_frame_based"
+              c:identifier="gst_base_rtp_audio_payload_set_frame_based">
+        <doc xml:whitespace="preserve">Tells #GstBaseRTPAudioPayload that the child element is for a frame based
+audio codec</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+      </method>
+      <method name="set_frame_options"
+              c:identifier="gst_base_rtp_audio_payload_set_frame_options">
+        <doc xml:whitespace="preserve">Sets the options for frame based audio codecs.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="frame_duration" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The duraction of an audio frame in milliseconds.</doc>
+            <type name="gint" c:type="gint"/>
+          </parameter>
+          <parameter name="frame_size" transfer-ownership="none">
+            <doc xml:whitespace="preserve">The size of an audio frame in bytes.</doc>
+            <type name="gint" c:type="gint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_sample_based"
+              c:identifier="gst_base_rtp_audio_payload_set_sample_based">
+        <doc xml:whitespace="preserve">Tells #GstBaseRTPAudioPayload that the child element is for a sample based
+audio codec</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+      </method>
+      <method name="set_sample_options"
+              c:identifier="gst_base_rtp_audio_payload_set_sample_options">
+        <doc xml:whitespace="preserve">Sets the options for sample based audio codecs.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="sample_size" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Size per sample in bytes.</doc>
+            <type name="gint" c:type="gint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_samplebits_options"
+              c:identifier="gst_base_rtp_audio_payload_set_samplebits_options"
+              version="0.10.18">
+        <doc xml:whitespace="preserve">Sets the options for sample based audio codecs.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="sample_size" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Size per sample in bits.</doc>
+            <type name="gint" c:type="gint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <property name="buffer-list" writable="1" transfer-ownership="none">
+        <type name="gboolean"/>
+      </property>
+      <field name="payload">
+        <type name="BaseRTPPayload" c:type="GstBaseRTPPayload"/>
+      </field>
+      <field name="priv">
+        <type name="BaseRTPAudioPayloadPrivate"
+              c:type="GstBaseRTPAudioPayloadPrivate*"/>
+      </field>
+      <field name="base_ts">
+        <type name="Gst.ClockTime" c:type="GstClockTime"/>
+      </field>
+      <field name="frame_size">
+        <type name="gint" c:type="gint"/>
+      </field>
+      <field name="frame_duration">
+        <type name="gint" c:type="gint"/>
+      </field>
+      <field name="sample_size">
+        <type name="gint" c:type="gint"/>
+      </field>
+      <field name="_gst_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </class>
+    <record name="BaseRTPAudioPayloadClass"
+            c:type="GstBaseRTPAudioPayloadClass"
+            glib:is-gtype-struct-for="BaseRTPAudioPayload">
+      <field name="parent_class">
+        <type name="BaseRTPPayloadClass" c:type="GstBaseRTPPayloadClass"/>
+      </field>
+      <field name="_gst_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </record>
+    <record name="BaseRTPAudioPayloadPrivate"
+            c:type="GstBaseRTPAudioPayloadPrivate"
+            disguised="1">
+    </record>
+    <class name="BaseRTPDepayload"
+           c:symbol-prefix="base_rtp_depayload"
+           c:type="GstBaseRTPDepayload"
+           parent="Gst.Element"
+           glib:type-name="GstBaseRTPDepayload"
+           glib:get-type="gst_base_rtp_depayload_get_type"
+           glib:type-struct="BaseRTPDepayloadClass">
+      <virtual-method name="add_to_queue">
+        <return-value transfer-ownership="none">
+          <type name="Gst.FlowReturn" c:type="GstFlowReturn"/>
+        </return-value>
+        <parameters>
+          <parameter name="in" transfer-ownership="none">
+            <type name="Gst.Buffer" c:type="GstBuffer*"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <virtual-method name="handle_event">
+        <return-value transfer-ownership="none">
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="event" transfer-ownership="none">
+            <type name="Gst.Event" c:type="GstEvent*"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <virtual-method name="packet_lost">
+        <return-value transfer-ownership="none">
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="event" transfer-ownership="none">
+            <type name="Gst.Event" c:type="GstEvent*"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <virtual-method name="process" introspectable="0">
+        <return-value>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </return-value>
+        <parameters>
+          <parameter name="in" transfer-ownership="none">
+            <type name="Gst.Buffer" c:type="GstBuffer*"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <virtual-method name="set_caps">
+        <return-value transfer-ownership="none">
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="caps" transfer-ownership="none">
+            <type name="Gst.Caps" c:type="GstCaps*"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <virtual-method name="set_gst_timestamp">
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="timestamp" transfer-ownership="none">
+            <type name="guint32" c:type="guint32"/>
+          </parameter>
+          <parameter name="buf" transfer-ownership="none">
+            <type name="Gst.Buffer" c:type="GstBuffer*"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <method name="push" c:identifier="gst_base_rtp_depayload_push">
+        <doc xml:whitespace="preserve">Push @out_buf to the peer of @filter. This function takes ownership of
+Unlike gst_base_rtp_depayload_push_ts(), this function will not apply
+any timestamp on the outgoing buffer. Subclasses should therefore timestamp
+outgoing buffers themselves.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstFlowReturn.</doc>
+          <type name="Gst.FlowReturn" c:type="GstFlowReturn"/>
+        </return-value>
+        <parameters>
+          <parameter name="out_buf" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a #GstBuffer</doc>
+            <type name="Gst.Buffer" c:type="GstBuffer*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="push_list"
+              c:identifier="gst_base_rtp_depayload_push_list"
+              version="0.10.32">
+        <doc xml:whitespace="preserve">Push @out_list to the peer of @filter. This function takes ownership of</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstFlowReturn.</doc>
+          <type name="Gst.FlowReturn" c:type="GstFlowReturn"/>
+        </return-value>
+        <parameters>
+          <parameter name="out_list" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a #GstBufferList</doc>
+            <type name="Gst.BufferList" c:type="GstBufferList*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="push_ts" c:identifier="gst_base_rtp_depayload_push_ts">
+        <doc xml:whitespace="preserve">Push @out_buf to the peer of @filter. This function takes ownership of
+Unlike gst_base_rtp_depayload_push(), this function will by default apply
+the last incomming timestamp on the outgoing buffer when it didn't have a
+timestamp already. The set_get_timestamp vmethod can be overwritten to change
+this behaviour (and take, for example, @timestamp into account).</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstFlowReturn.</doc>
+          <type name="Gst.FlowReturn" c:type="GstFlowReturn"/>
+        </return-value>
+        <parameters>
+          <parameter name="timestamp" transfer-ownership="none">
+            <doc xml:whitespace="preserve">an RTP timestamp to apply</doc>
+            <type name="guint32" c:type="guint32"/>
+          </parameter>
+          <parameter name="out_buf" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a #GstBuffer</doc>
+            <type name="Gst.Buffer" c:type="GstBuffer*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <property name="queue-delay" writable="1" transfer-ownership="none">
+        <type name="guint"/>
+      </property>
+      <field name="parent">
+        <type name="Gst.Element" c:type="GstElement"/>
+      </field>
+      <field name="sinkpad">
+        <type name="Gst.Pad" c:type="GstPad*"/>
+      </field>
+      <field name="srcpad">
+        <type name="Gst.Pad" c:type="GstPad*"/>
+      </field>
+      <field name="queuelock">
+        <type name="GLib.StaticRecMutex" c:type="GStaticRecMutex"/>
+      </field>
+      <field name="thread_running">
+        <type name="gboolean" c:type="gboolean"/>
+      </field>
+      <field name="thread">
+        <type name="GLib.Thread" c:type="GThread*"/>
+      </field>
+      <field name="clock_rate">
+        <type name="guint" c:type="guint"/>
+      </field>
+      <field name="queue_delay">
+        <type name="guint" c:type="guint"/>
+      </field>
+      <field name="queue">
+        <type name="GLib.Queue" c:type="GQueue*"/>
+      </field>
+      <field name="segment">
+        <type name="Gst.Segment" c:type="GstSegment"/>
+      </field>
+      <field name="need_newsegment">
+        <type name="gboolean" c:type="gboolean"/>
+      </field>
+      <field name="priv">
+        <type name="BaseRTPDepayloadPrivate"
+              c:type="GstBaseRTPDepayloadPrivate*"/>
+      </field>
+      <field name="_gst_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="3">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </class>
+    <record name="BaseRTPDepayloadClass"
+            c:type="GstBaseRTPDepayloadClass"
+            glib:is-gtype-struct-for="BaseRTPDepayload">
+      <field name="parent_class">
+        <type name="Gst.ElementClass" c:type="GstElementClass"/>
+      </field>
+      <field name="set_caps">
+        <callback name="set_caps">
+          <return-value transfer-ownership="none">
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="filter" transfer-ownership="none">
+              <type name="BaseRTPDepayload" c:type="GstBaseRTPDepayload*"/>
+            </parameter>
+            <parameter name="caps" transfer-ownership="none">
+              <type name="Gst.Caps" c:type="GstCaps*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="add_to_queue">
+        <callback name="add_to_queue">
+          <return-value transfer-ownership="none">
+            <type name="Gst.FlowReturn" c:type="GstFlowReturn"/>
+          </return-value>
+          <parameters>
+            <parameter name="filter" transfer-ownership="none">
+              <type name="BaseRTPDepayload" c:type="GstBaseRTPDepayload*"/>
+            </parameter>
+            <parameter name="in" transfer-ownership="none">
+              <type name="Gst.Buffer" c:type="GstBuffer*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="process" introspectable="0">
+        <callback name="process" introspectable="0">
+          <return-value>
+            <type name="Gst.Buffer" c:type="GstBuffer*"/>
+          </return-value>
+          <parameters>
+            <parameter name="base" transfer-ownership="none">
+              <type name="BaseRTPDepayload" c:type="GstBaseRTPDepayload*"/>
+            </parameter>
+            <parameter name="in" transfer-ownership="none">
+              <type name="Gst.Buffer" c:type="GstBuffer*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="set_gst_timestamp">
+        <callback name="set_gst_timestamp">
+          <return-value transfer-ownership="none">
+            <type name="none" c:type="void"/>
+          </return-value>
+          <parameters>
+            <parameter name="filter" transfer-ownership="none">
+              <type name="BaseRTPDepayload" c:type="GstBaseRTPDepayload*"/>
+            </parameter>
+            <parameter name="timestamp" transfer-ownership="none">
+              <type name="guint32" c:type="guint32"/>
+            </parameter>
+            <parameter name="buf" transfer-ownership="none">
+              <type name="Gst.Buffer" c:type="GstBuffer*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="packet_lost">
+        <callback name="packet_lost">
+          <return-value transfer-ownership="none">
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="filter" transfer-ownership="none">
+              <type name="BaseRTPDepayload" c:type="GstBaseRTPDepayload*"/>
+            </parameter>
+            <parameter name="event" transfer-ownership="none">
+              <type name="Gst.Event" c:type="GstEvent*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="handle_event">
+        <callback name="handle_event">
+          <return-value transfer-ownership="none">
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="filter" transfer-ownership="none">
+              <type name="BaseRTPDepayload" c:type="GstBaseRTPDepayload*"/>
+            </parameter>
+            <parameter name="event" transfer-ownership="none">
+              <type name="Gst.Event" c:type="GstEvent*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="_gst_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="2">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </record>
+    <record name="BaseRTPDepayloadPrivate"
+            c:type="GstBaseRTPDepayloadPrivate"
+            disguised="1">
+    </record>
+    <class name="BaseRTPPayload"
+           c:symbol-prefix="basertppayload"
+           c:type="GstBaseRTPPayload"
+           parent="Gst.Element"
+           abstract="1"
+           glib:type-name="GstBaseRTPPayload"
+           glib:get-type="gst_basertppayload_get_type"
+           glib:type-struct="BaseRTPPayloadClass">
+      <function name="is_filled" c:identifier="gst_basertppayload_is_filled">
+        <doc xml:whitespace="preserve">Check if the packet with @size and @duration would exceed the configured
+maximum size.
+configured MTU or max_ptime.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE if the packet of @size and @duration would exceed the</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="payload" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a #GstBaseRTPPayload</doc>
+            <type name="BaseRTPPayload" c:type="GstBaseRTPPayload*"/>
+          </parameter>
+          <parameter name="size" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the size of the packet</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+          <parameter name="duration" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the duration of the packet</doc>
+            <type name="Gst.ClockTime" c:type="GstClockTime"/>
+          </parameter>
+        </parameters>
+      </function>
+      <function name="push" c:identifier="gst_basertppayload_push">
+        <doc xml:whitespace="preserve">Push @buffer to the peer element of the payloader. The SSRC, payload type,
+seqnum and timestamp of the RTP buffer will be updated first.
+This function takes ownership of @buffer.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstFlowReturn.</doc>
+          <type name="Gst.FlowReturn" c:type="GstFlowReturn"/>
+        </return-value>
+        <parameters>
+          <parameter name="payload" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a #GstBaseRTPPayload</doc>
+            <type name="BaseRTPPayload" c:type="GstBaseRTPPayload*"/>
+          </parameter>
+          <parameter name="buffer" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a #GstBuffer</doc>
+            <type name="Gst.Buffer" c:type="GstBuffer*"/>
+          </parameter>
+        </parameters>
+      </function>
+      <function name="push_list"
+                c:identifier="gst_basertppayload_push_list"
+                version="0.10.24">
+        <doc xml:whitespace="preserve">Push @list to the peer element of the payloader. The SSRC, payload type,
+seqnum and timestamp of the RTP buffer will be updated first.
+This function takes ownership of @list.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstFlowReturn.</doc>
+          <type name="Gst.FlowReturn" c:type="GstFlowReturn"/>
+        </return-value>
+        <parameters>
+          <parameter name="payload" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a #GstBaseRTPPayload</doc>
+            <type name="BaseRTPPayload" c:type="GstBaseRTPPayload*"/>
+          </parameter>
+          <parameter name="list" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a #GstBufferList</doc>
+            <type name="Gst.BufferList" c:type="GstBufferList*"/>
+          </parameter>
+        </parameters>
+      </function>
+      <function name="set_options"
+                c:identifier="gst_basertppayload_set_options">
+        <doc xml:whitespace="preserve">Set the rtp options of the payloader. These options will be set in the caps
+of the payloader. Subclasses must call this method before calling
+gst_basertppayload_push() or gst_basertppayload_set_outcaps().</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="payload" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a #GstBaseRTPPayload</doc>
+            <type name="BaseRTPPayload" c:type="GstBaseRTPPayload*"/>
+          </parameter>
+          <parameter name="media" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the media type (typically "audio" or "video")</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="dynamic" transfer-ownership="none">
+            <doc xml:whitespace="preserve">if the payload type is dynamic</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </parameter>
+          <parameter name="encoding_name" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the encoding name</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="clock_rate" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the clock rate of the media</doc>
+            <type name="guint32" c:type="guint32"/>
+          </parameter>
+        </parameters>
+      </function>
+      <function name="set_outcaps"
+                c:identifier="gst_basertppayload_set_outcaps"
+                introspectable="0">
+        <doc xml:whitespace="preserve">Configure the output caps with the optional parameters.
+Variable arguments should be in the form field name, field type
+(as a GType), value(s).  The last variable argument should be NULL.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE if the caps could be set.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="payload" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a #GstBaseRTPPayload</doc>
+            <type name="BaseRTPPayload" c:type="GstBaseRTPPayload*"/>
+          </parameter>
+          <parameter name="fieldname" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the first field name or %NULL</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter transfer-ownership="none">
+            <varargs>
+            </varargs>
+          </parameter>
+        </parameters>
+      </function>
+      <virtual-method name="get_caps">
+        <return-value transfer-ownership="full">
+          <type name="Gst.Caps" c:type="GstCaps*"/>
+        </return-value>
+        <parameters>
+          <parameter name="pad" transfer-ownership="none">
+            <type name="Gst.Pad" c:type="GstPad*"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <virtual-method name="handle_buffer">
+        <return-value transfer-ownership="none">
+          <type name="Gst.FlowReturn" c:type="GstFlowReturn"/>
+        </return-value>
+        <parameters>
+          <parameter name="buffer" transfer-ownership="none">
+            <type name="Gst.Buffer" c:type="GstBuffer*"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <virtual-method name="set_caps">
+        <return-value transfer-ownership="none">
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="caps" transfer-ownership="none">
+            <type name="Gst.Caps" c:type="GstCaps*"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <property name="max-ptime" writable="1" transfer-ownership="none">
+        <type name="gint64"/>
+      </property>
+      <property name="min-ptime" writable="1" transfer-ownership="none">
+        <type name="gint64"/>
+      </property>
+      <property name="mtu" writable="1" transfer-ownership="none">
+        <type name="guint"/>
+      </property>
+      <property name="perfect-rtptime" writable="1" transfer-ownership="none">
+        <type name="gboolean"/>
+      </property>
+      <property name="pt" writable="1" transfer-ownership="none">
+        <type name="guint"/>
+      </property>
+      <property name="ptime-multiple" writable="1" transfer-ownership="none">
+        <type name="gint64"/>
+      </property>
+      <property name="seqnum" transfer-ownership="none">
+        <type name="guint"/>
+      </property>
+      <property name="seqnum-offset" writable="1" transfer-ownership="none">
+        <type name="gint"/>
+      </property>
+      <property name="ssrc" writable="1" transfer-ownership="none">
+        <type name="guint"/>
+      </property>
+      <property name="timestamp" transfer-ownership="none">
+        <type name="guint"/>
+      </property>
+      <property name="timestamp-offset" writable="1" transfer-ownership="none">
+        <type name="guint"/>
+      </property>
+      <field name="element">
+        <type name="Gst.Element" c:type="GstElement"/>
+      </field>
+      <field name="sinkpad">
+        <type name="Gst.Pad" c:type="GstPad*"/>
+      </field>
+      <field name="srcpad">
+        <type name="Gst.Pad" c:type="GstPad*"/>
+      </field>
+      <field name="seq_rand">
+        <type name="GLib.Rand" c:type="GRand*"/>
+      </field>
+      <field name="ssrc_rand">
+        <type name="GLib.Rand" c:type="GRand*"/>
+      </field>
+      <field name="ts_rand">
+        <type name="GLib.Rand" c:type="GRand*"/>
+      </field>
+      <field name="ts_base">
+        <type name="guint32" c:type="guint32"/>
+      </field>
+      <field name="seqnum_base">
+        <type name="guint16" c:type="guint16"/>
+      </field>
+      <field name="media">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <field name="encoding_name">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <field name="dynamic">
+        <type name="gboolean" c:type="gboolean"/>
+      </field>
+      <field name="clock_rate">
+        <type name="guint32" c:type="guint32"/>
+      </field>
+      <field name="ts_offset">
+        <type name="gint32" c:type="gint32"/>
+      </field>
+      <field name="timestamp">
+        <type name="guint32" c:type="guint32"/>
+      </field>
+      <field name="seqnum_offset">
+        <type name="gint16" c:type="gint16"/>
+      </field>
+      <field name="seqnum">
+        <type name="guint16" c:type="guint16"/>
+      </field>
+      <field name="max_ptime">
+        <type name="gint64" c:type="gint64"/>
+      </field>
+      <field name="pt">
+        <type name="guint" c:type="guint"/>
+      </field>
+      <field name="ssrc">
+        <type name="guint" c:type="guint"/>
+      </field>
+      <field name="current_ssrc">
+        <type name="guint" c:type="guint"/>
+      </field>
+      <field name="mtu">
+        <type name="guint" c:type="guint"/>
+      </field>
+      <field name="segment">
+        <type name="Gst.Segment" c:type="GstSegment"/>
+      </field>
+      <field name="min_ptime">
+        <type name="guint64" c:type="guint64"/>
+      </field>
+      <field name="priv">
+        <type name="BaseRTPPayloadPrivate" c:type="GstBaseRTPPayloadPrivate*"/>
+      </field>
+      <union name="abidata" c:type="abidata">
+        <record name="ABI" c:type="ABI">
+          <field name="ptime" writable="1">
+            <type name="guint64" c:type="guint64"/>
+          </field>
+          <field name="ptime_multiple" writable="1">
+            <type name="guint64" c:type="guint64"/>
+          </field>
+        </record>
+        <field name="_gst_reserved" writable="1">
+          <array zero-terminated="0" c:type="gpointer" fixed-size="3">
+            <type name="gpointer" c:type="gpointer"/>
+          </array>
+        </field>
+      </union>
+    </class>
+    <record name="BaseRTPPayloadClass"
+            c:type="GstBaseRTPPayloadClass"
+            glib:is-gtype-struct-for="BaseRTPPayload">
+      <field name="parent_class">
+        <type name="Gst.ElementClass" c:type="GstElementClass"/>
+      </field>
+      <field name="set_caps">
+        <callback name="set_caps">
+          <return-value transfer-ownership="none">
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="payload" transfer-ownership="none">
+              <type name="BaseRTPPayload" c:type="GstBaseRTPPayload*"/>
+            </parameter>
+            <parameter name="caps" transfer-ownership="none">
+              <type name="Gst.Caps" c:type="GstCaps*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="handle_buffer">
+        <callback name="handle_buffer">
+          <return-value transfer-ownership="none">
+            <type name="Gst.FlowReturn" c:type="GstFlowReturn"/>
+          </return-value>
+          <parameters>
+            <parameter name="payload" transfer-ownership="none">
+              <type name="BaseRTPPayload" c:type="GstBaseRTPPayload*"/>
+            </parameter>
+            <parameter name="buffer" transfer-ownership="none">
+              <type name="Gst.Buffer" c:type="GstBuffer*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="handle_event">
+        <callback name="handle_event">
+          <return-value transfer-ownership="none">
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="pad" transfer-ownership="none">
+              <type name="Gst.Pad" c:type="GstPad*"/>
+            </parameter>
+            <parameter name="event" transfer-ownership="none">
+              <type name="Gst.Event" c:type="GstEvent*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="get_caps">
+        <callback name="get_caps">
+          <return-value transfer-ownership="full">
+            <type name="Gst.Caps" c:type="GstCaps*"/>
+          </return-value>
+          <parameters>
+            <parameter name="payload" transfer-ownership="none">
+              <type name="BaseRTPPayload" c:type="GstBaseRTPPayload*"/>
+            </parameter>
+            <parameter name="pad" transfer-ownership="none">
+              <type name="Gst.Pad" c:type="GstPad*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="_gst_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="2">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </record>
+    <record name="BaseRTPPayloadPrivate"
+            c:type="GstBaseRTPPayloadPrivate"
+            disguised="1">
+    </record>
+    <enumeration name="RTCPFBType" version="0.10.23" c:type="GstRTCPFBType">
+      <doc xml:whitespace="preserve">Different types of feedback messages.</doc>
+      <member name="fb_type_invalid"
+              value="0"
+              c:identifier="GST_RTCP_FB_TYPE_INVALID"/>
+      <member name="rtpfb_type_nack"
+              value="1"
+              c:identifier="GST_RTCP_RTPFB_TYPE_NACK"/>
+      <member name="psfb_type_pli"
+              value="1"
+              c:identifier="GST_RTCP_PSFB_TYPE_PLI"/>
+      <member name="psfb_type_sli"
+              value="2"
+              c:identifier="GST_RTCP_PSFB_TYPE_SLI"/>
+      <member name="psfb_type_rpsi"
+              value="3"
+              c:identifier="GST_RTCP_PSFB_TYPE_RPSI"/>
+      <member name="psfb_type_afb"
+              value="15"
+              c:identifier="GST_RTCP_PSFB_TYPE_AFB"/>
+    </enumeration>
+    <record name="RTCPPacket" c:type="GstRTCPPacket">
+      <doc xml:whitespace="preserve">Data structure that points to a packet at @offset in @buffer. 
+The size of the structure is made public to allow stack allocations.</doc>
+      <field name="buffer" writable="1">
+        <type name="Gst.Buffer" c:type="GstBuffer*"/>
+      </field>
+      <field name="offset" writable="1">
+        <type name="guint" c:type="guint"/>
+      </field>
+      <field name="padding" writable="1">
+        <type name="gboolean" c:type="gboolean"/>
+      </field>
+      <field name="count" writable="1">
+        <type name="guint8" c:type="guint8"/>
+      </field>
+      <field name="type" writable="1">
+        <type name="RTCPType" c:type="GstRTCPType"/>
+      </field>
+      <field name="length" writable="1">
+        <type name="guint16" c:type="guint16"/>
+      </field>
+      <field name="item_offset" writable="1">
+        <type name="guint" c:type="guint"/>
+      </field>
+      <field name="item_count" writable="1">
+        <type name="guint" c:type="guint"/>
+      </field>
+      <field name="entry_offset" writable="1">
+        <type name="guint" c:type="guint"/>
+      </field>
+      <method name="add_rb" c:identifier="gst_rtcp_packet_add_rb">
+        <doc xml:whitespace="preserve">Add a new report block to @packet with the given values.
+the max MTU is exceeded or the number of report blocks is greater than
+#GST_RTCP_MAX_RB_COUNT.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE if the packet was created. This function can return %FALSE if</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="ssrc" transfer-ownership="none">
+            <doc xml:whitespace="preserve">data source being reported</doc>
+            <type name="guint32" c:type="guint32"/>
+          </parameter>
+          <parameter name="fractionlost" transfer-ownership="none">
+            <doc xml:whitespace="preserve">fraction lost since last SR/RR</doc>
+            <type name="guint8" c:type="guint8"/>
+          </parameter>
+          <parameter name="packetslost" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the cumululative number of packets lost</doc>
+            <type name="gint32" c:type="gint32"/>
+          </parameter>
+          <parameter name="exthighestseq" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the extended last sequence number received</doc>
+            <type name="guint32" c:type="guint32"/>
+          </parameter>
+          <parameter name="jitter" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the interarrival jitter</doc>
+            <type name="guint32" c:type="guint32"/>
+          </parameter>
+          <parameter name="lsr" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the last SR packet from this source</doc>
+            <type name="guint32" c:type="guint32"/>
+          </parameter>
+          <parameter name="dlsr" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the delay since last SR packet</doc>
+            <type name="guint32" c:type="guint32"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="bye_add_ssrc" c:identifier="gst_rtcp_packet_bye_add_ssrc">
+        <doc xml:whitespace="preserve">Add @ssrc to the BYE @packet.
+the max MTU is exceeded or the number of sources blocks is greater than
+#GST_RTCP_MAX_BYE_SSRC_COUNT.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE if the ssrc was added. This function can return %FALSE if</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="ssrc" transfer-ownership="none">
+            <doc xml:whitespace="preserve">an SSRC to add</doc>
+            <type name="guint32" c:type="guint32"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="bye_add_ssrcs"
+              c:identifier="gst_rtcp_packet_bye_add_ssrcs">
+        <doc xml:whitespace="preserve">Adds @len SSRCs in @ssrc to BYE @packet.
+the max MTU is exceeded or the number of sources blocks is greater than
+#GST_RTCP_MAX_BYE_SSRC_COUNT.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE if the all the SSRCs were added. This function can return %FALSE if</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="ssrc" transfer-ownership="none">
+            <doc xml:whitespace="preserve">an array of SSRCs to add</doc>
+            <type name="guint32" c:type="guint32*"/>
+          </parameter>
+          <parameter name="len" transfer-ownership="none">
+            <doc xml:whitespace="preserve">number of elements in @ssrc</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="bye_get_nth_ssrc"
+              c:identifier="gst_rtcp_packet_bye_get_nth_ssrc">
+        <doc xml:whitespace="preserve">Get the @nth SSRC of the BYE @packet.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">The @nth SSRC of @packet.</doc>
+          <type name="guint32" c:type="guint32"/>
+        </return-value>
+        <parameters>
+          <parameter name="nth" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the nth SSRC to get</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="bye_get_reason"
+              c:identifier="gst_rtcp_packet_bye_get_reason">
+        <doc xml:whitespace="preserve">Get the reason in @packet.
+a reason string. The string must be freed with g_free() after usage.</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">The reason for the BYE @packet or NULL if the packet did not contain</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </return-value>
+      </method>
+      <method name="bye_get_reason_len"
+              c:identifier="gst_rtcp_packet_bye_get_reason_len">
+        <doc xml:whitespace="preserve">Get the length of the reason string.
+present.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">The length of the reason string or 0 when there is no reason string</doc>
+          <type name="guint8" c:type="guint8"/>
+        </return-value>
+      </method>
+      <method name="bye_get_ssrc_count"
+              c:identifier="gst_rtcp_packet_bye_get_ssrc_count">
+        <doc xml:whitespace="preserve">Get the number of SSRC fields in @packet.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">The number of SSRC fields in @packet.</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </method>
+      <method name="bye_set_reason"
+              c:identifier="gst_rtcp_packet_bye_set_reason">
+        <doc xml:whitespace="preserve">Set the reason string to @reason in @packet.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">TRUE if the string could be set.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="reason" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a reason string</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="fb_get_fci"
+              c:identifier="gst_rtcp_packet_fb_get_fci"
+              version="0.10.31">
+        <doc xml:whitespace="preserve">Get the Feedback Control Information attached to a RTPFB or PSFB @packet.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a pointer to the FCI</doc>
+          <type name="guint8" c:type="guint8*"/>
+        </return-value>
+      </method>
+      <method name="fb_get_fci_length"
+              c:identifier="gst_rtcp_packet_fb_get_fci_length"
+              version="0.10.31">
+        <doc xml:whitespace="preserve">Get the length of the Feedback Control Information attached to a
+RTPFB or PSFB @packet.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">The length of the FCI in 32-bit words.</doc>
+          <type name="guint16" c:type="guint16"/>
+        </return-value>
+      </method>
+      <method name="fb_get_media_ssrc"
+              c:identifier="gst_rtcp_packet_fb_get_media_ssrc"
+              version="0.10.23">
+        <doc xml:whitespace="preserve">Get the media SSRC field of the RTPFB or PSFB @packet.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the media SSRC.</doc>
+          <type name="guint32" c:type="guint32"/>
+        </return-value>
+      </method>
+      <method name="fb_get_sender_ssrc"
+              c:identifier="gst_rtcp_packet_fb_get_sender_ssrc"
+              version="0.10.23">
+        <doc xml:whitespace="preserve">Get the sender SSRC field of the RTPFB or PSFB @packet.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the sender SSRC.</doc>
+          <type name="guint32" c:type="guint32"/>
+        </return-value>
+      </method>
+      <method name="fb_set_fci_length"
+              c:identifier="gst_rtcp_packet_fb_set_fci_length"
+              version="0.10.31">
+        <doc xml:whitespace="preserve">Set the length of the Feedback Control Information attached to a
+RTPFB or PSFB @packet.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE if there was enough space in the packet to add this much FCI</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="wordlen" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Length of the FCI in 32-bit words</doc>
+            <type name="guint16" c:type="guint16"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="fb_set_media_ssrc"
+              c:identifier="gst_rtcp_packet_fb_set_media_ssrc"
+              version="0.10.23">
+        <doc xml:whitespace="preserve">Set the media SSRC field of the RTPFB or PSFB @packet.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="ssrc" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a media SSRC</doc>
+            <type name="guint32" c:type="guint32"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="fb_set_sender_ssrc"
+              c:identifier="gst_rtcp_packet_fb_set_sender_ssrc"
+              version="0.10.23">
+        <doc xml:whitespace="preserve">Set the sender SSRC field of the RTPFB or PSFB @packet.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="ssrc" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a sender SSRC</doc>
+            <type name="guint32" c:type="guint32"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="fb_set_type"
+              c:identifier="gst_rtcp_packet_fb_set_type"
+              version="0.10.23">
+        <doc xml:whitespace="preserve">Set the feedback message type of the FB @packet.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="type" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the #GstRTCPFBType to set</doc>
+            <type name="RTCPFBType" c:type="GstRTCPFBType"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="get_count" c:identifier="gst_rtcp_packet_get_count">
+        <doc xml:whitespace="preserve">Get the count field in @packet.
+valid packet.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">The count field in @packet or -1 if @packet does not point to a</doc>
+          <type name="guint8" c:type="guint8"/>
+        </return-value>
+      </method>
+      <method name="get_length" c:identifier="gst_rtcp_packet_get_length">
+        <doc xml:whitespace="preserve">Get the length field of @packet. This is the length of the packet in 
+32-bit words minus one.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">The length field of @packet.</doc>
+          <type name="guint16" c:type="guint16"/>
+        </return-value>
+      </method>
+      <method name="get_padding" c:identifier="gst_rtcp_packet_get_padding">
+        <doc xml:whitespace="preserve">Get the packet padding of the packet pointed to by @packet.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">If the packet has the padding bit set.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </method>
+      <method name="get_rb" c:identifier="gst_rtcp_packet_get_rb">
+        <doc xml:whitespace="preserve">Parse the values of the @nth report block in @packet and store the result in
+the values.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="nth" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the nth report block in @packet</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+          <parameter name="ssrc" transfer-ownership="none">
+            <doc xml:whitespace="preserve">result for data source being reported</doc>
+            <type name="guint32" c:type="guint32*"/>
+          </parameter>
+          <parameter name="fractionlost" transfer-ownership="none">
+            <doc xml:whitespace="preserve">result for fraction lost since last SR/RR</doc>
+            <type name="guint8" c:type="guint8*"/>
+          </parameter>
+          <parameter name="packetslost" transfer-ownership="none">
+            <doc xml:whitespace="preserve">result for the cumululative number of packets lost</doc>
+            <type name="gint32" c:type="gint32*"/>
+          </parameter>
+          <parameter name="exthighestseq" transfer-ownership="none">
+            <doc xml:whitespace="preserve">result for the extended last sequence number received</doc>
+            <type name="guint32" c:type="guint32*"/>
+          </parameter>
+          <parameter name="jitter" transfer-ownership="none">
+            <doc xml:whitespace="preserve">result for the interarrival jitter</doc>
+            <type name="guint32" c:type="guint32*"/>
+          </parameter>
+          <parameter name="lsr" transfer-ownership="none">
+            <doc xml:whitespace="preserve">result for the last SR packet from this source</doc>
+            <type name="guint32" c:type="guint32*"/>
+          </parameter>
+          <parameter name="dlsr" transfer-ownership="none">
+            <doc xml:whitespace="preserve">result for the delay since last SR packet</doc>
+            <type name="guint32" c:type="guint32*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="get_rb_count" c:identifier="gst_rtcp_packet_get_rb_count">
+        <doc xml:whitespace="preserve">Get the number of report blocks in @packet.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">The number of report blocks in @packet.</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </method>
+      <method name="move_to_next" c:identifier="gst_rtcp_packet_move_to_next">
+        <doc xml:whitespace="preserve">Move the packet pointer @packet to the next packet in the payload.
+Use gst_rtcp_buffer_get_first_packet() to initialize @packet.
+function.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">TRUE if @packet is pointing to a valid packet after calling this</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </method>
+      <method name="remove" c:identifier="gst_rtcp_packet_remove">
+        <doc xml:whitespace="preserve">Removes the packet pointed to by @packet and moves pointer to the next one
+function.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">TRUE if @packet is pointing to a valid packet after calling this</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </method>
+      <method name="rr_get_ssrc" c:identifier="gst_rtcp_packet_rr_get_ssrc">
+        <doc xml:whitespace="preserve">Get the ssrc field of the RR @packet.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the ssrc.</doc>
+          <type name="guint32" c:type="guint32"/>
+        </return-value>
+      </method>
+      <method name="rr_set_ssrc" c:identifier="gst_rtcp_packet_rr_set_ssrc">
+        <doc xml:whitespace="preserve">Set the ssrc field of the RR @packet.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="ssrc" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the SSRC to set</doc>
+            <type name="guint32" c:type="guint32"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="sdes_add_entry"
+              c:identifier="gst_rtcp_packet_sdes_add_entry">
+        <doc xml:whitespace="preserve">Add a new SDES entry to the current item in @packet.
+reached.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE if the item could be added, %FALSE if the MTU has been</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="type" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the #GstRTCPSDESType of the SDES entry</doc>
+            <type name="RTCPSDESType" c:type="GstRTCPSDESType"/>
+          </parameter>
+          <parameter name="len" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the data length</doc>
+            <type name="guint8" c:type="guint8"/>
+          </parameter>
+          <parameter name="data" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the data</doc>
+            <type name="guint8" c:type="guint8*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="sdes_add_item"
+              c:identifier="gst_rtcp_packet_sdes_add_item">
+        <doc xml:whitespace="preserve">Add a new SDES item for @ssrc to @packet.
+items has been exceeded for the SDES packet or the MTU has been reached.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE if the item could be added, %FALSE if the maximum amount of</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="ssrc" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the SSRC of the new item to add</doc>
+            <type name="guint32" c:type="guint32"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="sdes_copy_entry"
+              c:identifier="gst_rtcp_packet_sdes_copy_entry">
+        <doc xml:whitespace="preserve">This function is like gst_rtcp_packet_sdes_get_entry() but it returns a
+null-terminated copy of the data instead. use g_free() after usage.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE if there was valid data.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="type" transfer-ownership="none">
+            <doc xml:whitespace="preserve">result of the entry type</doc>
+            <type name="RTCPSDESType" c:type="GstRTCPSDESType*"/>
+          </parameter>
+          <parameter name="len" transfer-ownership="none">
+            <doc xml:whitespace="preserve">result length of the entry data</doc>
+            <type name="guint8" c:type="guint8*"/>
+          </parameter>
+          <parameter name="data" transfer-ownership="none">
+            <doc xml:whitespace="preserve">result entry data</doc>
+            <type name="guint8" c:type="guint8**"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="sdes_first_entry"
+              c:identifier="gst_rtcp_packet_sdes_first_entry">
+        <doc xml:whitespace="preserve">Move to the first SDES entry in the current item.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE if there was a first entry.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </method>
+      <method name="sdes_first_item"
+              c:identifier="gst_rtcp_packet_sdes_first_item">
+        <doc xml:whitespace="preserve">Move to the first SDES item in @packet.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">TRUE if there was a first item.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </method>
+      <method name="sdes_get_entry"
+              c:identifier="gst_rtcp_packet_sdes_get_entry">
+        <doc xml:whitespace="preserve">Get the data of the current SDES item entry. @type (when not NULL) will
+contain the type of the entry. @data (when not NULL) will point to @len
+bytes.
+When @type refers to a text item, @data will point to a UTF8 string. Note
+that this UTF8 string is NOT null-terminated. Use
+gst_rtcp_packet_sdes_copy_entry() to get a null-termined copy of the entry.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE if there was valid data.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="type" transfer-ownership="none">
+            <doc xml:whitespace="preserve">result of the entry type</doc>
+            <type name="RTCPSDESType" c:type="GstRTCPSDESType*"/>
+          </parameter>
+          <parameter name="len" transfer-ownership="none">
+            <doc xml:whitespace="preserve">result length of the entry data</doc>
+            <type name="guint8" c:type="guint8*"/>
+          </parameter>
+          <parameter name="data" transfer-ownership="none">
+            <doc xml:whitespace="preserve">result entry data</doc>
+            <type name="guint8" c:type="guint8**"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="sdes_get_item_count"
+              c:identifier="gst_rtcp_packet_sdes_get_item_count">
+        <doc xml:whitespace="preserve">Get the number of items in the SDES packet @packet.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">The number of items in @packet.</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </method>
+      <method name="sdes_get_ssrc"
+              c:identifier="gst_rtcp_packet_sdes_get_ssrc">
+        <doc xml:whitespace="preserve">Get the SSRC of the current SDES item.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the SSRC of the current item.</doc>
+          <type name="guint32" c:type="guint32"/>
+        </return-value>
+      </method>
+      <method name="sdes_next_entry"
+              c:identifier="gst_rtcp_packet_sdes_next_entry">
+        <doc xml:whitespace="preserve">Move to the next SDES entry in the current item.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE if there was a next entry.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </method>
+      <method name="sdes_next_item"
+              c:identifier="gst_rtcp_packet_sdes_next_item">
+        <doc xml:whitespace="preserve">Move to the next SDES item in @packet.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">TRUE if there was a next item.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </method>
+      <method name="set_rb" c:identifier="gst_rtcp_packet_set_rb">
+        <doc xml:whitespace="preserve">Set the @nth new report block in @packet with the given values.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="nth" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the nth report block to set</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+          <parameter name="ssrc" transfer-ownership="none">
+            <doc xml:whitespace="preserve">data source being reported</doc>
+            <type name="guint32" c:type="guint32"/>
+          </parameter>
+          <parameter name="fractionlost" transfer-ownership="none">
+            <doc xml:whitespace="preserve">fraction lost since last SR/RR</doc>
+            <type name="guint8" c:type="guint8"/>
+          </parameter>
+          <parameter name="packetslost" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the cumululative number of packets lost</doc>
+            <type name="gint32" c:type="gint32"/>
+          </parameter>
+          <parameter name="exthighestseq" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the extended last sequence number received</doc>
+            <type name="guint32" c:type="guint32"/>
+          </parameter>
+          <parameter name="jitter" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the interarrival jitter</doc>
+            <type name="guint32" c:type="guint32"/>
+          </parameter>
+          <parameter name="lsr" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the last SR packet from this source</doc>
+            <type name="guint32" c:type="guint32"/>
+          </parameter>
+          <parameter name="dlsr" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the delay since last SR packet</doc>
+            <type name="guint32" c:type="guint32"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="sr_get_sender_info"
+              c:identifier="gst_rtcp_packet_sr_get_sender_info">
+        <doc xml:whitespace="preserve">Parse the SR sender info and store the values.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="ssrc" transfer-ownership="none">
+            <doc xml:whitespace="preserve">result SSRC</doc>
+            <type name="guint32" c:type="guint32*"/>
+          </parameter>
+          <parameter name="ntptime" transfer-ownership="none">
+            <doc xml:whitespace="preserve">result NTP time</doc>
+            <type name="guint64" c:type="guint64*"/>
+          </parameter>
+          <parameter name="rtptime" transfer-ownership="none">
+            <doc xml:whitespace="preserve">result RTP time</doc>
+            <type name="guint32" c:type="guint32*"/>
+          </parameter>
+          <parameter name="packet_count" transfer-ownership="none">
+            <doc xml:whitespace="preserve">result packet count</doc>
+            <type name="guint32" c:type="guint32*"/>
+          </parameter>
+          <parameter name="octet_count" transfer-ownership="none">
+            <doc xml:whitespace="preserve">result octect count</doc>
+            <type name="guint32" c:type="guint32*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="sr_set_sender_info"
+              c:identifier="gst_rtcp_packet_sr_set_sender_info">
+        <doc xml:whitespace="preserve">Set the given values in the SR packet @packet.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="ssrc" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the SSRC</doc>
+            <type name="guint32" c:type="guint32"/>
+          </parameter>
+          <parameter name="ntptime" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the NTP time</doc>
+            <type name="guint64" c:type="guint64"/>
+          </parameter>
+          <parameter name="rtptime" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the RTP time</doc>
+            <type name="guint32" c:type="guint32"/>
+          </parameter>
+          <parameter name="packet_count" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the packet count</doc>
+            <type name="guint32" c:type="guint32"/>
+          </parameter>
+          <parameter name="octet_count" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the octect count</doc>
+            <type name="guint32" c:type="guint32"/>
+          </parameter>
+        </parameters>
+      </method>
+    </record>
+    <enumeration name="RTCPSDESType" c:type="GstRTCPSDESType">
+      <member name="invalid" value="-1" c:identifier="GST_RTCP_SDES_INVALID"/>
+      <member name="end" value="0" c:identifier="GST_RTCP_SDES_END"/>
+      <member name="cname" value="1" c:identifier="GST_RTCP_SDES_CNAME"/>
+      <member name="name" value="2" c:identifier="GST_RTCP_SDES_NAME"/>
+      <member name="email" value="3" c:identifier="GST_RTCP_SDES_EMAIL"/>
+      <member name="phone" value="4" c:identifier="GST_RTCP_SDES_PHONE"/>
+      <member name="loc" value="5" c:identifier="GST_RTCP_SDES_LOC"/>
+      <member name="tool" value="6" c:identifier="GST_RTCP_SDES_TOOL"/>
+      <member name="note" value="7" c:identifier="GST_RTCP_SDES_NOTE"/>
+      <member name="priv" value="8" c:identifier="GST_RTCP_SDES_PRIV"/>
+    </enumeration>
+    <enumeration name="RTCPType" c:type="GstRTCPType">
+      <member name="invalid" value="0" c:identifier="GST_RTCP_TYPE_INVALID"/>
+      <member name="sr" value="200" c:identifier="GST_RTCP_TYPE_SR"/>
+      <member name="rr" value="201" c:identifier="GST_RTCP_TYPE_RR"/>
+      <member name="sdes" value="202" c:identifier="GST_RTCP_TYPE_SDES"/>
+      <member name="bye" value="203" c:identifier="GST_RTCP_TYPE_BYE"/>
+      <member name="app" value="204" c:identifier="GST_RTCP_TYPE_APP"/>
+      <member name="rtpfb" value="205" c:identifier="GST_RTCP_TYPE_RTPFB"/>
+      <member name="psfb" value="206" c:identifier="GST_RTCP_TYPE_PSFB"/>
+    </enumeration>
+    <constant name="RTCP_MAX_BYE_SSRC_COUNT" value="31">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RTCP_MAX_RB_COUNT" value="31">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RTCP_MAX_SDES" value="255">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RTCP_MAX_SDES_ITEM_COUNT" value="31">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RTCP_VALID_MASK" value="57598">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RTCP_VALID_VALUE" value="0">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RTCP_VERSION" value="2">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <enumeration name="RTPPayload" c:type="GstRTPPayload">
+      <member name="pcmu" value="0" c:identifier="GST_RTP_PAYLOAD_PCMU"/>
+      <member name="1016" value="1" c:identifier="GST_RTP_PAYLOAD_1016"/>
+      <member name="g721" value="2" c:identifier="GST_RTP_PAYLOAD_G721"/>
+      <member name="gsm" value="3" c:identifier="GST_RTP_PAYLOAD_GSM"/>
+      <member name="g723" value="4" c:identifier="GST_RTP_PAYLOAD_G723"/>
+      <member name="dvi4_8000"
+              value="5"
+              c:identifier="GST_RTP_PAYLOAD_DVI4_8000"/>
+      <member name="dvi4_16000"
+              value="6"
+              c:identifier="GST_RTP_PAYLOAD_DVI4_16000"/>
+      <member name="lpc" value="7" c:identifier="GST_RTP_PAYLOAD_LPC"/>
+      <member name="pcma" value="8" c:identifier="GST_RTP_PAYLOAD_PCMA"/>
+      <member name="g722" value="9" c:identifier="GST_RTP_PAYLOAD_G722"/>
+      <member name="l16_stereo"
+              value="10"
+              c:identifier="GST_RTP_PAYLOAD_L16_STEREO"/>
+      <member name="l16_mono"
+              value="11"
+              c:identifier="GST_RTP_PAYLOAD_L16_MONO"/>
+      <member name="qcelp" value="12" c:identifier="GST_RTP_PAYLOAD_QCELP"/>
+      <member name="cn" value="13" c:identifier="GST_RTP_PAYLOAD_CN"/>
+      <member name="mpa" value="14" c:identifier="GST_RTP_PAYLOAD_MPA"/>
+      <member name="g728" value="15" c:identifier="GST_RTP_PAYLOAD_G728"/>
+      <member name="dvi4_11025"
+              value="16"
+              c:identifier="GST_RTP_PAYLOAD_DVI4_11025"/>
+      <member name="dvi4_22050"
+              value="17"
+              c:identifier="GST_RTP_PAYLOAD_DVI4_22050"/>
+      <member name="g729" value="18" c:identifier="GST_RTP_PAYLOAD_G729"/>
+      <member name="cellb" value="25" c:identifier="GST_RTP_PAYLOAD_CELLB"/>
+      <member name="jpeg" value="26" c:identifier="GST_RTP_PAYLOAD_JPEG"/>
+      <member name="nv" value="28" c:identifier="GST_RTP_PAYLOAD_NV"/>
+      <member name="h261" value="31" c:identifier="GST_RTP_PAYLOAD_H261"/>
+      <member name="mpv" value="32" c:identifier="GST_RTP_PAYLOAD_MPV"/>
+      <member name="mp2t" value="33" c:identifier="GST_RTP_PAYLOAD_MP2T"/>
+      <member name="h263" value="34" c:identifier="GST_RTP_PAYLOAD_H263"/>
+    </enumeration>
+    <record name="RTPPayloadInfo" c:type="GstRTPPayloadInfo">
+      <doc xml:whitespace="preserve">Structure holding default payload type information.</doc>
+      <field name="payload_type" writable="1">
+        <type name="guint8" c:type="guint8"/>
+      </field>
+      <field name="media" writable="1">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <field name="encoding_name" writable="1">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <field name="clock_rate" writable="1">
+        <type name="guint" c:type="guint"/>
+      </field>
+      <field name="encoding_parameters" writable="1">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <field name="bitrate" writable="1">
+        <type name="guint" c:type="guint"/>
+      </field>
+    </record>
+    <constant name="RTP_PAYLOAD_1016_STRING" value="1">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="RTP_PAYLOAD_CELLB_STRING" value="25">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="RTP_PAYLOAD_CN_STRING" value="13">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="RTP_PAYLOAD_DVI4_11025_STRING" value="16">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="RTP_PAYLOAD_DVI4_16000_STRING" value="6">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="RTP_PAYLOAD_DVI4_22050_STRING" value="17">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="RTP_PAYLOAD_DVI4_8000_STRING" value="5">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="RTP_PAYLOAD_DYNAMIC_STRING" value="[96, 127]">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="RTP_PAYLOAD_G721_STRING" value="2">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="RTP_PAYLOAD_G722_STRING" value="9">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="RTP_PAYLOAD_G723_53" value="17">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RTP_PAYLOAD_G723_53_STRING" value="17">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="RTP_PAYLOAD_G723_63" value="16">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RTP_PAYLOAD_G723_63_STRING" value="16">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="RTP_PAYLOAD_G723_STRING" value="4">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="RTP_PAYLOAD_G728_STRING" value="15">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="RTP_PAYLOAD_G729_STRING" value="18">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="RTP_PAYLOAD_GSM_STRING" value="3">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="RTP_PAYLOAD_H261_STRING" value="31">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="RTP_PAYLOAD_H263_STRING" value="34">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="RTP_PAYLOAD_JPEG_STRING" value="26">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="RTP_PAYLOAD_L16_MONO_STRING" value="11">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="RTP_PAYLOAD_L16_STEREO_STRING" value="10">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="RTP_PAYLOAD_LPC_STRING" value="7">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="RTP_PAYLOAD_MP2T_STRING" value="33">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="RTP_PAYLOAD_MPA_STRING" value="14">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="RTP_PAYLOAD_MPV_STRING" value="32">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="RTP_PAYLOAD_NV_STRING" value="28">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="RTP_PAYLOAD_PCMA_STRING" value="8">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="RTP_PAYLOAD_PCMU_STRING" value="0">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="RTP_PAYLOAD_QCELP_STRING" value="12">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="RTP_PAYLOAD_TS41" value="19">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RTP_PAYLOAD_TS41_STRING" value="19">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="RTP_PAYLOAD_TS48" value="18">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="RTP_PAYLOAD_TS48_STRING" value="18">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="RTP_VERSION" value="2">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <function name="rtcp_buffer_add_packet"
+              c:identifier="gst_rtcp_buffer_add_packet">
+      <doc xml:whitespace="preserve">Add a new packet of @type to @buffer. @packet will point to the newly created 
+packet.
+if the max mtu is exceeded for the buffer.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">%TRUE if the packet could be created. This function returns %FALSE</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a valid RTCP buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="type" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the #GstRTCPType of the new packet</doc>
+          <type name="RTCPType" c:type="GstRTCPType"/>
+        </parameter>
+        <parameter name="packet" transfer-ownership="none">
+          <doc xml:whitespace="preserve">pointer to new packet</doc>
+          <type name="RTCPPacket" c:type="GstRTCPPacket*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtcp_buffer_end" c:identifier="gst_rtcp_buffer_end">
+      <doc xml:whitespace="preserve">Finish @buffer after being constructured. This function is usually called
+after gst_rtcp_buffer_new() and after adding the RTCP items to the new buffer. 
+The function adjusts the size of @buffer with the total length of all the
+added packets.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a buffer with an RTCP packet</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtcp_buffer_get_first_packet"
+              c:identifier="gst_rtcp_buffer_get_first_packet">
+      <doc xml:whitespace="preserve">Initialize a new #GstRTCPPacket pointer that points to the first packet in</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if the packet existed in @buffer.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a valid RTCP buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="packet" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstRTCPPacket</doc>
+          <type name="RTCPPacket" c:type="GstRTCPPacket*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtcp_buffer_get_packet_count"
+              c:identifier="gst_rtcp_buffer_get_packet_count">
+      <doc xml:whitespace="preserve">Get the number of RTCP packets in @buffer.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">the number of RTCP packets in @buffer.</doc>
+        <type name="guint" c:type="guint"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a valid RTCP buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtcp_buffer_new"
+              c:identifier="gst_rtcp_buffer_new"
+              introspectable="0">
+      <doc xml:whitespace="preserve">Create a new buffer for constructing RTCP packets. The packet will have a
+maximum size of @mtu.</doc>
+      <return-value>
+        <doc xml:whitespace="preserve">A newly allocated buffer.</doc>
+        <type name="Gst.Buffer" c:type="GstBuffer*"/>
+      </return-value>
+      <parameters>
+        <parameter name="mtu" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the maximum mtu size.</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtcp_buffer_new_copy_data"
+              c:identifier="gst_rtcp_buffer_new_copy_data"
+              introspectable="0">
+      <doc xml:whitespace="preserve">Create a new buffer and set the data to a copy of @len
+bytes of @data and the size to @len. The data will be freed when the buffer
+is freed.</doc>
+      <return-value>
+        <doc xml:whitespace="preserve">A newly allocated buffer with a copy of @data and of size @len.</doc>
+        <type name="Gst.Buffer" c:type="GstBuffer*"/>
+      </return-value>
+      <parameters>
+        <parameter name="data" transfer-ownership="none">
+          <doc xml:whitespace="preserve">data for the new buffer</doc>
+          <type name="gpointer" c:type="gpointer"/>
+        </parameter>
+        <parameter name="len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the length of data</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtcp_buffer_new_take_data"
+              c:identifier="gst_rtcp_buffer_new_take_data"
+              introspectable="0">
+      <doc xml:whitespace="preserve">Create a new buffer and set the data and size of the buffer to @data and @len
+respectively. @data will be freed when the buffer is unreffed, so this
+function transfers ownership of @data to the new buffer.</doc>
+      <return-value>
+        <doc xml:whitespace="preserve">A newly allocated buffer with @data and of size @len.</doc>
+        <type name="Gst.Buffer" c:type="GstBuffer*"/>
+      </return-value>
+      <parameters>
+        <parameter name="data" transfer-ownership="none">
+          <doc xml:whitespace="preserve">data for the new buffer</doc>
+          <type name="gpointer" c:type="gpointer"/>
+        </parameter>
+        <parameter name="len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the length of data</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtcp_buffer_validate"
+              c:identifier="gst_rtcp_buffer_validate">
+      <doc xml:whitespace="preserve">Check if the data pointed to by @buffer is a valid RTCP packet using
+gst_rtcp_buffer_validate_data().</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if @buffer is a valid RTCP packet.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer to validate</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtcp_buffer_validate_data"
+              c:identifier="gst_rtcp_buffer_validate_data">
+      <doc xml:whitespace="preserve">Check if the @data and @size point to the data of a valid RTCP (compound)
+packet. 
+Use this function to validate a packet before using the other functions in
+this module.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if the data points to a valid RTCP packet.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="data" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the data to validate</doc>
+          <type name="guint8" c:type="guint8*"/>
+        </parameter>
+        <parameter name="len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the length of @data to validate</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtcp_ntp_to_unix" c:identifier="gst_rtcp_ntp_to_unix">
+      <doc xml:whitespace="preserve">Converts an NTP time to UNIX nanoseconds. @ntptime can typically be
+the NTP time of an SR RTCP message and contains, in the upper 32 bits, the
+number of seconds since 1900 and, in the lower 32 bits, the fractional
+seconds. The resulting value will be the number of nanoseconds since 1970.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">the UNIX time for @ntptime in nanoseconds.</doc>
+        <type name="guint64" c:type="guint64"/>
+      </return-value>
+      <parameters>
+        <parameter name="ntptime" transfer-ownership="none">
+          <doc xml:whitespace="preserve">an NTP timestamp</doc>
+          <type name="guint64" c:type="guint64"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtcp_packet_fb_get_type"
+              c:identifier="gst_rtcp_packet_fb_get_type"
+              version="0.10.23">
+      <doc xml:whitespace="preserve">Get the feedback message type of the FB @packet.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">The feedback message type.</doc>
+        <type name="RTCPFBType" c:type="GstRTCPFBType"/>
+      </return-value>
+      <parameters>
+        <parameter name="packet" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a valid RTPFB or PSFB #GstRTCPPacket</doc>
+          <type name="RTCPPacket" c:type="GstRTCPPacket*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtcp_packet_get_type"
+              c:identifier="gst_rtcp_packet_get_type">
+      <doc xml:whitespace="preserve">Get the packet type of the packet pointed to by @packet.
+pointing to a valid packet.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">The packet type or GST_RTCP_TYPE_INVALID when @packet is not</doc>
+        <type name="RTCPType" c:type="GstRTCPType"/>
+      </return-value>
+      <parameters>
+        <parameter name="packet" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a valid #GstRTCPPacket</doc>
+          <type name="RTCPPacket" c:type="GstRTCPPacket*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtcp_sdes_name_to_type"
+              c:identifier="gst_rtcp_sdes_name_to_type"
+              version="0.10.26">
+      <doc xml:whitespace="preserve">Convert @name into a @GstRTCPSDESType. @name is typically a key in a
+#GstStructure containing SDES items.
+is a private sdes item.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">the #GstRTCPSDESType for @name or #GST_RTCP_SDES_PRIV when @name</doc>
+        <type name="RTCPSDESType" c:type="GstRTCPSDESType"/>
+      </return-value>
+      <parameters>
+        <parameter name="name" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a SDES name</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtcp_sdes_type_to_name"
+              c:identifier="gst_rtcp_sdes_type_to_name"
+              version="0.10.26">
+      <doc xml:whitespace="preserve">Converts @type to the string equivalent. The string is typically used as a
+key in a #GstStructure containing SDES items.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">the string equivalent of @type</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="type" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstRTCPSDESType</doc>
+          <type name="RTCPSDESType" c:type="GstRTCPSDESType"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtcp_unix_to_ntp" c:identifier="gst_rtcp_unix_to_ntp">
+      <doc xml:whitespace="preserve">Converts a UNIX timestamp in nanoseconds to an NTP time. The caller should
+pass a value with nanoseconds since 1970. The NTP time will, in the upper
+32 bits, contain the number of seconds since 1900 and, in the lower 32
+bits, the fractional seconds. The resulting value can be used as an ntptime
+for constructing SR RTCP packets.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">the NTP time for @unixtime.</doc>
+        <type name="guint64" c:type="guint64"/>
+      </return-value>
+      <parameters>
+        <parameter name="unixtime" transfer-ownership="none">
+          <doc xml:whitespace="preserve">an UNIX timestamp in nanoseconds</doc>
+          <type name="guint64" c:type="guint64"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_add_extension_onebyte_header"
+              c:identifier="gst_rtp_buffer_add_extension_onebyte_header"
+              version="0.10.31">
+      <doc xml:whitespace="preserve">Adds a RFC 5285 header extension with a one byte header to the end of the
+RTP header. If there is already a RFC 5285 header extension with a one byte
+header, the new extension will be appended.
+It will not work if there is already a header extension that does not follow
+the mecanism described in RFC 5285 or if there is a header extension with
+a two bytes header as described in RFC 5285. In that case, use
+gst_rtp_buffer_add_extension_twobytes_header()</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">%TRUE if header extension could be added</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="id" transfer-ownership="none">
+          <doc xml:whitespace="preserve">The ID of the header extension (between 1 and 14).</doc>
+          <type name="guint8" c:type="guint8"/>
+        </parameter>
+        <parameter name="data" transfer-ownership="none">
+          <doc xml:whitespace="preserve">location for data</doc>
+          <type name="gpointer" c:type="gpointer"/>
+        </parameter>
+        <parameter name="size" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the size of the data in bytes</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_add_extension_twobytes_header"
+              c:identifier="gst_rtp_buffer_add_extension_twobytes_header"
+              version="0.10.31">
+      <doc xml:whitespace="preserve">Adds a RFC 5285 header extension with a two bytes header to the end of the
+RTP header. If there is already a RFC 5285 header extension with a two bytes
+header, the new extension will be appended.
+It will not work if there is already a header extension that does not follow
+the mecanism described in RFC 5285 or if there is a header extension with
+a one byte header as described in RFC 5285. In that case, use
+gst_rtp_buffer_add_extension_onebyte_header()</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">%TRUE if header extension could be added</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="appbits" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Application specific bits</doc>
+          <type name="guint8" c:type="guint8"/>
+        </parameter>
+        <parameter name="id" transfer-ownership="none">
+          <doc xml:whitespace="preserve">The ID of the header extension</doc>
+          <type name="guint8" c:type="guint8"/>
+        </parameter>
+        <parameter name="data" transfer-ownership="none">
+          <doc xml:whitespace="preserve">location for data</doc>
+          <type name="gpointer" c:type="gpointer"/>
+        </parameter>
+        <parameter name="size" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the size of the data in bytes</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_allocate_data"
+              c:identifier="gst_rtp_buffer_allocate_data">
+      <doc xml:whitespace="preserve">Allocate enough data in @buffer to hold an RTP packet with @csrc_count CSRCs,
+a payload length of @payload_len and padding of @pad_len.
+MALLOCDATA of @buffer will be overwritten and will not be freed. 
+All other RTP header fields will be set to 0/FALSE.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstBuffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="payload_len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the length of the payload</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+        <parameter name="pad_len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the amount of padding</doc>
+          <type name="guint8" c:type="guint8"/>
+        </parameter>
+        <parameter name="csrc_count" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the number of CSRC entries</doc>
+          <type name="guint8" c:type="guint8"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_calc_header_len"
+              c:identifier="gst_rtp_buffer_calc_header_len">
+      <doc xml:whitespace="preserve">Calculate the header length of an RTP packet with @csrc_count CSRC entries.
+An RTP packet can have at most 15 CSRC entries.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">The length of an RTP header with @csrc_count CSRC entries.</doc>
+        <type name="guint" c:type="guint"/>
+      </return-value>
+      <parameters>
+        <parameter name="csrc_count" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the number of CSRC entries</doc>
+          <type name="guint8" c:type="guint8"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_calc_packet_len"
+              c:identifier="gst_rtp_buffer_calc_packet_len">
+      <doc xml:whitespace="preserve">Calculate the total length of an RTP packet with a payload size of @payload_len,
+a padding of @pad_len and a @csrc_count CSRC entries.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">The total length of an RTP header with given parameters.</doc>
+        <type name="guint" c:type="guint"/>
+      </return-value>
+      <parameters>
+        <parameter name="payload_len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the length of the payload</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+        <parameter name="pad_len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the amount of padding</doc>
+          <type name="guint8" c:type="guint8"/>
+        </parameter>
+        <parameter name="csrc_count" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the number of CSRC entries</doc>
+          <type name="guint8" c:type="guint8"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_calc_payload_len"
+              c:identifier="gst_rtp_buffer_calc_payload_len">
+      <doc xml:whitespace="preserve">Calculate the length of the payload of an RTP packet with size @packet_len,
+a padding of @pad_len and a @csrc_count CSRC entries.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">The length of the payload of an RTP packet  with given parameters.</doc>
+        <type name="guint" c:type="guint"/>
+      </return-value>
+      <parameters>
+        <parameter name="packet_len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the length of the total RTP packet</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+        <parameter name="pad_len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the amount of padding</doc>
+          <type name="guint8" c:type="guint8"/>
+        </parameter>
+        <parameter name="csrc_count" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the number of CSRC entries</doc>
+          <type name="guint8" c:type="guint8"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_compare_seqnum"
+              c:identifier="gst_rtp_buffer_compare_seqnum"
+              version="0.10.15">
+      <doc xml:whitespace="preserve">Compare two sequence numbers, taking care of wraparounds. This function
+returns the difference between @seqnum1 and @seqnum2.
+are equal or a positive value if @seqnum1 is smaller than @segnum2.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">a negative value if @seqnum1 is bigger than @seqnum2, 0 if they</doc>
+        <type name="gint" c:type="gint"/>
+      </return-value>
+      <parameters>
+        <parameter name="seqnum1" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a sequence number</doc>
+          <type name="guint16" c:type="guint16"/>
+        </parameter>
+        <parameter name="seqnum2" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a sequence number</doc>
+          <type name="guint16" c:type="guint16"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_default_clock_rate"
+              c:identifier="gst_rtp_buffer_default_clock_rate"
+              version="0.10.13">
+      <doc xml:whitespace="preserve">Get the default clock-rate for the static payload type @payload_type.
+the clock-rate is undefined.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">the default clock rate or -1 if the payload type is not static or</doc>
+        <type name="guint32" c:type="guint32"/>
+      </return-value>
+      <parameters>
+        <parameter name="payload_type" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the static payload type</doc>
+          <type name="guint8" c:type="guint8"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_ext_timestamp"
+              c:identifier="gst_rtp_buffer_ext_timestamp"
+              version="0.10.15">
+      <doc xml:whitespace="preserve">Update the @exttimestamp field with @timestamp. For the first call of the
+method, @exttimestamp should point to a location with a value of -1.
+This function makes sure that the returned value is a constantly increasing
+value even in the case where there is a timestamp wraparound.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">The extended timestamp of @timestamp.</doc>
+        <type name="guint64" c:type="guint64"/>
+      </return-value>
+      <parameters>
+        <parameter name="exttimestamp" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a previous extended timestamp</doc>
+          <type name="guint64" c:type="guint64*"/>
+        </parameter>
+        <parameter name="timestamp" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a new timestamp</doc>
+          <type name="guint32" c:type="guint32"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_get_csrc"
+              c:identifier="gst_rtp_buffer_get_csrc">
+      <doc xml:whitespace="preserve">Get the CSRC at index @idx in @buffer.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">the CSRC at index @idx in host order.</doc>
+        <type name="guint32" c:type="guint32"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="idx" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the index of the CSRC to get</doc>
+          <type name="guint8" c:type="guint8"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_get_csrc_count"
+              c:identifier="gst_rtp_buffer_get_csrc_count">
+      <doc xml:whitespace="preserve">Get the CSRC count of the RTP packet in @buffer.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">the CSRC count of @buffer.</doc>
+        <type name="guint8" c:type="guint8"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_get_extension"
+              c:identifier="gst_rtp_buffer_get_extension">
+      <doc xml:whitespace="preserve">Check if the extension bit is set on the RTP packet in @buffer.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if @buffer has the extension bit set.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_get_extension_data"
+              c:identifier="gst_rtp_buffer_get_extension_data"
+              version="0.10.15">
+      <doc xml:whitespace="preserve">Get the extension data. @bits will contain the extension 16 bits of custom
+data. @data will point to the data in the extension and @wordlen will contain
+the length of @data in 32 bits words.
+If @buffer did not contain an extension, this function will return %FALSE
+with @bits, @data and @wordlen unchanged.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if @buffer had the extension bit set.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="bits" transfer-ownership="none">
+          <doc xml:whitespace="preserve">location for result bits</doc>
+          <type name="guint16" c:type="guint16*"/>
+        </parameter>
+        <parameter name="data" transfer-ownership="none">
+          <doc xml:whitespace="preserve">location for data</doc>
+          <type name="gpointer" c:type="gpointer*"/>
+        </parameter>
+        <parameter name="wordlen" transfer-ownership="none">
+          <doc xml:whitespace="preserve">location for length of @data in 32 bits words</doc>
+          <type name="guint" c:type="guint*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_get_extension_onebyte_header"
+              c:identifier="gst_rtp_buffer_get_extension_onebyte_header"
+              version="0.10.31">
+      <doc xml:whitespace="preserve">Parses RFC 5285 style header extensions with a one byte header. It will
+return the nth extension with the requested id.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if @buffer had the requested header extension</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="id" transfer-ownership="none">
+          <doc xml:whitespace="preserve">The ID of the header extension to be read (between 1 and 14).</doc>
+          <type name="guint8" c:type="guint8"/>
+        </parameter>
+        <parameter name="nth" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Read the nth extension packet with the requested ID</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+        <parameter name="data" transfer-ownership="none">
+          <doc xml:whitespace="preserve">location for data</doc>
+          <type name="gpointer" c:type="gpointer*"/>
+        </parameter>
+        <parameter name="size" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the size of the data in bytes</doc>
+          <type name="guint" c:type="guint*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_get_extension_twobytes_header"
+              c:identifier="gst_rtp_buffer_get_extension_twobytes_header"
+              version="0.10.31">
+      <doc xml:whitespace="preserve">Parses RFC 5285 style header extensions with a two bytes header. It will
+return the nth extension with the requested id.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if @buffer had the requested header extension</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="appbits" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Application specific bits</doc>
+          <type name="guint8" c:type="guint8*"/>
+        </parameter>
+        <parameter name="id" transfer-ownership="none">
+          <doc xml:whitespace="preserve">The ID of the header extension to be read (between 1 and 14).</doc>
+          <type name="guint8" c:type="guint8"/>
+        </parameter>
+        <parameter name="nth" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Read the nth extension packet with the requested ID</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+        <parameter name="data" transfer-ownership="none">
+          <doc xml:whitespace="preserve">location for data</doc>
+          <type name="gpointer" c:type="gpointer*"/>
+        </parameter>
+        <parameter name="size" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the size of the data in bytes</doc>
+          <type name="guint" c:type="guint*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_get_header_len"
+              c:identifier="gst_rtp_buffer_get_header_len">
+      <doc xml:whitespace="preserve">Return the total length of the header in @buffer. This include the length of
+the fixed header, the CSRC list and the extension header.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">The total length of the header in @buffer.</doc>
+        <type name="guint" c:type="guint"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_get_marker"
+              c:identifier="gst_rtp_buffer_get_marker">
+      <doc xml:whitespace="preserve">Check if the marker bit is set on the RTP packet in @buffer.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if @buffer has the marker bit set.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_get_packet_len"
+              c:identifier="gst_rtp_buffer_get_packet_len">
+      <doc xml:whitespace="preserve">Return the total length of the packet in @buffer.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">The total length of the packet in @buffer.</doc>
+        <type name="guint" c:type="guint"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_get_padding"
+              c:identifier="gst_rtp_buffer_get_padding">
+      <doc xml:whitespace="preserve">Check if the padding bit is set on the RTP packet in @buffer.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if @buffer has the padding bit set.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_get_payload"
+              c:identifier="gst_rtp_buffer_get_payload"
+              introspectable="0">
+      <doc xml:whitespace="preserve">Get a pointer to the payload data in @buffer. This pointer is valid as long
+as a reference to @buffer is held.</doc>
+      <return-value>
+        <doc xml:whitespace="preserve">A pointer to the payload data in @buffer.</doc>
+        <type name="gpointer" c:type="gpointer"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_get_payload_buffer"
+              c:identifier="gst_rtp_buffer_get_payload_buffer"
+              introspectable="0">
+      <doc xml:whitespace="preserve">Create a buffer of the payload of the RTP packet in @buffer. This function
+will internally create a subbuffer of @buffer so that a memcpy can be
+avoided.</doc>
+      <return-value>
+        <doc xml:whitespace="preserve">A new buffer with the data of the payload.</doc>
+        <type name="Gst.Buffer" c:type="GstBuffer*"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_get_payload_len"
+              c:identifier="gst_rtp_buffer_get_payload_len">
+      <doc xml:whitespace="preserve">Get the length of the payload of the RTP packet in @buffer.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">The length of the payload in @buffer.</doc>
+        <type name="guint" c:type="guint"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_get_payload_subbuffer"
+              c:identifier="gst_rtp_buffer_get_payload_subbuffer"
+              version="0.10.10"
+              introspectable="0">
+      <doc xml:whitespace="preserve">Create a subbuffer of the payload of the RTP packet in @buffer. @offset bytes
+are skipped in the payload and the subbuffer will be of size @len.
+If @len is -1 the total payload starting from @offset if subbuffered.</doc>
+      <return-value>
+        <doc xml:whitespace="preserve">A new buffer with the specified data of the payload.</doc>
+        <type name="Gst.Buffer" c:type="GstBuffer*"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="offset" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the offset in the payload</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+        <parameter name="len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the length in the payload</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_get_payload_type"
+              c:identifier="gst_rtp_buffer_get_payload_type">
+      <doc xml:whitespace="preserve">Get the payload type of the RTP packet in @buffer.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">The payload type.</doc>
+        <type name="guint8" c:type="guint8"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_get_seq" c:identifier="gst_rtp_buffer_get_seq">
+      <doc xml:whitespace="preserve">Get the sequence number of the RTP packet in @buffer.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">The sequence number in host order.</doc>
+        <type name="guint16" c:type="guint16"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_get_ssrc"
+              c:identifier="gst_rtp_buffer_get_ssrc">
+      <doc xml:whitespace="preserve">Get the SSRC of the RTP packet in @buffer.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">the SSRC of @buffer in host order.</doc>
+        <type name="guint32" c:type="guint32"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_get_timestamp"
+              c:identifier="gst_rtp_buffer_get_timestamp">
+      <doc xml:whitespace="preserve">Get the timestamp of the RTP packet in @buffer.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">The timestamp in host order.</doc>
+        <type name="guint32" c:type="guint32"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_get_version"
+              c:identifier="gst_rtp_buffer_get_version">
+      <doc xml:whitespace="preserve">Get the version number of the RTP packet in @buffer.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">The version of @buffer.</doc>
+        <type name="guint8" c:type="guint8"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_list_add_extension_onebyte_header"
+              c:identifier="gst_rtp_buffer_list_add_extension_onebyte_header"
+              version="0.10.31">
+      <doc xml:whitespace="preserve">Adds a RFC 5285 header extension with a one byte header to the end of the
+RTP header. If there is already a RFC 5285 header extension with a one byte
+header, the new extension will be appended.
+It will not work if there is already a header extension that does not follow
+the mecanism described in RFC 5285 or if there is a header extension with
+a two bytes header as described in RFC 5285. In that case, use
+gst_rtp_buffer_list_add_extension_twobytes_header()
+This function will not modify the data section of the RTP buffer, only
+the header.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">%TRUE if header extension could be added</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="it" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstBufferListIterator pointing right after the #GstBuffer where the header extension should be added</doc>
+          <type name="Gst.BufferListIterator" c:type="GstBufferListIterator*"/>
+        </parameter>
+        <parameter name="id" transfer-ownership="none">
+          <doc xml:whitespace="preserve">The ID of the header extension (between 1 and 14).</doc>
+          <type name="guint8" c:type="guint8"/>
+        </parameter>
+        <parameter name="data" transfer-ownership="none">
+          <doc xml:whitespace="preserve">location for data</doc>
+          <type name="gpointer" c:type="gpointer"/>
+        </parameter>
+        <parameter name="size" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the size of the data in bytes</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_list_add_extension_twobytes_header"
+              c:identifier="gst_rtp_buffer_list_add_extension_twobytes_header"
+              version="0.10.31">
+      <doc xml:whitespace="preserve">Adds a RFC 5285 header extension with a two bytes header to the end of the
+RTP header. If there is already a RFC 5285 header extension with a two bytes
+header, the new extension will be appended.
+It will not work if there is already a header extension that does not follow
+the mecanism described in RFC 5285 or if there is a header extension with
+a one byte header as described in RFC 5285. In that case, use
+gst_rtp_buffer_add_extension_onebyte_header()
+This function will not modify the data section of the RTP buffer, only
+the header.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">%TRUE if header extension could be added</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="it" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstBufferListIterator pointing right after the #GstBuffer where the header extension should be added</doc>
+          <type name="Gst.BufferListIterator" c:type="GstBufferListIterator*"/>
+        </parameter>
+        <parameter name="appbits" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Application specific bits</doc>
+          <type name="guint8" c:type="guint8"/>
+        </parameter>
+        <parameter name="id" transfer-ownership="none">
+          <doc xml:whitespace="preserve">The ID of the header extension</doc>
+          <type name="guint8" c:type="guint8"/>
+        </parameter>
+        <parameter name="data" transfer-ownership="none">
+          <doc xml:whitespace="preserve">location for data</doc>
+          <type name="gpointer" c:type="gpointer"/>
+        </parameter>
+        <parameter name="size" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the size of the data in bytes</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_list_from_buffer"
+              c:identifier="gst_rtp_buffer_list_from_buffer"
+              introspectable="0">
+      <doc xml:whitespace="preserve">Splits a #GstBuffer into a #GstBufferList containing separate
+buffers for the header and data sections.</doc>
+      <return-value>
+        <doc xml:whitespace="preserve">a #GstBufferList</doc>
+        <type name="Gst.BufferList" c:type="GstBufferList*"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstBuffer containing a RTP packet</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_list_get_extension_onebyte_header"
+              c:identifier="gst_rtp_buffer_list_get_extension_onebyte_header"
+              version="0.10.31">
+      <doc xml:whitespace="preserve">Parses RFC 5285 style header extensions with a one byte header. It will
+return the nth extension with the requested id.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if @buffer had the requested header extension</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="bufferlist" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the bufferlist</doc>
+          <type name="Gst.BufferList" c:type="GstBufferList*"/>
+        </parameter>
+        <parameter name="group_idx" transfer-ownership="none">
+          <doc xml:whitespace="preserve">The index of the group in the #GstBufferList</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+        <parameter name="id" transfer-ownership="none">
+          <doc xml:whitespace="preserve">The ID of the header extension to be read (between 1 and 14).</doc>
+          <type name="guint8" c:type="guint8"/>
+        </parameter>
+        <parameter name="nth" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Read the nth extension packet with the requested ID</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+        <parameter name="data" transfer-ownership="none">
+          <doc xml:whitespace="preserve">location for data</doc>
+          <type name="gpointer" c:type="gpointer*"/>
+        </parameter>
+        <parameter name="size" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the size of the data in bytes</doc>
+          <type name="guint" c:type="guint*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_list_get_extension_twobytes_header"
+              c:identifier="gst_rtp_buffer_list_get_extension_twobytes_header"
+              version="0.10.31">
+      <doc xml:whitespace="preserve">Parses RFC 5285 style header extensions with a two bytes header. It will
+return the nth extension with the requested id.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if @buffer had the requested header extension</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="bufferlist" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the bufferlist</doc>
+          <type name="Gst.BufferList" c:type="GstBufferList*"/>
+        </parameter>
+        <parameter name="group_idx" transfer-ownership="none">
+          <doc xml:whitespace="preserve">The index of the group in the #GstBufferList</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+        <parameter name="appbits" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Application specific bits</doc>
+          <type name="guint8" c:type="guint8*"/>
+        </parameter>
+        <parameter name="id" transfer-ownership="none">
+          <doc xml:whitespace="preserve">The ID of the header extension to be read (between 1 and 14).</doc>
+          <type name="guint8" c:type="guint8"/>
+        </parameter>
+        <parameter name="nth" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Read the nth extension packet with the requested ID</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+        <parameter name="data" transfer-ownership="none">
+          <doc xml:whitespace="preserve">location for data</doc>
+          <type name="gpointer" c:type="gpointer*"/>
+        </parameter>
+        <parameter name="size" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the size of the data in bytes</doc>
+          <type name="guint" c:type="guint*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_list_get_payload_len"
+              c:identifier="gst_rtp_buffer_list_get_payload_len"
+              version="0.10.24">
+      <doc xml:whitespace="preserve">Get the length of the payload of the RTP packet in @list.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">The length of the payload in @list.</doc>
+        <type name="guint" c:type="guint"/>
+      </return-value>
+      <parameters>
+        <parameter name="list" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer list</doc>
+          <type name="Gst.BufferList" c:type="GstBufferList*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_list_get_payload_type"
+              c:identifier="gst_rtp_buffer_list_get_payload_type"
+              version="0.10.24">
+      <doc xml:whitespace="preserve">Get the payload type of the first RTP packet in @list.
+All packets in @list should have the same payload type.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">The payload type.</doc>
+        <type name="guint8" c:type="guint8"/>
+      </return-value>
+      <parameters>
+        <parameter name="list" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer list</doc>
+          <type name="Gst.BufferList" c:type="GstBufferList*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_list_get_seq"
+              c:identifier="gst_rtp_buffer_list_get_seq"
+              version="0.10.24">
+      <doc xml:whitespace="preserve">Get the sequence number of the first RTP packet in @list.
+All packets within @list have the same sequence number.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">The seq number</doc>
+        <type name="guint16" c:type="guint16"/>
+      </return-value>
+      <parameters>
+        <parameter name="list" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer list</doc>
+          <type name="Gst.BufferList" c:type="GstBufferList*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_list_get_ssrc"
+              c:identifier="gst_rtp_buffer_list_get_ssrc"
+              version="0.10.24">
+      <doc xml:whitespace="preserve">Get the SSRC of the first RTP packet in @list.
+All RTP packets within @list have the same SSRC.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">the SSRC of @list in host order.</doc>
+        <type name="guint32" c:type="guint32"/>
+      </return-value>
+      <parameters>
+        <parameter name="list" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer list</doc>
+          <type name="Gst.BufferList" c:type="GstBufferList*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_list_get_timestamp"
+              c:identifier="gst_rtp_buffer_list_get_timestamp"
+              version="0.10.24">
+      <doc xml:whitespace="preserve">Get the timestamp of the first RTP packet in @list.
+All packets within @list have the same timestamp.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">The timestamp in host order.</doc>
+        <type name="guint32" c:type="guint32"/>
+      </return-value>
+      <parameters>
+        <parameter name="list" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer list</doc>
+          <type name="Gst.BufferList" c:type="GstBufferList*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_list_set_payload_type"
+              c:identifier="gst_rtp_buffer_list_set_payload_type"
+              version="0.10.24">
+      <doc xml:whitespace="preserve">Set the payload type of each RTP packet in @list to @payload_type.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="list" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer list</doc>
+          <type name="Gst.BufferList" c:type="GstBufferList*"/>
+        </parameter>
+        <parameter name="payload_type" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the new type</doc>
+          <type name="guint8" c:type="guint8"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_list_set_seq"
+              c:identifier="gst_rtp_buffer_list_set_seq"
+              version="0.10.24">
+      <doc xml:whitespace="preserve">Set the sequence number of each RTP packet in @list to @seq.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">The seq number of the last packet in the list + 1.</doc>
+        <type name="guint16" c:type="guint16"/>
+      </return-value>
+      <parameters>
+        <parameter name="list" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer list</doc>
+          <type name="Gst.BufferList" c:type="GstBufferList*"/>
+        </parameter>
+        <parameter name="seq" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the new sequence number</doc>
+          <type name="guint16" c:type="guint16"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_list_set_ssrc"
+              c:identifier="gst_rtp_buffer_list_set_ssrc"
+              version="0.10.24">
+      <doc xml:whitespace="preserve">Set the SSRC on each RTP packet in @list to @ssrc.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="list" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer list</doc>
+          <type name="Gst.BufferList" c:type="GstBufferList*"/>
+        </parameter>
+        <parameter name="ssrc" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the new SSRC</doc>
+          <type name="guint32" c:type="guint32"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_list_set_timestamp"
+              c:identifier="gst_rtp_buffer_list_set_timestamp"
+              version="0.10.24">
+      <doc xml:whitespace="preserve">Set the timestamp of each RTP packet in @list to @timestamp.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="list" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer list</doc>
+          <type name="Gst.BufferList" c:type="GstBufferList*"/>
+        </parameter>
+        <parameter name="timestamp" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the new timestamp</doc>
+          <type name="guint32" c:type="guint32"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_list_validate"
+              c:identifier="gst_rtp_buffer_list_validate"
+              version="0.10.24">
+      <doc xml:whitespace="preserve">Check if all RTP packets in the @list are valid using validate_data().
+Use this function to validate an list before using the other functions in
+this module.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if @list consists only of valid RTP packets.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="list" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer list to validate</doc>
+          <type name="Gst.BufferList" c:type="GstBufferList*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_new_allocate"
+              c:identifier="gst_rtp_buffer_new_allocate"
+              introspectable="0">
+      <doc xml:whitespace="preserve">Allocate a new #GstBuffer with enough data to hold an RTP packet with
+All other RTP header fields will be set to 0/FALSE.
+parameters.</doc>
+      <return-value>
+        <doc xml:whitespace="preserve">A newly allocated buffer that can hold an RTP packet with given</doc>
+        <type name="Gst.Buffer" c:type="GstBuffer*"/>
+      </return-value>
+      <parameters>
+        <parameter name="payload_len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the length of the payload</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+        <parameter name="pad_len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the amount of padding</doc>
+          <type name="guint8" c:type="guint8"/>
+        </parameter>
+        <parameter name="csrc_count" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the number of CSRC entries</doc>
+          <type name="guint8" c:type="guint8"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_new_allocate_len"
+              c:identifier="gst_rtp_buffer_new_allocate_len"
+              introspectable="0">
+      <doc xml:whitespace="preserve">Create a new #GstBuffer that can hold an RTP packet that is exactly
+All RTP header fields will be set to 0/FALSE.</doc>
+      <return-value>
+        <doc xml:whitespace="preserve">A newly allocated buffer that can hold an RTP packet of @packet_len.</doc>
+        <type name="Gst.Buffer" c:type="GstBuffer*"/>
+      </return-value>
+      <parameters>
+        <parameter name="packet_len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the total length of the packet</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+        <parameter name="pad_len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the amount of padding</doc>
+          <type name="guint8" c:type="guint8"/>
+        </parameter>
+        <parameter name="csrc_count" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the number of CSRC entries</doc>
+          <type name="guint8" c:type="guint8"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_new_copy_data"
+              c:identifier="gst_rtp_buffer_new_copy_data"
+              introspectable="0">
+      <doc xml:whitespace="preserve">Create a new buffer and set the data to a copy of @len
+bytes of @data and the size to @len. The data will be freed when the buffer
+is freed.</doc>
+      <return-value>
+        <doc xml:whitespace="preserve">A newly allocated buffer with a copy of @data and of size @len.</doc>
+        <type name="Gst.Buffer" c:type="GstBuffer*"/>
+      </return-value>
+      <parameters>
+        <parameter name="data" transfer-ownership="none">
+          <doc xml:whitespace="preserve">data for the new buffer</doc>
+          <type name="gpointer" c:type="gpointer"/>
+        </parameter>
+        <parameter name="len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the length of data</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_new_take_data"
+              c:identifier="gst_rtp_buffer_new_take_data"
+              introspectable="0">
+      <doc xml:whitespace="preserve">Create a new buffer and set the data and size of the buffer to @data and @len
+respectively. @data will be freed when the buffer is unreffed, so this
+function transfers ownership of @data to the new buffer.</doc>
+      <return-value>
+        <doc xml:whitespace="preserve">A newly allocated buffer with @data and of size @len.</doc>
+        <type name="Gst.Buffer" c:type="GstBuffer*"/>
+      </return-value>
+      <parameters>
+        <parameter name="data" transfer-ownership="none">
+          <doc xml:whitespace="preserve">data for the new buffer</doc>
+          <type name="gpointer" c:type="gpointer"/>
+        </parameter>
+        <parameter name="len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the length of data</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_pad_to" c:identifier="gst_rtp_buffer_pad_to">
+      <doc xml:whitespace="preserve">Set the amount of padding in the RTP packet in @buffer to</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the new amount of padding</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_set_csrc"
+              c:identifier="gst_rtp_buffer_set_csrc">
+      <doc xml:whitespace="preserve">Modify the CSRC at index @idx in @buffer to @csrc.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="idx" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the CSRC index to set</doc>
+          <type name="guint8" c:type="guint8"/>
+        </parameter>
+        <parameter name="csrc" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the CSRC in host order to set at @idx</doc>
+          <type name="guint32" c:type="guint32"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_set_extension"
+              c:identifier="gst_rtp_buffer_set_extension">
+      <doc xml:whitespace="preserve">Set the extension bit on the RTP packet in @buffer to @extension.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="extension" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the new extension</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_set_extension_data"
+              c:identifier="gst_rtp_buffer_set_extension_data"
+              version="0.10.18">
+      <doc xml:whitespace="preserve">Set the extension bit of the rtp buffer and fill in the @bits and @length of the
+extension header. It will refuse to set the extension data if the buffer is not
+large enough.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">True if done.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="bits" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the bits specific for the extension</doc>
+          <type name="guint16" c:type="guint16"/>
+        </parameter>
+        <parameter name="length" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the length that counts the number of 32-bit words in the extension, excluding the extension header ( therefore zero is a valid length)</doc>
+          <type name="guint16" c:type="guint16"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_set_marker"
+              c:identifier="gst_rtp_buffer_set_marker">
+      <doc xml:whitespace="preserve">Set the marker bit on the RTP packet in @buffer to @marker.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="marker" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the new marker</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_set_packet_len"
+              c:identifier="gst_rtp_buffer_set_packet_len">
+      <doc xml:whitespace="preserve">Set the total @buffer size to @len. The data in the buffer will be made
+larger if needed. Any padding will be removed from the packet.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the new packet length</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_set_padding"
+              c:identifier="gst_rtp_buffer_set_padding">
+      <doc xml:whitespace="preserve">Set the padding bit on the RTP packet in @buffer to @padding.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="padding" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the new padding</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_set_payload_type"
+              c:identifier="gst_rtp_buffer_set_payload_type">
+      <doc xml:whitespace="preserve">Set the payload type of the RTP packet in @buffer to @payload_type.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="payload_type" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the new type</doc>
+          <type name="guint8" c:type="guint8"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_set_seq" c:identifier="gst_rtp_buffer_set_seq">
+      <doc xml:whitespace="preserve">Set the sequence number of the RTP packet in @buffer to @seq.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="seq" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the new sequence number</doc>
+          <type name="guint16" c:type="guint16"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_set_ssrc"
+              c:identifier="gst_rtp_buffer_set_ssrc">
+      <doc xml:whitespace="preserve">Set the SSRC on the RTP packet in @buffer to @ssrc.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="ssrc" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the new SSRC</doc>
+          <type name="guint32" c:type="guint32"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_set_timestamp"
+              c:identifier="gst_rtp_buffer_set_timestamp">
+      <doc xml:whitespace="preserve">Set the timestamp of the RTP packet in @buffer to @timestamp.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="timestamp" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the new timestamp</doc>
+          <type name="guint32" c:type="guint32"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_set_version"
+              c:identifier="gst_rtp_buffer_set_version">
+      <doc xml:whitespace="preserve">Set the version of the RTP packet in @buffer to @version.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="version" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the new version</doc>
+          <type name="guint8" c:type="guint8"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_validate"
+              c:identifier="gst_rtp_buffer_validate">
+      <doc xml:whitespace="preserve">Check if the data pointed to by @buffer is a valid RTP packet using
+validate_data().
+Use this function to validate a packet before using the other functions in
+this module.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if @buffer is a valid RTP packet.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the buffer to validate</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_buffer_validate_data"
+              c:identifier="gst_rtp_buffer_validate_data">
+      <doc xml:whitespace="preserve">Check if the @data and @size point to the data of a valid RTP packet.
+This function checks the length, version and padding of the packet data.
+Use this function to validate a packet before using the other functions in
+this module.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if the data points to a valid RTP packet.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="data" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the data to validate</doc>
+          <type name="guint8" c:type="guint8*"/>
+        </parameter>
+        <parameter name="len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the length of @data to validate</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_payload_info_for_name"
+              c:identifier="gst_rtp_payload_info_for_name">
+      <doc xml:whitespace="preserve">Get the #GstRTPPayloadInfo for @media and @encoding_name. This function is
+mostly used to get the default clock-rate and bandwidth for dynamic payload
+types specified with @media and @encoding name.
+The search for @encoding_name will be performed in a case insensitve way.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">a #GstRTPPayloadInfo or NULL when no info could be found.</doc>
+        <type name="RTPPayloadInfo" c:type="GstRTPPayloadInfo*"/>
+      </return-value>
+      <parameters>
+        <parameter name="media" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the media to find</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+        <parameter name="encoding_name" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the encoding name to find</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtp_payload_info_for_pt"
+              c:identifier="gst_rtp_payload_info_for_pt">
+      <doc xml:whitespace="preserve">Get the #GstRTPPayloadInfo for @payload_type. This function is
+mostly used to get the default clock-rate and bandwidth for static payload
+types specified with @payload_type.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">a #GstRTPPayloadInfo or NULL when no info could be found.</doc>
+        <type name="RTPPayloadInfo" c:type="GstRTPPayloadInfo*"/>
+      </return-value>
+      <parameters>
+        <parameter name="payload_type" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the payload_type to find</doc>
+          <type name="guint8" c:type="guint8"/>
+        </parameter>
+      </parameters>
+    </function>
+  </namespace>
+</repository>
diff --git a/gstreamer/plugins/rtp/ffi/ffi.factor b/gstreamer/plugins/rtp/ffi/ffi.factor
new file mode 100644 (file)
index 0000000..28f8605
--- /dev/null
@@ -0,0 +1,16 @@
+! Copyright (C) 2010 Anton Gorenko.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.libraries combinators kernel system
+gobject-introspection glib.ffi gstreamer.base.ffi gstreamer.ffi ;
+IN: gstreamer.rtp.ffi
+
+<<
+"gstreamer.rtp" {
+    { [ os winnt? ] [ drop ] }
+    { [ os macosx? ] [ drop ] }
+    { [ os unix? ] [ "libgstrtp-0.10.so" cdecl add-library ] }
+} cond
+>>
+
+GIR: vocab:gstreamer/rtp/GstRtp-0.10.gir
+
diff --git a/gstreamer/plugins/rtp/rtp.factor b/gstreamer/plugins/rtp/rtp.factor
new file mode 100644 (file)
index 0000000..7e928c1
--- /dev/null
@@ -0,0 +1,5 @@
+! Copyright (C) 2010 Anton Gorenko.
+! See http://factorcode.org/license.txt for BSD license.
+USING: gstreamer.rtp.ffi ;
+IN: gstreamer.rtp
+
diff --git a/gstreamer/plugins/rtsp/GstRtsp-0.10.gir b/gstreamer/plugins/rtsp/GstRtsp-0.10.gir
new file mode 100644 (file)
index 0000000..51ddff4
--- /dev/null
@@ -0,0 +1,3004 @@
+<?xml version="1.0"?>
+<!-- This file was automatically generated from C sources - DO NOT EDIT!
+To affect the contents of this file, edit the original C definitions,
+and/or use gtk-doc annotations.  -->
+<repository version="1.2"
+            xmlns="http://www.gtk.org/introspection/core/1.0"
+            xmlns:c="http://www.gtk.org/introspection/c/1.0"
+            xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+  <include name="GLib" version="2.0"/>
+  <include name="GModule" version="2.0"/>
+  <include name="GObject" version="2.0"/>
+  <include name="Gst" version="0.10"/>
+  <include name="GstSdp" version="0.10"/>
+  <include name="libxml2" version="2.0"/>
+  <package name="gstreamer-rtsp-0.10"/>
+  <c:include name="gst/audio/gstrtsp-enumtypes.h"/>
+  <c:include name="gst/audio/gstrtspbase64.h"/>
+  <c:include name="gst/audio/gstrtspconnection.h"/>
+  <c:include name="gst/audio/gstrtspdefs.h"/>
+  <c:include name="gst/audio/gstrtspextension.h"/>
+  <c:include name="gst/audio/gstrtspmessage.h"/>
+  <c:include name="gst/audio/gstrtsprange.h"/>
+  <c:include name="gst/audio/gstrtsptransport.h"/>
+  <c:include name="gst/audio/gstrtspurl.h"/>
+  <namespace name="GstRtsp"
+             version="0.10"
+             shared-library="libgstrtsp-0.10.so.0"
+             c:identifier-prefixes="Gst"
+             c:symbol-prefixes="gst">
+    <enumeration name="RTSPAuthMethod"
+                 glib:type-name="GstRTSPAuthMethod"
+                 glib:get-type="gst_rtsp_auth_method_get_type"
+                 c:type="GstRTSPAuthMethod">
+      <doc xml:whitespace="preserve">Authentication methods, ordered by strength</doc>
+      <member name="none"
+              value="0"
+              c:identifier="GST_RTSP_AUTH_NONE"
+              glib:nick="none"/>
+      <member name="basic"
+              value="1"
+              c:identifier="GST_RTSP_AUTH_BASIC"
+              glib:nick="basic"/>
+      <member name="digest"
+              value="2"
+              c:identifier="GST_RTSP_AUTH_DIGEST"
+              glib:nick="digest"/>
+    </enumeration>
+    <record name="RTSPConnection" c:type="GstRTSPConnection" disguised="1">
+      <doc xml:whitespace="preserve">Opaque RTSP connection object.</doc>
+      <method name="clear_auth_params"
+              c:identifier="gst_rtsp_connection_clear_auth_params"
+              version="0.10.20">
+        <doc xml:whitespace="preserve">Clear the list of authentication directives stored in @conn.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+      </method>
+      <method name="close" c:identifier="gst_rtsp_connection_close">
+        <doc xml:whitespace="preserve">Close the connected @conn. After this call, the connection is in the same
+state as when it was first created.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_RTSP_OK on success.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+      </method>
+      <method name="connect" c:identifier="gst_rtsp_connection_connect">
+        <doc xml:whitespace="preserve">Attempt to connect to the url of @conn made with
+gst_rtsp_connection_create(). If @timeout is #NULL this function can block
+forever. If @timeout contains a valid timeout, this function will return
+#GST_RTSP_ETIMEOUT after the timeout expired.
+This function can be cancelled with gst_rtsp_connection_flush().</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_RTSP_OK when a connection could be made.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="timeout" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a #GTimeVal timeout</doc>
+            <type name="GLib.TimeVal" c:type="GTimeVal*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="do_tunnel"
+              c:identifier="gst_rtsp_connection_do_tunnel"
+              version="0.10.23">
+        <doc xml:whitespace="preserve">If @conn received the first tunnel connection and @conn2 received
+the second tunnel connection, link the two connections together so that
+After this call, @conn2 cannot be used anymore and must be freed with
+gst_rtsp_connection_free().
+If @conn2 is %NULL then only the base64 decoding context will be setup for</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">return GST_RTSP_OK on success.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="conn2" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a #GstRTSPConnection or %NULL</doc>
+            <type name="RTSPConnection" c:type="GstRTSPConnection*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="flush" c:identifier="gst_rtsp_connection_flush">
+        <doc xml:whitespace="preserve">Start or stop the flushing action on @conn. When flushing, all current
+and future actions on @conn will return #GST_RTSP_EINTR until the connection
+is set to non-flushing mode again.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_RTSP_OK.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="flush" transfer-ownership="none">
+            <doc xml:whitespace="preserve">start or stop the flush</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="free" c:identifier="gst_rtsp_connection_free">
+        <doc xml:whitespace="preserve">Close and free @conn.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_RTSP_OK on success.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+      </method>
+      <method name="get_ip"
+              c:identifier="gst_rtsp_connection_get_ip"
+              version="0.10.20">
+        <doc xml:whitespace="preserve">Retrieve the IP address of the other end of @conn.
+connection is closed.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">The IP address as a string. this value remains valid until the</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </return-value>
+      </method>
+      <method name="get_readfd"
+              c:identifier="gst_rtsp_connection_get_readfd"
+              version="0.10.23">
+        <doc xml:whitespace="preserve">Get the file descriptor for reading.
+descriptor remains valid until the connection is closed.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the file descriptor used for reading or -1 on error. The file</doc>
+          <type name="gint" c:type="gint"/>
+        </return-value>
+      </method>
+      <method name="get_tunnelid"
+              c:identifier="gst_rtsp_connection_get_tunnelid"
+              version="0.10.23">
+        <doc xml:whitespace="preserve">Get the tunnel session id the connection.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">returns a non-empty string if @conn is being tunneled over HTTP.</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </return-value>
+      </method>
+      <method name="get_url"
+              c:identifier="gst_rtsp_connection_get_url"
+              version="0.10.23">
+        <doc xml:whitespace="preserve">Retrieve the URL of the other end of @conn.
+connection is freed.</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">The URL. This value remains valid until the</doc>
+          <type name="RTSPUrl" c:type="GstRTSPUrl*"/>
+        </return-value>
+      </method>
+      <method name="get_writefd"
+              c:identifier="gst_rtsp_connection_get_writefd"
+              version="0.10.23">
+        <doc xml:whitespace="preserve">Get the file descriptor for writing.
+descriptor remains valid until the connection is closed.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the file descriptor used for writing or -1 on error. The file</doc>
+          <type name="gint" c:type="gint"/>
+        </return-value>
+      </method>
+      <method name="is_tunneled"
+              c:identifier="gst_rtsp_connection_is_tunneled"
+              version="0.10.23">
+        <doc xml:whitespace="preserve">Get the tunneling state of the connection.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">if @conn is using HTTP tunneling.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+      </method>
+      <method name="next_timeout"
+              c:identifier="gst_rtsp_connection_next_timeout">
+        <doc xml:whitespace="preserve">Calculate the next timeout for @conn, storing the result in @timeout.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_RTSP_OK.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="timeout" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a timeout</doc>
+            <type name="GLib.TimeVal" c:type="GTimeVal*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="poll"
+              c:identifier="gst_rtsp_connection_poll"
+              version="0.10.15">
+        <doc xml:whitespace="preserve">Wait up to the specified @timeout for the connection to become available for
+at least one of the operations specified in @events. When the function returns
+with #GST_RTSP_OK, @revents will contain a bitmask of available operations on
+This function can be cancelled with gst_rtsp_connection_flush().</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_RTSP_OK on success.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="events" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a bitmask of #GstRTSPEvent flags to check</doc>
+            <type name="RTSPEvent" c:type="GstRTSPEvent"/>
+          </parameter>
+          <parameter name="revents" transfer-ownership="none">
+            <doc xml:whitespace="preserve">location for result flags</doc>
+            <type name="RTSPEvent" c:type="GstRTSPEvent*"/>
+          </parameter>
+          <parameter name="timeout" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a timeout</doc>
+            <type name="GLib.TimeVal" c:type="GTimeVal*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="read" c:identifier="gst_rtsp_connection_read">
+        <doc xml:whitespace="preserve">Attempt to read @size bytes into @data from the connected @conn, blocking up to
+the specified @timeout. @timeout can be #NULL, in which case this function
+might block forever.
+This function can be cancelled with gst_rtsp_connection_flush().</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_RTSP_OK on success.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="data" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the data to read</doc>
+            <type name="guint8" c:type="guint8*"/>
+          </parameter>
+          <parameter name="size" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the size of @data</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+          <parameter name="timeout" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a timeout value or #NULL</doc>
+            <type name="GLib.TimeVal" c:type="GTimeVal*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="receive" c:identifier="gst_rtsp_connection_receive">
+        <doc xml:whitespace="preserve">Attempt to read into @message from the connected @conn, blocking up to
+the specified @timeout. @timeout can be #NULL, in which case this function
+might block forever.
+This function can be cancelled with gst_rtsp_connection_flush().</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_RTSP_OK on success.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="message" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the message to read</doc>
+            <type name="RTSPMessage" c:type="GstRTSPMessage*"/>
+          </parameter>
+          <parameter name="timeout" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a timeout value or #NULL</doc>
+            <type name="GLib.TimeVal" c:type="GTimeVal*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="reset_timeout"
+              c:identifier="gst_rtsp_connection_reset_timeout">
+        <doc xml:whitespace="preserve">Reset the timeout of @conn.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_RTSP_OK.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+      </method>
+      <method name="send" c:identifier="gst_rtsp_connection_send">
+        <doc xml:whitespace="preserve">Attempt to send @message to the connected @conn, blocking up to
+the specified @timeout. @timeout can be #NULL, in which case this function
+might block forever.
+This function can be cancelled with gst_rtsp_connection_flush().</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_RTSP_OK on success.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="message" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the message to send</doc>
+            <type name="RTSPMessage" c:type="GstRTSPMessage*"/>
+          </parameter>
+          <parameter name="timeout" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a timeout value or #NULL</doc>
+            <type name="GLib.TimeVal" c:type="GTimeVal*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_auth" c:identifier="gst_rtsp_connection_set_auth">
+        <doc xml:whitespace="preserve">Configure @conn for authentication mode @method with @user and @pass as the
+user and password respectively.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_RTSP_OK.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="method" transfer-ownership="none">
+            <doc xml:whitespace="preserve">authentication method</doc>
+            <type name="RTSPAuthMethod" c:type="GstRTSPAuthMethod"/>
+          </parameter>
+          <parameter name="user" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the user</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="pass" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the password</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_auth_param"
+              c:identifier="gst_rtsp_connection_set_auth_param"
+              version="0.10.20">
+        <doc xml:whitespace="preserve">Setup @conn with authentication directives. This is not necesary for
+methods #GST_RTSP_AUTH_NONE and #GST_RTSP_AUTH_BASIC. For
+#GST_RTSP_AUTH_DIGEST, directives should be taken from the digest challenge
+in the WWW-Authenticate response header and can include realm, domain,
+nonce, opaque, stale, algorithm, qop as per RFC2617.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="param" transfer-ownership="none">
+            <doc xml:whitespace="preserve">authentication directive</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="value" transfer-ownership="none">
+            <doc xml:whitespace="preserve">value</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_http_mode"
+              c:identifier="gst_rtsp_connection_set_http_mode"
+              version="0.10.25">
+        <doc xml:whitespace="preserve">By setting the HTTP mode to %TRUE the message parsing will support HTTP
+messages in addition to the RTSP messages. It will also disable the
+automatic handling of setting up an HTTP tunnel.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="enable" transfer-ownership="none">
+            <doc xml:whitespace="preserve">%TRUE to enable manual HTTP mode</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_ip"
+              c:identifier="gst_rtsp_connection_set_ip"
+              version="0.10.23">
+        <doc xml:whitespace="preserve">Set the IP address of the server.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="ip" transfer-ownership="none">
+            <doc xml:whitespace="preserve">an ip address</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_proxy"
+              c:identifier="gst_rtsp_connection_set_proxy"
+              version="0.10.23">
+        <doc xml:whitespace="preserve">Set the proxy host and port.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_RTSP_OK.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="host" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the proxy host</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="port" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the proxy port</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_qos_dscp"
+              c:identifier="gst_rtsp_connection_set_qos_dscp"
+              version="0.10.20">
+        <doc xml:whitespace="preserve">Configure @conn to use the specified DSCP value.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_RTSP_OK on success.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="qos_dscp" transfer-ownership="none">
+            <doc xml:whitespace="preserve">DSCP value</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_tunneled"
+              c:identifier="gst_rtsp_connection_set_tunneled"
+              version="0.10.23">
+        <doc xml:whitespace="preserve">Set the HTTP tunneling state of the connection. This must be configured before
+the @conn is connected.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="tunneled" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the new state</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="write" c:identifier="gst_rtsp_connection_write">
+        <doc xml:whitespace="preserve">Attempt to write @size bytes of @data to the connected @conn, blocking up to
+the specified @timeout. @timeout can be #NULL, in which case this function
+might block forever.
+This function can be cancelled with gst_rtsp_connection_flush().</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_RTSP_OK on success.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="data" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the data to write</doc>
+            <type name="guint8" c:type="guint8*"/>
+          </parameter>
+          <parameter name="size" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the size of @data</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+          <parameter name="timeout" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a timeout value or #NULL</doc>
+            <type name="GLib.TimeVal" c:type="GTimeVal*"/>
+          </parameter>
+        </parameters>
+      </method>
+    </record>
+    <bitfield name="RTSPEvent"
+              glib:type-name="GstRTSPEvent"
+              glib:get-type="gst_rtsp_event_get_type"
+              c:type="GstRTSPEvent">
+      <doc xml:whitespace="preserve">The possible events for the connection.</doc>
+      <member name="read"
+              value="1"
+              c:identifier="GST_RTSP_EV_READ"
+              glib:nick="read"/>
+      <member name="write"
+              value="2"
+              c:identifier="GST_RTSP_EV_WRITE"
+              glib:nick="write"/>
+    </bitfield>
+    <interface name="RTSPExtension"
+               c:symbol-prefix="rtsp_extension"
+               c:type="GstRTSPExtension"
+               glib:type-name="GstRTSPExtension"
+               glib:get-type="gst_rtsp_extension_get_type"
+               glib:type-struct="RTSPExtensionInterface">
+      <virtual-method name="after_send" invoker="after_send">
+        <return-value transfer-ownership="none">
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="req" transfer-ownership="none">
+            <type name="RTSPMessage" c:type="GstRTSPMessage*"/>
+          </parameter>
+          <parameter name="resp" transfer-ownership="none">
+            <type name="RTSPMessage" c:type="GstRTSPMessage*"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <virtual-method name="before_send" invoker="before_send">
+        <return-value transfer-ownership="none">
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="req" transfer-ownership="none">
+            <type name="RTSPMessage" c:type="GstRTSPMessage*"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <virtual-method name="configure_stream" invoker="configure_stream">
+        <return-value transfer-ownership="none">
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="caps" transfer-ownership="none">
+            <type name="Gst.Caps" c:type="GstCaps*"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <virtual-method name="detect_server" invoker="detect_server">
+        <return-value transfer-ownership="none">
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="resp" transfer-ownership="none">
+            <type name="RTSPMessage" c:type="GstRTSPMessage*"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <virtual-method name="get_transports" invoker="get_transports">
+        <return-value transfer-ownership="none">
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="protocols" transfer-ownership="none">
+            <type name="RTSPLowerTrans" c:type="GstRTSPLowerTrans"/>
+          </parameter>
+          <parameter name="transport" transfer-ownership="none">
+            <type name="utf8" c:type="gchar**"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <virtual-method name="parse_sdp" invoker="parse_sdp">
+        <return-value transfer-ownership="none">
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="sdp" transfer-ownership="none">
+            <type name="GstSdp.SDPMessage" c:type="GstSDPMessage*"/>
+          </parameter>
+          <parameter name="s" transfer-ownership="none">
+            <type name="Gst.Structure" c:type="GstStructure*"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <virtual-method name="receive_request" invoker="receive_request">
+        <return-value transfer-ownership="none">
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="req" transfer-ownership="none">
+            <type name="RTSPMessage" c:type="GstRTSPMessage*"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <virtual-method name="setup_media" invoker="setup_media">
+        <return-value transfer-ownership="none">
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="media" transfer-ownership="none">
+            <type name="GstSdp.SDPMedia" c:type="GstSDPMedia*"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <virtual-method name="stream_select" invoker="stream_select">
+        <return-value transfer-ownership="none">
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="url" transfer-ownership="none">
+            <type name="RTSPUrl" c:type="GstRTSPUrl*"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <method name="after_send" c:identifier="gst_rtsp_extension_after_send">
+        <return-value transfer-ownership="none">
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="req" transfer-ownership="none">
+            <type name="RTSPMessage" c:type="GstRTSPMessage*"/>
+          </parameter>
+          <parameter name="resp" transfer-ownership="none">
+            <type name="RTSPMessage" c:type="GstRTSPMessage*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="before_send" c:identifier="gst_rtsp_extension_before_send">
+        <return-value transfer-ownership="none">
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="req" transfer-ownership="none">
+            <type name="RTSPMessage" c:type="GstRTSPMessage*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="configure_stream"
+              c:identifier="gst_rtsp_extension_configure_stream">
+        <return-value transfer-ownership="none">
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="caps" transfer-ownership="none">
+            <type name="Gst.Caps" c:type="GstCaps*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="detect_server"
+              c:identifier="gst_rtsp_extension_detect_server">
+        <return-value transfer-ownership="none">
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="resp" transfer-ownership="none">
+            <type name="RTSPMessage" c:type="GstRTSPMessage*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="get_transports"
+              c:identifier="gst_rtsp_extension_get_transports">
+        <return-value transfer-ownership="none">
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="protocols" transfer-ownership="none">
+            <type name="RTSPLowerTrans" c:type="GstRTSPLowerTrans"/>
+          </parameter>
+          <parameter name="transport" transfer-ownership="none">
+            <type name="utf8" c:type="gchar**"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="parse_sdp" c:identifier="gst_rtsp_extension_parse_sdp">
+        <return-value transfer-ownership="none">
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="sdp" transfer-ownership="none">
+            <type name="GstSdp.SDPMessage" c:type="GstSDPMessage*"/>
+          </parameter>
+          <parameter name="s" transfer-ownership="none">
+            <type name="Gst.Structure" c:type="GstStructure*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="receive_request"
+              c:identifier="gst_rtsp_extension_receive_request">
+        <return-value transfer-ownership="none">
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="req" transfer-ownership="none">
+            <type name="RTSPMessage" c:type="GstRTSPMessage*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="send" c:identifier="gst_rtsp_extension_send">
+        <return-value transfer-ownership="none">
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="req" transfer-ownership="none">
+            <type name="RTSPMessage" c:type="GstRTSPMessage*"/>
+          </parameter>
+          <parameter name="resp" transfer-ownership="none">
+            <type name="RTSPMessage" c:type="GstRTSPMessage*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="setup_media" c:identifier="gst_rtsp_extension_setup_media">
+        <return-value transfer-ownership="none">
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="media" transfer-ownership="none">
+            <type name="GstSdp.SDPMedia" c:type="GstSDPMedia*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="stream_select"
+              c:identifier="gst_rtsp_extension_stream_select">
+        <return-value transfer-ownership="none">
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="url" transfer-ownership="none">
+            <type name="RTSPUrl" c:type="GstRTSPUrl*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <glib:signal name="send">
+        <return-value transfer-ownership="none">
+          <type name="RTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="object" transfer-ownership="none">
+            <type name="gpointer"/>
+          </parameter>
+          <parameter name="p0" transfer-ownership="none">
+            <type name="gpointer"/>
+          </parameter>
+        </parameters>
+      </glib:signal>
+    </interface>
+    <record name="RTSPExtensionInterface"
+            c:type="GstRTSPExtensionInterface"
+            glib:is-gtype-struct-for="RTSPExtension">
+      <field name="parent">
+        <type name="GObject.TypeInterface" c:type="GTypeInterface"/>
+      </field>
+      <field name="detect_server">
+        <callback name="detect_server">
+          <return-value transfer-ownership="none">
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="ext" transfer-ownership="none">
+              <type name="RTSPExtension" c:type="GstRTSPExtension*"/>
+            </parameter>
+            <parameter name="resp" transfer-ownership="none">
+              <type name="RTSPMessage" c:type="GstRTSPMessage*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="before_send">
+        <callback name="before_send">
+          <return-value transfer-ownership="none">
+            <type name="RTSPResult" c:type="GstRTSPResult"/>
+          </return-value>
+          <parameters>
+            <parameter name="ext" transfer-ownership="none">
+              <type name="RTSPExtension" c:type="GstRTSPExtension*"/>
+            </parameter>
+            <parameter name="req" transfer-ownership="none">
+              <type name="RTSPMessage" c:type="GstRTSPMessage*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="after_send">
+        <callback name="after_send">
+          <return-value transfer-ownership="none">
+            <type name="RTSPResult" c:type="GstRTSPResult"/>
+          </return-value>
+          <parameters>
+            <parameter name="ext" transfer-ownership="none">
+              <type name="RTSPExtension" c:type="GstRTSPExtension*"/>
+            </parameter>
+            <parameter name="req" transfer-ownership="none">
+              <type name="RTSPMessage" c:type="GstRTSPMessage*"/>
+            </parameter>
+            <parameter name="resp" transfer-ownership="none">
+              <type name="RTSPMessage" c:type="GstRTSPMessage*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="parse_sdp">
+        <callback name="parse_sdp">
+          <return-value transfer-ownership="none">
+            <type name="RTSPResult" c:type="GstRTSPResult"/>
+          </return-value>
+          <parameters>
+            <parameter name="ext" transfer-ownership="none">
+              <type name="RTSPExtension" c:type="GstRTSPExtension*"/>
+            </parameter>
+            <parameter name="sdp" transfer-ownership="none">
+              <type name="GstSdp.SDPMessage" c:type="GstSDPMessage*"/>
+            </parameter>
+            <parameter name="s" transfer-ownership="none">
+              <type name="Gst.Structure" c:type="GstStructure*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="setup_media">
+        <callback name="setup_media">
+          <return-value transfer-ownership="none">
+            <type name="RTSPResult" c:type="GstRTSPResult"/>
+          </return-value>
+          <parameters>
+            <parameter name="ext" transfer-ownership="none">
+              <type name="RTSPExtension" c:type="GstRTSPExtension*"/>
+            </parameter>
+            <parameter name="media" transfer-ownership="none">
+              <type name="GstSdp.SDPMedia" c:type="GstSDPMedia*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="configure_stream">
+        <callback name="configure_stream">
+          <return-value transfer-ownership="none">
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="ext" transfer-ownership="none">
+              <type name="RTSPExtension" c:type="GstRTSPExtension*"/>
+            </parameter>
+            <parameter name="caps" transfer-ownership="none">
+              <type name="Gst.Caps" c:type="GstCaps*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="get_transports">
+        <callback name="get_transports">
+          <return-value transfer-ownership="none">
+            <type name="RTSPResult" c:type="GstRTSPResult"/>
+          </return-value>
+          <parameters>
+            <parameter name="ext" transfer-ownership="none">
+              <type name="RTSPExtension" c:type="GstRTSPExtension*"/>
+            </parameter>
+            <parameter name="protocols" transfer-ownership="none">
+              <type name="RTSPLowerTrans" c:type="GstRTSPLowerTrans"/>
+            </parameter>
+            <parameter name="transport" transfer-ownership="none">
+              <type name="utf8" c:type="gchar**"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="stream_select">
+        <callback name="stream_select">
+          <return-value transfer-ownership="none">
+            <type name="RTSPResult" c:type="GstRTSPResult"/>
+          </return-value>
+          <parameters>
+            <parameter name="ext" transfer-ownership="none">
+              <type name="RTSPExtension" c:type="GstRTSPExtension*"/>
+            </parameter>
+            <parameter name="url" transfer-ownership="none">
+              <type name="RTSPUrl" c:type="GstRTSPUrl*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="send">
+        <callback name="send">
+          <return-value transfer-ownership="none">
+            <type name="RTSPResult" c:type="GstRTSPResult"/>
+          </return-value>
+          <parameters>
+            <parameter name="ext" transfer-ownership="none">
+              <type name="RTSPExtension" c:type="GstRTSPExtension*"/>
+            </parameter>
+            <parameter name="req" transfer-ownership="none">
+              <type name="RTSPMessage" c:type="GstRTSPMessage*"/>
+            </parameter>
+            <parameter name="resp" transfer-ownership="none">
+              <type name="RTSPMessage" c:type="GstRTSPMessage*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="receive_request">
+        <callback name="receive_request">
+          <return-value transfer-ownership="none">
+            <type name="RTSPResult" c:type="GstRTSPResult"/>
+          </return-value>
+          <parameters>
+            <parameter name="ext" transfer-ownership="none">
+              <type name="RTSPExtension" c:type="GstRTSPExtension*"/>
+            </parameter>
+            <parameter name="req" transfer-ownership="none">
+              <type name="RTSPMessage" c:type="GstRTSPMessage*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="_gst_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="3">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </record>
+    <enumeration name="RTSPFamily"
+                 glib:type-name="GstRTSPFamily"
+                 glib:get-type="gst_rtsp_family_get_type"
+                 c:type="GstRTSPFamily">
+      <doc xml:whitespace="preserve">The possible network families.</doc>
+      <member name="none"
+              value="0"
+              c:identifier="GST_RTSP_FAM_NONE"
+              glib:nick="none"/>
+      <member name="inet"
+              value="1"
+              c:identifier="GST_RTSP_FAM_INET"
+              glib:nick="inet"/>
+      <member name="inet6"
+              value="2"
+              c:identifier="GST_RTSP_FAM_INET6"
+              glib:nick="inet6"/>
+    </enumeration>
+    <enumeration name="RTSPHeaderField"
+                 glib:type-name="GstRTSPHeaderField"
+                 glib:get-type="gst_rtsp_header_field_get_type"
+                 c:type="GstRTSPHeaderField">
+      <member name="invalid"
+              value="0"
+              c:identifier="GST_RTSP_HDR_INVALID"
+              glib:nick="invalid"/>
+      <member name="accept"
+              value="1"
+              c:identifier="GST_RTSP_HDR_ACCEPT"
+              glib:nick="accept"/>
+      <member name="accept_encoding"
+              value="2"
+              c:identifier="GST_RTSP_HDR_ACCEPT_ENCODING"
+              glib:nick="accept-encoding"/>
+      <member name="accept_language"
+              value="3"
+              c:identifier="GST_RTSP_HDR_ACCEPT_LANGUAGE"
+              glib:nick="accept-language"/>
+      <member name="allow"
+              value="4"
+              c:identifier="GST_RTSP_HDR_ALLOW"
+              glib:nick="allow"/>
+      <member name="authorization"
+              value="5"
+              c:identifier="GST_RTSP_HDR_AUTHORIZATION"
+              glib:nick="authorization"/>
+      <member name="bandwidth"
+              value="6"
+              c:identifier="GST_RTSP_HDR_BANDWIDTH"
+              glib:nick="bandwidth"/>
+      <member name="blocksize"
+              value="7"
+              c:identifier="GST_RTSP_HDR_BLOCKSIZE"
+              glib:nick="blocksize"/>
+      <member name="cache_control"
+              value="8"
+              c:identifier="GST_RTSP_HDR_CACHE_CONTROL"
+              glib:nick="cache-control"/>
+      <member name="conference"
+              value="9"
+              c:identifier="GST_RTSP_HDR_CONFERENCE"
+              glib:nick="conference"/>
+      <member name="connection"
+              value="10"
+              c:identifier="GST_RTSP_HDR_CONNECTION"
+              glib:nick="connection"/>
+      <member name="content_base"
+              value="11"
+              c:identifier="GST_RTSP_HDR_CONTENT_BASE"
+              glib:nick="content-base"/>
+      <member name="content_encoding"
+              value="12"
+              c:identifier="GST_RTSP_HDR_CONTENT_ENCODING"
+              glib:nick="content-encoding"/>
+      <member name="content_language"
+              value="13"
+              c:identifier="GST_RTSP_HDR_CONTENT_LANGUAGE"
+              glib:nick="content-language"/>
+      <member name="content_length"
+              value="14"
+              c:identifier="GST_RTSP_HDR_CONTENT_LENGTH"
+              glib:nick="content-length"/>
+      <member name="content_location"
+              value="15"
+              c:identifier="GST_RTSP_HDR_CONTENT_LOCATION"
+              glib:nick="content-location"/>
+      <member name="content_type"
+              value="16"
+              c:identifier="GST_RTSP_HDR_CONTENT_TYPE"
+              glib:nick="content-type"/>
+      <member name="cseq"
+              value="17"
+              c:identifier="GST_RTSP_HDR_CSEQ"
+              glib:nick="cseq"/>
+      <member name="date"
+              value="18"
+              c:identifier="GST_RTSP_HDR_DATE"
+              glib:nick="date"/>
+      <member name="expires"
+              value="19"
+              c:identifier="GST_RTSP_HDR_EXPIRES"
+              glib:nick="expires"/>
+      <member name="from"
+              value="20"
+              c:identifier="GST_RTSP_HDR_FROM"
+              glib:nick="from"/>
+      <member name="if_modified_since"
+              value="21"
+              c:identifier="GST_RTSP_HDR_IF_MODIFIED_SINCE"
+              glib:nick="if-modified-since"/>
+      <member name="last_modified"
+              value="22"
+              c:identifier="GST_RTSP_HDR_LAST_MODIFIED"
+              glib:nick="last-modified"/>
+      <member name="proxy_authenticate"
+              value="23"
+              c:identifier="GST_RTSP_HDR_PROXY_AUTHENTICATE"
+              glib:nick="proxy-authenticate"/>
+      <member name="proxy_require"
+              value="24"
+              c:identifier="GST_RTSP_HDR_PROXY_REQUIRE"
+              glib:nick="proxy-require"/>
+      <member name="public"
+              value="25"
+              c:identifier="GST_RTSP_HDR_PUBLIC"
+              glib:nick="public"/>
+      <member name="range"
+              value="26"
+              c:identifier="GST_RTSP_HDR_RANGE"
+              glib:nick="range"/>
+      <member name="referer"
+              value="27"
+              c:identifier="GST_RTSP_HDR_REFERER"
+              glib:nick="referer"/>
+      <member name="require"
+              value="28"
+              c:identifier="GST_RTSP_HDR_REQUIRE"
+              glib:nick="require"/>
+      <member name="retry_after"
+              value="29"
+              c:identifier="GST_RTSP_HDR_RETRY_AFTER"
+              glib:nick="retry-after"/>
+      <member name="rtp_info"
+              value="30"
+              c:identifier="GST_RTSP_HDR_RTP_INFO"
+              glib:nick="rtp-info"/>
+      <member name="scale"
+              value="31"
+              c:identifier="GST_RTSP_HDR_SCALE"
+              glib:nick="scale"/>
+      <member name="session"
+              value="32"
+              c:identifier="GST_RTSP_HDR_SESSION"
+              glib:nick="session"/>
+      <member name="server"
+              value="33"
+              c:identifier="GST_RTSP_HDR_SERVER"
+              glib:nick="server"/>
+      <member name="speed"
+              value="34"
+              c:identifier="GST_RTSP_HDR_SPEED"
+              glib:nick="speed"/>
+      <member name="transport"
+              value="35"
+              c:identifier="GST_RTSP_HDR_TRANSPORT"
+              glib:nick="transport"/>
+      <member name="unsupported"
+              value="36"
+              c:identifier="GST_RTSP_HDR_UNSUPPORTED"
+              glib:nick="unsupported"/>
+      <member name="user_agent"
+              value="37"
+              c:identifier="GST_RTSP_HDR_USER_AGENT"
+              glib:nick="user-agent"/>
+      <member name="via"
+              value="38"
+              c:identifier="GST_RTSP_HDR_VIA"
+              glib:nick="via"/>
+      <member name="www_authenticate"
+              value="39"
+              c:identifier="GST_RTSP_HDR_WWW_AUTHENTICATE"
+              glib:nick="www-authenticate"/>
+      <member name="client_challenge"
+              value="40"
+              c:identifier="GST_RTSP_HDR_CLIENT_CHALLENGE"
+              glib:nick="client-challenge"/>
+      <member name="real_challenge1"
+              value="41"
+              c:identifier="GST_RTSP_HDR_REAL_CHALLENGE1"
+              glib:nick="real-challenge1"/>
+      <member name="real_challenge2"
+              value="42"
+              c:identifier="GST_RTSP_HDR_REAL_CHALLENGE2"
+              glib:nick="real-challenge2"/>
+      <member name="real_challenge3"
+              value="43"
+              c:identifier="GST_RTSP_HDR_REAL_CHALLENGE3"
+              glib:nick="real-challenge3"/>
+      <member name="subscribe"
+              value="44"
+              c:identifier="GST_RTSP_HDR_SUBSCRIBE"
+              glib:nick="subscribe"/>
+      <member name="alert"
+              value="45"
+              c:identifier="GST_RTSP_HDR_ALERT"
+              glib:nick="alert"/>
+      <member name="client_id"
+              value="46"
+              c:identifier="GST_RTSP_HDR_CLIENT_ID"
+              glib:nick="client-id"/>
+      <member name="company_id"
+              value="47"
+              c:identifier="GST_RTSP_HDR_COMPANY_ID"
+              glib:nick="company-id"/>
+      <member name="guid"
+              value="48"
+              c:identifier="GST_RTSP_HDR_GUID"
+              glib:nick="guid"/>
+      <member name="region_data"
+              value="49"
+              c:identifier="GST_RTSP_HDR_REGION_DATA"
+              glib:nick="region-data"/>
+      <member name="max_asm_width"
+              value="50"
+              c:identifier="GST_RTSP_HDR_MAX_ASM_WIDTH"
+              glib:nick="max-asm-width"/>
+      <member name="language"
+              value="51"
+              c:identifier="GST_RTSP_HDR_LANGUAGE"
+              glib:nick="language"/>
+      <member name="player_start_time"
+              value="52"
+              c:identifier="GST_RTSP_HDR_PLAYER_START_TIME"
+              glib:nick="player-start-time"/>
+      <member name="location"
+              value="53"
+              c:identifier="GST_RTSP_HDR_LOCATION"
+              glib:nick="location"/>
+      <member name="etag"
+              value="54"
+              c:identifier="GST_RTSP_HDR_ETAG"
+              glib:nick="etag"/>
+      <member name="if_match"
+              value="55"
+              c:identifier="GST_RTSP_HDR_IF_MATCH"
+              glib:nick="if-match"/>
+      <member name="accept_charset"
+              value="56"
+              c:identifier="GST_RTSP_HDR_ACCEPT_CHARSET"
+              glib:nick="accept-charset"/>
+      <member name="supported"
+              value="57"
+              c:identifier="GST_RTSP_HDR_SUPPORTED"
+              glib:nick="supported"/>
+      <member name="vary"
+              value="58"
+              c:identifier="GST_RTSP_HDR_VARY"
+              glib:nick="vary"/>
+      <member name="x_accelerate_streaming"
+              value="59"
+              c:identifier="GST_RTSP_HDR_X_ACCELERATE_STREAMING"
+              glib:nick="x-accelerate-streaming"/>
+      <member name="x_accept_authent"
+              value="60"
+              c:identifier="GST_RTSP_HDR_X_ACCEPT_AUTHENT"
+              glib:nick="x-accept-authent"/>
+      <member name="x_accept_proxy_authent"
+              value="61"
+              c:identifier="GST_RTSP_HDR_X_ACCEPT_PROXY_AUTHENT"
+              glib:nick="x-accept-proxy-authent"/>
+      <member name="x_broadcast_id"
+              value="62"
+              c:identifier="GST_RTSP_HDR_X_BROADCAST_ID"
+              glib:nick="x-broadcast-id"/>
+      <member name="x_burst_streaming"
+              value="63"
+              c:identifier="GST_RTSP_HDR_X_BURST_STREAMING"
+              glib:nick="x-burst-streaming"/>
+      <member name="x_notice"
+              value="64"
+              c:identifier="GST_RTSP_HDR_X_NOTICE"
+              glib:nick="x-notice"/>
+      <member name="x_player_lag_time"
+              value="65"
+              c:identifier="GST_RTSP_HDR_X_PLAYER_LAG_TIME"
+              glib:nick="x-player-lag-time"/>
+      <member name="x_playlist"
+              value="66"
+              c:identifier="GST_RTSP_HDR_X_PLAYLIST"
+              glib:nick="x-playlist"/>
+      <member name="x_playlist_change_notice"
+              value="67"
+              c:identifier="GST_RTSP_HDR_X_PLAYLIST_CHANGE_NOTICE"
+              glib:nick="x-playlist-change-notice"/>
+      <member name="x_playlist_gen_id"
+              value="68"
+              c:identifier="GST_RTSP_HDR_X_PLAYLIST_GEN_ID"
+              glib:nick="x-playlist-gen-id"/>
+      <member name="x_playlist_seek_id"
+              value="69"
+              c:identifier="GST_RTSP_HDR_X_PLAYLIST_SEEK_ID"
+              glib:nick="x-playlist-seek-id"/>
+      <member name="x_proxy_client_agent"
+              value="70"
+              c:identifier="GST_RTSP_HDR_X_PROXY_CLIENT_AGENT"
+              glib:nick="x-proxy-client-agent"/>
+      <member name="x_proxy_client_verb"
+              value="71"
+              c:identifier="GST_RTSP_HDR_X_PROXY_CLIENT_VERB"
+              glib:nick="x-proxy-client-verb"/>
+      <member name="x_receding_playlistchange"
+              value="72"
+              c:identifier="GST_RTSP_HDR_X_RECEDING_PLAYLISTCHANGE"
+              glib:nick="x-receding-playlistchange"/>
+      <member name="x_rtp_info"
+              value="73"
+              c:identifier="GST_RTSP_HDR_X_RTP_INFO"
+              glib:nick="x-rtp-info"/>
+      <member name="x_startupprofile"
+              value="74"
+              c:identifier="GST_RTSP_HDR_X_STARTUPPROFILE"
+              glib:nick="x-startupprofile"/>
+      <member name="timestamp"
+              value="75"
+              c:identifier="GST_RTSP_HDR_TIMESTAMP"
+              glib:nick="timestamp"/>
+      <member name="authentication_info"
+              value="76"
+              c:identifier="GST_RTSP_HDR_AUTHENTICATION_INFO"
+              glib:nick="authentication-info"/>
+      <member name="host"
+              value="77"
+              c:identifier="GST_RTSP_HDR_HOST"
+              glib:nick="host"/>
+      <member name="pragma"
+              value="78"
+              c:identifier="GST_RTSP_HDR_PRAGMA"
+              glib:nick="pragma"/>
+      <member name="x_server_ip_address"
+              value="79"
+              c:identifier="GST_RTSP_HDR_X_SERVER_IP_ADDRESS"
+              glib:nick="x-server-ip-address"/>
+      <member name="x_sessioncookie"
+              value="80"
+              c:identifier="GST_RTSP_HDR_X_SESSIONCOOKIE"
+              glib:nick="x-sessioncookie"/>
+      <member name="last"
+              value="81"
+              c:identifier="GST_RTSP_HDR_LAST"
+              glib:nick="last"/>
+    </enumeration>
+    <bitfield name="RTSPLowerTrans"
+              glib:type-name="GstRTSPLowerTrans"
+              glib:get-type="gst_rtsp_lower_trans_get_type"
+              c:type="GstRTSPLowerTrans">
+      <doc xml:whitespace="preserve">The different transport methods.</doc>
+      <member name="udp_unicast"
+              value="1"
+              c:identifier="GST_RTSP_LOWER_TRANS_UDP"
+              glib:nick="udp-unicast"/>
+      <member name="udp_multicast"
+              value="2"
+              c:identifier="GST_RTSP_LOWER_TRANS_UDP_MCAST"
+              glib:nick="udp-multicast"/>
+      <member name="tcp"
+              value="4"
+              c:identifier="GST_RTSP_LOWER_TRANS_TCP"
+              glib:nick="tcp"/>
+      <member name="http"
+              value="16"
+              c:identifier="GST_RTSP_LOWER_TRANS_HTTP"
+              glib:nick="http"/>
+    </bitfield>
+    <record name="RTSPMessage" c:type="GstRTSPMessage">
+      <doc xml:whitespace="preserve">An RTSP message containing request, response or data messages. Depending on
+the @type, the appropriate structure may be accessed.</doc>
+      <field name="type" writable="1">
+        <type name="RTSPMsgType" c:type="GstRTSPMsgType"/>
+      </field>
+      <union name="type_data" c:type="type_data">
+        <record name="request" c:type="request">
+          <field name="method" writable="1">
+            <type name="RTSPMethod" c:type="GstRTSPMethod"/>
+          </field>
+          <field name="uri" writable="1">
+            <type name="utf8" c:type="gchar*"/>
+          </field>
+          <field name="version" writable="1">
+            <type name="RTSPVersion" c:type="GstRTSPVersion"/>
+          </field>
+        </record>
+        <record name="response" c:type="response">
+          <field name="code" writable="1">
+            <type name="RTSPStatusCode" c:type="GstRTSPStatusCode"/>
+          </field>
+          <field name="reason" writable="1">
+            <type name="utf8" c:type="gchar*"/>
+          </field>
+          <field name="version" writable="1">
+            <type name="RTSPVersion" c:type="GstRTSPVersion"/>
+          </field>
+        </record>
+        <record name="data" c:type="data">
+          <field name="channel" writable="1">
+            <type name="guint8" c:type="guint8"/>
+          </field>
+        </record>
+      </union>
+      <field name="hdr_fields" writable="1">
+        <array name="GLib.Array" c:type="GArray*">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+      <field name="body" writable="1">
+        <type name="guint8" c:type="guint8*"/>
+      </field>
+      <field name="body_size" writable="1">
+        <type name="guint" c:type="guint"/>
+      </field>
+      <method name="add_header" c:identifier="gst_rtsp_message_add_header">
+        <doc xml:whitespace="preserve">Add a header with key @field and @value to @msg. This function takes a copy
+of @value.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstRTSPResult.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="field" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a #GstRTSPHeaderField</doc>
+            <type name="RTSPHeaderField" c:type="GstRTSPHeaderField"/>
+          </parameter>
+          <parameter name="value" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the value of the header</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="append_headers"
+              c:identifier="gst_rtsp_message_append_headers">
+        <doc xml:whitespace="preserve">Append the currently configured headers in @msg to the #GString @str suitable
+for transmission.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_RTSP_OK.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="str" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a string</doc>
+            <type name="GLib.String" c:type="GString*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="dump" c:identifier="gst_rtsp_message_dump">
+        <doc xml:whitespace="preserve">Dump the contents of @msg to stdout.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_RTSP_OK.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+      </method>
+      <method name="free" c:identifier="gst_rtsp_message_free">
+        <doc xml:whitespace="preserve">Free the memory used by @msg.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstRTSPResult.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+      </method>
+      <method name="get_body" c:identifier="gst_rtsp_message_get_body">
+        <doc xml:whitespace="preserve">Get the body of @msg. @data remains valid for as long as @msg is valid and
+unchanged.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_RTSP_OK.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="data" transfer-ownership="none">
+            <doc xml:whitespace="preserve">location for the data</doc>
+            <type name="guint8" c:type="guint8**"/>
+          </parameter>
+          <parameter name="size" transfer-ownership="none">
+            <doc xml:whitespace="preserve">location for the size of @data</doc>
+            <type name="guint" c:type="guint*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="get_header" c:identifier="gst_rtsp_message_get_header">
+        <doc xml:whitespace="preserve">Get the @indx header value with key @field from @msg. The result in @value
+stays valid as long as it remains present in @msg.
+was not found.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_RTSP_OK when @field was found, #GST_RTSP_ENOTIMPL if the key</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="field" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a #GstRTSPHeaderField</doc>
+            <type name="RTSPHeaderField" c:type="GstRTSPHeaderField"/>
+          </parameter>
+          <parameter name="value" transfer-ownership="none">
+            <doc xml:whitespace="preserve">pointer to hold the result</doc>
+            <type name="utf8" c:type="gchar**"/>
+          </parameter>
+          <parameter name="indx" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the index of the header</doc>
+            <type name="gint" c:type="gint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="init" c:identifier="gst_rtsp_message_init">
+        <doc xml:whitespace="preserve">Initialize @msg. This function is mostly used when @msg is allocated on the
+stack. The reverse operation of this is gst_rtsp_message_unset().</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstRTSPResult.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+      </method>
+      <method name="init_data" c:identifier="gst_rtsp_message_init_data">
+        <doc xml:whitespace="preserve">Initialize a new data #GstRTSPMessage for @channel.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstRTSPResult.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="channel" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a channel</doc>
+            <type name="guint8" c:type="guint8"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="init_request" c:identifier="gst_rtsp_message_init_request">
+        <doc xml:whitespace="preserve">Initialize @msg as a request message with @method and @uri. To clear @msg
+again, use gst_rtsp_message_unset().</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstRTSPResult.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="method" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the request method to use</doc>
+            <type name="RTSPMethod" c:type="GstRTSPMethod"/>
+          </parameter>
+          <parameter name="uri" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the uri of the request</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="init_response"
+              c:identifier="gst_rtsp_message_init_response">
+        <doc xml:whitespace="preserve">Initialize @msg with @code and @reason.
+When @reason is #NULL, the default reason for @code will be used.
+When @request is not #NULL, the relevant headers will be copied to the new
+response message.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstRTSPResult.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="code" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the status code</doc>
+            <type name="RTSPStatusCode" c:type="GstRTSPStatusCode"/>
+          </parameter>
+          <parameter name="reason" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the status reason or #NULL</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="request" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the request that triggered the response or #NULL</doc>
+            <type name="RTSPMessage" c:type="GstRTSPMessage*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="parse_data" c:identifier="gst_rtsp_message_parse_data">
+        <doc xml:whitespace="preserve">Parse the data message @msg and store the channel in @channel.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstRTSPResult.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="channel" transfer-ownership="none">
+            <doc xml:whitespace="preserve">location to hold the channel</doc>
+            <type name="guint8" c:type="guint8*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="parse_request"
+              c:identifier="gst_rtsp_message_parse_request">
+        <doc xml:whitespace="preserve">Parse the request message @msg and store the values @method, @uri and
+value.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstRTSPResult.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="method" transfer-ownership="none">
+            <doc xml:whitespace="preserve">location to hold the method</doc>
+            <type name="RTSPMethod" c:type="GstRTSPMethod*"/>
+          </parameter>
+          <parameter name="uri" transfer-ownership="none">
+            <doc xml:whitespace="preserve">location to hold the uri</doc>
+            <type name="utf8" c:type="gchar**"/>
+          </parameter>
+          <parameter name="version" transfer-ownership="none">
+            <doc xml:whitespace="preserve">location to hold the version</doc>
+            <type name="RTSPVersion" c:type="GstRTSPVersion*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="parse_response"
+              c:identifier="gst_rtsp_message_parse_response">
+        <doc xml:whitespace="preserve">Parse the response message @msg and store the values @code, @reason and
+value.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstRTSPResult.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="code" transfer-ownership="none">
+            <doc xml:whitespace="preserve">location to hold the status code</doc>
+            <type name="RTSPStatusCode" c:type="GstRTSPStatusCode*"/>
+          </parameter>
+          <parameter name="reason" transfer-ownership="none">
+            <doc xml:whitespace="preserve">location to hold the status reason</doc>
+            <type name="utf8" c:type="gchar**"/>
+          </parameter>
+          <parameter name="version" transfer-ownership="none">
+            <doc xml:whitespace="preserve">location to hold the version</doc>
+            <type name="RTSPVersion" c:type="GstRTSPVersion*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="remove_header"
+              c:identifier="gst_rtsp_message_remove_header">
+        <doc xml:whitespace="preserve">Remove the @indx header with key @field from @msg. If @indx equals -1, all
+headers will be removed.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstRTSPResult.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="field" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a #GstRTSPHeaderField</doc>
+            <type name="RTSPHeaderField" c:type="GstRTSPHeaderField"/>
+          </parameter>
+          <parameter name="indx" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the index of the header</doc>
+            <type name="gint" c:type="gint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_body" c:identifier="gst_rtsp_message_set_body">
+        <doc xml:whitespace="preserve">Set the body of @msg to a copy of @data.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_RTSP_OK.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="data" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the data</doc>
+            <type name="guint8" c:type="guint8*"/>
+          </parameter>
+          <parameter name="size" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the size of @data</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="steal_body" c:identifier="gst_rtsp_message_steal_body">
+        <doc xml:whitespace="preserve">Take the body of @msg and store it in @data and @size. After this method,
+the body and size of @msg will be set to #NULL and 0 respectively.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_RTSP_OK.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="data" transfer-ownership="none">
+            <doc xml:whitespace="preserve">location for the data</doc>
+            <type name="guint8" c:type="guint8**"/>
+          </parameter>
+          <parameter name="size" transfer-ownership="none">
+            <doc xml:whitespace="preserve">location for the size of @data</doc>
+            <type name="guint" c:type="guint*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="take_body" c:identifier="gst_rtsp_message_take_body">
+        <doc xml:whitespace="preserve">Set the body of @msg to @data and @size. This method takes ownership of</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_RTSP_OK.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="data" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the data</doc>
+            <type name="guint8" c:type="guint8*"/>
+          </parameter>
+          <parameter name="size" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the size of @data</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="take_header"
+              c:identifier="gst_rtsp_message_take_header"
+              version="0.10.23">
+        <doc xml:whitespace="preserve">Add a header with key @field and @value to @msg. This function takes
+ownership of @value.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstRTSPResult.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="field" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a #GstRTSPHeaderField</doc>
+            <type name="RTSPHeaderField" c:type="GstRTSPHeaderField"/>
+          </parameter>
+          <parameter name="value" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the value of the header</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="unset" c:identifier="gst_rtsp_message_unset">
+        <doc xml:whitespace="preserve">Unset the contents of @msg so that it becomes an uninitialized
+#GstRTSPMessage again. This function is mostly used in combination with 
+gst_rtsp_message_init_request(), gst_rtsp_message_init_response() and
+gst_rtsp_message_init_data() on stack allocated #GstRTSPMessage structures.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_RTSP_OK.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+      </method>
+    </record>
+    <bitfield name="RTSPMethod"
+              glib:type-name="GstRTSPMethod"
+              glib:get-type="gst_rtsp_method_get_type"
+              c:type="GstRTSPMethod">
+      <doc xml:whitespace="preserve">The different supported RTSP methods.</doc>
+      <member name="invalid"
+              value="0"
+              c:identifier="GST_RTSP_INVALID"
+              glib:nick="invalid"/>
+      <member name="describe"
+              value="1"
+              c:identifier="GST_RTSP_DESCRIBE"
+              glib:nick="describe"/>
+      <member name="announce"
+              value="2"
+              c:identifier="GST_RTSP_ANNOUNCE"
+              glib:nick="announce"/>
+      <member name="get_parameter"
+              value="4"
+              c:identifier="GST_RTSP_GET_PARAMETER"
+              glib:nick="get-parameter"/>
+      <member name="options"
+              value="8"
+              c:identifier="GST_RTSP_OPTIONS"
+              glib:nick="options"/>
+      <member name="pause"
+              value="16"
+              c:identifier="GST_RTSP_PAUSE"
+              glib:nick="pause"/>
+      <member name="play"
+              value="32"
+              c:identifier="GST_RTSP_PLAY"
+              glib:nick="play"/>
+      <member name="record"
+              value="64"
+              c:identifier="GST_RTSP_RECORD"
+              glib:nick="record"/>
+      <member name="redirect"
+              value="128"
+              c:identifier="GST_RTSP_REDIRECT"
+              glib:nick="redirect"/>
+      <member name="setup"
+              value="256"
+              c:identifier="GST_RTSP_SETUP"
+              glib:nick="setup"/>
+      <member name="set_parameter"
+              value="512"
+              c:identifier="GST_RTSP_SET_PARAMETER"
+              glib:nick="set-parameter"/>
+      <member name="teardown"
+              value="1024"
+              c:identifier="GST_RTSP_TEARDOWN"
+              glib:nick="teardown"/>
+      <member name="get"
+              value="2048"
+              c:identifier="GST_RTSP_GET"
+              glib:nick="get"/>
+      <member name="post"
+              value="4096"
+              c:identifier="GST_RTSP_POST"
+              glib:nick="post"/>
+    </bitfield>
+    <enumeration name="RTSPMsgType" c:type="GstRTSPMsgType">
+      <doc xml:whitespace="preserve">The type of a message.</doc>
+      <member name="invalid"
+              value="0"
+              c:identifier="GST_RTSP_MESSAGE_INVALID"/>
+      <member name="request"
+              value="1"
+              c:identifier="GST_RTSP_MESSAGE_REQUEST"/>
+      <member name="response"
+              value="2"
+              c:identifier="GST_RTSP_MESSAGE_RESPONSE"/>
+      <member name="http_request"
+              value="3"
+              c:identifier="GST_RTSP_MESSAGE_HTTP_REQUEST"/>
+      <member name="http_response"
+              value="4"
+              c:identifier="GST_RTSP_MESSAGE_HTTP_RESPONSE"/>
+      <member name="data" value="5" c:identifier="GST_RTSP_MESSAGE_DATA"/>
+    </enumeration>
+    <bitfield name="RTSPProfile" c:type="GstRTSPProfile">
+      <doc xml:whitespace="preserve">The transfer profile to use.</doc>
+      <member name="unknown"
+              value="0"
+              c:identifier="GST_RTSP_PROFILE_UNKNOWN"/>
+      <member name="avp" value="1" c:identifier="GST_RTSP_PROFILE_AVP"/>
+      <member name="savp" value="2" c:identifier="GST_RTSP_PROFILE_SAVP"/>
+    </bitfield>
+    <record name="RTSPRange" c:type="GstRTSPRange">
+      <doc xml:whitespace="preserve">A type to specify a range.</doc>
+      <field name="min" writable="1">
+        <type name="gint" c:type="gint"/>
+      </field>
+      <field name="max" writable="1">
+        <type name="gint" c:type="gint"/>
+      </field>
+    </record>
+    <enumeration name="RTSPRangeUnit" c:type="GstRTSPRangeUnit">
+      <doc xml:whitespace="preserve">Different possible time range units.</doc>
+      <member name="smpte" value="0" c:identifier="GST_RTSP_RANGE_SMPTE"/>
+      <member name="smpte_30_drop"
+              value="1"
+              c:identifier="GST_RTSP_RANGE_SMPTE_30_DROP"/>
+      <member name="smpte_25"
+              value="2"
+              c:identifier="GST_RTSP_RANGE_SMPTE_25"/>
+      <member name="npt" value="3" c:identifier="GST_RTSP_RANGE_NPT"/>
+      <member name="clock" value="4" c:identifier="GST_RTSP_RANGE_CLOCK"/>
+    </enumeration>
+    <enumeration name="RTSPResult"
+                 glib:type-name="GstRTSPResult"
+                 glib:get-type="gst_rtsp_result_get_type"
+                 c:type="GstRTSPResult">
+      <doc xml:whitespace="preserve">Result codes from the RTSP functions.</doc>
+      <member name="ok" value="0" c:identifier="GST_RTSP_OK" glib:nick="ok"/>
+      <member name="error"
+              value="-1"
+              c:identifier="GST_RTSP_ERROR"
+              glib:nick="error"/>
+      <member name="einval"
+              value="-2"
+              c:identifier="GST_RTSP_EINVAL"
+              glib:nick="einval"/>
+      <member name="eintr"
+              value="-3"
+              c:identifier="GST_RTSP_EINTR"
+              glib:nick="eintr"/>
+      <member name="enomem"
+              value="-4"
+              c:identifier="GST_RTSP_ENOMEM"
+              glib:nick="enomem"/>
+      <member name="eresolv"
+              value="-5"
+              c:identifier="GST_RTSP_ERESOLV"
+              glib:nick="eresolv"/>
+      <member name="enotimpl"
+              value="-6"
+              c:identifier="GST_RTSP_ENOTIMPL"
+              glib:nick="enotimpl"/>
+      <member name="esys"
+              value="-7"
+              c:identifier="GST_RTSP_ESYS"
+              glib:nick="esys"/>
+      <member name="eparse"
+              value="-8"
+              c:identifier="GST_RTSP_EPARSE"
+              glib:nick="eparse"/>
+      <member name="ewsastart"
+              value="-9"
+              c:identifier="GST_RTSP_EWSASTART"
+              glib:nick="ewsastart"/>
+      <member name="ewsaversion"
+              value="-10"
+              c:identifier="GST_RTSP_EWSAVERSION"
+              glib:nick="ewsaversion"/>
+      <member name="eeof"
+              value="-11"
+              c:identifier="GST_RTSP_EEOF"
+              glib:nick="eeof"/>
+      <member name="enet"
+              value="-12"
+              c:identifier="GST_RTSP_ENET"
+              glib:nick="enet"/>
+      <member name="enotip"
+              value="-13"
+              c:identifier="GST_RTSP_ENOTIP"
+              glib:nick="enotip"/>
+      <member name="etimeout"
+              value="-14"
+              c:identifier="GST_RTSP_ETIMEOUT"
+              glib:nick="etimeout"/>
+      <member name="etget"
+              value="-15"
+              c:identifier="GST_RTSP_ETGET"
+              glib:nick="etget"/>
+      <member name="etpost"
+              value="-16"
+              c:identifier="GST_RTSP_ETPOST"
+              glib:nick="etpost"/>
+      <member name="elast"
+              value="-17"
+              c:identifier="GST_RTSP_ELAST"
+              glib:nick="elast"/>
+    </enumeration>
+    <enumeration name="RTSPState"
+                 glib:type-name="GstRTSPState"
+                 glib:get-type="gst_rtsp_state_get_type"
+                 c:type="GstRTSPState">
+      <doc xml:whitespace="preserve">The different RTSP states.</doc>
+      <member name="invalid"
+              value="0"
+              c:identifier="GST_RTSP_STATE_INVALID"
+              glib:nick="invalid"/>
+      <member name="init"
+              value="1"
+              c:identifier="GST_RTSP_STATE_INIT"
+              glib:nick="init"/>
+      <member name="ready"
+              value="2"
+              c:identifier="GST_RTSP_STATE_READY"
+              glib:nick="ready"/>
+      <member name="seeking"
+              value="3"
+              c:identifier="GST_RTSP_STATE_SEEKING"
+              glib:nick="seeking"/>
+      <member name="playing"
+              value="4"
+              c:identifier="GST_RTSP_STATE_PLAYING"
+              glib:nick="playing"/>
+      <member name="recording"
+              value="5"
+              c:identifier="GST_RTSP_STATE_RECORDING"
+              glib:nick="recording"/>
+    </enumeration>
+    <enumeration name="RTSPStatusCode"
+                 glib:type-name="GstRTSPStatusCode"
+                 glib:get-type="gst_rtsp_status_code_get_type"
+                 c:type="GstRTSPStatusCode">
+      <member name="invalid"
+              value="0"
+              c:identifier="GST_RTSP_STS_INVALID"
+              glib:nick="invalid"/>
+      <member name="continue"
+              value="100"
+              c:identifier="GST_RTSP_STS_CONTINUE"
+              glib:nick="continue"/>
+      <member name="ok"
+              value="200"
+              c:identifier="GST_RTSP_STS_OK"
+              glib:nick="ok"/>
+      <member name="created"
+              value="201"
+              c:identifier="GST_RTSP_STS_CREATED"
+              glib:nick="created"/>
+      <member name="low_on_storage"
+              value="250"
+              c:identifier="GST_RTSP_STS_LOW_ON_STORAGE"
+              glib:nick="low-on-storage"/>
+      <member name="multiple_choices"
+              value="300"
+              c:identifier="GST_RTSP_STS_MULTIPLE_CHOICES"
+              glib:nick="multiple-choices"/>
+      <member name="moved_permanently"
+              value="301"
+              c:identifier="GST_RTSP_STS_MOVED_PERMANENTLY"
+              glib:nick="moved-permanently"/>
+      <member name="move_temporarily"
+              value="302"
+              c:identifier="GST_RTSP_STS_MOVE_TEMPORARILY"
+              glib:nick="move-temporarily"/>
+      <member name="see_other"
+              value="303"
+              c:identifier="GST_RTSP_STS_SEE_OTHER"
+              glib:nick="see-other"/>
+      <member name="not_modified"
+              value="304"
+              c:identifier="GST_RTSP_STS_NOT_MODIFIED"
+              glib:nick="not-modified"/>
+      <member name="use_proxy"
+              value="305"
+              c:identifier="GST_RTSP_STS_USE_PROXY"
+              glib:nick="use-proxy"/>
+      <member name="bad_request"
+              value="400"
+              c:identifier="GST_RTSP_STS_BAD_REQUEST"
+              glib:nick="bad-request"/>
+      <member name="unauthorized"
+              value="401"
+              c:identifier="GST_RTSP_STS_UNAUTHORIZED"
+              glib:nick="unauthorized"/>
+      <member name="payment_required"
+              value="402"
+              c:identifier="GST_RTSP_STS_PAYMENT_REQUIRED"
+              glib:nick="payment-required"/>
+      <member name="forbidden"
+              value="403"
+              c:identifier="GST_RTSP_STS_FORBIDDEN"
+              glib:nick="forbidden"/>
+      <member name="not_found"
+              value="404"
+              c:identifier="GST_RTSP_STS_NOT_FOUND"
+              glib:nick="not-found"/>
+      <member name="method_not_allowed"
+              value="405"
+              c:identifier="GST_RTSP_STS_METHOD_NOT_ALLOWED"
+              glib:nick="method-not-allowed"/>
+      <member name="not_acceptable"
+              value="406"
+              c:identifier="GST_RTSP_STS_NOT_ACCEPTABLE"
+              glib:nick="not-acceptable"/>
+      <member name="proxy_auth_required"
+              value="407"
+              c:identifier="GST_RTSP_STS_PROXY_AUTH_REQUIRED"
+              glib:nick="proxy-auth-required"/>
+      <member name="request_timeout"
+              value="408"
+              c:identifier="GST_RTSP_STS_REQUEST_TIMEOUT"
+              glib:nick="request-timeout"/>
+      <member name="gone"
+              value="410"
+              c:identifier="GST_RTSP_STS_GONE"
+              glib:nick="gone"/>
+      <member name="length_required"
+              value="411"
+              c:identifier="GST_RTSP_STS_LENGTH_REQUIRED"
+              glib:nick="length-required"/>
+      <member name="precondition_failed"
+              value="412"
+              c:identifier="GST_RTSP_STS_PRECONDITION_FAILED"
+              glib:nick="precondition-failed"/>
+      <member name="request_entity_too_large"
+              value="413"
+              c:identifier="GST_RTSP_STS_REQUEST_ENTITY_TOO_LARGE"
+              glib:nick="request-entity-too-large"/>
+      <member name="request_uri_too_large"
+              value="414"
+              c:identifier="GST_RTSP_STS_REQUEST_URI_TOO_LARGE"
+              glib:nick="request-uri-too-large"/>
+      <member name="unsupported_media_type"
+              value="415"
+              c:identifier="GST_RTSP_STS_UNSUPPORTED_MEDIA_TYPE"
+              glib:nick="unsupported-media-type"/>
+      <member name="parameter_not_understood"
+              value="451"
+              c:identifier="GST_RTSP_STS_PARAMETER_NOT_UNDERSTOOD"
+              glib:nick="parameter-not-understood"/>
+      <member name="conference_not_found"
+              value="452"
+              c:identifier="GST_RTSP_STS_CONFERENCE_NOT_FOUND"
+              glib:nick="conference-not-found"/>
+      <member name="not_enough_bandwidth"
+              value="453"
+              c:identifier="GST_RTSP_STS_NOT_ENOUGH_BANDWIDTH"
+              glib:nick="not-enough-bandwidth"/>
+      <member name="session_not_found"
+              value="454"
+              c:identifier="GST_RTSP_STS_SESSION_NOT_FOUND"
+              glib:nick="session-not-found"/>
+      <member name="method_not_valid_in_this_state"
+              value="455"
+              c:identifier="GST_RTSP_STS_METHOD_NOT_VALID_IN_THIS_STATE"
+              glib:nick="method-not-valid-in-this-state"/>
+      <member name="header_field_not_valid_for_resource"
+              value="456"
+              c:identifier="GST_RTSP_STS_HEADER_FIELD_NOT_VALID_FOR_RESOURCE"
+              glib:nick="header-field-not-valid-for-resource"/>
+      <member name="invalid_range"
+              value="457"
+              c:identifier="GST_RTSP_STS_INVALID_RANGE"
+              glib:nick="invalid-range"/>
+      <member name="parameter_is_readonly"
+              value="458"
+              c:identifier="GST_RTSP_STS_PARAMETER_IS_READONLY"
+              glib:nick="parameter-is-readonly"/>
+      <member name="aggregate_operation_not_allowed"
+              value="459"
+              c:identifier="GST_RTSP_STS_AGGREGATE_OPERATION_NOT_ALLOWED"
+              glib:nick="aggregate-operation-not-allowed"/>
+      <member name="only_aggregate_operation_allowed"
+              value="460"
+              c:identifier="GST_RTSP_STS_ONLY_AGGREGATE_OPERATION_ALLOWED"
+              glib:nick="only-aggregate-operation-allowed"/>
+      <member name="unsupported_transport"
+              value="461"
+              c:identifier="GST_RTSP_STS_UNSUPPORTED_TRANSPORT"
+              glib:nick="unsupported-transport"/>
+      <member name="destination_unreachable"
+              value="462"
+              c:identifier="GST_RTSP_STS_DESTINATION_UNREACHABLE"
+              glib:nick="destination-unreachable"/>
+      <member name="internal_server_error"
+              value="500"
+              c:identifier="GST_RTSP_STS_INTERNAL_SERVER_ERROR"
+              glib:nick="internal-server-error"/>
+      <member name="not_implemented"
+              value="501"
+              c:identifier="GST_RTSP_STS_NOT_IMPLEMENTED"
+              glib:nick="not-implemented"/>
+      <member name="bad_gateway"
+              value="502"
+              c:identifier="GST_RTSP_STS_BAD_GATEWAY"
+              glib:nick="bad-gateway"/>
+      <member name="service_unavailable"
+              value="503"
+              c:identifier="GST_RTSP_STS_SERVICE_UNAVAILABLE"
+              glib:nick="service-unavailable"/>
+      <member name="gateway_timeout"
+              value="504"
+              c:identifier="GST_RTSP_STS_GATEWAY_TIMEOUT"
+              glib:nick="gateway-timeout"/>
+      <member name="rtsp_version_not_supported"
+              value="505"
+              c:identifier="GST_RTSP_STS_RTSP_VERSION_NOT_SUPPORTED"
+              glib:nick="rtsp-version-not-supported"/>
+      <member name="option_not_supported"
+              value="551"
+              c:identifier="GST_RTSP_STS_OPTION_NOT_SUPPORTED"
+              glib:nick="option-not-supported"/>
+    </enumeration>
+    <record name="RTSPTime" c:type="GstRTSPTime">
+      <doc xml:whitespace="preserve">A time indication.</doc>
+      <field name="type" writable="1">
+        <type name="RTSPTimeType" c:type="GstRTSPTimeType"/>
+      </field>
+      <field name="seconds" writable="1">
+        <type name="gdouble" c:type="gdouble"/>
+      </field>
+    </record>
+    <record name="RTSPTimeRange" c:type="GstRTSPTimeRange">
+      <doc xml:whitespace="preserve">A time range.</doc>
+      <field name="unit" writable="1">
+        <type name="RTSPRangeUnit" c:type="GstRTSPRangeUnit"/>
+      </field>
+      <field name="min" writable="1">
+        <type name="RTSPTime" c:type="GstRTSPTime"/>
+      </field>
+      <field name="max" writable="1">
+        <type name="RTSPTime" c:type="GstRTSPTime"/>
+      </field>
+    </record>
+    <enumeration name="RTSPTimeType" c:type="GstRTSPTimeType">
+      <doc xml:whitespace="preserve">Possible time types.</doc>
+      <member name="seconds" value="0" c:identifier="GST_RTSP_TIME_SECONDS"/>
+      <member name="now" value="1" c:identifier="GST_RTSP_TIME_NOW"/>
+      <member name="end" value="2" c:identifier="GST_RTSP_TIME_END"/>
+    </enumeration>
+    <bitfield name="RTSPTransMode" c:type="GstRTSPTransMode">
+      <doc xml:whitespace="preserve">The transfer mode to use.</doc>
+      <member name="unknown" value="0" c:identifier="GST_RTSP_TRANS_UNKNOWN"/>
+      <member name="rtp" value="1" c:identifier="GST_RTSP_TRANS_RTP"/>
+      <member name="rdt" value="2" c:identifier="GST_RTSP_TRANS_RDT"/>
+    </bitfield>
+    <record name="RTSPTransport" c:type="GstRTSPTransport">
+      <doc xml:whitespace="preserve">A structure holding the RTSP transport values.</doc>
+      <field name="trans" writable="1">
+        <type name="RTSPTransMode" c:type="GstRTSPTransMode"/>
+      </field>
+      <field name="profile" writable="1">
+        <type name="RTSPProfile" c:type="GstRTSPProfile"/>
+      </field>
+      <field name="lower_transport" writable="1">
+        <type name="RTSPLowerTrans" c:type="GstRTSPLowerTrans"/>
+      </field>
+      <field name="destination" writable="1">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <field name="source" writable="1">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <field name="layers" writable="1">
+        <type name="guint" c:type="guint"/>
+      </field>
+      <field name="mode_play" writable="1">
+        <type name="gboolean" c:type="gboolean"/>
+      </field>
+      <field name="mode_record" writable="1">
+        <type name="gboolean" c:type="gboolean"/>
+      </field>
+      <field name="append" writable="1">
+        <type name="gboolean" c:type="gboolean"/>
+      </field>
+      <field name="interleaved" writable="1">
+        <type name="RTSPRange" c:type="GstRTSPRange"/>
+      </field>
+      <field name="ttl" writable="1">
+        <type name="guint" c:type="guint"/>
+      </field>
+      <field name="port" writable="1">
+        <type name="RTSPRange" c:type="GstRTSPRange"/>
+      </field>
+      <field name="client_port" writable="1">
+        <type name="RTSPRange" c:type="GstRTSPRange"/>
+      </field>
+      <field name="server_port" writable="1">
+        <type name="RTSPRange" c:type="GstRTSPRange"/>
+      </field>
+      <field name="ssrc" writable="1">
+        <type name="guint" c:type="guint"/>
+      </field>
+      <method name="as_text" c:identifier="gst_rtsp_transport_as_text">
+        <doc xml:whitespace="preserve">Convert @transport into a string that can be used to signal the transport in
+an RTSP SETUP response.
+is invalid.</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">a string describing the RTSP transport or #NULL when the transport</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </return-value>
+      </method>
+      <method name="free" c:identifier="gst_rtsp_transport_free">
+        <doc xml:whitespace="preserve">Free the memory used by @transport.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_RTSP_OK.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+      </method>
+      <method name="init" c:identifier="gst_rtsp_transport_init">
+        <doc xml:whitespace="preserve">Initialize @transport so that it can be used.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_RTSP_OK.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+      </method>
+    </record>
+    <record name="RTSPUrl"
+            c:type="GstRTSPUrl"
+            glib:type-name="GstRTSPUrl"
+            glib:get-type="gst_rtsp_url_get_type"
+            c:symbol-prefix="rtsp_url">
+      <doc xml:whitespace="preserve">This structure contains the result of a parsed RTSP URL</doc>
+      <field name="transports" writable="1">
+        <type name="RTSPLowerTrans" c:type="GstRTSPLowerTrans"/>
+      </field>
+      <field name="family" writable="1">
+        <type name="RTSPFamily" c:type="GstRTSPFamily"/>
+      </field>
+      <field name="user" writable="1">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <field name="passwd" writable="1">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <field name="host" writable="1">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <field name="port" writable="1">
+        <type name="guint16" c:type="guint16"/>
+      </field>
+      <field name="abspath" writable="1">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <field name="query" writable="1">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <method name="copy" c:identifier="gst_rtsp_url_copy" version="0.10.22">
+        <doc xml:whitespace="preserve">Make a copy of @url.</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">a copy of @url. Free with gst_rtsp_url_free () after usage.</doc>
+          <type name="RTSPUrl" c:type="GstRTSPUrl*"/>
+        </return-value>
+      </method>
+      <method name="decode_path_components"
+              c:identifier="gst_rtsp_url_decode_path_components"
+              version="0.10.32"
+              introspectable="0">
+        <doc xml:whitespace="preserve">Splits the path of @url on '/' boundaries, decoding the resulting components,
+The decoding performed by this routine is "URI decoding", as defined in RFC
+3986, commonly known as percent-decoding. For example, a string "foo%2fbar"
+will decode to "foo/bar" -- the %2f being replaced by the corresponding byte
+with hex value 0x2f. Note that there is no guarantee that the resulting byte
+sequence is valid in any given encoding. As a special case, %00 is not
+unescaped to NUL, as that would prematurely terminate the string.
+Also note that since paths usually start with a slash, the first component
+will usually be the empty string.</doc>
+        <return-value>
+          <doc xml:whitespace="preserve">a string vector. g_strfreev() after usage.</doc>
+          <array c:type="gchar**">
+            <type name="utf8"/>
+          </array>
+        </return-value>
+      </method>
+      <method name="free" c:identifier="gst_rtsp_url_free">
+        <doc xml:whitespace="preserve">Free the memory used by @url.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+      </method>
+      <method name="get_port" c:identifier="gst_rtsp_url_get_port">
+        <doc xml:whitespace="preserve">Get the port number of @url.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_RTSP_OK.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="port" transfer-ownership="none">
+            <doc xml:whitespace="preserve">location to hold the port</doc>
+            <type name="guint16" c:type="guint16*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="get_request_uri"
+              c:identifier="gst_rtsp_url_get_request_uri">
+        <doc xml:whitespace="preserve">Get a newly allocated string describing the request URI for @url.</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">a string with the request URI. g_free() after usage.</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </return-value>
+      </method>
+      <method name="set_port" c:identifier="gst_rtsp_url_set_port">
+        <doc xml:whitespace="preserve">Set the port number in @url to @port.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_RTSP_OK.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="port" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the port</doc>
+            <type name="guint16" c:type="guint16"/>
+          </parameter>
+        </parameters>
+      </method>
+    </record>
+    <enumeration name="RTSPVersion"
+                 glib:type-name="GstRTSPVersion"
+                 glib:get-type="gst_rtsp_version_get_type"
+                 c:type="GstRTSPVersion">
+      <doc xml:whitespace="preserve">The supported RTSP versions.</doc>
+      <member name="invalid"
+              value="0"
+              c:identifier="GST_RTSP_VERSION_INVALID"
+              glib:nick="invalid"/>
+      <member name="1_0"
+              value="16"
+              c:identifier="GST_RTSP_VERSION_1_0"
+              glib:nick="1-0"/>
+      <member name="1_1"
+              value="17"
+              c:identifier="GST_RTSP_VERSION_1_1"
+              glib:nick="1-1"/>
+    </enumeration>
+    <record name="RTSPWatch" c:type="GstRTSPWatch" disguised="1">
+      <doc xml:whitespace="preserve">Opaque RTSP watch object that can be used for asynchronous RTSP
+operations.</doc>
+      <method name="attach"
+              c:identifier="gst_rtsp_watch_attach"
+              version="0.10.23">
+        <doc xml:whitespace="preserve">Adds a #GstRTSPWatch to a context so that it will be executed within that context.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the ID (greater than 0) for the watch within the GMainContext.</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+        <parameters>
+          <parameter name="context" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a GMainContext (if NULL, the default context will be used)</doc>
+            <type name="GLib.MainContext" c:type="GMainContext*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="queue_data"
+              c:identifier="gst_rtsp_watch_queue_data"
+              version="0.10.24"
+              deprecated="Use gst_rtsp_watch_write_data()">
+        <doc xml:whitespace="preserve">Queue @data for transmission in @watch. It will be transmitted when the
+connection of the @watch becomes writable.
+This function will take ownership of @data and g_free() it after use.
+The return value of this function will be used as the id argument in the
+message_sent callback.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">an id.</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+        <parameters>
+          <parameter name="data" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the data to queue</doc>
+            <type name="guint8" c:type="guint8*"/>
+          </parameter>
+          <parameter name="size" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the size of @data</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="queue_message"
+              c:identifier="gst_rtsp_watch_queue_message"
+              version="0.10.23"
+              deprecated="Use gst_rtsp_watch_send_message()">
+        <doc xml:whitespace="preserve">Queue a @message for transmission in @watch. The contents of this
+message will be serialized and transmitted when the connection of the
+The return value of this function will be used as the id argument in the
+message_sent callback.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">an id.</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+        <parameters>
+          <parameter name="message" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a #GstRTSPMessage</doc>
+            <type name="RTSPMessage" c:type="GstRTSPMessage*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="reset"
+              c:identifier="gst_rtsp_watch_reset"
+              version="0.10.23">
+        <doc xml:whitespace="preserve">Reset @watch, this is usually called after gst_rtsp_connection_do_tunnel()
+when the file descriptors of the connection might have changed.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+      </method>
+      <method name="send_message"
+              c:identifier="gst_rtsp_watch_send_message"
+              version="0.10.25">
+        <doc xml:whitespace="preserve">Send a @message using the connection of the @watch. If it cannot be sent
+immediately, it will be queued for transmission in @watch. The contents of
+callback.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_RTSP_OK on success.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="message" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a #GstRTSPMessage</doc>
+            <type name="RTSPMessage" c:type="GstRTSPMessage*"/>
+          </parameter>
+          <parameter name="id" transfer-ownership="none">
+            <doc xml:whitespace="preserve">location for a message ID or %NULL</doc>
+            <type name="guint" c:type="guint*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="unref"
+              c:identifier="gst_rtsp_watch_unref"
+              version="0.10.23">
+        <doc xml:whitespace="preserve">Decreases the reference count of @watch by one. If the resulting reference
+count is zero the watch and associated memory will be destroyed.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+      </method>
+      <method name="write_data"
+              c:identifier="gst_rtsp_watch_write_data"
+              version="0.10.25">
+        <doc xml:whitespace="preserve">Write @data using the connection of the @watch. If it cannot be sent
+immediately, it will be queued for transmission in @watch. The contents of
+callback.
+This function will take ownership of @data and g_free() it after use.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_RTSP_OK on success.</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="data" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the data to queue</doc>
+            <type name="guint8" c:type="guint8*"/>
+          </parameter>
+          <parameter name="size" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the size of @data</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+          <parameter name="id" transfer-ownership="none">
+            <doc xml:whitespace="preserve">location for a message ID or %NULL</doc>
+            <type name="guint" c:type="guint*"/>
+          </parameter>
+        </parameters>
+      </method>
+    </record>
+    <record name="RTSPWatchFuncs" c:type="GstRTSPWatchFuncs" version="0.10.23">
+      <doc xml:whitespace="preserve">Callback functions from a #GstRTSPWatch.</doc>
+      <field name="message_received">
+        <callback name="message_received">
+          <return-value transfer-ownership="none">
+            <type name="RTSPResult" c:type="GstRTSPResult"/>
+          </return-value>
+          <parameters>
+            <parameter name="watch" transfer-ownership="none">
+              <type name="RTSPWatch" c:type="GstRTSPWatch*"/>
+            </parameter>
+            <parameter name="message" transfer-ownership="none">
+              <type name="RTSPMessage" c:type="GstRTSPMessage*"/>
+            </parameter>
+            <parameter name="user_data" transfer-ownership="none" closure="2">
+              <type name="gpointer" c:type="gpointer"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="message_sent">
+        <callback name="message_sent">
+          <return-value transfer-ownership="none">
+            <type name="RTSPResult" c:type="GstRTSPResult"/>
+          </return-value>
+          <parameters>
+            <parameter name="watch" transfer-ownership="none">
+              <type name="RTSPWatch" c:type="GstRTSPWatch*"/>
+            </parameter>
+            <parameter name="id" transfer-ownership="none">
+              <type name="guint" c:type="guint"/>
+            </parameter>
+            <parameter name="user_data" transfer-ownership="none" closure="2">
+              <type name="gpointer" c:type="gpointer"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="closed">
+        <callback name="closed">
+          <return-value transfer-ownership="none">
+            <type name="RTSPResult" c:type="GstRTSPResult"/>
+          </return-value>
+          <parameters>
+            <parameter name="watch" transfer-ownership="none">
+              <type name="RTSPWatch" c:type="GstRTSPWatch*"/>
+            </parameter>
+            <parameter name="user_data" transfer-ownership="none" closure="1">
+              <type name="gpointer" c:type="gpointer"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="error">
+        <callback name="error">
+          <return-value transfer-ownership="none">
+            <type name="RTSPResult" c:type="GstRTSPResult"/>
+          </return-value>
+          <parameters>
+            <parameter name="watch" transfer-ownership="none">
+              <type name="RTSPWatch" c:type="GstRTSPWatch*"/>
+            </parameter>
+            <parameter name="result" transfer-ownership="none">
+              <type name="RTSPResult" c:type="GstRTSPResult"/>
+            </parameter>
+            <parameter name="user_data" transfer-ownership="none" closure="2">
+              <type name="gpointer" c:type="gpointer"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="tunnel_start">
+        <callback name="tunnel_start">
+          <return-value transfer-ownership="none">
+            <type name="RTSPStatusCode" c:type="GstRTSPStatusCode"/>
+          </return-value>
+          <parameters>
+            <parameter name="watch" transfer-ownership="none">
+              <type name="RTSPWatch" c:type="GstRTSPWatch*"/>
+            </parameter>
+            <parameter name="user_data" transfer-ownership="none" closure="1">
+              <type name="gpointer" c:type="gpointer"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="tunnel_complete">
+        <callback name="tunnel_complete">
+          <return-value transfer-ownership="none">
+            <type name="RTSPResult" c:type="GstRTSPResult"/>
+          </return-value>
+          <parameters>
+            <parameter name="watch" transfer-ownership="none">
+              <type name="RTSPWatch" c:type="GstRTSPWatch*"/>
+            </parameter>
+            <parameter name="user_data" transfer-ownership="none" closure="1">
+              <type name="gpointer" c:type="gpointer"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="error_full">
+        <callback name="error_full">
+          <return-value transfer-ownership="none">
+            <type name="RTSPResult" c:type="GstRTSPResult"/>
+          </return-value>
+          <parameters>
+            <parameter name="watch" transfer-ownership="none">
+              <type name="RTSPWatch" c:type="GstRTSPWatch*"/>
+            </parameter>
+            <parameter name="result" transfer-ownership="none">
+              <type name="RTSPResult" c:type="GstRTSPResult"/>
+            </parameter>
+            <parameter name="message" transfer-ownership="none">
+              <type name="RTSPMessage" c:type="GstRTSPMessage*"/>
+            </parameter>
+            <parameter name="id" transfer-ownership="none">
+              <type name="guint" c:type="guint"/>
+            </parameter>
+            <parameter name="user_data" transfer-ownership="none" closure="4">
+              <type name="gpointer" c:type="gpointer"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="tunnel_lost">
+        <callback name="tunnel_lost">
+          <return-value transfer-ownership="none">
+            <type name="RTSPResult" c:type="GstRTSPResult"/>
+          </return-value>
+          <parameters>
+            <parameter name="watch" transfer-ownership="none">
+              <type name="RTSPWatch" c:type="GstRTSPWatch*"/>
+            </parameter>
+            <parameter name="user_data" transfer-ownership="none" closure="1">
+              <type name="gpointer" c:type="gpointer"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="_gst_reserved" writable="1">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="2">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </record>
+    <constant name="RTSP_DEFAULT_PORT" value="554">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <function name="rtsp_base64_decode_ip"
+              c:identifier="gst_rtsp_base64_decode_ip"
+              deprecated="use g_base64_decode_inplace() instead.">
+      <doc xml:whitespace="preserve">Decode the base64 string pointed to by @data in-place. When @len is not #NULL
+it will contain the length of the decoded data.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="data" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the base64 encoded data</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+        <parameter name="len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">location for output length or NULL</doc>
+          <type name="gulong" c:type="gsize*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtsp_base64_encode"
+              c:identifier="gst_rtsp_base64_encode"
+              deprecated="Use g_base64_encode()">
+      <doc xml:whitespace="preserve">Encode a sequence of binary data into its Base-64 stringified representation.
+representing @data.</doc>
+      <return-value transfer-ownership="full">
+        <doc xml:whitespace="preserve">a newly allocated, zero-terminated Base-64 encoded string</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="data" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the binary data to encode</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+        <parameter name="len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the length of @data</doc>
+          <type name="gulong" c:type="gsize"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtsp_connection_accept"
+              c:identifier="gst_rtsp_connection_accept"
+              version="0.10.23">
+      <doc xml:whitespace="preserve">Accept a new connection on @sock and create a new #GstRTSPConnection for
+handling communication on new socket.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">#GST_RTSP_OK when @conn contains a valid connection.</doc>
+        <type name="RTSPResult" c:type="GstRTSPResult"/>
+      </return-value>
+      <parameters>
+        <parameter name="sock" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a socket</doc>
+          <type name="gint" c:type="gint"/>
+        </parameter>
+        <parameter name="conn" transfer-ownership="none">
+          <doc xml:whitespace="preserve">storage for a #GstRTSPConnection</doc>
+          <type name="RTSPConnection" c:type="GstRTSPConnection**"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtsp_connection_create"
+              c:identifier="gst_rtsp_connection_create">
+      <doc xml:whitespace="preserve">Create a newly allocated #GstRTSPConnection from @url and store it in @conn.
+The connection will not yet attempt to connect to @url, use
+gst_rtsp_connection_connect().
+A copy of @url will be made.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">#GST_RTSP_OK when @conn contains a valid connection.</doc>
+        <type name="RTSPResult" c:type="GstRTSPResult"/>
+      </return-value>
+      <parameters>
+        <parameter name="url" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstRTSPUrl</doc>
+          <type name="RTSPUrl" c:type="GstRTSPUrl*"/>
+        </parameter>
+        <parameter name="conn" transfer-ownership="none">
+          <doc xml:whitespace="preserve">storage for a #GstRTSPConnection</doc>
+          <type name="RTSPConnection" c:type="GstRTSPConnection**"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtsp_connection_create_from_fd"
+              c:identifier="gst_rtsp_connection_create_from_fd"
+              version="0.10.25">
+      <doc xml:whitespace="preserve">Create a new #GstRTSPConnection for handling communication on the existing
+file descriptor @fd. The @initial_buffer contains any data already read from</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">#GST_RTSP_OK when @conn contains a valid connection.</doc>
+        <type name="RTSPResult" c:type="GstRTSPResult"/>
+      </return-value>
+      <parameters>
+        <parameter name="fd" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a file descriptor</doc>
+          <type name="gint" c:type="gint"/>
+        </parameter>
+        <parameter name="ip" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the IP address of the other end</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+        <parameter name="port" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the port used by the other end</doc>
+          <type name="guint16" c:type="guint16"/>
+        </parameter>
+        <parameter name="initial_buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">data already read from @fd</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+        <parameter name="conn" transfer-ownership="none">
+          <doc xml:whitespace="preserve">storage for a #GstRTSPConnection</doc>
+          <type name="RTSPConnection" c:type="GstRTSPConnection**"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtsp_find_header_field"
+              c:identifier="gst_rtsp_find_header_field">
+      <doc xml:whitespace="preserve">Convert @header to a #GstRTSPHeaderField.
+header field is unknown.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">a #GstRTSPHeaderField for @header or #GST_RTSP_HDR_INVALID if the</doc>
+        <type name="RTSPHeaderField" c:type="GstRTSPHeaderField"/>
+      </return-value>
+      <parameters>
+        <parameter name="header" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a header string</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtsp_find_method" c:identifier="gst_rtsp_find_method">
+      <doc xml:whitespace="preserve">Convert @method to a #GstRTSPMethod.
+method is unknown.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">a #GstRTSPMethod for @method or #GST_RTSP_INVALID if the</doc>
+        <type name="RTSPMethod" c:type="GstRTSPMethod"/>
+      </return-value>
+      <parameters>
+        <parameter name="method" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a method</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtsp_header_allow_multiple"
+              c:identifier="gst_rtsp_header_allow_multiple"
+              version="0.10.25">
+      <doc xml:whitespace="preserve">Check whether @field may appear multiple times in a message.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">%TRUE if multiple headers are allowed.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="field" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstRTSPHeaderField</doc>
+          <type name="RTSPHeaderField" c:type="GstRTSPHeaderField"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtsp_header_as_text"
+              c:identifier="gst_rtsp_header_as_text">
+      <doc xml:whitespace="preserve">Convert @field to a string.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">a string representation of @field.</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="field" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstRTSPHeaderField</doc>
+          <type name="RTSPHeaderField" c:type="GstRTSPHeaderField"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtsp_message_get_type"
+              c:identifier="gst_rtsp_message_get_type">
+      <doc xml:whitespace="preserve">Get the message type of @msg.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">the message type.</doc>
+        <type name="RTSPMsgType" c:type="GstRTSPMsgType"/>
+      </return-value>
+      <parameters>
+        <parameter name="msg" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstRTSPMessage</doc>
+          <type name="RTSPMessage" c:type="GstRTSPMessage*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtsp_message_new" c:identifier="gst_rtsp_message_new">
+      <doc xml:whitespace="preserve">Create a new initialized #GstRTSPMessage. Free with gst_rtsp_message_free().</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">a #GstRTSPResult.</doc>
+        <type name="RTSPResult" c:type="GstRTSPResult"/>
+      </return-value>
+      <parameters>
+        <parameter name="msg" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a location for the new #GstRTSPMessage</doc>
+          <type name="RTSPMessage" c:type="GstRTSPMessage**"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtsp_message_new_data"
+              c:identifier="gst_rtsp_message_new_data">
+      <doc xml:whitespace="preserve">Create a new data #GstRTSPMessage with @channel and store the
+result message in @msg. Free with gst_rtsp_message_free().</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">a #GstRTSPResult.</doc>
+        <type name="RTSPResult" c:type="GstRTSPResult"/>
+      </return-value>
+      <parameters>
+        <parameter name="msg" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a location for the new #GstRTSPMessage</doc>
+          <type name="RTSPMessage" c:type="GstRTSPMessage**"/>
+        </parameter>
+        <parameter name="channel" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the channel</doc>
+          <type name="guint8" c:type="guint8"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtsp_message_new_request"
+              c:identifier="gst_rtsp_message_new_request">
+      <doc xml:whitespace="preserve">Create a new #GstRTSPMessage with @method and @uri and store the result
+request message in @msg. Free with gst_rtsp_message_free().</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">a #GstRTSPResult.</doc>
+        <type name="RTSPResult" c:type="GstRTSPResult"/>
+      </return-value>
+      <parameters>
+        <parameter name="msg" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a location for the new #GstRTSPMessage</doc>
+          <type name="RTSPMessage" c:type="GstRTSPMessage**"/>
+        </parameter>
+        <parameter name="method" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the request method to use</doc>
+          <type name="RTSPMethod" c:type="GstRTSPMethod"/>
+        </parameter>
+        <parameter name="uri" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the uri of the request</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtsp_message_new_response"
+              c:identifier="gst_rtsp_message_new_response">
+      <doc xml:whitespace="preserve">Create a new response #GstRTSPMessage with @code and @reason and store the
+result message in @msg. Free with gst_rtsp_message_free().
+When @reason is #NULL, the default reason for @code will be used.
+When @request is not #NULL, the relevant headers will be copied to the new
+response message.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">a #GstRTSPResult.</doc>
+        <type name="RTSPResult" c:type="GstRTSPResult"/>
+      </return-value>
+      <parameters>
+        <parameter name="msg" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a location for the new #GstRTSPMessage</doc>
+          <type name="RTSPMessage" c:type="GstRTSPMessage**"/>
+        </parameter>
+        <parameter name="code" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the status code</doc>
+          <type name="RTSPStatusCode" c:type="GstRTSPStatusCode"/>
+        </parameter>
+        <parameter name="reason" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the status reason or #NULL</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+        <parameter name="request" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the request that triggered the response or #NULL</doc>
+          <type name="RTSPMessage" c:type="GstRTSPMessage*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtsp_method_as_text"
+              c:identifier="gst_rtsp_method_as_text">
+      <doc xml:whitespace="preserve">Convert @method to a string.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">a string representation of @method.</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="method" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstRTSPMethod</doc>
+          <type name="RTSPMethod" c:type="GstRTSPMethod"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtsp_options_as_text"
+              c:identifier="gst_rtsp_options_as_text"
+              version="0.10.23">
+      <doc xml:whitespace="preserve">Convert @options to a string.</doc>
+      <return-value transfer-ownership="full">
+        <doc xml:whitespace="preserve">a new string of @options. g_free() after usage.</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="options" transfer-ownership="none">
+          <doc xml:whitespace="preserve">one or more #GstRTSPMethod</doc>
+          <type name="RTSPMethod" c:type="GstRTSPMethod"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtsp_range_free" c:identifier="gst_rtsp_range_free">
+      <doc xml:whitespace="preserve">Free the memory alocated by @range.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="range" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstRTSPTimeRange</doc>
+          <type name="RTSPTimeRange" c:type="GstRTSPTimeRange*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtsp_range_parse" c:identifier="gst_rtsp_range_parse">
+      <doc xml:whitespace="preserve">Parse @rangestr to a #GstRTSPTimeRange.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">#GST_RTSP_OK on success.</doc>
+        <type name="RTSPResult" c:type="GstRTSPResult"/>
+      </return-value>
+      <parameters>
+        <parameter name="rangestr" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a range string to parse</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+        <parameter name="range" transfer-ownership="none">
+          <doc xml:whitespace="preserve">location to hold the #GstRTSPTimeRange result</doc>
+          <type name="RTSPTimeRange" c:type="GstRTSPTimeRange**"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtsp_range_to_string"
+              c:identifier="gst_rtsp_range_to_string"
+              version="0.10.23">
+      <doc xml:whitespace="preserve">Convert @range into a string representation.</doc>
+      <return-value transfer-ownership="full">
+        <doc xml:whitespace="preserve">The string representation of @range. g_free() after usage.</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="range" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstRTSPTimeRange</doc>
+          <type name="RTSPTimeRange" c:type="GstRTSPTimeRange*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtsp_status_as_text"
+              c:identifier="gst_rtsp_status_as_text">
+      <doc xml:whitespace="preserve">Convert @code to a string.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">a string representation of @code.</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="code" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstRTSPStatusCode</doc>
+          <type name="RTSPStatusCode" c:type="GstRTSPStatusCode"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtsp_strresult" c:identifier="gst_rtsp_strresult">
+      <doc xml:whitespace="preserve">Convert @result in a human readable string.</doc>
+      <return-value transfer-ownership="full">
+        <doc xml:whitespace="preserve">a newly allocated string. g_free() after usage.</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="result" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstRTSPResult</doc>
+          <type name="RTSPResult" c:type="GstRTSPResult"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtsp_transport_get_manager"
+              c:identifier="gst_rtsp_transport_get_manager">
+      <doc xml:whitespace="preserve">Get the #GStreamer element that can handle the buffers transported over
+It is possible that there are several managers available, use @option to
+selected one.
+needed/available for @trans.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">#GST_RTSP_OK.</doc>
+        <type name="RTSPResult" c:type="GstRTSPResult"/>
+      </return-value>
+      <parameters>
+        <parameter name="trans" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstRTSPTransMode</doc>
+          <type name="RTSPTransMode" c:type="GstRTSPTransMode"/>
+        </parameter>
+        <parameter name="manager" transfer-ownership="none">
+          <doc xml:whitespace="preserve">location to hold the result</doc>
+          <type name="utf8" c:type="gchar**"/>
+        </parameter>
+        <parameter name="option" transfer-ownership="none">
+          <doc xml:whitespace="preserve">option index.</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtsp_transport_get_mime"
+              c:identifier="gst_rtsp_transport_get_mime">
+      <doc xml:whitespace="preserve">Get the mime type of the transport mode @trans. This mime type is typically
+used to generate #GstCaps on buffers.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">#GST_RTSP_OK.</doc>
+        <type name="RTSPResult" c:type="GstRTSPResult"/>
+      </return-value>
+      <parameters>
+        <parameter name="trans" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstRTSPTransMode</doc>
+          <type name="RTSPTransMode" c:type="GstRTSPTransMode"/>
+        </parameter>
+        <parameter name="mime" transfer-ownership="none">
+          <doc xml:whitespace="preserve">location to hold the result</doc>
+          <type name="utf8" c:type="gchar**"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtsp_transport_new" c:identifier="gst_rtsp_transport_new">
+      <doc xml:whitespace="preserve">Allocate a new initialized #GstRTSPTransport. Use gst_rtsp_transport_free()
+after usage.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">a #GstRTSPResult.</doc>
+        <type name="RTSPResult" c:type="GstRTSPResult"/>
+      </return-value>
+      <parameters>
+        <parameter name="transport" transfer-ownership="none">
+          <doc xml:whitespace="preserve">location to hold the new #GstRTSPTransport</doc>
+          <type name="RTSPTransport" c:type="GstRTSPTransport**"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtsp_transport_parse"
+              c:identifier="gst_rtsp_transport_parse">
+      <doc xml:whitespace="preserve">Parse the RTSP transport string @str into @transport.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">a #GstRTSPResult.</doc>
+        <type name="RTSPResult" c:type="GstRTSPResult"/>
+      </return-value>
+      <parameters>
+        <parameter name="str" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a transport string</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+        <parameter name="transport" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstRTSPTransport</doc>
+          <type name="RTSPTransport" c:type="GstRTSPTransport*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtsp_url_parse" c:identifier="gst_rtsp_url_parse">
+      <doc xml:whitespace="preserve">Parse the RTSP @urlstr into a newly allocated #GstRTSPUrl. Free after usage
+with gst_rtsp_url_free().</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">a #GstRTSPResult.</doc>
+        <type name="RTSPResult" c:type="GstRTSPResult"/>
+      </return-value>
+      <parameters>
+        <parameter name="urlstr" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the url string to parse</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+        <parameter name="url" transfer-ownership="none">
+          <doc xml:whitespace="preserve">location to hold the result.</doc>
+          <type name="RTSPUrl" c:type="GstRTSPUrl**"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtsp_version_as_text"
+              c:identifier="gst_rtsp_version_as_text">
+      <doc xml:whitespace="preserve">Convert @version to a string.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">a string representation of @version.</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="version" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstRTSPVersion</doc>
+          <type name="RTSPVersion" c:type="GstRTSPVersion"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="rtsp_watch_new"
+              c:identifier="gst_rtsp_watch_new"
+              version="0.10.23"
+              introspectable="0">
+      <doc xml:whitespace="preserve">Create a watch object for @conn. The functions provided in @funcs will be
+called with @user_data when activity happened on the watch.
+The new watch is usually created so that it can be attached to a
+maincontext with gst_rtsp_watch_attach(). 
+communication. Free with gst_rtsp_watch_unref () after usage.</doc>
+      <return-value>
+        <doc xml:whitespace="preserve">a #GstRTSPWatch that can be used for asynchronous RTSP</doc>
+        <type name="RTSPWatch" c:type="GstRTSPWatch*"/>
+      </return-value>
+      <parameters>
+        <parameter name="conn" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstRTSPConnection</doc>
+          <type name="RTSPConnection" c:type="GstRTSPConnection*"/>
+        </parameter>
+        <parameter name="funcs" transfer-ownership="none">
+          <doc xml:whitespace="preserve">watch functions</doc>
+          <type name="RTSPWatchFuncs" c:type="GstRTSPWatchFuncs*"/>
+        </parameter>
+        <parameter name="user_data" transfer-ownership="none">
+          <doc xml:whitespace="preserve">user data to pass to @funcs</doc>
+          <type name="gpointer" c:type="gpointer"/>
+        </parameter>
+        <parameter name="notify" transfer-ownership="none" scope="async">
+          <doc xml:whitespace="preserve">notify when @user_data is not referenced anymore</doc>
+          <type name="GLib.DestroyNotify" c:type="GDestroyNotify"/>
+        </parameter>
+      </parameters>
+    </function>
+  </namespace>
+</repository>
diff --git a/gstreamer/plugins/rtsp/ffi/ffi.factor b/gstreamer/plugins/rtsp/ffi/ffi.factor
new file mode 100644 (file)
index 0000000..a3989d7
--- /dev/null
@@ -0,0 +1,20 @@
+! Copyright (C) 2010 Anton Gorenko.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.syntax alien.libraries combinators kernel
+system
+gobject-introspection glib.ffi gstreamer.ffi gstreamer.sdp.ffi ;
+IN: gstreamer.rtsp.ffi
+
+<<
+"gstreamer.rtsp" {
+    { [ os winnt? ] [ drop ] }
+    { [ os macosx? ] [ drop ] }
+    { [ os unix? ] [ "libgstrtsp-0.10.so" cdecl add-library ] }
+} cond
+>>
+
+! git error (there is _GstRTSPTransport only in .gir)
+C-TYPE: GstRTSPTransport
+
+GIR: vocab:gstreamer/rtsp/GstRtsp-0.10.gir
+
diff --git a/gstreamer/plugins/rtsp/rtsp.factor b/gstreamer/plugins/rtsp/rtsp.factor
new file mode 100644 (file)
index 0000000..72069f6
--- /dev/null
@@ -0,0 +1,5 @@
+! Copyright (C) 2010 Anton Gorenko.
+! See http://factorcode.org/license.txt for BSD license.
+USING: gstreamer.rtsp.ffi ;
+IN: gstreamer.rtsp
+
diff --git a/gstreamer/plugins/sdp/GstSdp-0.10.gir b/gstreamer/plugins/sdp/GstSdp-0.10.gir
new file mode 100644 (file)
index 0000000..5cdb692
--- /dev/null
@@ -0,0 +1,1220 @@
+<?xml version="1.0"?>
+<!-- This file was automatically generated from C sources - DO NOT EDIT!
+To affect the contents of this file, edit the original C definitions,
+and/or use gtk-doc annotations.  -->
+<repository version="1.2"
+            xmlns="http://www.gtk.org/introspection/core/1.0"
+            xmlns:c="http://www.gtk.org/introspection/c/1.0"
+            xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+  <include name="GLib" version="2.0"/>
+  <include name="GModule" version="2.0"/>
+  <include name="GObject" version="2.0"/>
+  <include name="Gst" version="0.10"/>
+  <include name="libxml2" version="2.0"/>
+  <package name="gstreamer-sdp-0.10"/>
+  <c:include name="gst/audio/gstsdp.h"/>
+  <c:include name="gst/audio/gstsdpmessage.h"/>
+  <namespace name="GstSdp"
+             version="0.10"
+             shared-library="libgstsdp-0.10.so.0"
+             c:identifier-prefixes="Gst"
+             c:symbol-prefixes="gst">
+    <record name="SDPAttribute" c:type="GstSDPAttribute">
+      <doc xml:whitespace="preserve">The contents of the SDP "a=" field which contains a key/value pair.</doc>
+      <field name="key" writable="1">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <field name="value" writable="1">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+    </record>
+    <record name="SDPBandwidth" c:type="GstSDPBandwidth">
+      <doc xml:whitespace="preserve">The contents of the SDP "b=" field which specifies the proposed bandwidth to
+be used by the session or media.</doc>
+      <field name="bwtype" writable="1">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <field name="bandwidth" writable="1">
+        <type name="guint" c:type="guint"/>
+      </field>
+    </record>
+    <record name="SDPConnection" c:type="GstSDPConnection">
+      <doc xml:whitespace="preserve">The contents of the SDP "c=" field which contains connection data.</doc>
+      <field name="nettype" writable="1">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <field name="addrtype" writable="1">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <field name="address" writable="1">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <field name="ttl" writable="1">
+        <type name="guint" c:type="guint"/>
+      </field>
+      <field name="addr_number" writable="1">
+        <type name="guint" c:type="guint"/>
+      </field>
+    </record>
+    <record name="SDPKey" c:type="GstSDPKey">
+      <doc xml:whitespace="preserve">The contents of the SDP "k=" field which is used to convey encryption
+keys.</doc>
+      <field name="type" writable="1">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <field name="data" writable="1">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+    </record>
+    <record name="SDPMedia" c:type="GstSDPMedia">
+      <doc xml:whitespace="preserve">The contents of the SDP "m=" field with all related fields.</doc>
+      <field name="media" writable="1">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <field name="port" writable="1">
+        <type name="guint" c:type="guint"/>
+      </field>
+      <field name="num_ports" writable="1">
+        <type name="guint" c:type="guint"/>
+      </field>
+      <field name="proto" writable="1">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <field name="fmts" writable="1">
+        <array name="GLib.Array" c:type="GArray*">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+      <field name="information" writable="1">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <field name="connections" writable="1">
+        <array name="GLib.Array" c:type="GArray*">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+      <field name="bandwidths" writable="1">
+        <array name="GLib.Array" c:type="GArray*">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+      <field name="key" writable="1">
+        <type name="SDPKey" c:type="GstSDPKey"/>
+      </field>
+      <field name="attributes" writable="1">
+        <array name="GLib.Array" c:type="GArray*">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+      <method name="add_attribute" c:identifier="gst_sdp_media_add_attribute">
+        <doc xml:whitespace="preserve">Add the attribute with @key and @value to @media.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_SDP_OK.</doc>
+          <type name="SDPResult" c:type="GstSDPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="key" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a key</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="value" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a value</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="add_bandwidth" c:identifier="gst_sdp_media_add_bandwidth">
+        <doc xml:whitespace="preserve">Add the bandwidth information with @bwtype and @bandwidth to @media.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_SDP_OK.</doc>
+          <type name="SDPResult" c:type="GstSDPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="bwtype" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the bandwidth modifier type</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="bandwidth" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the bandwidth in kilobits per second</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="add_connection"
+              c:identifier="gst_sdp_media_add_connection">
+        <doc xml:whitespace="preserve">Add the given connection parameters to @media.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstSDPResult.</doc>
+          <type name="SDPResult" c:type="GstSDPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="nettype" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the type of network. "IN" is defined to have the meaning "Internet".</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="addrtype" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the type of address.</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="address" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the address</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="ttl" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the time to live of the address</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+          <parameter name="addr_number" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the number of layers</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="add_format" c:identifier="gst_sdp_media_add_format">
+        <doc xml:whitespace="preserve">Add the format information to @media.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_SDP_OK.</doc>
+          <type name="SDPResult" c:type="GstSDPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="format" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the format</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="as_text" c:identifier="gst_sdp_media_as_text">
+        <doc xml:whitespace="preserve">Convert the contents of @media to a text string.</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">A dynamically allocated string representing the media.</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </return-value>
+      </method>
+      <method name="attributes_len"
+              c:identifier="gst_sdp_media_attributes_len">
+        <doc xml:whitespace="preserve">Get the number of attribute fields in @media.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the number of attributes in @media.</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </method>
+      <method name="bandwidths_len"
+              c:identifier="gst_sdp_media_bandwidths_len">
+        <doc xml:whitespace="preserve">Get the number of bandwidth fields in @media.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the number of bandwidths in @media.</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </method>
+      <method name="connections_len"
+              c:identifier="gst_sdp_media_connections_len">
+        <doc xml:whitespace="preserve">Get the number of connection fields in @media.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the number of connections in @media.</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </method>
+      <method name="formats_len" c:identifier="gst_sdp_media_formats_len">
+        <doc xml:whitespace="preserve">Get the number of formats in @media.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the number of formats in @media.</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </method>
+      <method name="free" c:identifier="gst_sdp_media_free">
+        <doc xml:whitespace="preserve">Free all resources allocated by @media. @media should not be used anymore after
+this function. This function should be used when @media was dynamically
+allocated with gst_sdp_media_new().</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstSDPResult.</doc>
+          <type name="SDPResult" c:type="GstSDPResult"/>
+        </return-value>
+      </method>
+      <method name="get_attribute" c:identifier="gst_sdp_media_get_attribute">
+        <doc xml:whitespace="preserve">Get the attribute at position @idx in @media.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the #GstSDPAttribute at position @idx.</doc>
+          <type name="SDPAttribute" c:type="GstSDPAttribute*"/>
+        </return-value>
+        <parameters>
+          <parameter name="idx" transfer-ownership="none">
+            <doc xml:whitespace="preserve">an index</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="get_attribute_val"
+              c:identifier="gst_sdp_media_get_attribute_val">
+        <doc xml:whitespace="preserve">Get the first attribute value for @key in @media.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the first attribute value for @key.</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </return-value>
+        <parameters>
+          <parameter name="key" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a key</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="get_attribute_val_n"
+              c:identifier="gst_sdp_media_get_attribute_val_n">
+        <doc xml:whitespace="preserve">Get the @nth attribute value for @key in @media.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the @nth attribute value.</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </return-value>
+        <parameters>
+          <parameter name="key" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a key</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="nth" transfer-ownership="none">
+            <doc xml:whitespace="preserve">an index</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="get_bandwidth" c:identifier="gst_sdp_media_get_bandwidth">
+        <doc xml:whitespace="preserve">Get the bandwidth at position @idx in @media.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the #GstSDPBandwidth at position @idx.</doc>
+          <type name="SDPBandwidth" c:type="GstSDPBandwidth*"/>
+        </return-value>
+        <parameters>
+          <parameter name="idx" transfer-ownership="none">
+            <doc xml:whitespace="preserve">an index</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="get_connection"
+              c:identifier="gst_sdp_media_get_connection">
+        <doc xml:whitespace="preserve">Get the connection at position @idx in @media.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the #GstSDPConnection at position @idx.</doc>
+          <type name="SDPConnection" c:type="GstSDPConnection*"/>
+        </return-value>
+        <parameters>
+          <parameter name="idx" transfer-ownership="none">
+            <doc xml:whitespace="preserve">an index</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="get_format" c:identifier="gst_sdp_media_get_format">
+        <doc xml:whitespace="preserve">Get the format information at position @idx in @media.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the format at position @idx.</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </return-value>
+        <parameters>
+          <parameter name="idx" transfer-ownership="none">
+            <doc xml:whitespace="preserve">an index</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="get_information"
+              c:identifier="gst_sdp_media_get_information">
+        <doc xml:whitespace="preserve">Get the information of @media</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the information of @media.</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </return-value>
+      </method>
+      <method name="get_key" c:identifier="gst_sdp_media_get_key">
+        <doc xml:whitespace="preserve">Get the encryption information from @media.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstSDPKey.</doc>
+          <type name="SDPKey" c:type="GstSDPKey*"/>
+        </return-value>
+      </method>
+      <method name="get_media" c:identifier="gst_sdp_media_get_media">
+        <doc xml:whitespace="preserve">Get the media description of @media.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the media description.</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </return-value>
+      </method>
+      <method name="get_num_ports" c:identifier="gst_sdp_media_get_num_ports">
+        <doc xml:whitespace="preserve">Get the number of ports for @media.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the number of ports for @media.</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </method>
+      <method name="get_port" c:identifier="gst_sdp_media_get_port">
+        <doc xml:whitespace="preserve">Get the port number for @media.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the port number of @media.</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </method>
+      <method name="get_proto" c:identifier="gst_sdp_media_get_proto">
+        <doc xml:whitespace="preserve">Get the transport protocol of @media</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the transport protocol of @media.</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </return-value>
+      </method>
+      <method name="init" c:identifier="gst_sdp_media_init">
+        <doc xml:whitespace="preserve">Initialize @media so that its contents are as if it was freshly allocated
+with gst_sdp_media_new(). This function is mostly used to initialize a media
+allocated on the stack. gst_sdp_media_uninit() undoes this operation.
+When this function is invoked on newly allocated data (with malloc or on the
+stack), its contents should be set to 0 before calling this function.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstSDPResult.</doc>
+          <type name="SDPResult" c:type="GstSDPResult"/>
+        </return-value>
+      </method>
+      <method name="set_information"
+              c:identifier="gst_sdp_media_set_information">
+        <doc xml:whitespace="preserve">Set the media information of @media to @information.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_SDP_OK.</doc>
+          <type name="SDPResult" c:type="GstSDPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="information" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the media information</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_key" c:identifier="gst_sdp_media_set_key">
+        <doc xml:whitespace="preserve">Adds the encryption information to @media.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstSDPResult.</doc>
+          <type name="SDPResult" c:type="GstSDPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="type" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the encryption type</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="data" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the encryption data</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_media" c:identifier="gst_sdp_media_set_media">
+        <doc xml:whitespace="preserve">Set the media description of @media to @med.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_SDP_OK.</doc>
+          <type name="SDPResult" c:type="GstSDPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="med" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the media description</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_port_info" c:identifier="gst_sdp_media_set_port_info">
+        <doc xml:whitespace="preserve">Set the port information in @media.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_SDP_OK.</doc>
+          <type name="SDPResult" c:type="GstSDPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="port" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the port number</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+          <parameter name="num_ports" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the number of ports</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_proto" c:identifier="gst_sdp_media_set_proto">
+        <doc xml:whitespace="preserve">Set the media transport protocol of @media to @proto.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_SDP_OK.</doc>
+          <type name="SDPResult" c:type="GstSDPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="proto" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the media transport protocol</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="uninit" c:identifier="gst_sdp_media_uninit">
+        <doc xml:whitespace="preserve">Free all resources allocated in @media. @media should not be used anymore after
+this function. This function should be used when @media was allocated on the
+stack and initialized with gst_sdp_media_init().</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstSDPResult.</doc>
+          <type name="SDPResult" c:type="GstSDPResult"/>
+        </return-value>
+      </method>
+    </record>
+    <record name="SDPMessage" c:type="GstSDPMessage">
+      <doc xml:whitespace="preserve">The contents of the SDP message.</doc>
+      <field name="version" writable="1">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <field name="origin" writable="1">
+        <type name="SDPOrigin" c:type="GstSDPOrigin"/>
+      </field>
+      <field name="session_name" writable="1">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <field name="information" writable="1">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <field name="uri" writable="1">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <field name="emails" writable="1">
+        <array name="GLib.Array" c:type="GArray*">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+      <field name="phones" writable="1">
+        <array name="GLib.Array" c:type="GArray*">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+      <field name="connection" writable="1">
+        <type name="SDPConnection" c:type="GstSDPConnection"/>
+      </field>
+      <field name="bandwidths" writable="1">
+        <array name="GLib.Array" c:type="GArray*">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+      <field name="times" writable="1">
+        <array name="GLib.Array" c:type="GArray*">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+      <field name="zones" writable="1">
+        <array name="GLib.Array" c:type="GArray*">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+      <field name="key" writable="1">
+        <type name="SDPKey" c:type="GstSDPKey"/>
+      </field>
+      <field name="attributes" writable="1">
+        <array name="GLib.Array" c:type="GArray*">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+      <field name="medias" writable="1">
+        <array name="GLib.Array" c:type="GArray*">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+      <method name="add_attribute"
+              c:identifier="gst_sdp_message_add_attribute">
+        <doc xml:whitespace="preserve">Add the attribute with @key and @value to @msg.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">@GST_SDP_OK.</doc>
+          <type name="SDPResult" c:type="GstSDPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="key" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the key</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="value" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the value</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="add_bandwidth"
+              c:identifier="gst_sdp_message_add_bandwidth">
+        <doc xml:whitespace="preserve">Add the specified bandwidth information to @msg.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstSDPResult.</doc>
+          <type name="SDPResult" c:type="GstSDPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="bwtype" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the bandwidth modifier type</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="bandwidth" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the bandwidth in kilobits per second</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="add_email" c:identifier="gst_sdp_message_add_email">
+        <doc xml:whitespace="preserve">Add @email to the list of emails in @msg.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstSDPResult.</doc>
+          <type name="SDPResult" c:type="GstSDPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="email" transfer-ownership="none">
+            <doc xml:whitespace="preserve">an email</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="add_media" c:identifier="gst_sdp_message_add_media">
+        <doc xml:whitespace="preserve">Adds @media to the array of medias in @msg. This function takes ownership of
+the contents of @media so that @media will have to be reinitialized with
+gst_media_init() before it can be used again.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstSDPResult.</doc>
+          <type name="SDPResult" c:type="GstSDPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="media" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a #GstSDPMedia to add</doc>
+            <type name="SDPMedia" c:type="GstSDPMedia*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="add_phone" c:identifier="gst_sdp_message_add_phone">
+        <doc xml:whitespace="preserve">Add @phone to the list of phones in @msg.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstSDPResult.</doc>
+          <type name="SDPResult" c:type="GstSDPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="phone" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a phone</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="add_time" c:identifier="gst_sdp_message_add_time">
+        <doc xml:whitespace="preserve">Add time information @start and @stop to @msg.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstSDPResult.</doc>
+          <type name="SDPResult" c:type="GstSDPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="start" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the start time</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="stop" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the stop time</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="repeat" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the repeat times</doc>
+            <type name="utf8" c:type="gchar**"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="add_zone" c:identifier="gst_sdp_message_add_zone">
+        <doc xml:whitespace="preserve">Add time zone information to @msg.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstSDPResult.</doc>
+          <type name="SDPResult" c:type="GstSDPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="adj_time" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the NTP time that a time zone adjustment happens</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="typed_time" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the offset from the time when the session was first scheduled</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="as_text" c:identifier="gst_sdp_message_as_text">
+        <doc xml:whitespace="preserve">Convert the contents of @msg to a text string.</doc>
+        <return-value transfer-ownership="full">
+          <doc xml:whitespace="preserve">A dynamically allocated string representing the SDP description.</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </return-value>
+      </method>
+      <method name="attributes_len"
+              c:identifier="gst_sdp_message_attributes_len">
+        <doc xml:whitespace="preserve">Get the number of attributes in @msg.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the number of attributes in @msg.</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </method>
+      <method name="bandwidths_len"
+              c:identifier="gst_sdp_message_bandwidths_len">
+        <doc xml:whitespace="preserve">Get the number of bandwidth information in @msg.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the number of bandwidth information in @msg.</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </method>
+      <method name="dump" c:identifier="gst_sdp_message_dump">
+        <doc xml:whitespace="preserve">Dump the parsed contents of @msg to stdout.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstSDPResult.</doc>
+          <type name="SDPResult" c:type="GstSDPResult"/>
+        </return-value>
+      </method>
+      <method name="emails_len" c:identifier="gst_sdp_message_emails_len">
+        <doc xml:whitespace="preserve">Get the number of emails in @msg.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the number of emails in @msg.</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </method>
+      <method name="free" c:identifier="gst_sdp_message_free">
+        <doc xml:whitespace="preserve">Free all resources allocated by @msg. @msg should not be used anymore after
+this function. This function should be used when @msg was dynamically
+allocated with gst_sdp_message_new().</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstSDPResult.</doc>
+          <type name="SDPResult" c:type="GstSDPResult"/>
+        </return-value>
+      </method>
+      <method name="get_attribute"
+              c:identifier="gst_sdp_message_get_attribute">
+        <doc xml:whitespace="preserve">Get the attribute at position @idx in @msg.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the #GstSDPAttribute at position @idx.</doc>
+          <type name="SDPAttribute" c:type="GstSDPAttribute*"/>
+        </return-value>
+        <parameters>
+          <parameter name="idx" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the index</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="get_attribute_val"
+              c:identifier="gst_sdp_message_get_attribute_val">
+        <doc xml:whitespace="preserve">Get the first attribute with key @key in @msg.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the attribute value of the first attribute with @key.</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </return-value>
+        <parameters>
+          <parameter name="key" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the key</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="get_attribute_val_n"
+              c:identifier="gst_sdp_message_get_attribute_val_n">
+        <doc xml:whitespace="preserve">Get the @nth attribute with key @key in @msg.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the attribute value of the @nth attribute with @key.</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </return-value>
+        <parameters>
+          <parameter name="key" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the key</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="nth" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the index</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="get_bandwidth"
+              c:identifier="gst_sdp_message_get_bandwidth">
+        <doc xml:whitespace="preserve">Get the bandwidth at index @idx from @msg.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstSDPBandwidth.</doc>
+          <type name="SDPBandwidth" c:type="GstSDPBandwidth*"/>
+        </return-value>
+        <parameters>
+          <parameter name="idx" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the bandwidth index</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="get_connection"
+              c:identifier="gst_sdp_message_get_connection">
+        <doc xml:whitespace="preserve">Get the connection of @msg.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstSDPConnection. The result remains valid as long as @msg is valid.</doc>
+          <type name="SDPConnection" c:type="GstSDPConnection*"/>
+        </return-value>
+      </method>
+      <method name="get_email" c:identifier="gst_sdp_message_get_email">
+        <doc xml:whitespace="preserve">Get the email with number @idx from @msg.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the email at position @idx.</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </return-value>
+        <parameters>
+          <parameter name="idx" transfer-ownership="none">
+            <doc xml:whitespace="preserve">an email index</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="get_information"
+              c:identifier="gst_sdp_message_get_information">
+        <doc xml:whitespace="preserve">Get the information in @msg.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstSDPResult.</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </return-value>
+      </method>
+      <method name="get_key" c:identifier="gst_sdp_message_get_key">
+        <doc xml:whitespace="preserve">Get the encryption information from @msg.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstSDPKey.</doc>
+          <type name="SDPKey" c:type="GstSDPKey*"/>
+        </return-value>
+      </method>
+      <method name="get_media" c:identifier="gst_sdp_message_get_media">
+        <doc xml:whitespace="preserve">Get the media description at index @idx in @msg.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstSDPMedia.</doc>
+          <type name="SDPMedia" c:type="GstSDPMedia*"/>
+        </return-value>
+        <parameters>
+          <parameter name="idx" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the index</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="get_origin" c:identifier="gst_sdp_message_get_origin">
+        <doc xml:whitespace="preserve">Get the origin of @msg.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstSDPOrigin. The result remains valid as long as @msg is valid.</doc>
+          <type name="SDPOrigin" c:type="GstSDPOrigin*"/>
+        </return-value>
+      </method>
+      <method name="get_phone" c:identifier="gst_sdp_message_get_phone">
+        <doc xml:whitespace="preserve">Get the phone with number @idx from @msg.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the phone at position @idx.</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </return-value>
+        <parameters>
+          <parameter name="idx" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a phone index</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="get_session_name"
+              c:identifier="gst_sdp_message_get_session_name">
+        <doc xml:whitespace="preserve">Get the session name in @msg.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstSDPResult.</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </return-value>
+      </method>
+      <method name="get_time" c:identifier="gst_sdp_message_get_time">
+        <doc xml:whitespace="preserve">Get time information with index @idx from @msg.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstSDPTime.</doc>
+          <type name="SDPTime" c:type="GstSDPTime*"/>
+        </return-value>
+        <parameters>
+          <parameter name="idx" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the time index</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="get_uri" c:identifier="gst_sdp_message_get_uri">
+        <doc xml:whitespace="preserve">Get the URI in @msg.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstSDPResult.</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </return-value>
+      </method>
+      <method name="get_version" c:identifier="gst_sdp_message_get_version">
+        <doc xml:whitespace="preserve">Get the version in @msg.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstSDPResult.</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </return-value>
+      </method>
+      <method name="get_zone" c:identifier="gst_sdp_message_get_zone">
+        <doc xml:whitespace="preserve">Get time zone information with index @idx from @msg.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstSDPZone.</doc>
+          <type name="SDPZone" c:type="GstSDPZone*"/>
+        </return-value>
+        <parameters>
+          <parameter name="idx" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the zone index</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="init" c:identifier="gst_sdp_message_init">
+        <doc xml:whitespace="preserve">Initialize @msg so that its contents are as if it was freshly allocated
+with gst_sdp_message_new(). This function is mostly used to initialize a message
+allocated on the stack. gst_sdp_message_uninit() undoes this operation.
+When this function is invoked on newly allocated data (with malloc or on the
+stack), its contents should be set to 0 before calling this function.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstSDPResult.</doc>
+          <type name="SDPResult" c:type="GstSDPResult"/>
+        </return-value>
+      </method>
+      <method name="medias_len" c:identifier="gst_sdp_message_medias_len">
+        <doc xml:whitespace="preserve">Get the number of media descriptions in @msg.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the number of media descriptions in @msg.</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </method>
+      <method name="phones_len" c:identifier="gst_sdp_message_phones_len">
+        <doc xml:whitespace="preserve">Get the number of phones in @msg.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the number of phones in @msg.</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </method>
+      <method name="set_connection"
+              c:identifier="gst_sdp_message_set_connection">
+        <doc xml:whitespace="preserve">Configure the SDP connection in @msg with the given parameters.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstSDPResult.</doc>
+          <type name="SDPResult" c:type="GstSDPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="nettype" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the type of network. "IN" is defined to have the meaning "Internet".</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="addrtype" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the type of address.</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="address" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the address</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="ttl" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the time to live of the address</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+          <parameter name="addr_number" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the number of layers</doc>
+            <type name="guint" c:type="guint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_information"
+              c:identifier="gst_sdp_message_set_information">
+        <doc xml:whitespace="preserve">Set the information in @msg.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstSDPResult.</doc>
+          <type name="SDPResult" c:type="GstSDPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="information" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the information</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_key" c:identifier="gst_sdp_message_set_key">
+        <doc xml:whitespace="preserve">Adds the encryption information to @msg.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstSDPResult.</doc>
+          <type name="SDPResult" c:type="GstSDPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="type" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the encryption type</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="data" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the encryption data</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_origin" c:identifier="gst_sdp_message_set_origin">
+        <doc xml:whitespace="preserve">Configure the SDP origin in @msg with the given parameters.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GST_SDP_OK.</doc>
+          <type name="SDPResult" c:type="GstSDPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="username" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the user name</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="sess_id" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a session id</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="sess_version" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a session version</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="nettype" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a network type</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="addrtype" transfer-ownership="none">
+            <doc xml:whitespace="preserve">an address type</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+          <parameter name="addr" transfer-ownership="none">
+            <doc xml:whitespace="preserve">an address</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_session_name"
+              c:identifier="gst_sdp_message_set_session_name">
+        <doc xml:whitespace="preserve">Set the session name in @msg.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstSDPResult.</doc>
+          <type name="SDPResult" c:type="GstSDPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="session_name" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the session name</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_uri" c:identifier="gst_sdp_message_set_uri">
+        <doc xml:whitespace="preserve">Set the URI in @msg.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstSDPResult.</doc>
+          <type name="SDPResult" c:type="GstSDPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="uri" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the URI</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_version" c:identifier="gst_sdp_message_set_version">
+        <doc xml:whitespace="preserve">Set the version in @msg.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstSDPResult.</doc>
+          <type name="SDPResult" c:type="GstSDPResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="version" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the version</doc>
+            <type name="utf8" c:type="gchar*"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="times_len" c:identifier="gst_sdp_message_times_len">
+        <doc xml:whitespace="preserve">Get the number of time information entries in @msg.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the number of time information entries in @msg.</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </method>
+      <method name="uninit" c:identifier="gst_sdp_message_uninit">
+        <doc xml:whitespace="preserve">Free all resources allocated in @msg. @msg should not be used anymore after
+this function. This function should be used when @msg was allocated on the
+stack and initialized with gst_sdp_message_init().</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstSDPResult.</doc>
+          <type name="SDPResult" c:type="GstSDPResult"/>
+        </return-value>
+      </method>
+      <method name="zones_len" c:identifier="gst_sdp_message_zones_len">
+        <doc xml:whitespace="preserve">Get the number of time zone information entries in @msg.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">the number of time zone information entries in @msg.</doc>
+          <type name="guint" c:type="guint"/>
+        </return-value>
+      </method>
+    </record>
+    <record name="SDPOrigin" c:type="GstSDPOrigin">
+      <doc xml:whitespace="preserve">The contents of the SDP "o=" field which gives the originator of the session
+(their username and the address of the user's host) plus a session id and
+session version number.</doc>
+      <field name="username" writable="1">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <field name="sess_id" writable="1">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <field name="sess_version" writable="1">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <field name="nettype" writable="1">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <field name="addrtype" writable="1">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <field name="addr" writable="1">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+    </record>
+    <enumeration name="SDPResult" c:type="GstSDPResult">
+      <doc xml:whitespace="preserve">Return values for the SDP functions.</doc>
+      <member name="ok" value="0" c:identifier="GST_SDP_OK"/>
+      <member name="einval" value="-1" c:identifier="GST_SDP_EINVAL"/>
+    </enumeration>
+    <record name="SDPTime" c:type="GstSDPTime">
+      <doc xml:whitespace="preserve">The contents of the SDP "t=" field which specify the start and stop times for
+a conference session.</doc>
+      <field name="start" writable="1">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <field name="stop" writable="1">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <field name="repeat" writable="1">
+        <array name="GLib.Array" c:type="GArray*">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </record>
+    <record name="SDPZone" c:type="GstSDPZone">
+      <doc xml:whitespace="preserve">The contents of the SDP "z=" field which allows the sender to
+specify a list of time zone adjustments and offsets from the base
+time.</doc>
+      <field name="time" writable="1">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+      <field name="typed_time" writable="1">
+        <type name="utf8" c:type="gchar*"/>
+      </field>
+    </record>
+    <constant name="SDP_BWTYPE_AS" value="AS">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="SDP_BWTYPE_CT" value="CT">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="SDP_BWTYPE_EXT_PREFIX" value="X-">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="SDP_BWTYPE_RR" value="RR">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="SDP_BWTYPE_RS" value="RS">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <function name="sdp_address_is_multicast"
+              c:identifier="gst_sdp_address_is_multicast"
+              version="0.10.32">
+      <doc xml:whitespace="preserve">Check if the given @addr is a multicast address.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE when @addr is multicast.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="nettype" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a network type</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+        <parameter name="addrtype" transfer-ownership="none">
+          <doc xml:whitespace="preserve">an address type</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+        <parameter name="addr" transfer-ownership="none">
+          <doc xml:whitespace="preserve">an address</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="sdp_media_new" c:identifier="gst_sdp_media_new">
+      <doc xml:whitespace="preserve">Allocate a new GstSDPMedia and store the result in @media.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">a #GstSDPResult.</doc>
+        <type name="SDPResult" c:type="GstSDPResult"/>
+      </return-value>
+      <parameters>
+        <parameter name="media" transfer-ownership="none">
+          <doc xml:whitespace="preserve">pointer to new #GstSDPMedia</doc>
+          <type name="SDPMedia" c:type="GstSDPMedia**"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="sdp_message_as_uri"
+              c:identifier="gst_sdp_message_as_uri"
+              version="0.10.31">
+      <doc xml:whitespace="preserve">Creates a uri from @msg with the given @scheme. The uri has the format:
+Where each value is url encoded.</doc>
+      <return-value transfer-ownership="full">
+        <doc xml:whitespace="preserve">a uri for @msg.</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="scheme" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the uri scheme</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+        <parameter name="msg" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the #GstSDPMessage</doc>
+          <type name="SDPMessage" c:type="GstSDPMessage*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="sdp_message_new" c:identifier="gst_sdp_message_new">
+      <doc xml:whitespace="preserve">Allocate a new GstSDPMessage and store the result in @msg.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">a #GstSDPResult.</doc>
+        <type name="SDPResult" c:type="GstSDPResult"/>
+      </return-value>
+      <parameters>
+        <parameter name="msg" transfer-ownership="none">
+          <doc xml:whitespace="preserve">pointer to new #GstSDPMessage</doc>
+          <type name="SDPMessage" c:type="GstSDPMessage**"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="sdp_message_parse_buffer"
+              c:identifier="gst_sdp_message_parse_buffer">
+      <doc xml:whitespace="preserve">Parse the contents of @size bytes pointed to by @data and store the result in</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">#GST_SDP_OK on success.</doc>
+        <type name="SDPResult" c:type="GstSDPResult"/>
+      </return-value>
+      <parameters>
+        <parameter name="data" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the start of the buffer</doc>
+          <type name="guint8" c:type="guint8*"/>
+        </parameter>
+        <parameter name="size" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the size of the buffer</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+        <parameter name="msg" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the result #GstSDPMessage</doc>
+          <type name="SDPMessage" c:type="GstSDPMessage*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="sdp_message_parse_uri"
+              c:identifier="gst_sdp_message_parse_uri"
+              version="0.10.31">
+      <doc xml:whitespace="preserve">Parse the null-terminated @uri and store the result in @msg.
+The uri should be of the form:
+scheme://[address[:ttl=ttl][:noa=noa]]/[sessionname]
+[#type=value *[&amp;type=value]]
+where value is url encoded. This looslely resembles
+http://tools.ietf.org/html/draft-fujikawa-sdp-url-01</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">#GST_SDP_OK on success.</doc>
+        <type name="SDPResult" c:type="GstSDPResult"/>
+      </return-value>
+      <parameters>
+        <parameter name="uri" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the start of the uri</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+        <parameter name="msg" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the result #GstSDPMessage</doc>
+          <type name="SDPMessage" c:type="GstSDPMessage*"/>
+        </parameter>
+      </parameters>
+    </function>
+  </namespace>
+</repository>
diff --git a/gstreamer/plugins/sdp/ffi/ffi.factor b/gstreamer/plugins/sdp/ffi/ffi.factor
new file mode 100644 (file)
index 0000000..f023bb2
--- /dev/null
@@ -0,0 +1,16 @@
+! Copyright (C) 2010 Anton Gorenko.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.libraries combinators kernel system
+gobject-introspection glib.ffi ;
+IN: gstreamer.sdp.ffi
+
+<<
+"gstreamer.sdp" {
+    { [ os winnt? ] [ drop ] }
+    { [ os macosx? ] [ drop ] }
+    { [ os unix? ] [ "libgstsdp-0.10.so" cdecl add-library ] }
+} cond
+>>
+
+GIR: vocab:gstreamer/sdp/GstSdp-0.10.gir
+
diff --git a/gstreamer/plugins/sdp/sdp.factor b/gstreamer/plugins/sdp/sdp.factor
new file mode 100644 (file)
index 0000000..1cfdbfe
--- /dev/null
@@ -0,0 +1,5 @@
+! Copyright (C) 2010 Anton Gorenko.
+! See http://factorcode.org/license.txt for BSD license.
+USING: gstreamer.sdp.ffi ;
+IN: gstreamer.sdp
+
diff --git a/gstreamer/plugins/tag/GstTag-0.10.gir b/gstreamer/plugins/tag/GstTag-0.10.gir
new file mode 100644 (file)
index 0000000..a1a2fc4
--- /dev/null
@@ -0,0 +1,963 @@
+<?xml version="1.0"?>
+<!-- This file was automatically generated from C sources - DO NOT EDIT!
+To affect the contents of this file, edit the original C definitions,
+and/or use gtk-doc annotations.  -->
+<repository version="1.2"
+            xmlns="http://www.gtk.org/introspection/core/1.0"
+            xmlns:c="http://www.gtk.org/introspection/c/1.0"
+            xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+  <include name="GLib" version="2.0"/>
+  <include name="GModule" version="2.0"/>
+  <include name="GObject" version="2.0"/>
+  <include name="Gst" version="0.10"/>
+  <include name="GstBase" version="0.10"/>
+  <include name="libxml2" version="2.0"/>
+  <package name="gstreamer-tag-0.10"/>
+  <namespace name="GstTag"
+             version="0.10"
+             shared-library="libgsttag-0.10.so.0"
+             c:identifier-prefixes="Gst"
+             c:symbol-prefixes="gst">
+    <constant name="TAG_CAPTURING_CONTRAST" value="capturing-contrast">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="TAG_CAPTURING_DIGITAL_ZOOM_RATIO"
+              value="capturing-digital-zoom-ratio">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="TAG_CAPTURING_EXPOSURE_MODE"
+              value="capturing-exposure-mode">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="TAG_CAPTURING_EXPOSURE_PROGRAM"
+              value="capturing-exposure-program">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="TAG_CAPTURING_FLASH_FIRED" value="capturing-flash-fired">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="TAG_CAPTURING_FLASH_MODE" value="capturing-flash-mode">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="TAG_CAPTURING_FOCAL_LENGTH" value="capturing-focal-length">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="TAG_CAPTURING_FOCAL_RATIO" value="capturing-focal-ratio">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="TAG_CAPTURING_GAIN_ADJUSTMENT"
+              value="capturing-gain-adjustment">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="TAG_CAPTURING_ISO_SPEED" value="capturing-iso-speed">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="TAG_CAPTURING_METERING_MODE"
+              value="capturing-metering-mode">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="TAG_CAPTURING_SATURATION" value="capturing-saturation">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="TAG_CAPTURING_SCENE_CAPTURE_TYPE"
+              value="capturing-scene-capture-type">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="TAG_CAPTURING_SHARPNESS" value="capturing-sharpness">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="TAG_CAPTURING_SHUTTER_SPEED"
+              value="capturing-shutter-speed">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="TAG_CAPTURING_SOURCE" value="capturing-source">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="TAG_CAPTURING_WHITE_BALANCE"
+              value="capturing-white-balance">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="TAG_CDDA_CDDB_DISCID" value="discid">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="TAG_CDDA_CDDB_DISCID_FULL" value="discid-full">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="TAG_CDDA_MUSICBRAINZ_DISCID" value="musicbrainz-discid">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="TAG_CDDA_MUSICBRAINZ_DISCID_FULL"
+              value="musicbrainz-discid-full">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="TAG_CMML_CLIP" value="cmml-clip">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="TAG_CMML_HEAD" value="cmml-head">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="TAG_CMML_STREAM" value="cmml-stream">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="TAG_IMAGE_HORIZONTAL_PPI" value="image-horizontal-ppi">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="TAG_IMAGE_VERTICAL_PPI" value="image-vertical-ppi">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="TAG_MUSICBRAINZ_ALBUMARTISTID"
+              value="musicbrainz-albumartistid">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="TAG_MUSICBRAINZ_ALBUMID" value="musicbrainz-albumid">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="TAG_MUSICBRAINZ_ARTISTID" value="musicbrainz-artistid">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="TAG_MUSICBRAINZ_TRACKID" value="musicbrainz-trackid">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="TAG_MUSICBRAINZ_TRMID" value="musicbrainz-trmid">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <class name="TagDemux"
+           c:symbol-prefix="tag_demux"
+           c:type="GstTagDemux"
+           version="0.10.15"
+           parent="Gst.Element"
+           abstract="1"
+           glib:type-name="GstTagDemux"
+           glib:get-type="gst_tag_demux_get_type"
+           glib:type-struct="TagDemuxClass">
+      <doc xml:whitespace="preserve">Opaque #GstTagDemux structure.</doc>
+      <virtual-method name="identify_tag">
+        <return-value transfer-ownership="none">
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="buffer" transfer-ownership="none">
+            <type name="Gst.Buffer" c:type="GstBuffer*"/>
+          </parameter>
+          <parameter name="start_tag" transfer-ownership="none">
+            <type name="gboolean" c:type="gboolean"/>
+          </parameter>
+          <parameter name="tag_size" transfer-ownership="none">
+            <type name="guint" c:type="guint*"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <virtual-method name="merge_tags">
+        <return-value transfer-ownership="full">
+          <type name="Gst.TagList" c:type="GstTagList*"/>
+        </return-value>
+        <parameters>
+          <parameter name="start_tags" transfer-ownership="none">
+            <type name="Gst.TagList" c:type="GstTagList*"/>
+          </parameter>
+          <parameter name="end_tags" transfer-ownership="none">
+            <type name="Gst.TagList" c:type="GstTagList*"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <virtual-method name="parse_tag">
+        <return-value transfer-ownership="none">
+          <type name="TagDemuxResult" c:type="GstTagDemuxResult"/>
+        </return-value>
+        <parameters>
+          <parameter name="buffer" transfer-ownership="none">
+            <type name="Gst.Buffer" c:type="GstBuffer*"/>
+          </parameter>
+          <parameter name="start_tag" transfer-ownership="none">
+            <type name="gboolean" c:type="gboolean"/>
+          </parameter>
+          <parameter name="tag_size" transfer-ownership="none">
+            <type name="guint" c:type="guint*"/>
+          </parameter>
+          <parameter name="tags" transfer-ownership="none">
+            <type name="Gst.TagList" c:type="GstTagList**"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <field name="element">
+        <type name="Gst.Element" c:type="GstElement"/>
+      </field>
+      <field name="priv">
+        <type name="TagDemuxPrivate" c:type="GstTagDemuxPrivate*"/>
+      </field>
+      <field name="reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </class>
+    <record name="TagDemuxClass"
+            c:type="GstTagDemuxClass"
+            glib:is-gtype-struct-for="TagDemux"
+            version="0.10.15">
+      <doc xml:whitespace="preserve">The #GstTagDemuxClass structure.  See documentation at beginning of section
+for details about what subclasses need to override and do.</doc>
+      <field name="parent_class">
+        <type name="Gst.ElementClass" c:type="GstElementClass"/>
+      </field>
+      <field name="min_start_size">
+        <type name="guint" c:type="guint"/>
+      </field>
+      <field name="min_end_size">
+        <type name="guint" c:type="guint"/>
+      </field>
+      <field name="identify_tag">
+        <callback name="identify_tag">
+          <return-value transfer-ownership="none">
+            <type name="gboolean" c:type="gboolean"/>
+          </return-value>
+          <parameters>
+            <parameter name="demux" transfer-ownership="none">
+              <type name="TagDemux" c:type="GstTagDemux*"/>
+            </parameter>
+            <parameter name="buffer" transfer-ownership="none">
+              <type name="Gst.Buffer" c:type="GstBuffer*"/>
+            </parameter>
+            <parameter name="start_tag" transfer-ownership="none">
+              <type name="gboolean" c:type="gboolean"/>
+            </parameter>
+            <parameter name="tag_size" transfer-ownership="none">
+              <type name="guint" c:type="guint*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="parse_tag">
+        <callback name="parse_tag">
+          <return-value transfer-ownership="none">
+            <type name="TagDemuxResult" c:type="GstTagDemuxResult"/>
+          </return-value>
+          <parameters>
+            <parameter name="demux" transfer-ownership="none">
+              <type name="TagDemux" c:type="GstTagDemux*"/>
+            </parameter>
+            <parameter name="buffer" transfer-ownership="none">
+              <type name="Gst.Buffer" c:type="GstBuffer*"/>
+            </parameter>
+            <parameter name="start_tag" transfer-ownership="none">
+              <type name="gboolean" c:type="gboolean"/>
+            </parameter>
+            <parameter name="tag_size" transfer-ownership="none">
+              <type name="guint" c:type="guint*"/>
+            </parameter>
+            <parameter name="tags" transfer-ownership="none">
+              <type name="Gst.TagList" c:type="GstTagList**"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="merge_tags">
+        <callback name="merge_tags">
+          <return-value transfer-ownership="full">
+            <type name="Gst.TagList" c:type="GstTagList*"/>
+          </return-value>
+          <parameters>
+            <parameter name="demux" transfer-ownership="none">
+              <type name="TagDemux" c:type="GstTagDemux*"/>
+            </parameter>
+            <parameter name="start_tags" transfer-ownership="none">
+              <type name="Gst.TagList" c:type="GstTagList*"/>
+            </parameter>
+            <parameter name="end_tags" transfer-ownership="none">
+              <type name="Gst.TagList" c:type="GstTagList*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="4">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </record>
+    <record name="TagDemuxPrivate" c:type="GstTagDemuxPrivate" disguised="1">
+    </record>
+    <enumeration name="TagDemuxResult"
+                 version="0.10.15"
+                 glib:type-name="GstTagDemuxResult"
+                 glib:get-type="gst_tag_demux_result_get_type"
+                 c:type="GstTagDemuxResult">
+      <doc xml:whitespace="preserve">Result values from the parse_tag virtual function.</doc>
+      <member name="broken_tag"
+              value="0"
+              c:identifier="GST_TAG_DEMUX_RESULT_BROKEN_TAG"
+              glib:nick="broken-tag"/>
+      <member name="again"
+              value="1"
+              c:identifier="GST_TAG_DEMUX_RESULT_AGAIN"
+              glib:nick="again"/>
+      <member name="ok"
+              value="2"
+              c:identifier="GST_TAG_DEMUX_RESULT_OK"
+              glib:nick="ok"/>
+    </enumeration>
+    <enumeration name="TagImageType"
+                 version="0.10.9"
+                 glib:type-name="GstTagImageType"
+                 glib:get-type="gst_tag_image_type_get_type"
+                 c:type="GstTagImageType">
+      <doc xml:whitespace="preserve">Type of image contained in an image tag (specified as field in
+the image buffer's caps structure)</doc>
+      <member name="none"
+              value="-1"
+              c:identifier="GST_TAG_IMAGE_TYPE_NONE"
+              glib:nick="none"/>
+      <member name="undefined"
+              value="0"
+              c:identifier="GST_TAG_IMAGE_TYPE_UNDEFINED"
+              glib:nick="undefined"/>
+      <member name="front_cover"
+              value="1"
+              c:identifier="GST_TAG_IMAGE_TYPE_FRONT_COVER"
+              glib:nick="front-cover"/>
+      <member name="back_cover"
+              value="2"
+              c:identifier="GST_TAG_IMAGE_TYPE_BACK_COVER"
+              glib:nick="back-cover"/>
+      <member name="leaflet_page"
+              value="3"
+              c:identifier="GST_TAG_IMAGE_TYPE_LEAFLET_PAGE"
+              glib:nick="leaflet-page"/>
+      <member name="medium"
+              value="4"
+              c:identifier="GST_TAG_IMAGE_TYPE_MEDIUM"
+              glib:nick="medium"/>
+      <member name="lead_artist"
+              value="5"
+              c:identifier="GST_TAG_IMAGE_TYPE_LEAD_ARTIST"
+              glib:nick="lead-artist"/>
+      <member name="artist"
+              value="6"
+              c:identifier="GST_TAG_IMAGE_TYPE_ARTIST"
+              glib:nick="artist"/>
+      <member name="conductor"
+              value="7"
+              c:identifier="GST_TAG_IMAGE_TYPE_CONDUCTOR"
+              glib:nick="conductor"/>
+      <member name="band_orchestra"
+              value="8"
+              c:identifier="GST_TAG_IMAGE_TYPE_BAND_ORCHESTRA"
+              glib:nick="band-orchestra"/>
+      <member name="composer"
+              value="9"
+              c:identifier="GST_TAG_IMAGE_TYPE_COMPOSER"
+              glib:nick="composer"/>
+      <member name="lyricist"
+              value="10"
+              c:identifier="GST_TAG_IMAGE_TYPE_LYRICIST"
+              glib:nick="lyricist"/>
+      <member name="recording_location"
+              value="11"
+              c:identifier="GST_TAG_IMAGE_TYPE_RECORDING_LOCATION"
+              glib:nick="recording-location"/>
+      <member name="during_recording"
+              value="12"
+              c:identifier="GST_TAG_IMAGE_TYPE_DURING_RECORDING"
+              glib:nick="during-recording"/>
+      <member name="during_performance"
+              value="13"
+              c:identifier="GST_TAG_IMAGE_TYPE_DURING_PERFORMANCE"
+              glib:nick="during-performance"/>
+      <member name="video_capture"
+              value="14"
+              c:identifier="GST_TAG_IMAGE_TYPE_VIDEO_CAPTURE"
+              glib:nick="video-capture"/>
+      <member name="fish"
+              value="15"
+              c:identifier="GST_TAG_IMAGE_TYPE_FISH"
+              glib:nick="fish"/>
+      <member name="illustration"
+              value="16"
+              c:identifier="GST_TAG_IMAGE_TYPE_ILLUSTRATION"
+              glib:nick="illustration"/>
+      <member name="artist_logo"
+              value="17"
+              c:identifier="GST_TAG_IMAGE_TYPE_BAND_ARTIST_LOGO"
+              glib:nick="artist-logo"/>
+      <member name="publisher_studio_logo"
+              value="18"
+              c:identifier="GST_TAG_IMAGE_TYPE_PUBLISHER_STUDIO_LOGO"
+              glib:nick="publisher-studio-logo"/>
+    </enumeration>
+    <function name="tag_freeform_string_to_utf8"
+              c:identifier="gst_tag_freeform_string_to_utf8"
+              version="0.10.13">
+      <doc xml:whitespace="preserve">Convenience function to read a string with unknown character encoding. If
+the string is already in UTF-8 encoding, it will be returned right away.
+If not it tries to detect byte-order-mark for UTF-16/32 cases and use that.
+Otherwise, the environment will be searched for a number of environment
+variables (whose names are specified in the NULL-terminated string array
+are specified, the current locale will be tried. If that also doesn't work,
+WINDOWS-1252/ISO-8859-1 is assumed (which will almost always succeed).</doc>
+      <return-value transfer-ownership="full">
+        <doc xml:whitespace="preserve">a newly-allocated string in UTF-8 encoding, or NULL</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="data" transfer-ownership="none">
+          <doc xml:whitespace="preserve">string data</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+        <parameter name="size" transfer-ownership="none">
+          <doc xml:whitespace="preserve">length of string data, or -1 if the string is NUL-terminated</doc>
+          <type name="gint" c:type="gint"/>
+        </parameter>
+        <parameter name="env_vars" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a NULL-terminated string array of environment variable names, or NULL</doc>
+          <type name="utf8" c:type="gchar**"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="tag_from_id3_tag" c:identifier="gst_tag_from_id3_tag">
+      <doc xml:whitespace="preserve">Looks up the GStreamer tag for a ID3v2 tag.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">The corresponding GStreamer tag or NULL if none exists.</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="id3_tag" transfer-ownership="none">
+          <doc xml:whitespace="preserve">ID3v2 tag to convert to GStreamer tag</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="tag_from_id3_user_tag"
+              c:identifier="gst_tag_from_id3_user_tag">
+      <doc xml:whitespace="preserve">Looks up the GStreamer tag for an ID3v2 user tag (e.g. description in
+TXXX frame or owner in UFID frame).</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">The corresponding GStreamer tag or NULL if none exists.</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="type" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the type of ID3v2 user tag (e.g. "TXXX" or "UDIF")</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+        <parameter name="id3_user_tag" transfer-ownership="none">
+          <doc xml:whitespace="preserve">ID3v2 user tag to convert to GStreamer tag</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="tag_from_vorbis_tag"
+              c:identifier="gst_tag_from_vorbis_tag">
+      <doc xml:whitespace="preserve">Looks up the GStreamer tag for a vorbiscomment tag.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">The corresponding GStreamer tag or NULL if none exists.</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="vorbis_tag" transfer-ownership="none">
+          <doc xml:whitespace="preserve">vorbiscomment tag to convert to GStreamer tag</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="tag_get_language_code_iso_639_1"
+              c:identifier="gst_tag_get_language_code_iso_639_1"
+              version="0.10.26">
+      <doc xml:whitespace="preserve">Returns two-letter ISO-639-1 language code given a three-letter ISO-639-2
+language code or two-letter ISO-639-1 language code (both are accepted for
+convenience).
+Language codes are case-sensitive and expected to be lower case.
+or NULL if no mapping is known. The returned string must not be
+modified or freed.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">two-letter ISO-639-1 language code string that maps to @lang_code,</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="lang_code" transfer-ownership="none">
+          <doc xml:whitespace="preserve">ISO-639 language code (e.g. "deu" or "ger" or "de")</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="tag_get_language_code_iso_639_2B"
+              c:identifier="gst_tag_get_language_code_iso_639_2B"
+              version="0.10.26">
+      <doc xml:whitespace="preserve">Returns three-letter ISO-639-2 "bibliographic" language code given a
+two-letter ISO-639-1 language code or a three-letter ISO-639-2 language
+code (both are accepted for convenience).
+The "bibliographic" code is derived from the English name of the language
+(e.g. "ger" for German instead of "de" or "deu"). In most scenarios, the
+"terminological" codes are prefered.
+Language codes are case-sensitive and expected to be lower case.
+or NULL if no mapping is known. The returned string must not be
+modified or freed.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">three-letter ISO-639-2 language code string that maps to @lang_code,</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="lang_code" transfer-ownership="none">
+          <doc xml:whitespace="preserve">ISO-639 language code (e.g. "deu" or "ger" or "de")</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="tag_get_language_code_iso_639_2T"
+              c:identifier="gst_tag_get_language_code_iso_639_2T"
+              version="0.10.26">
+      <doc xml:whitespace="preserve">Returns three-letter ISO-639-2 "terminological" language code given a
+two-letter ISO-639-1 language code or a three-letter ISO-639-2 language
+code (both are accepted for convenience).
+The "terminological" code is derived from the local name of the language
+(e.g. "deu" for German instead of "ger"). In most scenarios, the
+"terminological" codes are prefered over the "bibliographic" ones.
+Language codes are case-sensitive and expected to be lower case.
+or NULL if no mapping is known. The returned string must not be
+modified or freed.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">three-letter ISO-639-2 language code string that maps to @lang_code,</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="lang_code" transfer-ownership="none">
+          <doc xml:whitespace="preserve">ISO-639 language code (e.g. "deu" or "ger" or "de")</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="tag_get_language_codes"
+              c:identifier="gst_tag_get_language_codes"
+              version="0.10.26"
+              introspectable="0">
+      <doc xml:whitespace="preserve">Returns a list of known language codes (in form of two-letter ISO-639-1
+codes). This is useful for UIs to build a list of available languages for
+tagging purposes (e.g. to tag an audio track appropriately in a video or
+audio editor).
+with g_strfreev() when no longer needed.</doc>
+      <return-value>
+        <doc xml:whitespace="preserve">NULL-terminated string array with two-letter language codes. Free</doc>
+        <array c:type="gchar**">
+          <type name="utf8"/>
+        </array>
+      </return-value>
+    </function>
+    <function name="tag_get_language_name"
+              c:identifier="gst_tag_get_language_name"
+              version="0.10.26">
+      <doc xml:whitespace="preserve">Returns the name of the language given an ISO-639 language code, such
+as often found in a GST_TAG_LANGUAGE tag. The name will be translated
+according to the current locale (if the library was built against the
+iso-codes package, otherwise the English name will be returned).
+Language codes are case-sensitive and expected to be lower case.
+not be mapped to a language name. The returned string must not be
+modified and does not need to freed; it will stay valid until the
+application is terminated.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">language name in UTF-8 format, or NULL if @language_code could</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="language_code" transfer-ownership="none">
+          <doc xml:whitespace="preserve">two or three-letter ISO-639 language code</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="tag_id3_genre_count"
+              c:identifier="gst_tag_id3_genre_count">
+      <doc xml:whitespace="preserve">Gets the number of ID3v1 genres that can be identified. Winamp genres are 
+included.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">the number of ID3v1 genres that can be identified</doc>
+        <type name="guint" c:type="guint"/>
+      </return-value>
+    </function>
+    <function name="tag_id3_genre_get" c:identifier="gst_tag_id3_genre_get">
+      <doc xml:whitespace="preserve">Gets the ID3v1 genre name for a given ID.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">the genre or NULL if no genre is associated with that ID.</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="id" transfer-ownership="none">
+          <doc xml:whitespace="preserve">ID of genre to query</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="tag_image_data_to_image_buffer"
+              c:identifier="gst_tag_image_data_to_image_buffer"
+              version="0.10.20"
+              introspectable="0">
+      <doc xml:whitespace="preserve">Helper function for tag-reading plugins to create a #GstBuffer suitable to
+add to a #GstTagList as an image tag (such as #GST_TAG_IMAGE or
+#GST_TAG_PREVIEW_IMAGE) from the encoded image data and an (optional) image
+type.
+blob of binary image data, often accompanied by a MIME type or some other
+content type string (e.g. 'png', 'jpeg', 'jpg'). Sometimes there is also an
+'image type' to indicate what kind of image this is (e.g. front cover,
+back cover, artist, etc.). The image data may also be an URI to the image
+rather than the image itself.
+In GStreamer, image tags are #GstBuffer&lt;!-- --&gt;s containing the raw image
+data, with the buffer caps describing the content type of the image
+(e.g. image/jpeg, image/png, text/uri-list). The buffer caps may contain
+an additional 'image-type' field of #GST_TYPE_TAG_IMAGE_TYPE to describe
+the type of image (front cover, back cover etc.). #GST_TAG_PREVIEW_IMAGE
+tags should not carry an image type, their type is already indicated via
+the special tag name.
+This function will do various checks and typefind the encoded image
+data (we can't trust the declared mime type).</doc>
+      <return-value>
+        <doc xml:whitespace="preserve">a newly-allocated image buffer for use in tag lists, or NULL</doc>
+        <type name="Gst.Buffer" c:type="GstBuffer*"/>
+      </return-value>
+      <parameters>
+        <parameter name="image_data" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the (encoded) image</doc>
+          <type name="guint8" c:type="guint8*"/>
+        </parameter>
+        <parameter name="image_data_len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the length of the encoded image data at @image_data</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+        <parameter name="image_type" transfer-ownership="none">
+          <doc xml:whitespace="preserve">type of the image, or #GST_TAG_IMAGE_TYPE_UNDEFINED. Pass #GST_TAG_IMAGE_TYPE_NONE if no image type should be set at all (e.g. for preview images)</doc>
+          <type name="TagImageType" c:type="GstTagImageType"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="tag_list_add_id3_image"
+              c:identifier="gst_tag_list_add_id3_image"
+              version="0.10.20">
+      <doc xml:whitespace="preserve">Adds an image from an ID3 APIC frame (or similar, such as used in FLAC)
+to the given tag list. Also see gst_tag_image_data_to_image_buffer() for
+more information on image tags in GStreamer.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">%TRUE if the image was processed, otherwise %FALSE</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="tag_list" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a tag list</doc>
+          <type name="Gst.TagList" c:type="GstTagList*"/>
+        </parameter>
+        <parameter name="image_data" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the (encoded) image</doc>
+          <type name="guint8" c:type="guint8*"/>
+        </parameter>
+        <parameter name="image_data_len" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the length of the encoded image data at @image_data</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+        <parameter name="id3_picture_type" transfer-ownership="none">
+          <doc xml:whitespace="preserve">picture type as per the ID3 (v2.4.0) specification for the APIC frame (0 = unknown/other)</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="tag_list_from_exif_buffer"
+              c:identifier="gst_tag_list_from_exif_buffer"
+              version="0.10.30">
+      <doc xml:whitespace="preserve">Parses the IFD and IFD tags data contained in the buffer and puts it
+on a taglist. The base_offset is used to subtract from the offset in
+the tag entries and be able to get the offset relative to the buffer
+start</doc>
+      <return-value transfer-ownership="full">
+        <doc xml:whitespace="preserve">The parsed taglist</doc>
+        <type name="Gst.TagList" c:type="GstTagList*"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">The exif buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="byte_order" transfer-ownership="none">
+          <doc xml:whitespace="preserve">byte order of the data</doc>
+          <type name="gint" c:type="gint"/>
+        </parameter>
+        <parameter name="base_offset" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Offset from the tiff header to this buffer</doc>
+          <type name="guint32" c:type="guint32"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="tag_list_from_exif_buffer_with_tiff_header"
+              c:identifier="gst_tag_list_from_exif_buffer_with_tiff_header"
+              version="0.10.30">
+      <doc xml:whitespace="preserve">Parses the exif tags starting with a tiff header structure.</doc>
+      <return-value transfer-ownership="full">
+        <doc xml:whitespace="preserve">The taglist</doc>
+        <type name="Gst.TagList" c:type="GstTagList*"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">The exif buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="tag_list_from_vorbiscomment_buffer"
+              c:identifier="gst_tag_list_from_vorbiscomment_buffer">
+      <doc xml:whitespace="preserve">Creates a new tag list that contains the information parsed out of a
+vorbiscomment packet.
+given vorbiscomment buffer or NULL on error.</doc>
+      <return-value transfer-ownership="full">
+        <doc xml:whitespace="preserve">A new #GstTagList with all tags that could be extracted from the</doc>
+        <type name="Gst.TagList" c:type="GstTagList*"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">buffer to convert</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="id_data" transfer-ownership="none">
+          <doc xml:whitespace="preserve">identification data at start of stream</doc>
+          <type name="guint8" c:type="guint8*"/>
+        </parameter>
+        <parameter name="id_data_length" transfer-ownership="none">
+          <doc xml:whitespace="preserve">length of identification data</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+        <parameter name="vendor_string" transfer-ownership="none">
+          <doc xml:whitespace="preserve">pointer to a string that should take the vendor string of this vorbis comment or NULL if you don't need it.</doc>
+          <type name="utf8" c:type="gchar**"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="tag_list_from_xmp_buffer"
+              c:identifier="gst_tag_list_from_xmp_buffer"
+              version="0.10.29">
+      <doc xml:whitespace="preserve">Parse a xmp packet into a taglist.</doc>
+      <return-value transfer-ownership="full">
+        <doc xml:whitespace="preserve">new taglist or %NULL, free the list when done</doc>
+        <type name="Gst.TagList" c:type="GstTagList*"/>
+      </return-value>
+      <parameters>
+        <parameter name="buffer" transfer-ownership="none">
+          <doc xml:whitespace="preserve">buffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="tag_list_new_from_id3v1"
+              c:identifier="gst_tag_list_new_from_id3v1">
+      <doc xml:whitespace="preserve">Parses the data containing an ID3v1 tag and returns a #GstTagList from the
+parsed data.</doc>
+      <return-value transfer-ownership="full">
+        <doc xml:whitespace="preserve">A new tag list or NULL if the data was not an ID3v1 tag.</doc>
+        <type name="Gst.TagList" c:type="GstTagList*"/>
+      </return-value>
+      <parameters>
+        <parameter name="data" transfer-ownership="none">
+          <doc xml:whitespace="preserve">128 bytes of data containing the ID3v1 tag</doc>
+          <type name="guint8" c:type="guint8*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="tag_list_to_exif_buffer"
+              c:identifier="gst_tag_list_to_exif_buffer"
+              version="0.10.30"
+              introspectable="0">
+      <doc xml:whitespace="preserve">Formats the tags in taglist on exif format. The resulting buffer contains
+the tags IFD and is followed by the data pointed by the tag entries.</doc>
+      <return-value>
+        <doc xml:whitespace="preserve">A GstBuffer containing the tag entries followed by the tag data</doc>
+        <type name="Gst.Buffer" c:type="GstBuffer*"/>
+      </return-value>
+      <parameters>
+        <parameter name="taglist" transfer-ownership="none">
+          <doc xml:whitespace="preserve">The taglist</doc>
+          <type name="Gst.TagList" c:type="GstTagList*"/>
+        </parameter>
+        <parameter name="byte_order" transfer-ownership="none">
+          <doc xml:whitespace="preserve">byte order used in writing (G_LITTLE_ENDIAN or G_BIG_ENDIAN)</doc>
+          <type name="gint" c:type="gint"/>
+        </parameter>
+        <parameter name="base_offset" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Offset from the tiff header first byte</doc>
+          <type name="guint32" c:type="guint32"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="tag_list_to_exif_buffer_with_tiff_header"
+              c:identifier="gst_tag_list_to_exif_buffer_with_tiff_header"
+              version="0.10.30"
+              introspectable="0">
+      <doc xml:whitespace="preserve">Formats the tags in taglist into exif structure, a tiff header
+is put in the beginning of the buffer.</doc>
+      <return-value>
+        <doc xml:whitespace="preserve">A GstBuffer containing the data</doc>
+        <type name="Gst.Buffer" c:type="GstBuffer*"/>
+      </return-value>
+      <parameters>
+        <parameter name="taglist" transfer-ownership="none">
+          <doc xml:whitespace="preserve">The taglist</doc>
+          <type name="Gst.TagList" c:type="GstTagList*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="tag_list_to_vorbiscomment_buffer"
+              c:identifier="gst_tag_list_to_vorbiscomment_buffer"
+              introspectable="0">
+      <doc xml:whitespace="preserve">Creates a new vorbiscomment buffer from a tag list.
+that could be converted from the given tag list.</doc>
+      <return-value>
+        <doc xml:whitespace="preserve">A new #GstBuffer containing a vorbiscomment buffer with all tags</doc>
+        <type name="Gst.Buffer" c:type="GstBuffer*"/>
+      </return-value>
+      <parameters>
+        <parameter name="list" transfer-ownership="none">
+          <doc xml:whitespace="preserve">tag list to convert</doc>
+          <type name="Gst.TagList" c:type="GstTagList*"/>
+        </parameter>
+        <parameter name="id_data" transfer-ownership="none">
+          <doc xml:whitespace="preserve">identification data at start of stream</doc>
+          <type name="guint8" c:type="guint8*"/>
+        </parameter>
+        <parameter name="id_data_length" transfer-ownership="none">
+          <doc xml:whitespace="preserve">length of identification data, may be 0 if @id_data is NULL</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+        <parameter name="vendor_string" transfer-ownership="none">
+          <doc xml:whitespace="preserve">string that describes the vendor string or NULL</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="tag_list_to_xmp_buffer"
+              c:identifier="gst_tag_list_to_xmp_buffer"
+              version="0.10.29"
+              introspectable="0">
+      <doc xml:whitespace="preserve">Formats a taglist as a xmp packet.</doc>
+      <return-value>
+        <doc xml:whitespace="preserve">new buffer or %NULL, unref the buffer when done</doc>
+        <type name="Gst.Buffer" c:type="GstBuffer*"/>
+      </return-value>
+      <parameters>
+        <parameter name="list" transfer-ownership="none">
+          <doc xml:whitespace="preserve">tags</doc>
+          <type name="Gst.TagList" c:type="GstTagList*"/>
+        </parameter>
+        <parameter name="read_only" transfer-ownership="none">
+          <doc xml:whitespace="preserve">does the container forbid inplace editing</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="tag_parse_extended_comment"
+              c:identifier="gst_tag_parse_extended_comment"
+              version="0.10.10">
+      <doc xml:whitespace="preserve">Convenience function to parse a GST_TAG_EXTENDED_COMMENT string and
+separate it into its components.
+If successful, @key, @lang and/or @value will be set to newly allocated
+strings that you need to free with g_free() when done. @key and @lang
+may also be set to NULL by this function if there is no key or no language
+code in the extended comment string.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if the string could be parsed, otherwise FALSE</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="ext_comment" transfer-ownership="none">
+          <doc xml:whitespace="preserve">an extended comment string, see #GST_TAG_EXTENDED_COMMENT</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+        <parameter name="key" transfer-ownership="none">
+          <doc xml:whitespace="preserve">return location for the comment description key, or NULL</doc>
+          <type name="utf8" c:type="gchar**"/>
+        </parameter>
+        <parameter name="lang" transfer-ownership="none">
+          <doc xml:whitespace="preserve">return location for the comment ISO-639 language code, or NULL</doc>
+          <type name="utf8" c:type="gchar**"/>
+        </parameter>
+        <parameter name="value" transfer-ownership="none">
+          <doc xml:whitespace="preserve">return location for the actual comment string, or NULL</doc>
+          <type name="utf8" c:type="gchar**"/>
+        </parameter>
+        <parameter name="fail_if_no_key" transfer-ownership="none">
+          <doc xml:whitespace="preserve">whether to fail if strings are not in key=value form</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="tag_register_musicbrainz_tags"
+              c:identifier="gst_tag_register_musicbrainz_tags">
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+    </function>
+    <function name="tag_to_id3_tag" c:identifier="gst_tag_to_id3_tag">
+      <doc xml:whitespace="preserve">Looks up the ID3v2 tag for a GStreamer tag.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">The corresponding ID3v2 tag or NULL if none exists.</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="gst_tag" transfer-ownership="none">
+          <doc xml:whitespace="preserve">GStreamer tag to convert to vorbiscomment tag</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="tag_to_vorbis_comments"
+              c:identifier="gst_tag_to_vorbis_comments"
+              introspectable="0">
+      <doc xml:whitespace="preserve">Creates a new tag list that contains the information parsed out of a
+vorbiscomment packet.
+g_list_foreach (list, (GFunc) g_free, NULL) plus g_list_free (list)</doc>
+      <return-value>
+        <doc xml:whitespace="preserve">A #GList of newly-allowcated key=value strings. Free with</doc>
+        <type name="GLib.List" c:type="GList*">
+          <type name="gpointer" c:type="gpointer"/>
+        </type>
+      </return-value>
+      <parameters>
+        <parameter name="list" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstTagList</doc>
+          <type name="Gst.TagList" c:type="GstTagList*"/>
+        </parameter>
+        <parameter name="tag" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a GStreamer tag identifier, such as #GST_TAG_ARTIST</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="tag_to_vorbis_tag" c:identifier="gst_tag_to_vorbis_tag">
+      <doc xml:whitespace="preserve">Looks up the vorbiscomment tag for a GStreamer tag.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">The corresponding vorbiscomment tag or NULL if none exists.</doc>
+        <type name="utf8" c:type="gchar*"/>
+      </return-value>
+      <parameters>
+        <parameter name="gst_tag" transfer-ownership="none">
+          <doc xml:whitespace="preserve">GStreamer tag to convert to vorbiscomment tag</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="vorbis_tag_add" c:identifier="gst_vorbis_tag_add">
+      <doc xml:whitespace="preserve">Convenience function using gst_tag_from_vorbis_tag(), parsing
+a vorbis comment string into the right type and adding it to the
+given taglist @list.
+Unknown vorbiscomment tags will be added to the tag list in form
+of a #GST_TAG_EXTENDED_COMMENT (since 0.10.10 at least).</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="list" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstTagList</doc>
+          <type name="Gst.TagList" c:type="GstTagList*"/>
+        </parameter>
+        <parameter name="tag" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a vorbiscomment tag string (key in key=value), must be valid UTF-8</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+        <parameter name="value" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a vorbiscomment value string (value in key=value), must be valid UTF-8</doc>
+          <type name="utf8" c:type="gchar*"/>
+        </parameter>
+      </parameters>
+    </function>
+  </namespace>
+</repository>
diff --git a/gstreamer/plugins/tag/ffi/ffi.factor b/gstreamer/plugins/tag/ffi/ffi.factor
new file mode 100644 (file)
index 0000000..28eda35
--- /dev/null
@@ -0,0 +1,16 @@
+! Copyright (C) 2010 Anton Gorenko.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.libraries combinators kernel system
+gobject-introspection glib.ffi gstreamer.ffi ;
+IN: gstreamer.tag.ffi
+
+<<
+"gstreamer.tag" {
+    { [ os winnt? ] [ drop ] }
+    { [ os macosx? ] [ drop ] }
+    { [ os unix? ] [ "libgsttag-0.10.so" cdecl add-library ] }
+} cond
+>>
+
+GIR: vocab:gstreamer/tag/GstTag-0.10.gir
+
diff --git a/gstreamer/plugins/tag/tag.factor b/gstreamer/plugins/tag/tag.factor
new file mode 100644 (file)
index 0000000..30c6c97
--- /dev/null
@@ -0,0 +1,5 @@
+! Copyright (C) 2010 Anton Gorenko.
+! See http://factorcode.org/license.txt for BSD license.
+USING: gstreamer.tag.ffi ;
+IN: gstreamer.tag
+
diff --git a/gstreamer/plugins/video/GstVideo-0.10.gir b/gstreamer/plugins/video/GstVideo-0.10.gir
new file mode 100644 (file)
index 0000000..ba39781
--- /dev/null
@@ -0,0 +1,1188 @@
+<?xml version="1.0"?>
+<!-- This file was automatically generated from C sources - DO NOT EDIT!
+To affect the contents of this file, edit the original C definitions,
+and/or use gtk-doc annotations.  -->
+<repository version="1.2"
+            xmlns="http://www.gtk.org/introspection/core/1.0"
+            xmlns:c="http://www.gtk.org/introspection/c/1.0"
+            xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+  <include name="GLib" version="2.0"/>
+  <include name="GModule" version="2.0"/>
+  <include name="GObject" version="2.0"/>
+  <include name="Gst" version="0.10"/>
+  <include name="GstBase" version="0.10"/>
+  <include name="libxml2" version="2.0"/>
+  <package name="gstreamer-video-0.10"/>
+  <c:include name="gst/video/gstvideofilter.h"/>
+  <c:include name="gst/video/gstvideosink.h"/>
+  <c:include name="gst/video/video-enumtypes.h"/>
+  <c:include name="gst/video/video.h"/>
+  <namespace name="GstVideo"
+             version="0.10"
+             shared-library="libgstvideo-0.10.so.0"
+             c:identifier-prefixes="Gst"
+             c:symbol-prefixes="gst">
+    <constant name="VIDEO_BYTE1_MASK_24" value="0x00FF0000">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="VIDEO_BYTE1_MASK_24_INT" value="16711680">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="VIDEO_BYTE1_MASK_32" value="0xFF000000">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="VIDEO_BYTE1_MASK_32_INT" value="-16777216">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="VIDEO_BYTE2_MASK_24" value="0x0000FF00">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="VIDEO_BYTE2_MASK_24_INT" value="65280">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="VIDEO_BYTE2_MASK_32" value="0x00FF0000">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="VIDEO_BYTE2_MASK_32_INT" value="16711680">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="VIDEO_BYTE3_MASK_24" value="0x000000FF">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="VIDEO_BYTE3_MASK_24_INT" value="255">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="VIDEO_BYTE3_MASK_32" value="0x0000FF00">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="VIDEO_BYTE3_MASK_32_INT" value="65280">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="VIDEO_BYTE4_MASK_32" value="0x000000FF">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="VIDEO_BYTE4_MASK_32_INT" value="255">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="VIDEO_CAPS_GRAY8"
+              value="video/x-raw-gray, bpp = (int) 8, depth = (int) 8, width = ">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="VIDEO_CAPS_RGB8_PALETTED"
+              value="video/x-raw-rgb, bpp = (int)8, depth = (int)8, width = ">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="VIDEO_COMP1_MASK_15" value="0x7c00">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="VIDEO_COMP1_MASK_15_INT" value="31744">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="VIDEO_COMP1_MASK_16" value="0xf800">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="VIDEO_COMP1_MASK_16_INT" value="63488">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="VIDEO_COMP2_MASK_15" value="0x03e0">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="VIDEO_COMP2_MASK_15_INT" value="992">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="VIDEO_COMP2_MASK_16" value="0x07e0">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="VIDEO_COMP2_MASK_16_INT" value="2016">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="VIDEO_COMP3_MASK_15" value="0x001f">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="VIDEO_COMP3_MASK_15_INT" value="31">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="VIDEO_COMP3_MASK_16" value="0x001f">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="VIDEO_COMP3_MASK_16_INT" value="31">
+      <type name="gint" c:type="gint"/>
+    </constant>
+    <constant name="VIDEO_FPS_RANGE" value="(fraction) [ 0, max ]">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <constant name="VIDEO_SIZE_RANGE" value="(int) [ 1, max ]">
+      <type name="utf8" c:type="gchar*"/>
+    </constant>
+    <callback name="VideoConvertFrameCallback"
+              c:type="GstVideoConvertFrameCallback">
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="buf" transfer-ownership="none">
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="error" transfer-ownership="none">
+          <type name="GLib.Error" c:type="GError*"/>
+        </parameter>
+        <parameter name="user_data" transfer-ownership="none" closure="2">
+          <type name="gpointer" c:type="gpointer"/>
+        </parameter>
+      </parameters>
+    </callback>
+    <class name="VideoFilter"
+           c:symbol-prefix="video_filter"
+           c:type="GstVideoFilter"
+           parent="GstBase.BaseTransform"
+           abstract="1"
+           glib:type-name="GstVideoFilter"
+           glib:get-type="gst_video_filter_get_type"
+           glib:type-struct="VideoFilterClass">
+      <field name="element">
+        <type name="GstBase.BaseTransform" c:type="GstBaseTransform"/>
+      </field>
+      <field name="inited">
+        <type name="gboolean" c:type="gboolean"/>
+      </field>
+    </class>
+    <record name="VideoFilterClass"
+            c:type="GstVideoFilterClass"
+            glib:is-gtype-struct-for="VideoFilter">
+      <field name="parent_class">
+        <type name="GstBase.BaseTransformClass"
+              c:type="GstBaseTransformClass"/>
+      </field>
+    </record>
+    <enumeration name="VideoFormat"
+                 glib:type-name="GstVideoFormat"
+                 glib:get-type="gst_video_format_get_type"
+                 c:type="GstVideoFormat">
+      <doc xml:whitespace="preserve">Enum value describing the most common video formats.</doc>
+      <member name="unknown"
+              value="0"
+              c:identifier="GST_VIDEO_FORMAT_UNKNOWN"
+              glib:nick="unknown"/>
+      <member name="i420"
+              value="1"
+              c:identifier="GST_VIDEO_FORMAT_I420"
+              glib:nick="i420"/>
+      <member name="yv12"
+              value="2"
+              c:identifier="GST_VIDEO_FORMAT_YV12"
+              glib:nick="yv12"/>
+      <member name="yuy2"
+              value="3"
+              c:identifier="GST_VIDEO_FORMAT_YUY2"
+              glib:nick="yuy2"/>
+      <member name="uyvy"
+              value="4"
+              c:identifier="GST_VIDEO_FORMAT_UYVY"
+              glib:nick="uyvy"/>
+      <member name="ayuv"
+              value="5"
+              c:identifier="GST_VIDEO_FORMAT_AYUV"
+              glib:nick="ayuv"/>
+      <member name="rgbx"
+              value="6"
+              c:identifier="GST_VIDEO_FORMAT_RGBx"
+              glib:nick="rgbx"/>
+      <member name="bgrx"
+              value="7"
+              c:identifier="GST_VIDEO_FORMAT_BGRx"
+              glib:nick="bgrx"/>
+      <member name="xrgb"
+              value="8"
+              c:identifier="GST_VIDEO_FORMAT_xRGB"
+              glib:nick="xrgb"/>
+      <member name="xbgr"
+              value="9"
+              c:identifier="GST_VIDEO_FORMAT_xBGR"
+              glib:nick="xbgr"/>
+      <member name="rgba"
+              value="10"
+              c:identifier="GST_VIDEO_FORMAT_RGBA"
+              glib:nick="rgba"/>
+      <member name="bgra"
+              value="11"
+              c:identifier="GST_VIDEO_FORMAT_BGRA"
+              glib:nick="bgra"/>
+      <member name="argb"
+              value="12"
+              c:identifier="GST_VIDEO_FORMAT_ARGB"
+              glib:nick="argb"/>
+      <member name="abgr"
+              value="13"
+              c:identifier="GST_VIDEO_FORMAT_ABGR"
+              glib:nick="abgr"/>
+      <member name="rgb"
+              value="14"
+              c:identifier="GST_VIDEO_FORMAT_RGB"
+              glib:nick="rgb"/>
+      <member name="bgr"
+              value="15"
+              c:identifier="GST_VIDEO_FORMAT_BGR"
+              glib:nick="bgr"/>
+      <member name="y41b"
+              value="16"
+              c:identifier="GST_VIDEO_FORMAT_Y41B"
+              glib:nick="y41b"/>
+      <member name="y42b"
+              value="17"
+              c:identifier="GST_VIDEO_FORMAT_Y42B"
+              glib:nick="y42b"/>
+      <member name="yvyu"
+              value="18"
+              c:identifier="GST_VIDEO_FORMAT_YVYU"
+              glib:nick="yvyu"/>
+      <member name="y444"
+              value="19"
+              c:identifier="GST_VIDEO_FORMAT_Y444"
+              glib:nick="y444"/>
+      <member name="v210"
+              value="20"
+              c:identifier="GST_VIDEO_FORMAT_v210"
+              glib:nick="v210"/>
+      <member name="v216"
+              value="21"
+              c:identifier="GST_VIDEO_FORMAT_v216"
+              glib:nick="v216"/>
+      <member name="nv12"
+              value="22"
+              c:identifier="GST_VIDEO_FORMAT_NV12"
+              glib:nick="nv12"/>
+      <member name="nv21"
+              value="23"
+              c:identifier="GST_VIDEO_FORMAT_NV21"
+              glib:nick="nv21"/>
+      <member name="gray8"
+              value="24"
+              c:identifier="GST_VIDEO_FORMAT_GRAY8"
+              glib:nick="gray8"/>
+      <member name="gray16_be"
+              value="25"
+              c:identifier="GST_VIDEO_FORMAT_GRAY16_BE"
+              glib:nick="gray16-be"/>
+      <member name="gray16_le"
+              value="26"
+              c:identifier="GST_VIDEO_FORMAT_GRAY16_LE"
+              glib:nick="gray16-le"/>
+      <member name="v308"
+              value="27"
+              c:identifier="GST_VIDEO_FORMAT_v308"
+              glib:nick="v308"/>
+      <member name="y800"
+              value="28"
+              c:identifier="GST_VIDEO_FORMAT_Y800"
+              glib:nick="y800"/>
+      <member name="y16"
+              value="29"
+              c:identifier="GST_VIDEO_FORMAT_Y16"
+              glib:nick="y16"/>
+      <member name="rgb16"
+              value="30"
+              c:identifier="GST_VIDEO_FORMAT_RGB16"
+              glib:nick="rgb16"/>
+      <member name="bgr16"
+              value="31"
+              c:identifier="GST_VIDEO_FORMAT_BGR16"
+              glib:nick="bgr16"/>
+      <member name="rgb15"
+              value="32"
+              c:identifier="GST_VIDEO_FORMAT_RGB15"
+              glib:nick="rgb15"/>
+      <member name="bgr15"
+              value="33"
+              c:identifier="GST_VIDEO_FORMAT_BGR15"
+              glib:nick="bgr15"/>
+      <member name="uyvp"
+              value="34"
+              c:identifier="GST_VIDEO_FORMAT_UYVP"
+              glib:nick="uyvp"/>
+      <member name="a420"
+              value="35"
+              c:identifier="GST_VIDEO_FORMAT_A420"
+              glib:nick="a420"/>
+      <member name="rgb8_paletted"
+              value="36"
+              c:identifier="GST_VIDEO_FORMAT_RGB8_PALETTED"
+              glib:nick="rgb8-paletted"/>
+      <member name="yuv9"
+              value="37"
+              c:identifier="GST_VIDEO_FORMAT_YUV9"
+              glib:nick="yuv9"/>
+      <member name="yvu9"
+              value="38"
+              c:identifier="GST_VIDEO_FORMAT_YVU9"
+              glib:nick="yvu9"/>
+      <member name="iyu1"
+              value="39"
+              c:identifier="GST_VIDEO_FORMAT_IYU1"
+              glib:nick="iyu1"/>
+    </enumeration>
+    <record name="VideoRectangle" c:type="GstVideoRectangle">
+      <doc xml:whitespace="preserve">Helper structure representing a rectangular area.</doc>
+      <field name="x" writable="1">
+        <type name="gint" c:type="gint"/>
+      </field>
+      <field name="y" writable="1">
+        <type name="gint" c:type="gint"/>
+      </field>
+      <field name="w" writable="1">
+        <type name="gint" c:type="gint"/>
+      </field>
+      <field name="h" writable="1">
+        <type name="gint" c:type="gint"/>
+      </field>
+    </record>
+    <class name="VideoSink"
+           c:symbol-prefix="video_sink"
+           c:type="GstVideoSink"
+           parent="GstBase.BaseSink"
+           glib:type-name="GstVideoSink"
+           glib:get-type="gst_video_sink_get_type"
+           glib:type-struct="VideoSinkClass">
+      <doc xml:whitespace="preserve">The video sink instance structure. Derived video sinks should set the</doc>
+      <function name="center_rect" c:identifier="gst_video_sink_center_rect">
+        <doc xml:whitespace="preserve">Takes @src rectangle and position it at the center of @dst rectangle with or
+without @scaling. It handles clipping if the @src rectangle is bigger than
+the @dst one and @scaling is set to FALSE.</doc>
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="src" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the #GstVideoRectangle describing the source area</doc>
+            <type name="VideoRectangle" c:type="GstVideoRectangle"/>
+          </parameter>
+          <parameter name="dst" transfer-ownership="none">
+            <doc xml:whitespace="preserve">the #GstVideoRectangle describing the destination area</doc>
+            <type name="VideoRectangle" c:type="GstVideoRectangle"/>
+          </parameter>
+          <parameter name="result" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a pointer to a #GstVideoRectangle which will receive the result area</doc>
+            <type name="VideoRectangle" c:type="GstVideoRectangle*"/>
+          </parameter>
+          <parameter name="scaling" transfer-ownership="none">
+            <doc xml:whitespace="preserve">a #gboolean indicating if scaling should be applied or not</doc>
+            <type name="gboolean" c:type="gboolean"/>
+          </parameter>
+        </parameters>
+      </function>
+      <virtual-method name="show_frame">
+        <return-value transfer-ownership="none">
+          <type name="Gst.FlowReturn" c:type="GstFlowReturn"/>
+        </return-value>
+        <parameters>
+          <parameter name="buf" transfer-ownership="none">
+            <type name="Gst.Buffer" c:type="GstBuffer*"/>
+          </parameter>
+        </parameters>
+      </virtual-method>
+      <property name="show-preroll-frame"
+                writable="1"
+                construct="1"
+                transfer-ownership="none">
+        <type name="gboolean"/>
+      </property>
+      <field name="element">
+        <type name="GstBase.BaseSink" c:type="GstBaseSink"/>
+      </field>
+      <field name="width">
+        <type name="gint" c:type="gint"/>
+      </field>
+      <field name="height">
+        <type name="gint" c:type="gint"/>
+      </field>
+      <field name="priv">
+        <type name="VideoSinkPrivate" c:type="GstVideoSinkPrivate*"/>
+      </field>
+      <field name="_gst_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="3">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </class>
+    <record name="VideoSinkClass"
+            c:type="GstVideoSinkClass"
+            glib:is-gtype-struct-for="VideoSink">
+      <doc xml:whitespace="preserve">The video sink class structure. Derived classes should override the</doc>
+      <field name="parent_class">
+        <type name="GstBase.BaseSinkClass" c:type="GstBaseSinkClass"/>
+      </field>
+      <field name="show_frame">
+        <callback name="show_frame">
+          <return-value transfer-ownership="none">
+            <type name="Gst.FlowReturn" c:type="GstFlowReturn"/>
+          </return-value>
+          <parameters>
+            <parameter name="video_sink" transfer-ownership="none">
+              <type name="VideoSink" c:type="GstVideoSink*"/>
+            </parameter>
+            <parameter name="buf" transfer-ownership="none">
+              <type name="Gst.Buffer" c:type="GstBuffer*"/>
+            </parameter>
+          </parameters>
+        </callback>
+      </field>
+      <field name="_gst_reserved">
+        <array zero-terminated="0" c:type="gpointer" fixed-size="3">
+          <type name="gpointer" c:type="gpointer"/>
+        </array>
+      </field>
+    </record>
+    <record name="VideoSinkPrivate" c:type="GstVideoSinkPrivate" disguised="1">
+    </record>
+    <function name="video_calculate_display_ratio"
+              c:identifier="gst_video_calculate_display_ratio"
+              version="0.10.7">
+      <doc xml:whitespace="preserve">Given the Pixel Aspect Ratio and size of an input video frame, and the 
+pixel aspect ratio of the intended display device, calculates the actual 
+display ratio the video will be rendered with.
+dar_n and dar_d parameters. 
+The return value is FALSE in the case of integer overflow or other error.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">A boolean indicating success and a calculated Display Ratio in the</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="dar_n" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Numerator of the calculated display_ratio</doc>
+          <type name="guint" c:type="guint*"/>
+        </parameter>
+        <parameter name="dar_d" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Denominator of the calculated display_ratio</doc>
+          <type name="guint" c:type="guint*"/>
+        </parameter>
+        <parameter name="video_width" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Width of the video frame in pixels</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+        <parameter name="video_height" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Height of the video frame in pixels</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+        <parameter name="video_par_n" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Numerator of the pixel aspect ratio of the input video.</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+        <parameter name="video_par_d" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Denominator of the pixel aspect ratio of the input video.</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+        <parameter name="display_par_n" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Numerator of the pixel aspect ratio of the display device</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+        <parameter name="display_par_d" transfer-ownership="none">
+          <doc xml:whitespace="preserve">Denominator of the pixel aspect ratio of the display device</doc>
+          <type name="guint" c:type="guint"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="video_convert_frame"
+              c:identifier="gst_video_convert_frame"
+              version="0.10.31"
+              introspectable="0"
+              throws="1">
+      <doc xml:whitespace="preserve">Converts a raw video buffer into the specified output caps.
+The output caps can be any raw video formats or any image formats (jpeg, png, ...).
+The width, height and pixel-aspect-ratio can also be specified in the output caps.
+will point to the #GError).</doc>
+      <return-value>
+        <doc xml:whitespace="preserve">The converted #GstBuffer, or %NULL if an error happened (in which case @err</doc>
+        <type name="Gst.Buffer" c:type="GstBuffer*"/>
+      </return-value>
+      <parameters>
+        <parameter name="buf" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstBuffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="to_caps" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the #GstCaps to convert to</doc>
+          <type name="Gst.Caps" c:type="GstCaps*"/>
+        </parameter>
+        <parameter name="timeout" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the maximum amount of time allowed for the processing.</doc>
+          <type name="Gst.ClockTime" c:type="GstClockTime"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="video_convert_frame_async"
+              c:identifier="gst_video_convert_frame_async"
+              version="0.10.31">
+      <doc xml:whitespace="preserve">Converts a raw video buffer into the specified output caps.
+The output caps can be any raw video formats or any image formats (jpeg, png, ...).
+The width, height and pixel-aspect-ratio can also be specified in the output caps.
+finish after @timeout. @callback will always be called from the thread default
+%GMainContext, see g_main_context_get_thread_default(). If GLib before 2.22 is used,
+this will always be the global default main context.
+anymore.</doc>
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="buf" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstBuffer</doc>
+          <type name="Gst.Buffer" c:type="GstBuffer*"/>
+        </parameter>
+        <parameter name="to_caps" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the #GstCaps to convert to</doc>
+          <type name="Gst.Caps" c:type="GstCaps*"/>
+        </parameter>
+        <parameter name="timeout" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the maximum amount of time allowed for the processing.</doc>
+          <type name="Gst.ClockTime" c:type="GstClockTime"/>
+        </parameter>
+        <parameter name="callback"
+                   transfer-ownership="none"
+                   scope="notified"
+                   closure="4"
+                   destroy="5">
+          <doc xml:whitespace="preserve">%GstVideoConvertFrameCallback that will be called after conversion.</doc>
+          <type name="VideoConvertFrameCallback"
+                c:type="GstVideoConvertFrameCallback"/>
+        </parameter>
+        <parameter name="user_data" transfer-ownership="none">
+          <type name="gpointer" c:type="gpointer"/>
+        </parameter>
+        <parameter name="destroy_notify"
+                   transfer-ownership="none"
+                   scope="async">
+          <doc xml:whitespace="preserve">%GDestroyNotify to be called after @user_data is not needed anymore</doc>
+          <type name="GLib.DestroyNotify" c:type="GDestroyNotify"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="video_event_new_still_frame"
+              c:identifier="gst_video_event_new_still_frame"
+              version="0.10.26"
+              introspectable="0">
+      <doc xml:whitespace="preserve">Creates a new Still Frame event. If @in_still is %TRUE, then the event
+represents the start of a still frame sequence. If it is %FALSE, then
+the event ends a still frame sequence.
+To parse an event created by gst_video_event_new_still_frame() use
+gst_video_event_parse_still_frame().</doc>
+      <return-value>
+        <doc xml:whitespace="preserve">The new GstEvent</doc>
+        <type name="Gst.Event" c:type="GstEvent*"/>
+      </return-value>
+      <parameters>
+        <parameter name="in_still" transfer-ownership="none">
+          <doc xml:whitespace="preserve">boolean value for the still-frame state of the event.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="video_event_parse_still_frame"
+              c:identifier="gst_video_event_parse_still_frame"
+              version="0.10.26">
+      <doc xml:whitespace="preserve">Parse a #GstEvent, identify if it is a Still Frame event, and
+return the still-frame state from the event if it is.
+If the event represents the start of a still frame, the in_still
+variable will be set to TRUE, otherwise FALSE. It is OK to pass NULL for the
+in_still variable order to just check whether the event is a valid still-frame
+event.
+Create a still frame event using gst_video_event_new_still_frame()</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">%TRUE if the event is a valid still-frame event. %FALSE if not</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="event" transfer-ownership="none">
+          <doc xml:whitespace="preserve">A #GstEvent to parse</doc>
+          <type name="Gst.Event" c:type="GstEvent*"/>
+        </parameter>
+        <parameter name="in_still" transfer-ownership="none">
+          <doc xml:whitespace="preserve">A boolean to receive the still-frame status from the event, or NULL</doc>
+          <type name="gboolean" c:type="gboolean*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="video_format_convert"
+              c:identifier="gst_video_format_convert"
+              version="0.10.16">
+      <doc xml:whitespace="preserve">Converts among various #GstFormat types.  This function handles
+GST_FORMAT_BYTES, GST_FORMAT_TIME, and GST_FORMAT_DEFAULT.  For
+raw video, GST_FORMAT_DEFAULT corresponds to video frames.  This
+function can be to handle pad queries of the type GST_QUERY_CONVERT.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if the conversion was successful.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="format" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstVideoFormat</doc>
+          <type name="VideoFormat" c:type="GstVideoFormat"/>
+        </parameter>
+        <parameter name="width" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the width of video</doc>
+          <type name="gint" c:type="int"/>
+        </parameter>
+        <parameter name="height" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the height of video</doc>
+          <type name="gint" c:type="int"/>
+        </parameter>
+        <parameter name="fps_n" transfer-ownership="none">
+          <doc xml:whitespace="preserve">frame rate numerator</doc>
+          <type name="gint" c:type="int"/>
+        </parameter>
+        <parameter name="fps_d" transfer-ownership="none">
+          <doc xml:whitespace="preserve">frame rate denominator</doc>
+          <type name="gint" c:type="int"/>
+        </parameter>
+        <parameter name="src_format" transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GstFormat of the @src_value</doc>
+          <type name="Gst.Format" c:type="GstFormat"/>
+        </parameter>
+        <parameter name="src_value" transfer-ownership="none">
+          <doc xml:whitespace="preserve">value to convert</doc>
+          <type name="gint64" c:type="gint64"/>
+        </parameter>
+        <parameter name="dest_format" transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GstFormat of the @dest_value</doc>
+          <type name="Gst.Format" c:type="GstFormat"/>
+        </parameter>
+        <parameter name="dest_value" transfer-ownership="none">
+          <doc xml:whitespace="preserve">pointer to destination value</doc>
+          <type name="gint64" c:type="gint64*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="video_format_from_fourcc"
+              c:identifier="gst_video_format_from_fourcc"
+              version="0.10.16">
+      <doc xml:whitespace="preserve">Converts a FOURCC value into the corresponding #GstVideoFormat.
+If the FOURCC cannot be represented by #GstVideoFormat,
+#GST_VIDEO_FORMAT_UNKNOWN is returned.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">the #GstVideoFormat describing the FOURCC value</doc>
+        <type name="VideoFormat" c:type="GstVideoFormat"/>
+      </return-value>
+      <parameters>
+        <parameter name="fourcc" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a FOURCC value representing raw YUV video</doc>
+          <type name="guint32" c:type="guint32"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="video_format_get_component_height"
+              c:identifier="gst_video_format_get_component_height"
+              version="0.10.16">
+      <doc xml:whitespace="preserve">Calculates the height of the component.  See
+of the component index.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">height of component @component</doc>
+        <type name="gint" c:type="int"/>
+      </return-value>
+      <parameters>
+        <parameter name="format" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstVideoFormat</doc>
+          <type name="VideoFormat" c:type="GstVideoFormat"/>
+        </parameter>
+        <parameter name="component" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the component index</doc>
+          <type name="gint" c:type="int"/>
+        </parameter>
+        <parameter name="height" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the height of video</doc>
+          <type name="gint" c:type="int"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="video_format_get_component_offset"
+              c:identifier="gst_video_format_get_component_offset"
+              version="0.10.16">
+      <doc xml:whitespace="preserve">Calculates the offset (in bytes) of the first pixel of the component
+with index @component.  For packed formats, this will typically be a
+small integer (0, 1, 2, 3).  For planar formats, this will be a
+(relatively) large offset to the beginning of the second or third
+component planes.  See @gst_video_format_get_row_stride for a description
+of the component index.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">offset of component @component</doc>
+        <type name="gint" c:type="int"/>
+      </return-value>
+      <parameters>
+        <parameter name="format" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstVideoFormat</doc>
+          <type name="VideoFormat" c:type="GstVideoFormat"/>
+        </parameter>
+        <parameter name="component" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the component index</doc>
+          <type name="gint" c:type="int"/>
+        </parameter>
+        <parameter name="width" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the width of video</doc>
+          <type name="gint" c:type="int"/>
+        </parameter>
+        <parameter name="height" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the height of video</doc>
+          <type name="gint" c:type="int"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="video_format_get_component_width"
+              c:identifier="gst_video_format_get_component_width"
+              version="0.10.16">
+      <doc xml:whitespace="preserve">Calculates the width of the component.  See
+of the component index.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">width of component @component</doc>
+        <type name="gint" c:type="int"/>
+      </return-value>
+      <parameters>
+        <parameter name="format" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstVideoFormat</doc>
+          <type name="VideoFormat" c:type="GstVideoFormat"/>
+        </parameter>
+        <parameter name="component" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the component index</doc>
+          <type name="gint" c:type="int"/>
+        </parameter>
+        <parameter name="width" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the width of video</doc>
+          <type name="gint" c:type="int"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="video_format_get_pixel_stride"
+              c:identifier="gst_video_format_get_pixel_stride"
+              version="0.10.16">
+      <doc xml:whitespace="preserve">Calculates the pixel stride (number of bytes from one pixel to the
+pixel to its immediate left) for the video component with an index
+of @component.  See @gst_video_format_get_row_stride for a description
+of the component index.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">pixel stride of component @component</doc>
+        <type name="gint" c:type="int"/>
+      </return-value>
+      <parameters>
+        <parameter name="format" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstVideoFormat</doc>
+          <type name="VideoFormat" c:type="GstVideoFormat"/>
+        </parameter>
+        <parameter name="component" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the component index</doc>
+          <type name="gint" c:type="int"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="video_format_get_row_stride"
+              c:identifier="gst_video_format_get_row_stride"
+              version="0.10.16">
+      <doc xml:whitespace="preserve">Calculates the row stride (number of bytes from one row of pixels to
+the next) for the video component with an index of @component.  For
+YUV video, Y, U, and V have component indices of 0, 1, and 2,
+respectively.  For RGB video, R, G, and B have component indicies of
+0, 1, and 2, respectively.  Alpha channels, if present, have a component
+index of 3.  The @width parameter always represents the width of the
+video, not the component.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">row stride of component @component</doc>
+        <type name="gint" c:type="int"/>
+      </return-value>
+      <parameters>
+        <parameter name="format" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstVideoFormat</doc>
+          <type name="VideoFormat" c:type="GstVideoFormat"/>
+        </parameter>
+        <parameter name="component" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the component index</doc>
+          <type name="gint" c:type="int"/>
+        </parameter>
+        <parameter name="width" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the width of video</doc>
+          <type name="gint" c:type="int"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="video_format_get_size"
+              c:identifier="gst_video_format_get_size"
+              version="0.10.16">
+      <doc xml:whitespace="preserve">Calculates the total number of bytes in the raw video format.  This
+number should be used when allocating a buffer for raw video.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">size (in bytes) of raw video format</doc>
+        <type name="gint" c:type="int"/>
+      </return-value>
+      <parameters>
+        <parameter name="format" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstVideoFormat</doc>
+          <type name="VideoFormat" c:type="GstVideoFormat"/>
+        </parameter>
+        <parameter name="width" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the width of video</doc>
+          <type name="gint" c:type="int"/>
+        </parameter>
+        <parameter name="height" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the height of video</doc>
+          <type name="gint" c:type="int"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="video_format_has_alpha"
+              c:identifier="gst_video_format_has_alpha"
+              version="0.10.16">
+      <doc xml:whitespace="preserve">Returns TRUE or FALSE depending on if the video format provides an
+alpha channel.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if @format has an alpha channel</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="format" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstVideoFormat</doc>
+          <type name="VideoFormat" c:type="GstVideoFormat"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="video_format_is_gray"
+              c:identifier="gst_video_format_is_gray"
+              version="0.10.29">
+      <doc xml:whitespace="preserve">Determine whether the video format is a grayscale format.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if @format represents grayscale video</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="format" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstVideoFormat</doc>
+          <type name="VideoFormat" c:type="GstVideoFormat"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="video_format_is_rgb"
+              c:identifier="gst_video_format_is_rgb"
+              version="0.10.16">
+      <doc xml:whitespace="preserve">Determine whether the video format is an RGB format.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if @format represents RGB video</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="format" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstVideoFormat</doc>
+          <type name="VideoFormat" c:type="GstVideoFormat"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="video_format_is_yuv"
+              c:identifier="gst_video_format_is_yuv"
+              version="0.10.16">
+      <doc xml:whitespace="preserve">Determine whether the video format is a YUV format.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if @format represents YUV video</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="format" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstVideoFormat</doc>
+          <type name="VideoFormat" c:type="GstVideoFormat"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="video_format_new_caps"
+              c:identifier="gst_video_format_new_caps"
+              version="0.10.16">
+      <doc xml:whitespace="preserve">Creates a new #GstCaps object based on the parameters provided.</doc>
+      <return-value transfer-ownership="full">
+        <doc xml:whitespace="preserve">a new #GstCaps object, or NULL if there was an error</doc>
+        <type name="Gst.Caps" c:type="GstCaps*"/>
+      </return-value>
+      <parameters>
+        <parameter name="format" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the #GstVideoFormat describing the raw video format</doc>
+          <type name="VideoFormat" c:type="GstVideoFormat"/>
+        </parameter>
+        <parameter name="width" transfer-ownership="none">
+          <doc xml:whitespace="preserve">width of video</doc>
+          <type name="gint" c:type="int"/>
+        </parameter>
+        <parameter name="height" transfer-ownership="none">
+          <doc xml:whitespace="preserve">height of video</doc>
+          <type name="gint" c:type="int"/>
+        </parameter>
+        <parameter name="framerate_n" transfer-ownership="none">
+          <doc xml:whitespace="preserve">numerator of frame rate</doc>
+          <type name="gint" c:type="int"/>
+        </parameter>
+        <parameter name="framerate_d" transfer-ownership="none">
+          <doc xml:whitespace="preserve">denominator of frame rate</doc>
+          <type name="gint" c:type="int"/>
+        </parameter>
+        <parameter name="par_n" transfer-ownership="none">
+          <doc xml:whitespace="preserve">numerator of pixel aspect ratio</doc>
+          <type name="gint" c:type="int"/>
+        </parameter>
+        <parameter name="par_d" transfer-ownership="none">
+          <doc xml:whitespace="preserve">denominator of pixel aspect ratio</doc>
+          <type name="gint" c:type="int"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="video_format_new_caps_interlaced"
+              c:identifier="gst_video_format_new_caps_interlaced"
+              version="0.10.23">
+      <doc xml:whitespace="preserve">Creates a new #GstCaps object based on the parameters provided.</doc>
+      <return-value transfer-ownership="full">
+        <doc xml:whitespace="preserve">a new #GstCaps object, or NULL if there was an error</doc>
+        <type name="Gst.Caps" c:type="GstCaps*"/>
+      </return-value>
+      <parameters>
+        <parameter name="format" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the #GstVideoFormat describing the raw video format</doc>
+          <type name="VideoFormat" c:type="GstVideoFormat"/>
+        </parameter>
+        <parameter name="width" transfer-ownership="none">
+          <doc xml:whitespace="preserve">width of video</doc>
+          <type name="gint" c:type="int"/>
+        </parameter>
+        <parameter name="height" transfer-ownership="none">
+          <doc xml:whitespace="preserve">height of video</doc>
+          <type name="gint" c:type="int"/>
+        </parameter>
+        <parameter name="framerate_n" transfer-ownership="none">
+          <doc xml:whitespace="preserve">numerator of frame rate</doc>
+          <type name="gint" c:type="int"/>
+        </parameter>
+        <parameter name="framerate_d" transfer-ownership="none">
+          <doc xml:whitespace="preserve">denominator of frame rate</doc>
+          <type name="gint" c:type="int"/>
+        </parameter>
+        <parameter name="par_n" transfer-ownership="none">
+          <doc xml:whitespace="preserve">numerator of pixel aspect ratio</doc>
+          <type name="gint" c:type="int"/>
+        </parameter>
+        <parameter name="par_d" transfer-ownership="none">
+          <doc xml:whitespace="preserve">denominator of pixel aspect ratio</doc>
+          <type name="gint" c:type="int"/>
+        </parameter>
+        <parameter name="interlaced" transfer-ownership="none">
+          <doc xml:whitespace="preserve">#TRUE if the format is interlaced</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="video_format_parse_caps"
+              c:identifier="gst_video_format_parse_caps"
+              version="0.10.16">
+      <doc xml:whitespace="preserve">Determines the #GstVideoFormat of @caps and places it in the location
+pointed to by @format.  Extracts the size of the video and places it
+in the location pointed to by @width and @height.  If @caps does not
+represent one of the raw video formats listed in #GstVideoFormat, the
+function will fail and return FALSE.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if @caps was parsed correctly.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="caps" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the #GstCaps to parse</doc>
+          <type name="Gst.Caps" c:type="GstCaps*"/>
+        </parameter>
+        <parameter name="format" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the #GstVideoFormat of the video represented by @caps (output)</doc>
+          <type name="VideoFormat" c:type="GstVideoFormat*"/>
+        </parameter>
+        <parameter name="width" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the width of the video represented by @caps, may be NULL (output)</doc>
+          <type name="gint" c:type="int*"/>
+        </parameter>
+        <parameter name="height" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the height of the video represented by @caps, may be NULL (output)</doc>
+          <type name="gint" c:type="int*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="video_format_parse_caps_interlaced"
+              c:identifier="gst_video_format_parse_caps_interlaced"
+              version="0.10.23">
+      <doc xml:whitespace="preserve">Extracts whether the caps represents interlaced content or not and places it
+in @interlaced.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if @caps was parsed correctly.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="caps" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the fixed #GstCaps to parse</doc>
+          <type name="Gst.Caps" c:type="GstCaps*"/>
+        </parameter>
+        <parameter name="interlaced" transfer-ownership="none">
+          <doc xml:whitespace="preserve">whether @caps represents interlaced video or not, may be NULL (output)</doc>
+          <type name="gboolean" c:type="gboolean*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="video_format_to_fourcc"
+              c:identifier="gst_video_format_to_fourcc"
+              version="0.10.16">
+      <doc xml:whitespace="preserve">Converts a #GstVideoFormat value into the corresponding FOURCC.  Only
+a few YUV formats have corresponding FOURCC values.  If @format has
+no corresponding FOURCC value, 0 is returned.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">the FOURCC corresponding to @format</doc>
+        <type name="guint32" c:type="guint32"/>
+      </return-value>
+      <parameters>
+        <parameter name="format" transfer-ownership="none">
+          <doc xml:whitespace="preserve">a #GstVideoFormat video format</doc>
+          <type name="VideoFormat" c:type="GstVideoFormat"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="video_frame_rate" c:identifier="gst_video_frame_rate">
+      <doc xml:whitespace="preserve">A convenience function to retrieve a GValue holding the framerate
+from the caps on a pad.
+The pad needs to have negotiated caps containing a framerate property.
+do not contain a framerate.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">NULL if the pad has no configured caps or the configured caps</doc>
+        <type name="GObject.Value" c:type="GValue*"/>
+      </return-value>
+      <parameters>
+        <parameter name="pad" transfer-ownership="none">
+          <doc xml:whitespace="preserve">pointer to a #GstPad</doc>
+          <type name="Gst.Pad" c:type="GstPad*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="video_get_size" c:identifier="gst_video_get_size">
+      <doc xml:whitespace="preserve">Inspect the caps of the provided pad and retrieve the width and height of
+the video frames it is configured for.
+The pad needs to have negotiated caps containing width and height properties.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if the width and height could be retrieved.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="pad" transfer-ownership="none">
+          <doc xml:whitespace="preserve">pointer to a #GstPad</doc>
+          <type name="Gst.Pad" c:type="GstPad*"/>
+        </parameter>
+        <parameter name="width" transfer-ownership="none">
+          <doc xml:whitespace="preserve">pointer to integer to hold pixel width of the video frames (output)</doc>
+          <type name="gint" c:type="gint*"/>
+        </parameter>
+        <parameter name="height" transfer-ownership="none">
+          <doc xml:whitespace="preserve">pointer to integer to hold pixel height of the video frames (output)</doc>
+          <type name="gint" c:type="gint*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="video_parse_caps_chroma_site"
+              c:identifier="gst_video_parse_caps_chroma_site"
+              version="0.10.29">
+      <doc xml:whitespace="preserve">Extracts the chroma site used by the caps.  Possible values are
+"mpeg2" for MPEG-2 style chroma siting (co-sited horizontally,
+halfway-sited vertically), "jpeg" for JPEG and Theora style
+chroma siting (halfway-sited both horizontally and vertically).
+Other chroma site values are possible, but uncommon.
+When no chroma site is specified in the caps, it should be assumed
+to be "mpeg2".
+determined.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">a chroma site string, or NULL if no chroma site could be</doc>
+        <type name="utf8" c:type="char*"/>
+      </return-value>
+      <parameters>
+        <parameter name="caps" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the fixed #GstCaps to parse</doc>
+          <type name="Gst.Caps" c:type="GstCaps*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="video_parse_caps_color_matrix"
+              c:identifier="gst_video_parse_caps_color_matrix"
+              version="0.10.29">
+      <doc xml:whitespace="preserve">Extracts the color matrix used by the caps.  Possible values are
+"sdtv" for the standard definition color matrix (as specified in
+Rec. ITU-R BT.470-6) or "hdtv" for the high definition color
+matrix (as specified in Rec. ITU-R BT.709)
+determined.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">a color matrix string, or NULL if no color matrix could be</doc>
+        <type name="utf8" c:type="char*"/>
+      </return-value>
+      <parameters>
+        <parameter name="caps" transfer-ownership="none">
+          <doc xml:whitespace="preserve">the fixed #GstCaps to parse</doc>
+          <type name="Gst.Caps" c:type="GstCaps*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="video_parse_caps_framerate"
+              c:identifier="gst_video_parse_caps_framerate"
+              version="0.10.16">
+      <doc xml:whitespace="preserve">Extracts the frame rate from @caps and places the values in the locations
+pointed to by @fps_n and @fps_d.  Returns TRUE if the values could be
+parsed correctly, FALSE if not.
+This function can be used with #GstCaps that have any media type; it
+is not limited to formats handled by #GstVideoFormat.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if @caps was parsed correctly.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="caps" transfer-ownership="none">
+          <doc xml:whitespace="preserve">pointer to a #GstCaps instance</doc>
+          <type name="Gst.Caps" c:type="GstCaps*"/>
+        </parameter>
+        <parameter name="fps_n" transfer-ownership="none">
+          <doc xml:whitespace="preserve">pointer to integer to hold numerator of frame rate (output)</doc>
+          <type name="gint" c:type="int*"/>
+        </parameter>
+        <parameter name="fps_d" transfer-ownership="none">
+          <doc xml:whitespace="preserve">pointer to integer to hold denominator of frame rate (output)</doc>
+          <type name="gint" c:type="int*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="video_parse_caps_palette"
+              c:identifier="gst_video_parse_caps_palette"
+              version="0.10.32"
+              introspectable="0">
+      <doc xml:whitespace="preserve">Returns the palette data from the caps as a #GstBuffer. For
+#GST_VIDEO_FORMAT_RGB8_PALETTED this is containing 256 #guint32
+values, each containing ARGB colors in native endianness.</doc>
+      <return-value>
+        <doc xml:whitespace="preserve">a #GstBuffer containing the palette data. Unref after usage.</doc>
+        <type name="Gst.Buffer" c:type="GstBuffer*"/>
+      </return-value>
+      <parameters>
+        <parameter name="caps" transfer-ownership="none">
+          <doc xml:whitespace="preserve">#GstCaps to parse</doc>
+          <type name="Gst.Caps" c:type="GstCaps*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="video_parse_caps_pixel_aspect_ratio"
+              c:identifier="gst_video_parse_caps_pixel_aspect_ratio"
+              version="0.10.16">
+      <doc xml:whitespace="preserve">Extracts the pixel aspect ratio from @caps and places the values in
+the locations pointed to by @par_n and @par_d.  Returns TRUE if the
+values could be parsed correctly, FALSE if not.
+This function can be used with #GstCaps that have any media type; it
+is not limited to formats handled by #GstVideoFormat.</doc>
+      <return-value transfer-ownership="none">
+        <doc xml:whitespace="preserve">TRUE if @caps was parsed correctly.</doc>
+        <type name="gboolean" c:type="gboolean"/>
+      </return-value>
+      <parameters>
+        <parameter name="caps" transfer-ownership="none">
+          <doc xml:whitespace="preserve">pointer to a #GstCaps instance</doc>
+          <type name="Gst.Caps" c:type="GstCaps*"/>
+        </parameter>
+        <parameter name="par_n" transfer-ownership="none">
+          <doc xml:whitespace="preserve">pointer to numerator of pixel aspect ratio (output)</doc>
+          <type name="gint" c:type="int*"/>
+        </parameter>
+        <parameter name="par_d" transfer-ownership="none">
+          <doc xml:whitespace="preserve">pointer to denominator of pixel aspect ratio (output)</doc>
+          <type name="gint" c:type="int*"/>
+        </parameter>
+      </parameters>
+    </function>
+  </namespace>
+</repository>
diff --git a/gstreamer/plugins/video/ffi/ffi.factor b/gstreamer/plugins/video/ffi/ffi.factor
new file mode 100644 (file)
index 0000000..474c48b
--- /dev/null
@@ -0,0 +1,19 @@
+! Copyright (C) 2010 Anton Gorenko.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.c-types alien.libraries combinators kernel
+system
+gobject-introspection glib.ffi gobject.ffi gstreamer.ffi ;
+IN: gstreamer.video.ffi
+
+<<
+"gstreamer.video" {
+    { [ os winnt? ] [ drop ] }
+    { [ os macosx? ] [ drop ] }
+    { [ os unix? ] [ "libgstvideo-0.10.so" cdecl add-library ] }
+} cond
+>>
+
+IMPLEMENT-STRUCTS: GstVideoRectangle ;
+
+GIR: vocab:gstreamer/video/GstVideo-0.10.gir
+
diff --git a/gstreamer/plugins/video/video.factor b/gstreamer/plugins/video/video.factor
new file mode 100644 (file)
index 0000000..fde33e9
--- /dev/null
@@ -0,0 +1,5 @@
+! Copyright (C) 2010 Anton Gorenko.
+! See http://factorcode.org/license.txt for BSD license.
+USING: gstreamer.video.ffi ;
+IN: gstreamer.video
+
diff --git a/headers/authors.txt b/headers/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/headers/bsd/authors.txt b/headers/bsd/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/headers/bsd/bsd.factor b/headers/bsd/bsd.factor
new file mode 100644 (file)
index 0000000..06634c2
--- /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>byte-array .
+    ] keep
+    [ bpfh-caplen "caplen: " write . ] keep
+    [ bpfh-datalen "datalen: " write . ] keep
+    [ bpfh-hdrlen "hdrlen: " write . ] keep
+    drop ;
+
diff --git a/headers/headers.factor b/headers/headers.factor
new file mode 100644 (file)
index 0000000..a228e77
--- /dev/null
@@ -0,0 +1,86 @@
+! 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 kernel structs math math.parser
+prettyprint sequences ;
+IN: io.sockets.headers
+
+C-STRUCT: etherneth
+    { { "char" 6 } "dmac" }
+    { { "char" 6 } "smac" }
+    { "ushort" "type" } ;
+
+: >mac-address ( byte-array -- string )
+    6 memory>byte-array
+    [ >hex 2 48 pad-left ] { } map-as ":" join ;
+
+: 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 0x0f bitand ;
+
+: set-iph-hl ( n iph -- )
+    [ iph-hl|v 0x0f bitand >r 4 shift r> bitor ] keep
+    set-iph-hl|v ;
+
+: set-iph-v ( n iph -- )
+    [ iph-hl|v 0xf0 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 0x0f bitand ;
+
+: set-tcph-x2 ( n iph -- )
+    [ tcph-x2|off 0x0f bitand >r 4 shift r> bitor ] keep
+    set-tcph-x2|off ;
+
+: set-tcph-off ( n iph -- )
+    [ tcph-x2|off 0x0f bitand bitor ] keep
+    set-tcph-x2|off ;
+
diff --git a/images/jpeg/jpeg.factor b/images/jpeg/jpeg.factor
new file mode 100644 (file)
index 0000000..eb4433a
--- /dev/null
@@ -0,0 +1,372 @@
+! Copyright (C) 2009 Marc Fauconneau.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors arrays byte-arrays combinators
+compression.huffman fry grouping images images.loader
+images.processing io io.binary io.encodings.binary
+io.streams.byte-array io.streams.limited io.streams.throwing
+kernel locals math math.bitwise math.blas.matrices
+math.blas.vectors math.constants math.functions math.matrices
+math.order math.vectors memoize namespaces sequences
+sequences.deep ;
+QUALIFIED-WITH: bitstreams bs
+IN: images.jpeg
+
+SINGLETON: jpeg-image
+
+TUPLE: loading-jpeg < image
+    { headers }
+    { bitstream }
+    { color-info initial: { f f f f } }
+    { quant-tables initial: { f f } }
+    { huff-tables initial: { f f f f } }
+    { components } ;
+
+{ "jpg" "jpeg" } [ jpeg-image ?register-image-class ] each
+
+<PRIVATE
+
+: <loading-jpeg> ( headers bitstream -- image )
+    loading-jpeg new swap >>bitstream swap >>headers ;
+
+SINGLETONS: SOF DHT DAC RST SOI EOI SOS DQT DNL DRI DHP EXP
+APP JPG COM TEM RES ;
+
+! ISO/IEC 10918-1 Table B.1
+:: >marker ( byte -- marker )
+    byte
+    {
+      { [ dup 0xCC = ] [ { DAC } ] }
+      { [ dup 0xC4 = ] [ { DHT } ] }
+      { [ dup 0xC9 = ] [ { JPG } ] }
+      { [ dup -4 shift 0xC = ] [ SOF byte 4 bits 2array ] }
+
+      { [ dup 0xD8 = ] [ { SOI } ] }
+      { [ dup 0xD9 = ] [ { EOI } ] }
+      { [ dup 0xDA = ] [ { SOS } ] }
+      { [ dup 0xDB = ] [ { DQT } ] }
+      { [ dup 0xDC = ] [ { DNL } ] }
+      { [ dup 0xDD = ] [ { DRI } ] }
+      { [ dup 0xDE = ] [ { DHP } ] }
+      { [ dup 0xDF = ] [ { EXP } ] }
+      { [ dup -4 shift 0xD = ] [ RST byte 4 bits 2array ] }
+
+      { [ dup -4 shift 0xE = ] [ APP byte 4 bits 2array ] }
+      { [ dup 0xFE = ] [ { COM } ] }
+      { [ dup -4 shift 0xF = ] [ JPG byte 4 bits 2array ] }
+
+      { [ dup 0x01 = ] [ { TEM } ] }
+      [ { RES } ]
+    }
+    cond nip ;
+
+TUPLE: jpeg-chunk length type data ;
+
+: <jpeg-chunk> ( type length data -- jpeg-chunk )
+    jpeg-chunk new
+        swap >>data
+        swap >>length
+        swap >>type ;
+
+TUPLE: jpeg-color-info
+    h v quant-table dc-huff-table ac-huff-table { diff initial: 0 } id ;
+
+: <jpeg-color-info> ( h v quant-table -- jpeg-color-info )
+    jpeg-color-info new
+        swap >>quant-table
+        swap >>v
+        swap >>h ;
+
+: jpeg> ( -- jpeg-image ) jpeg-image get ;
+
+: apply-diff ( dc color -- dc' )
+    [ diff>> + dup ] [ diff<< ] bi ;
+
+: fetch-tables ( component -- )
+    [ [ jpeg> quant-tables>> nth ] change-quant-table drop ]
+    [ [ jpeg> huff-tables>> nth ] change-dc-huff-table drop ]
+    [ [ 2 + jpeg> huff-tables>> nth ] change-ac-huff-table drop ] tri ;
+
+: read4/4 ( -- a b ) read1 16 /mod ;
+
+! headers
+
+: decode-frame ( header -- )
+    data>>
+    binary
+    [
+        read1 8 assert=
+        2 read be>
+        2 read be>
+        swap 2array jpeg> dim<<
+        read1
+        [
+            read1 read4/4 read1 <jpeg-color-info>
+            swap [ >>id ] keep jpeg> color-info>> set-nth
+        ] times
+    ] with-byte-reader ;
+
+: decode-quant-table ( chunk -- )
+    dup data>>
+    binary
+    [
+        length>>
+        2 - 65 /
+        [
+            read4/4 [ 0 assert= ] dip
+            64 read
+            swap jpeg> quant-tables>> set-nth
+        ] times
+    ] with-byte-reader ;
+
+: decode-huff-table ( chunk -- )
+    data>> [ binary <byte-reader> ] [ length ] bi limit-stream [
+        [ input-stream get stream>> [ count>> ] [ limit>> ] bi < ]
+        [
+            read4/4 swap 2 * +
+            16 read
+            dup [ ] [ + ] map-reduce read
+            binary [ [ read [ B{ } ] unless* ] { } map-as ] with-byte-reader
+            swap jpeg> huff-tables>> set-nth
+        ] while
+    ] stream-throw-on-eof ;
+
+: decode-scan ( chunk -- )
+    data>>
+    binary
+    [
+        read1 <iota>
+        [   drop
+            read1 jpeg> color-info>> nth clone
+            read1 16 /mod [ >>dc-huff-table ] [ >>ac-huff-table ] bi*
+        ] map jpeg> components<<
+        read1 0 assert=
+        read1 63 assert=
+        read1 16 /mod [ 0 assert= ] bi@
+    ] with-byte-reader ;
+
+: singleton-first ( seq -- elt )
+    [ length 1 assert= ] [ first ] bi ;
+
+ERROR: not-a-baseline-jpeg-image ;
+
+: baseline-parse ( -- )
+    jpeg> headers>> [ type>> { SOF 0 } = ] any? [ not-a-baseline-jpeg-image ] unless
+    jpeg> headers>>
+    {
+        [ [ type>> { SOF 0 } = ] filter singleton-first decode-frame ]
+        [ [ type>> { DQT } = ] filter [ decode-quant-table ] each ]
+        [ [ type>> { DHT } = ] filter [ decode-huff-table ] each ]
+        [ [ type>> { SOS } = ] filter singleton-first decode-scan ]
+    } cleave ;
+
+: parse-marker ( -- marker )
+    read1 0xFF assert=
+    read1 >marker ;
+
+: parse-headers ( -- chunks )
+    [ parse-marker dup { SOS } = not ]
+    [
+        2 read be>
+        dup 2 - read <jpeg-chunk>
+    ] [ produce ] keep dip swap suffix ;
+
+MEMO: zig-zag ( -- zz )
+    {
+        {  0  1  5  6 14 15 27 28 }
+        {  2  4  7 13 16 26 29 42 }
+        {  3  8 12 17 25 30 41 43 }
+        {  9 11 18 24 31 40 44 53 }
+        { 10 19 23 32 39 45 52 54 }
+        { 20 22 33 38 46 51 55 60 }
+        { 21 34 37 47 50 56 59 61 }
+        { 35 36 48 49 57 58 62 63 }
+    } flatten ;
+
+MEMO: yuv>bgr-matrix ( -- m )
+    {
+        { 1  2.03211  0       }
+        { 1 -0.39465 -0.58060 }
+        { 1  0        1.13983 }
+    } ;
+
+: wave ( x u -- n ) swap 2 * 1 + * pi * 16 / cos ;
+
+:: dct-vect ( u v -- basis )
+    { 8 8 } coord-matrix [ { u v } [ wave ] 2map product ] map^2
+    1 u v [ 0 = [ 2 sqrt / ] when ] bi@ 4 / m*n ;
+
+MEMO: dct-matrix ( -- m ) 64 <iota> [ 8 /mod dct-vect flatten ] map ;
+
+: mb-dim ( component -- dim )  [ h>> ] [ v>> ] bi 2array ;
+
+! : blocks ( component -- seq )
+!    mb-dim ! coord-matrix flip concat [ [ { 2 2 } v* ] [ v+ ] bi* ] with map ;
+
+: all-macroblocks ( quot: ( mb -- ) -- )
+    [
+        jpeg>
+        [ dim>> 8 v/n ]
+        [ color-info>> sift { 0 0 } [ mb-dim vmax ] reduce v/ ] bi
+        [ ceiling ] map
+        coord-matrix flip concat
+    ]
+    [ each ] bi* ; inline
+
+: reverse-zigzag ( b -- b' ) zig-zag swap [ nth ] curry map ;
+
+: idct-factor ( b -- b' ) dct-matrix v.m ;
+
+MEMO: dct-matrix-blas ( -- m ) dct-matrix >float-blas-matrix ;
+: V.M ( x A -- x.A ) Mtranspose swap M.V ;
+: idct-blas ( b -- b' ) >float-blas-vector dct-matrix-blas V.M ;
+
+: idct ( b -- b' ) idct-factor ;
+
+:: draw-block ( block x,y color-id jpeg-image -- )
+    block dup length>> sqrt >fixnum group flip
+    dup matrix-dim coord-matrix flip
+    [
+        [ '[ _ [ second ] [ first ] bi ] dip nth nth ]
+        [ x,y v+ color-id jpeg-image draw-color ] bi
+    ] with each^2 ;
+
+: sign-extend ( bits v -- v' )
+    swap [ ] [ 1 - 2^ < ] 2bi
+    [ -1 swap shift 1 + + ] [ drop ] if ;
+
+: read1-jpeg-dc ( decoder -- dc )
+    [ read1-huff dup ] [ bs>> bs:read ] bi sign-extend ;
+
+: read1-jpeg-ac ( decoder -- run/ac )
+    [ read1-huff 16 /mod dup ] [ bs>> bs:read ] bi sign-extend 2array ;
+
+:: decode-block ( color -- pixels )
+    color dc-huff-table>> read1-jpeg-dc color apply-diff
+    64 0 <array> :> coefs
+    0 coefs set-nth
+    0 :> k!
+    [
+        color ac-huff-table>> read1-jpeg-ac
+        [ first 1 + k + k! ] [ second k coefs set-nth ] [ ] tri
+        { 0 0 } = not
+        k 63 < and
+    ] loop
+    coefs color quant-table>> v*
+    reverse-zigzag idct ;
+    
+:: draw-macroblock-yuv420 ( mb blocks -- )
+    mb { 16 16 } v* :> pos
+    0 blocks nth pos { 0 0 } v+ 0 jpeg> draw-block
+    1 blocks nth pos { 8 0 } v+ 0 jpeg> draw-block
+    2 blocks nth pos { 0 8 } v+ 0 jpeg> draw-block
+    3 blocks nth pos { 8 8 } v+ 0 jpeg> draw-block
+    4 blocks nth 8 group 2 matrix-zoom concat pos 1 jpeg> draw-block
+    5 blocks nth 8 group 2 matrix-zoom concat pos 2 jpeg> draw-block ;
+    
+:: draw-macroblock-yuv444 ( mb blocks -- )
+    mb { 8 8 } v* :> pos
+    3 <iota> [ [ blocks nth pos ] [ jpeg> draw-block ] bi ] each ;
+
+:: draw-macroblock-y ( mb blocks -- )
+    mb { 8 8 } v* :> pos
+    0 blocks nth pos 0 jpeg> draw-block
+    64 0 <array> pos 1 jpeg> draw-block
+    64 0 <array> pos 2 jpeg> draw-block ;
+    ! %fixme: color hack
+ !   color h>> 2 =
+ !   [ 8 group 2 matrix-zoom concat ] unless
+ !   pos { 8 8 } v* color jpeg> draw-block ;
+
+: decode-macroblock ( -- blocks )
+    jpeg> components>>
+    [
+        [ mb-dim first2 * ]
+        [ [ decode-block ] curry replicate ] bi
+    ] map concat ;
+
+: cleanup-bitstream ( bytes -- bytes' )
+    binary [
+        [
+            { 0xFF } read-until
+            read1 [ 0x00 = and ] keep swap
+        ]
+        [ drop ] produce
+        swap >marker {  EOI } assert=
+        swap suffix
+        { 0xFF } join
+    ] with-byte-reader ;
+
+: setup-bitmap ( image -- )
+    dup dim>> 16 v/n [ ceiling ] map 16 v*n >>dim
+    BGR >>component-order
+    ubyte-components >>component-type
+    f >>upside-down?
+    dup dim>> first2 * 3 * 0 <array> >>bitmap
+    drop ;
+
+ERROR: unsupported-colorspace ;
+SINGLETONS: YUV420 YUV444 Y MAGIC! ;
+
+:: detect-colorspace ( jpeg-image -- csp )
+    jpeg-image color-info>> sift :> colors
+    MAGIC!
+    colors length 1 = [ drop Y ] when
+    colors length 3 =
+    [
+        colors [ mb-dim { 1 1 } = ] all?
+        [ drop YUV444 ] when
+
+        colors unclip
+        [ [ mb-dim { 1 1 } = ] all? ]
+        [ mb-dim { 2 2 } =  ] bi* and
+        [ drop YUV420 ] when
+    ] when ;
+    
+! this eats ~50% cpu time
+: draw-macroblocks ( mbs -- )
+    jpeg> detect-colorspace
+    {
+        { YUV420 [ [ first2 draw-macroblock-yuv420 ] each ] }
+        { YUV444 [ [ first2 draw-macroblock-yuv444 ] each ] }
+        { Y      [ [ first2 draw-macroblock-y ] each ] }
+        [ unsupported-colorspace ]
+    } case ;
+
+! this eats ~25% cpu time
+: color-transform ( yuv -- rgb )
+    { 128 0 0 } v+ yuv>bgr-matrix swap m.v
+    [ 0 max 255 min >fixnum ] map ;
+
+: baseline-decompress ( -- )
+    jpeg> bitstream>> cleanup-bitstream { 255 255 255 255 } append
+    >byte-array bs:<msb0-bit-reader> jpeg> bitstream<<
+    jpeg> 
+    [ bitstream>> ] 
+    [ [ [ <huffman-decoder> ] with map ] change-huff-tables drop ] bi
+    jpeg> components>> [ fetch-tables ] each
+    [ decode-macroblock 2array ] collector 
+    [ all-macroblocks ] dip
+    jpeg> setup-bitmap draw-macroblocks 
+    jpeg> bitmap>> 3 <groups> [ color-transform ] map! drop
+    jpeg> [ >byte-array ] change-bitmap drop ;
+
+ERROR: not-a-jpeg-image ;
+
+: loading-jpeg>image ( loading-jpeg -- image )
+    dup jpeg-image [
+        baseline-parse
+        baseline-decompress
+    ] with-variable ;
+
+: load-jpeg ( stream -- loading-jpeg )
+    [
+        parse-marker { SOI } = [ not-a-jpeg-image ] unless
+        parse-headers
+        contents <loading-jpeg>
+    ] with-input-stream ;
+
+PRIVATE>
+
+M: jpeg-image stream>image ( stream jpeg-image -- bitmap )
+    drop load-jpeg loading-jpeg>image ;
diff --git a/images/processing/rotation/authors.txt b/images/processing/rotation/authors.txt
new file mode 100644 (file)
index 0000000..0980144
--- /dev/null
@@ -0,0 +1,2 @@
+Kobi Lurie
+Doug Coleman
diff --git a/images/processing/rotation/rotation-tests.factor b/images/processing/rotation/rotation-tests.factor
new file mode 100644 (file)
index 0000000..8f65362
--- /dev/null
@@ -0,0 +1,71 @@
+! Copyright (C) 2009 Kobi Lurie, Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors fry images.loader
+images.processing.rotation kernel literals math sequences
+tools.test images.processing.rotation.private ;
+IN: images.processing.rotation.tests
+
+: first-row ( seq^2 -- seq ) first ;
+: first-col ( seq^2 -- item ) harvest [ first ] map ;
+: last-row ( seq^2 -- item ) last ;
+: last-col ( seq^2 -- item ) harvest [ last ] map ;
+: end-of-first-row ( seq^2 -- item ) first-row last ;
+: first-of-first-row ( seq^2 -- item ) first-row first ;
+: end-of-last-row ( seq^2 -- item ) last-row last ;
+: first-of-last-row ( seq^2 -- item ) last-row first ;
+
+<<
+
+: clone-image ( image -- new-image )
+    clone [ clone ] change-bitmap ;
+
+>>
+
+: pasted-image ( -- image )
+    "vocab:images/processing/rotation/test-bitmaps/PastedImage.bmp"
+    load-image clone-image ;
+
+: pasted-image90 ( -- image )
+    "vocab:images/processing/rotation/test-bitmaps/PastedImage90.bmp"
+    load-image clone-image ;
+
+: lake-image ( -- image )
+    "vocab:images/processing/rotation/test-bitmaps/lake.bmp"
+    load-image clone-image image>pixel-rows ;
+
+[ t ] [ pasted-image dup clone-image 4 [ 90 rotate ] times = ] unit-test
+[ t ] [ pasted-image dup clone-image 2 [ 180 rotate ] times = ] unit-test
+[ t ] [ pasted-image dup clone-image 270 rotate 90 rotate = ] unit-test
+[ t ] [
+    pasted-image dup clone-image dup { 90 180 90 } [ rotate drop ] with each =
+] unit-test
+
+[ t ] [
+    pasted-image 90 rotate
+    pasted-image90 = 
+] unit-test
+
+[ t ] [
+    "vocab:images/processing/rotation/test-bitmaps/small.bmp"
+    load-image 90 rotate 
+    "vocab:images/processing/rotation/test-bitmaps/small-rotated.bmp"
+    load-image =
+] unit-test
+    
+[ t ] [
+    lake-image
+    [ first-of-first-row ]
+    [ 90 (rotate) end-of-first-row ] bi =
+] unit-test
+
+[ t ]
+[ lake-image [ first-row ] [ 90 (rotate) last-col ] bi = ] unit-test
+
+[ t ]
+[ lake-image [ last-col ] [ 90 (rotate) last-row reverse ] bi = ] unit-test
+
+[ t ]
+[ lake-image [ last-row ] [ 90 (rotate) first-col ] bi = ] unit-test
+
+[ t ]
+[ lake-image [ first-col ] [ 90 (rotate) first-row reverse ] bi = ] unit-test
diff --git a/images/processing/rotation/rotation.factor b/images/processing/rotation/rotation.factor
new file mode 100644 (file)
index 0000000..863fa2e
--- /dev/null
@@ -0,0 +1,68 @@
+! Copyright (C) 2009 Kobi Lurie.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors arrays colors combinators
+combinators.short-circuit fry grouping images images.bitmap
+images.loader images.normalization kernel locals math sequences ;
+IN: images.processing.rotation
+
+ERROR: unsupported-rotation degrees ;
+
+<PRIVATE
+
+: rotate-90 ( seq^3 -- seq^3 ) flip [ reverse ] map ;
+: rotate-180 ( seq^3 -- seq^3 ) reverse [ reverse ] map ;
+: rotate-270 ( seq^3 -- seq^3 ) flip reverse ;
+
+: (rotate) ( seq n -- seq' )
+    {
+        { 0 [ ] }
+        { 90 [ rotate-90 ] }
+        { 180 [ rotate-180 ] }
+        { 270 [ rotate-270 ] }
+        [ unsupported-rotation ]
+    } case ;
+
+: rows-remove-pad ( byte-rows -- pixels' )
+    [ dup length 4 mod head* ] map ; 
+
+: row-length ( image -- n ) 
+    [ bitmap>> length ] [ dim>> second ] bi /i ;
+
+: image>byte-rows ( image -- byte-rows )
+    [ bitmap>> ] [ row-length ] bi group rows-remove-pad ;
+
+: (seperate-to-pixels) ( byte-rows image -- pixel-rows )
+    component-order>> bytes-per-pixel '[ _ group ] map ;
+
+: image>pixel-rows ( image -- pixel-rows )
+    [ image>byte-rows ] keep (seperate-to-pixels) ;
+: flatten-table ( seq^3 -- seq )
+    [ concat ] map concat ;
+
+: ?reverse-dimensions ( image n -- )
+    { 270 90 } member? [ [ reverse ] change-dim ] when drop ;
+
+:  normalize-degree ( n -- n' ) 360 rem ;
+
+: processing-effect ( image quot -- image' )
+    '[ image>pixel-rows @ flatten-table ] [ bitmap<< ] [ ] tri ; inline
+
+:: rotate' ( image n -- image )
+    n normalize-degree :> n'
+    image image>pixel-rows :> pixel-table
+    image n' ?reverse-dimensions
+    pixel-table n' (rotate) :> table-rotated
+    image table-rotated flatten-table >>bitmap ;
+
+PRIVATE>
+
+: rotate ( image n -- image' )
+    normalize-degree
+    [ '[ _ (rotate) ] processing-effect ] [ ?reverse-dimensions ] 2bi ;
+
+: reflect-y-axis ( image -- image ) 
+    [ [ reverse ] map ] processing-effect ;
+
+: reflect-x-axis ( image -- image ) 
+    [ reverse ] processing-effect ;
diff --git a/images/processing/rotation/test-bitmaps/PastedImage.bmp b/images/processing/rotation/test-bitmaps/PastedImage.bmp
new file mode 100644 (file)
index 0000000..8edfedd
Binary files /dev/null and b/images/processing/rotation/test-bitmaps/PastedImage.bmp differ
diff --git a/images/processing/rotation/test-bitmaps/PastedImage90.bmp b/images/processing/rotation/test-bitmaps/PastedImage90.bmp
new file mode 100644 (file)
index 0000000..2aa6ef1
Binary files /dev/null and b/images/processing/rotation/test-bitmaps/PastedImage90.bmp differ
diff --git a/images/processing/rotation/test-bitmaps/lake.bmp b/images/processing/rotation/test-bitmaps/lake.bmp
new file mode 100644 (file)
index 0000000..431e4ef
Binary files /dev/null and b/images/processing/rotation/test-bitmaps/lake.bmp differ
diff --git a/images/processing/rotation/test-bitmaps/small-rotated.bmp b/images/processing/rotation/test-bitmaps/small-rotated.bmp
new file mode 100644 (file)
index 0000000..571ea83
Binary files /dev/null and b/images/processing/rotation/test-bitmaps/small-rotated.bmp differ
diff --git a/images/processing/rotation/test-bitmaps/small.bmp b/images/processing/rotation/test-bitmaps/small.bmp
new file mode 100644 (file)
index 0000000..7274857
Binary files /dev/null and b/images/processing/rotation/test-bitmaps/small.bmp differ
diff --git a/irc-ui/authors.txt b/irc-ui/authors.txt
new file mode 100644 (file)
index 0000000..9366723
--- /dev/null
@@ -0,0 +1 @@
+William Schlieper
diff --git a/irc-ui/commandparser/commandparser.factor b/irc-ui/commandparser/commandparser.factor
new file mode 100644 (file)
index 0000000..43ea80c
--- /dev/null
@@ -0,0 +1,15 @@
+! Copyright (C) 2008 William Schlieper
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: kernel vocabs.loader sequences strings splitting words irc.messages ;
+
+IN: irc.ui.commandparser
+
+: command ( string string -- string command )
+    [ "say" ] when-empty
+    dup "irc.ui.commands" lookup
+    [ nip ]
+    [ " " append prepend "quote" "irc.ui.commands" lookup ] if* ;
+
+: parse-message ( string -- )
+    "/" ?head [ " " split1 swap command ] [ "say" command ] if execute ;
diff --git a/irc-ui/commands/commands.factor b/irc-ui/commands/commands.factor
new file mode 100644 (file)
index 0000000..93d1e2e
--- /dev/null
@@ -0,0 +1,28 @@
+! Copyright (C) 2008 William Schlieper
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: accessors kernel sequences arrays irc.client
+       irc.messages irc.ui namespaces ;
+
+IN: irc.ui.commands
+
+: say ( string -- )
+    irc-tab get
+    [ window>> client>> profile>> nickname>> <own-message> print-irc ]
+    [ chat>> speak ] 2bi ;
+
+: me ( string -- ) ! Placeholder until I make /me look different
+    "ACTION " 1 prefix prepend 1 suffix say ;
+
+: join ( string -- )
+    irc-tab get window>> join-channel ;
+
+: query ( string -- )
+    irc-tab get window>> query-nick ;
+
+: whois ( string -- )
+    "WHOIS" swap { } clone swap  <irc-client-message>
+    irc-tab get listener>> speak ;
+
+: quote ( string -- )
+    drop ; ! THIS WILL CHANGE
diff --git a/irc-ui/ircui-rc b/irc-ui/ircui-rc
new file mode 100644 (file)
index 0000000..a1533c7
--- /dev/null
@@ -0,0 +1,9 @@
+! Default system ircui-rc file\r
+! Copy into .ircui-rc in your home directory and then change username and such\r
+! To find your home directory, type "home ." into a Factor listener\r
+\r
+USING: irc.client irc.ui ;\r
+\r
+"irc.freenode.org" 8001 "factor-irc" f ! server port nick password\r
+{ "#concatenative" "#terrorisland" } ! all the channels you want to autojoin\r
+server-open\r
diff --git a/irc-ui/load/load.factor b/irc-ui/load/load.factor
new file mode 100644 (file)
index 0000000..88c0d35
--- /dev/null
@@ -0,0 +1,16 @@
+! Copyright (C) 2008 William Schlieper
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: kernel io.files io.pathnames parser editors sequences ;
+
+IN: irc.ui.load
+
+: file-or ( path path -- path ) [ [ exists? ] keep ] dip ? ;
+
+: personal-ui-rc ( -- path ) home ".ircui-rc" append-path ;
+
+: system-ui-rc ( -- path ) "extra/irc/ui/ircui-rc" resource-path ;
+
+: ircui-rc ( -- path ) personal-ui-rc system-ui-rc file-or ;
+
+: run-ircui ( -- ) ircui-rc run-file ;
diff --git a/irc-ui/summary.txt b/irc-ui/summary.txt
new file mode 100644 (file)
index 0000000..284672b
--- /dev/null
@@ -0,0 +1 @@
+A simple IRC client
\ No newline at end of file
diff --git a/irc-ui/ui.factor b/irc-ui/ui.factor
new file mode 100644 (file)
index 0000000..d65817f
--- /dev/null
@@ -0,0 +1,250 @@
+! Copyright (C) 2008 William Schlieper
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: accessors kernel threads combinators concurrency.mailboxes
+       sequences strings hashtables splitting fry assocs hashtables colors
+       sorting unicode math.order
+       ui ui.gadgets ui.gadgets.panes ui.gadgets.editors
+       ui.gadgets.scrollers ui.commands ui.gadgets.frames ui.gestures
+       ui.gadgets.tabs ui.gadgets.grids ui.gadgets.packs ui.gadgets.labels
+       io io.styles namespaces calendar calendar.format models continuations
+       irc.client irc.client.private irc.messages
+       irc.ui.commandparser irc.ui.load vocabs.loader classes prettyprint ;
+
+RENAME: join sequences => sjoin
+
+IN: irc.ui
+
+SYMBOL: chat
+
+SYMBOL: client
+
+TUPLE: ui-window < tabbed client ;
+
+M: ui-window ungraft*
+    client>> terminate-irc ;
+
+TUPLE: irc-tab < frame chat client window ;
+
+: write-color ( str color -- )
+    foreground associate format ;
+CONSTANT: dark-red T{ rgba f 0.5 0.0 0.0 1 }
+CONSTANT: dark-green T{ rgba f 0.0 0.5 0.0 1 }
+CONSTANT: dark-blue T{ rgba f 0.0 0.0 0.5 1 }
+
+: dot-or-parens ( string -- string )
+    [ "." ]
+    [ "(" prepend ")" append ] if-empty ;
+
+GENERIC: write-irc ( irc-message -- )
+
+M: ping write-irc
+    drop "* Ping" blue write-color ;
+
+M: privmsg write-irc
+    "<" dark-blue write-color
+    [ irc-message-sender write ] keep
+    "> " dark-blue write-color
+    trailing>> write ;
+
+M: notice write-irc
+    [ type>> dark-blue write-color ] keep
+    ": " dark-blue write-color
+    trailing>> write ;
+
+TUPLE: own-message message nick timestamp ;
+
+: <own-message> ( message nick -- own-message )
+    now own-message boa ;
+
+M: own-message write-irc
+    "<" dark-blue write-color
+    [ nick>> bold font-style associate format ] keep
+    "> " dark-blue write-color
+    message>> write ;
+
+M: join write-irc
+    "* " dark-green write-color
+    irc-message-sender write
+    " has entered the channel." dark-green write-color ;
+
+M: part write-irc
+    "* " dark-red write-color
+    [ irc-message-sender write ] keep
+    " has left the channel" dark-red write-color
+    trailing>> dot-or-parens dark-red write-color ;
+
+M: quit write-irc
+    "* " dark-red write-color
+    [ irc-message-sender write ] keep
+    " has left IRC" dark-red write-color
+    trailing>> dot-or-parens dark-red write-color ;
+
+M: kick write-irc
+    "* " dark-red write-color
+    [ irc-message-sender write ] keep
+    " has kicked " dark-red write-color
+    [ who>> write ] keep
+    " from the channel" dark-red write-color
+    trailing>> dot-or-parens dark-red write-color ;
+
+M: mode write-irc
+    "* " dark-blue write-color
+    [ name>> write ] keep
+    " has applied mode " dark-blue write-color
+    [ mode>> write ] keep
+    " to " dark-blue write-color
+    parameter>> write ;
+
+M: nick write-irc
+    "* " dark-blue write-color
+    [ irc-message-sender write ] keep
+    " is now known as " blue write-color
+    trailing>> write ;
+
+M: unhandled write-irc
+    "UNHANDLED: " write
+    line>> dark-blue write-color ;
+
+M: irc-end write-irc
+    drop "* You have left IRC" dark-red write-color ;
+
+M: irc-disconnected write-irc
+    drop "* Disconnected" dark-red write-color ;
+
+M: irc-connected write-irc
+    drop "* Connected" dark-green write-color ;
+
+M: irc-chat-end write-irc
+    drop ;
+
+M: irc-message write-irc
+    "UNIMPLEMENTED" write
+    [ class pprint ] keep
+    ": " write
+    line>> dark-blue write-color ;
+
+GENERIC: time-happened ( message -- timestamp )
+
+M: irc-message time-happened timestamp>> ;
+
+M: object time-happened drop now ;
+
+: print-irc ( irc-message -- )
+    [ time-happened timestamp>hms write " " write ]
+    [ write-irc nl ] bi ;
+
+: send-message ( message -- )
+    [ print-irc ]
+    [ chat get speak ] bi ;
+
+GENERIC: handle-inbox ( tab message -- )
+
+: value-labels ( assoc val -- seq )
+    '[ nip _ = ] assoc-filter keys sort-strings [ <label> ] map ;
+
+: add-gadget-color ( pack seq color -- pack )
+    '[ _ >>color add-gadget ] each ;
+
+M: object handle-inbox
+    nip print-irc ;
+
+: display ( stream tab -- )
+    '[ _ [ [ t ]
+           [ _ dup chat>> hear handle-inbox ]
+           while ] with-output-stream ] "ircv" spawn drop ;
+
+: <irc-pane> ( tab -- tab pane )
+    <scrolling-pane>
+    [ <pane-stream> swap display ] 2keep ;
+
+TUPLE: irc-editor < editor outstream tab ;
+
+: <irc-editor> ( tab pane -- tab editor )
+    irc-editor new-editor
+    swap <pane-stream> >>outstream ;
+
+: editor-send ( irc-editor -- )
+    { [ outstream>> ]
+      [ [ irc-tab? ] find-parent ]
+      [ editor-string ]
+      [ "" swap set-editor-string ] } cleave
+     '[ _ irc-tab set _ parse-message ] with-output-stream ;
+
+irc-editor "general" f {
+    { T{ key-down f f "RET" } editor-send }
+    { T{ key-down f f "ENTER" } editor-send }
+} define-command-map
+
+: new-irc-tab ( chat ui-window class -- irc-tab )
+    new-frame
+    swap >>window
+    swap >>chat
+    <irc-pane> [ <scroller> @center grid-add ] keep
+    <irc-editor> <scroller> @bottom grid-add ;
+
+M: irc-tab graft*
+    [ chat>> ] [ window>> client>> ] bi attach-chat ;
+
+M: irc-tab ungraft*
+    chat>> detach-chat ;
+
+TUPLE: irc-channel-tab < irc-tab userlist ;
+
+: <irc-channel-tab> ( chat ui-window -- irc-tab )
+    irc-channel-tab new-irc-tab
+    <pile> [ <scroller> @right grid-add ] keep >>userlist ;
+
+: update-participants ( tab -- )
+    [ userlist>> [ clear-gadget ] keep ]
+    [ chat>> participants>> ] bi
+    [ +operator+ value-labels dark-green add-gadget-color ]
+    [ +voice+ value-labels blue add-gadget-color ]
+    [ +normal+ value-labels black add-gadget-color ] tri drop ;
+
+M: participant-changed handle-inbox
+    drop update-participants ;
+
+TUPLE: irc-server-tab < irc-tab ;
+
+: <irc-server-tab> ( chat -- irc-tab )
+    f irc-server-tab new-irc-tab ;
+
+: <irc-nick-tab> ( chat ui-window -- irc-tab )
+    irc-tab new-irc-tab ;
+
+M: irc-tab pref-dim*
+    drop { 480 480 } ;
+
+: join-channel ( name ui-window -- )
+    [ dup <irc-channel-chat> ] dip
+    [ <irc-channel-tab> swap ] keep
+    add-page ;
+
+: query-nick ( nick ui-window -- )
+    [ dup <irc-nick-chat> ] dip
+    [ <irc-nick-tab> swap ] keep
+    add-page ;
+
+: irc-window ( ui-window -- )
+    [ ]
+    [ client>> profile>> server>> ] bi
+    open-window ;
+
+: ui-connect ( profile -- ui-window )
+    <irc-client>
+    { [ [ <irc-server-chat> ] dip attach-chat ]
+      [ chats>> +server-chat+ swap at <irc-server-tab> dup
+        "Server" associate ui-window new-tabbed [ swap window<< ] keep ]
+      [ >>client ]
+      [ connect-irc ] } cleave ;
+
+: server-open ( server port nick password channels -- )
+    [ <irc-profile> ui-connect [ irc-window ] keep ] dip
+    [ over join-channel ] each drop ;
+
+: main-run ( -- ) run-ircui ;
+
+MAIN: main-run
+
+"irc.ui.commands" require
diff --git a/javascriptcore/authors.txt b/javascriptcore/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/javascriptcore/core-foundation/authors.txt b/javascriptcore/core-foundation/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/javascriptcore/core-foundation/core-foundation.factor b/javascriptcore/core-foundation/core-foundation.factor
new file mode 100644 (file)
index 0000000..9dfc93b
--- /dev/null
@@ -0,0 +1,11 @@
+! Copyright (C) 2010 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.syntax core-foundation core-foundation.strings
+javascriptcore.ffi ;
+IN: javascriptcore.core-foundation
+
+FUNCTION: JSStringRef JSStringCreateWithCFString ( CFStringRef string ) ;
+
+FUNCTION: CFStringRef JSStringCopyCFString ( CFAllocatorRef alloc, JSStringRef string ) ;
+
+
diff --git a/javascriptcore/core-foundation/platforms.txt b/javascriptcore/core-foundation/platforms.txt
new file mode 100644 (file)
index 0000000..6e806f4
--- /dev/null
@@ -0,0 +1 @@
+macosx
diff --git a/javascriptcore/ffi/authors.txt b/javascriptcore/ffi/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/javascriptcore/ffi/ffi.factor b/javascriptcore/ffi/ffi.factor
new file mode 100644 (file)
index 0000000..377a0d4
--- /dev/null
@@ -0,0 +1,269 @@
+! Copyright (C) 2010 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.c-types alien.libraries alien.syntax
+classes.struct combinators io.encodings.utf16n
+io.encodings.utf8 kernel system ;
+IN: javascriptcore.ffi
+
+<<
+"javascriptcore" {
+    { [ os macosx? ] [
+        "/System/Library/Frameworks/JavaScriptCore.framework/Versions/Current/JavaScriptCore" cdecl add-library
+    ] }
+    ! { [ os windows? ]  [ "javascriptcore.dll" ] }
+    ! { [ os unix? ]  [ "libsqlite3.so" ] }
+    [ drop ]
+} cond
+>>
+
+LIBRARY: javascriptcore
+
+TYPEDEF: void* JSContextGroupRef
+TYPEDEF: void* JSContextRef
+TYPEDEF: void* JSGlobalContextRef
+TYPEDEF: void* JSStringRef
+TYPEDEF: void* JSClassRef
+TYPEDEF: void* JSPropertyNameArrayRef
+TYPEDEF: void* JSPropertyNameAccumulatorRef
+TYPEDEF: void* JSValueRef
+TYPEDEF: void* JSObjectRef
+TYPEDEF: void* JSObjectInitializeCallback
+TYPEDEF: void* JSObjectFinalizeCallback
+TYPEDEF: void* JSObjectHasPropertyCallback
+TYPEDEF: void* JSObjectGetPropertyCallback
+TYPEDEF: void* JSObjectSetPropertyCallback
+TYPEDEF: void* JSObjectDeletePropertyCallback
+TYPEDEF: void* JSObjectGetPropertyNamesCallback
+TYPEDEF: void* JSObjectCallAsFunctionCallback
+TYPEDEF: void* JSObjectCallAsConstructorCallback
+TYPEDEF: void* JSObjectHasInstanceCallback
+TYPEDEF: void* JSObjectConvertToTypeCallback
+TYPEDEF: uint unsigned
+TYPEDEF: ushort JSChar
+
+ENUM: JSPropertyAttributes
+    { kJSPropertyAttributeNone       0 }
+    { kJSPropertyAttributeReadOnly   2 }
+    { kJSPropertyAttributeDontEnum   4 }
+    { kJSPropertyAttributeDontDelete 8 } ;
+
+ENUM: JSClassAttributes
+    { kJSClassAttributeNone 0 }
+    { kJSClassAttributeNoAutomaticPrototype 2 } ;
+
+ENUM: JSType
+    kJSTypeUndefined,
+    kJSTypeNull,
+    kJSTypeBoolean,
+    kJSTypeNumber,
+    kJSTypeString,
+    kJSTypeObject ;
+
+STRUCT: JSStaticValue
+    { name c-string }
+    { getProperty JSObjectGetPropertyCallback }
+    { setProperty JSObjectSetPropertyCallback }
+    { attributes JSPropertyAttributes } ;
+
+STRUCT: JSStaticFunction
+    { name c-string }
+    { callAsFunction JSObjectCallAsFunctionCallback } ;
+
+STRUCT: JSClassDefinition
+    { version int }
+    { attributes JSClassAttributes }
+    { className c-string }
+    { parentClass JSClassRef }
+    { staticValues JSStaticValue* }
+    { staticFunctions JSStaticFunction* }
+    { initialize JSObjectInitializeCallback }
+    { finalize JSObjectFinalizeCallback }
+    { hasProperty JSObjectHasPropertyCallback }
+    { getProperty JSObjectGetPropertyCallback }
+    { setProperty JSObjectSetPropertyCallback }
+    { deleteProperty JSObjectDeletePropertyCallback }
+    { getPropertyNames JSObjectGetPropertyNamesCallback }
+    { callAsFunction JSObjectCallAsFunctionCallback }
+    { callAsConstructor JSObjectCallAsConstructorCallback }
+    { hasInstance JSObjectHasInstanceCallback }
+    { convertToType JSObjectConvertToTypeCallback } ;
+
+ALIAS: kJSClassDefinitionEmpty JSClassDefinition
+
+FUNCTION: JSValueRef JSEvaluateScript (
+    JSContextRef ctx,
+    JSStringRef script,
+    JSObjectRef thisObject,
+    JSStringRef sourceURL,
+    int startingLineNumber,
+    JSValueRef* exception ) ;
+
+FUNCTION: bool JSCheckScriptSyntax (
+    JSContextRef ctx,
+    JSStringRef script,
+    JSStringRef sourceURL,
+    int startingLineNumber,
+    JSValueRef* exception ) ;
+
+FUNCTION: void JSGarbageCollect
+    ( JSContextRef ctx ) ;
+
+FUNCTION: JSContextGroupRef JSContextGroupCreate
+    ( ) ;
+
+FUNCTION: JSContextGroupRef JSContextGroupRetain
+    ( JSContextGroupRef group ) ;
+
+FUNCTION: void JSContextGroupRelease
+    ( JSContextGroupRef group ) ;
+
+FUNCTION: JSGlobalContextRef JSGlobalContextCreate
+    ( JSClassRef globalObjectClass ) ; 
+
+FUNCTION: JSGlobalContextRef JSGlobalContextCreateInGroup (
+    JSContextGroupRef group,
+    JSClassRef globalObjectClass ) ;
+
+FUNCTION: JSGlobalContextRef JSGlobalContextRetain
+    ( JSGlobalContextRef ctx ) ;
+
+FUNCTION: void JSGlobalContextRelease
+    ( JSGlobalContextRef ctx ) ;
+
+FUNCTION: JSObjectRef JSContextGetGlobalObject
+    ( JSContextRef ctx ) ;
+
+FUNCTION: JSContextGroupRef JSContextGetGroup
+    ( JSContextRef ctx ) ;
+
+FUNCTION: JSClassRef JSClassCreate
+    ( JSClassDefinition* definition ) ;
+
+FUNCTION: JSClassRef JSClassRetain
+    ( JSClassRef jsClass ) ;
+
+FUNCTION: void JSClassRelease
+    ( JSClassRef jsClass ) ;
+
+FUNCTION: JSObjectRef JSObjectMake
+    ( JSContextRef ctx,
+      JSClassRef jsClass, void* data ) ;
+
+FUNCTION: JSObjectRef JSObjectMakeFunctionWithCallback ( JSContextRef ctx, JSStringRef name, JSObjectCallAsFunctionCallback callAsFunction ) ;
+
+FUNCTION: JSObjectRef JSObjectMakeConstructor ( JSContextRef ctx, JSClassRef jsClass, JSObjectCallAsConstructorCallback callAsConstructor ) ;
+
+FUNCTION: JSObjectRef JSObjectMakeArray ( JSContextRef ctx, size_t argumentCount, JSValueRef arguments[], JSValueRef* exception ) ;
+
+FUNCTION: JSObjectRef JSObjectMakeDate ( JSContextRef ctx, size_t argumentCount, JSValueRef arguments[], JSValueRef* exception ) ;
+
+FUNCTION: JSObjectRef JSObjectMakeError ( JSContextRef ctx, size_t argumentCount, JSValueRef arguments[], JSValueRef* exception ) ;
+
+FUNCTION: JSObjectRef JSObjectMakeRegExp ( JSContextRef ctx, size_t argumentCount, JSValueRef arguments[], JSValueRef* exception ) ;
+
+FUNCTION: JSObjectRef JSObjectMakeFunction ( JSContextRef ctx, JSStringRef name, unsigned parameterCount, JSStringRef parameterNames[], JSStringRef body, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception ) ;
+
+FUNCTION: JSValueRef JSObjectGetPrototype ( JSContextRef ctx, JSObjectRef object ) ;
+
+FUNCTION: void JSObjectSetPrototype ( JSContextRef ctx, JSObjectRef object, JSValueRef value ) ;
+
+FUNCTION: bool JSObjectHasProperty ( JSContextRef ctx, JSObjectRef object, JSStringRef propertyName ) ;
+
+FUNCTION: JSValueRef JSObjectGetProperty ( JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception ) ;
+
+FUNCTION: void JSObjectSetProperty ( JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSPropertyAttributes attributes, JSValueRef* exception ) ;
+
+FUNCTION: bool JSObjectDeleteProperty ( JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception ) ;
+
+FUNCTION: JSValueRef JSObjectGetPropertyAtIndex ( JSContextRef ctx, JSObjectRef object, unsigned propertyIndex, JSValueRef* exception ) ;
+
+FUNCTION: void JSObjectSetPropertyAtIndex ( JSContextRef ctx, JSObjectRef object, unsigned propertyIndex, JSValueRef value, JSValueRef* exception ) ;
+
+FUNCTION: void* JSObjectGetPrivate ( JSObjectRef object ) ;
+
+FUNCTION: bool JSObjectSetPrivate ( JSObjectRef object, void* data ) ;
+
+FUNCTION: bool JSObjectIsFunction ( JSContextRef ctx, JSObjectRef object ) ;
+
+FUNCTION: JSValueRef JSObjectCallAsFunction ( JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, JSValueRef arguments[], JSValueRef* exception ) ;
+
+FUNCTION: bool JSObjectIsConstructor ( JSContextRef ctx, JSObjectRef object ) ;
+
+FUNCTION: JSObjectRef JSObjectCallAsConstructor ( JSContextRef ctx, JSObjectRef object, size_t argumentCount, JSValueRef arguments[], JSValueRef* exception ) ;
+
+FUNCTION: JSPropertyNameArrayRef JSObjectCopyPropertyNames ( JSContextRef ctx, JSObjectRef object ) ;
+
+FUNCTION: JSPropertyNameArrayRef JSPropertyNameArrayRetain ( JSPropertyNameArrayRef array ) ;
+
+FUNCTION: void JSPropertyNameArrayRelease ( JSPropertyNameArrayRef array ) ;
+
+FUNCTION: size_t JSPropertyNameArrayGetCount ( JSPropertyNameArrayRef array ) ;
+
+FUNCTION: JSStringRef JSPropertyNameArrayGetNameAtIndex ( JSPropertyNameArrayRef array, size_t index ) ;
+
+FUNCTION: void JSPropertyNameAccumulatorAddName ( JSPropertyNameAccumulatorRef accumulator, JSStringRef propertyName ) ;
+
+FUNCTION: JSStringRef JSStringCreateWithCharacters ( JSChar* chars, size_t numChars ) ;
+
+FUNCTION: JSStringRef JSStringCreateWithUTF8CString ( c-string string ) ;
+
+FUNCTION: JSStringRef JSStringRetain ( JSStringRef string ) ;
+
+FUNCTION: void JSStringRelease ( JSStringRef string ) ;
+
+FUNCTION: size_t JSStringGetLength ( JSStringRef string ) ;
+
+FUNCTION: JSChar* JSStringGetCharactersPtr ( JSStringRef string ) ;
+
+FUNCTION: size_t JSStringGetMaximumUTF8CStringSize ( JSStringRef string ) ;
+
+FUNCTION: size_t JSStringGetUTF8CString ( JSStringRef string, char* buffer, size_t bufferSize ) ;
+
+FUNCTION: bool JSStringIsEqual ( JSStringRef a, JSStringRef b ) ;
+
+FUNCTION: bool JSStringIsEqualToUTF8CString ( JSStringRef a, char* b ) ;
+
+FUNCTION: JSType JSValueGetType ( JSContextRef ctx, JSValueRef value ) ;
+
+FUNCTION: bool JSValueIsUndefined ( JSContextRef ctx, JSValueRef value ) ;
+
+FUNCTION: bool JSValueIsNull ( JSContextRef ctx, JSValueRef value ) ;
+
+FUNCTION: bool JSValueIsBoolean ( JSContextRef ctx, JSValueRef value ) ;
+
+FUNCTION: bool JSValueIsNumber ( JSContextRef ctx, JSValueRef value ) ;
+
+FUNCTION: bool JSValueIsString ( JSContextRef ctx, JSValueRef value ) ;
+
+FUNCTION: bool JSValueIsObject ( JSContextRef ctx, JSValueRef value ) ;
+
+FUNCTION: bool JSValueIsObjectOfClass ( JSContextRef ctx, JSValueRef value, JSClassRef jsClass ) ;
+
+FUNCTION: bool JSValueIsEqual ( JSContextRef ctx, JSValueRef a, JSValueRef b, JSValueRef* exception ) ;
+
+FUNCTION: bool JSValueIsStrictEqual ( JSContextRef ctx, JSValueRef a, JSValueRef b ) ;
+
+FUNCTION: bool JSValueIsInstanceOfConstructor ( JSContextRef ctx, JSValueRef value, JSObjectRef constructor, JSValueRef* exception ) ;
+
+FUNCTION: JSValueRef JSValueMakeUndefined ( JSContextRef ctx ) ;
+
+FUNCTION: JSValueRef JSValueMakeNull ( JSContextRef ctx ) ;
+
+FUNCTION: JSValueRef JSValueMakeBoolean ( JSContextRef ctx, bool boolean ) ;
+
+FUNCTION: JSValueRef JSValueMakeNumber ( JSContextRef ctx, double number ) ;
+
+FUNCTION: JSValueRef JSValueMakeString ( JSContextRef ctx, JSStringRef string ) ;
+
+FUNCTION: bool JSValueToBoolean ( JSContextRef ctx, JSValueRef value ) ;
+
+FUNCTION: double JSValueToNumber ( JSContextRef ctx, JSValueRef value, JSValueRef* exception ) ;
+
+FUNCTION: JSStringRef JSValueToStringCopy ( JSContextRef ctx, JSValueRef value, JSValueRef* exception ) ;
+
+FUNCTION: JSObjectRef JSValueToObject ( JSContextRef ctx, JSValueRef value, JSValueRef* exception ) ;
+
+FUNCTION: void JSValueProtect ( JSContextRef ctx, JSValueRef value ) ;
+
+FUNCTION: void JSValueUnprotect ( JSContextRef ctx, JSValueRef value ) ;
+
diff --git a/javascriptcore/ffi/hack/authors.txt b/javascriptcore/ffi/hack/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/javascriptcore/ffi/hack/hack.factor b/javascriptcore/ffi/hack/hack.factor
new file mode 100644 (file)
index 0000000..30ba881
--- /dev/null
@@ -0,0 +1,29 @@
+! Copyright (C) 2010 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.accessors alien.c-types alien.syntax kernel
+kernel.private math system ;
+IN: javascriptcore.ffi.hack
+
+HOOK: set-callstack-bounds os ( -- )
+
+HOOK: macosx-callstack-start-offset cpu ( -- address )
+HOOK: macosx-callstack-size-offset cpu ( -- address )
+
+M: ppc macosx-callstack-start-offset 0x188 ;
+M: ppc macosx-callstack-size-offset 0x18c ;
+
+M: x86.32 macosx-callstack-start-offset 0xc48 ;
+M: x86.32 macosx-callstack-size-offset 0xc4c ;
+
+M: x86.64 macosx-callstack-start-offset 0x1860 ;
+M: x86.64 macosx-callstack-size-offset 0x1868 ;
+
+M: object set-callstack-bounds ;
+
+FUNCTION: void* pthread_self ( ) ;
+
+M: macosx set-callstack-bounds
+    callstack-bounds over [ alien-address ] bi@ -
+    pthread_self
+    [ macosx-callstack-size-offset set-alien-unsigned-cell ]
+    [ macosx-callstack-start-offset set-alien-cell ] bi ;
diff --git a/javascriptcore/ffi/hack/platforms.txt b/javascriptcore/ffi/hack/platforms.txt
new file mode 100644 (file)
index 0000000..6e806f4
--- /dev/null
@@ -0,0 +1 @@
+macosx
diff --git a/javascriptcore/ffi/platforms.txt b/javascriptcore/ffi/platforms.txt
new file mode 100644 (file)
index 0000000..6e806f4
--- /dev/null
@@ -0,0 +1 @@
+macosx
diff --git a/javascriptcore/javascriptcore-tests.factor b/javascriptcore/javascriptcore-tests.factor
new file mode 100644 (file)
index 0000000..53ae12d
--- /dev/null
@@ -0,0 +1,10 @@
+! Copyright (C) 2010 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors javascriptcore kernel tools.test ;
+IN: javascriptcore.tests
+
+[ "2" ] [ "1+1" eval-js-standalone ] unit-test
+
+[ "1+shoes" eval-js-standalone ]
+[ error>> "ReferenceError: Can't find variable: shoes" = ] must-fail-with
+
diff --git a/javascriptcore/javascriptcore.factor b/javascriptcore/javascriptcore.factor
new file mode 100644 (file)
index 0000000..e3465a3
--- /dev/null
@@ -0,0 +1,48 @@
+! Copyright (C) 2010 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.c-types alien.data byte-arrays continuations fry
+io.encodings.string io.encodings.utf8 io.files
+javascriptcore.ffi javascriptcore.ffi.hack kernel namespaces
+sequences ;
+IN: javascriptcore
+
+ERROR: javascriptcore-error error ;
+
+SYMBOL: js-context
+
+: with-global-context ( quot -- )
+    [
+        [ f JSGlobalContextCreate dup js-context set ] dip
+        [ nip '[ @ ] ]
+        [ drop '[ _ JSGlobalContextRelease ] ] 2bi
+        [ ] cleanup
+    ] with-scope ; inline
+
+: with-javascriptcore ( quot -- )
+    set-callstack-bounds
+    with-global-context ; inline
+
+: JSString>string ( JSString -- string )
+    dup JSStringGetMaximumUTF8CStringSize [ <byte-array> ] keep
+    [ JSStringGetUTF8CString drop ] [ drop ] 2bi
+    utf8 decode [ 0 = ] trim-tail ;
+
+: JSValueRef>string ( ctx JSValueRef/f -- string/f )
+    [
+        f JSValueToStringCopy
+        [ JSString>string ] [ JSStringRelease ] bi
+    ] [
+        drop f
+    ] if* ;
+
+: eval-js ( string -- result-string )
+    [ js-context get dup ] dip
+    JSStringCreateWithUTF8CString f f 0
+    { { void* initial: f } } [ JSEvaluateScript ] with-out-parameters
+    dup [ nip JSValueRef>string javascriptcore-error ] [ drop JSValueRef>string ] if ;
+
+: eval-js-standalone ( string -- result-string )
+    '[ _ eval-js ] with-javascriptcore ;
+
+: eval-js-path-standalone ( path -- result-string ) utf8 file-contents eval-js-standalone ;
+
diff --git a/javascriptcore/platforms.txt b/javascriptcore/platforms.txt
new file mode 100644 (file)
index 0000000..6e806f4
--- /dev/null
@@ -0,0 +1 @@
+macosx
diff --git a/jni/jni-internals.factor b/jni/jni-internals.factor
new file mode 100644 (file)
index 0000000..9be4a53
--- /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>  0x00010004 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/jni/jni.factor b/jni/jni.factor
new file mode 100644 (file)
index 0000000..d1c6417
--- /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 ;
+
diff --git a/jni/load.factor b/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/ldap/authors.txt b/ldap/authors.txt
new file mode 100644 (file)
index 0000000..7c29e7c
--- /dev/null
@@ -0,0 +1 @@
+Elie Chaftari
diff --git a/ldap/conf/addentry.ldif b/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/ldap/conf/createdit.ldif b/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/ldap/conf/slapd.conf b/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/ldap/ldap-tests.factor b/ldap/ldap-tests.factor
new file mode 100644 (file)
index 0000000..1402970
--- /dev/null
@@ -0,0 +1,58 @@
+USING: alien alien.c-types io kernel ldap ldap.libldap
+namespaces prettyprint tools.test ;
+IN: ldap.tests
+
+"void*" <c-object> "ldap://localhost:389" initialize
+
+get-ldp LDAP_OPT_PROTOCOL_VERSION LDAP_VERSION3 <int> set-option
+
+[ 3 ] [
+    get-ldp LDAP_OPT_PROTOCOL_VERSION "int*" <c-object> [ get-option ] keep
+    *int
+] 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
+] drop
diff --git a/ldap/ldap.factor b/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/ldap/libldap/authors.txt b/ldap/libldap/authors.txt
new file mode 100644 (file)
index 0000000..7c29e7c
--- /dev/null
@@ -0,0 +1 @@
+Elie Chaftari
diff --git a/ldap/libldap/libldap.factor b/ldap/libldap/libldap.factor
new file mode 100644 (file)
index 0000000..ee1ad27
--- /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? ]   [ "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         0x0000              ; inline
+: LDAP_SCOPE_BASEOBJECT   LDAP_SCOPE_BASE        ; inline
+: LDAP_SCOPE_ONELEVEL     0x0001              ; inline
+: LDAP_SCOPE_ONE          LDAP_SCOPE_ONELEVEL    ; inline
+: LDAP_SCOPE_SUBTREE      0x0002              ; inline
+: LDAP_SCOPE_SUB          LDAP_SCOPE_SUBTREE     ; inline
+: LDAP_SCOPE_SUBORDINATE  0x0003              ; 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             0x00 ; inline
+: LDAP_MSG_ALL             0x01 ; inline
+: LDAP_MSG_RECEIVED        0x02 ; inline
+
+! the possible result types returned
+: LDAP_RES_BIND             0x61 ; inline
+: LDAP_RES_SEARCH_ENTRY     0x64 ; inline
+: LDAP_RES_SEARCH_REFERENCE 0x73 ; inline
+: LDAP_RES_SEARCH_RESULT    0x65 ; inline
+: LDAP_RES_MODIFY           0x67 ; inline
+: LDAP_RES_ADD              0x69 ; inline
+: LDAP_RES_DELETE           0x6b ; inline
+: LDAP_RES_MODDN            0x6d ; inline
+: LDAP_RES_COMPARE          0x6f ; inline
+: LDAP_RES_EXTENDED         0x78 ; inline
+: LDAP_RES_EXTENDED_PARTIAL 0x79 ; inline
+
+: result-types ( -- seq ) {
+    { 0x61  "LDAP_RES_BIND" }
+    { 0x64  "LDAP_RES_SEARCH_ENTRY" }
+    { 0x73  "LDAP_RES_SEARCH_REFERENCE" }
+    { 0x65  "LDAP_RES_SEARCH_RESULT" }
+    { 0x67  "LDAP_RES_MODIFY" }
+    { 0x69  "LDAP_RES_ADD" }
+    { 0x6b  "LDAP_RES_DELETE" }
+    { 0x6d  "LDAP_RES_MODDN" }
+    { 0x6f  "LDAP_RES_COMPARE" }
+    { 0x78  "LDAP_RES_EXTENDED" }
+    { 0x79  "LDAP_RES_EXTENDED_PARTIAL" }
+} ;
+
+: LDAP_OPT_PROTOCOL_VERSION 0x0011 ; 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/ldap/libldap/tags.txt b/ldap/libldap/tags.txt
new file mode 100644 (file)
index 0000000..bb863cf
--- /dev/null
@@ -0,0 +1 @@
+bindings
diff --git a/ldap/summary.txt b/ldap/summary.txt
new file mode 100644 (file)
index 0000000..d695d4b
--- /dev/null
@@ -0,0 +1 @@
+OpenLDAP binding
diff --git a/ldap/tags.txt b/ldap/tags.txt
new file mode 100644 (file)
index 0000000..80d57bb
--- /dev/null
@@ -0,0 +1,2 @@
+enterprise
+network
diff --git a/llvm/authors.txt b/llvm/authors.txt
new file mode 100644 (file)
index 0000000..5645cd9
--- /dev/null
@@ -0,0 +1 @@
+Matthew Willis
diff --git a/llvm/clang/ffi/ffi.factor b/llvm/clang/ffi/ffi.factor
new file mode 100644 (file)
index 0000000..e9a83ba
--- /dev/null
@@ -0,0 +1,564 @@
+USING: alien alien.c-types alien.libraries alien.syntax
+classes.struct combinators system unix.types ;
+IN: llvm.clang.ffi
+
+<<
+"libclang" {
+    { [ os macosx?  ] [ "libclang.dylib" ] }
+    { [ os windows? ] [ "clang.dll"      ] }
+    { [ os unix?    ] [ "/usrlibclang.so"    ] }
+} cond cdecl add-library
+>>
+LIBRARY: libclang
+
+C-TYPE: CXTranslationUnitImpl
+
+TYPEDEF: void* CXIndex
+TYPEDEF: CXTranslationUnitImpl* CXTranslationUnit
+TYPEDEF: void* CXClientData
+
+STRUCT: CXUnsavedFile
+    { Filename c-string }
+    { Contents c-string }
+    { Length   ulong    } ;
+
+ENUM: CXAvailabilityKind
+  CXAvailability_Available
+  CXAvailability_Deprecated
+  CXAvailability_NotAvailable ;
+
+STRUCT: CXString
+    { data          void* }
+    { private_flags uint  } ;
+
+FUNCTION: c-string clang_getCString ( CXString string ) ;
+FUNCTION: void clang_disposeString ( CXString string ) ;
+
+FUNCTION: CXIndex clang_createIndex ( int excludeDeclarationsFromPCH,
+                                      int displayDiagnostics ) ;
+FUNCTION: void clang_disposeIndex ( CXIndex index ) ;
+
+TYPEDEF: void* CXFile
+
+FUNCTION: CXString clang_getFileName ( CXFile SFile ) ;
+FUNCTION: time_t clang_getFileTime ( CXFile SFile ) ;
+FUNCTION: uint clang_isFileMultipleIncludeGuarded ( CXTranslationUnit tu, CXFile file ) ;
+FUNCTION: CXFile clang_getFile ( CXTranslationUnit tu, c-string file_name ) ;
+
+STRUCT: CXSourceLocation
+    { ptr_data void*[2] }
+    { int_data uint     } ;
+
+STRUCT: CXSourceRange
+    { ptr_data       void*[2] }
+    { begin_int_data uint     }
+    { end_int_data   uint     } ;
+
+FUNCTION: CXSourceLocation clang_getNullLocation ( ) ;
+FUNCTION: uint clang_equalLocations ( CXSourceLocation loc1, CXSourceLocation loc2 ) ;
+
+FUNCTION: CXSourceLocation clang_getLocation ( CXTranslationUnit tu, CXFile file, uint line, uint column ) ;
+FUNCTION: CXSourceLocation clang_getLocationForOffset ( CXTranslationUnit tu,
+                                                        CXFile            file,
+                                                        uint              offset ) ;
+
+FUNCTION: CXSourceRange clang_getNullRange ( ) ;
+
+FUNCTION: CXSourceRange clang_getRange ( CXSourceLocation begin,
+                                         CXSourceLocation end ) ;
+
+FUNCTION: void clang_getInstantiationLocation ( CXSourceLocation location,
+                                                CXFile*          file,
+                                                uint*            line,
+                                                uint*            column,
+                                                uint*            offset ) ;
+
+FUNCTION: void clang_getSpellingLocation ( CXSourceLocation location,
+                                           CXFile*          file,
+                                           uint*            line,
+                                           uint*            column,
+                                           uint*            offset ) ;
+
+FUNCTION: CXSourceLocation clang_getRangeStart ( CXSourceRange range ) ;
+FUNCTION: CXSourceLocation clang_getRangeEnd ( CXSourceRange range ) ;
+
+ENUM: CXDiagnosticSeverity
+  CXDiagnostic_Ignored
+  CXDiagnostic_Note
+  CXDiagnostic_Warning
+  CXDiagnostic_Error
+  CXDiagnostic_Fatal ;
+
+TYPEDEF: void* CXDiagnostic
+
+FUNCTION: uint clang_getNumDiagnostics ( CXTranslationUnit Unit ) ;
+FUNCTION: CXDiagnostic clang_getDiagnostic ( CXTranslationUnit Unit,
+                                             uint              Index ) ;
+FUNCTION: void clang_disposeDiagnostic ( CXDiagnostic Diagnostic ) ;
+
+ENUM: CXDiagnosticDisplayOptions
+    { CXDiagnostic_DisplaySourceLocation 0x01 }
+    { CXDiagnostic_DisplayColumn         0x02 }
+    { CXDiagnostic_DisplaySourceRanges   0x04 }
+    { CXDiagnostic_DisplayOption         0x08 }
+    { CXDiagnostic_DisplayCategoryId     0x10 }
+    { CXDiagnostic_DisplayCategoryName   0x20 } ;
+
+FUNCTION: CXString clang_formatDiagnostic ( CXDiagnostic Diagnostic,
+                                            uint         Options ) ;
+FUNCTION: uint clang_defaultDiagnosticDisplayOptions ( ) ;
+
+FUNCTION: CXDiagnosticSeverity clang_getDiagnosticSeverity ( CXDiagnostic ) ;
+FUNCTION: CXSourceLocation clang_getDiagnosticLocation ( CXDiagnostic ) ;
+FUNCTION: CXString clang_getDiagnosticSpelling ( CXDiagnostic ) ;
+FUNCTION: CXString clang_getDiagnosticOption ( CXDiagnostic Diag, CXString* Disable ) ;
+FUNCTION: uint clang_getDiagnosticCategory ( CXDiagnostic ) ;
+FUNCTION: CXString clang_getDiagnosticCategoryName ( uint Category ) ;
+FUNCTION: uint clang_getDiagnosticNumRanges ( CXDiagnostic ) ;
+FUNCTION: CXSourceRange clang_getDiagnosticRange ( CXDiagnostic Diagnostic, uint Range ) ;
+FUNCTION: uint clang_getDiagnosticNumFixIts ( CXDiagnostic Diagnostic ) ;
+FUNCTION: CXString clang_getDiagnosticFixIt ( CXDiagnostic   Diagnostic,
+                                              uint           FixIt,
+                                              CXSourceRange* ReplacementRange ) ;
+FUNCTION: CXString clang_getTranslationUnitSpelling ( CXTranslationUnit CTUnit ) ;
+FUNCTION: CXTranslationUnit clang_createTranslationUnitFromSourceFile ( CXIndex        CIdx,
+                                                                        c-string       source_filename,
+                                                                        int            num_clang_command_line_args,
+                                                                        char**         clang_command_line_args,
+                                                                        uint           num_unsaved_files,
+                                                                        CXUnsavedFile* unsaved_files ) ;
+FUNCTION: CXTranslationUnit clang_createTranslationUnit ( CXIndex CIdx, c-string ast_filename ) ;
+
+ENUM: CXTranslationUnit_Flags
+    { CXTranslationUnit_None                        0x00 }
+    { CXTranslationUnit_DetailedPreprocessingRecord 0x01 }
+    { CXTranslationUnit_Incomplete                  0x02 }
+    { CXTranslationUnit_PrecompiledPreamble         0x04 }
+    { CXTranslationUnit_CacheCompletionResults      0x08 }
+    { CXTranslationUnit_CXXPrecompiledPreamble      0x10 }
+    { CXTranslationUnit_CXXChainedPCH               0x20 }
+    { CXTranslationUnit_NestedMacroInstantiations   0x40 } ;
+
+FUNCTION: uint clang_defaultEditingTranslationUnitOptions ( ) ;
+FUNCTION: CXTranslationUnit clang_parseTranslationUnit ( CXIndex        CIdx,
+                                                         c-string       source_filename,
+                                                         char**         command_line_args,
+                                                         int            num_command_line_args,
+                                                         CXUnsavedFile* unsaved_files,
+                                                         uint           num_unsaved_files,
+                                                         uint           options ) ;
+
+ENUM: CXSaveTranslationUnit_Flags CXSaveTranslationUnit_None ;
+
+FUNCTION: uint clang_defaultSaveOptions ( CXTranslationUnit TU ) ;
+FUNCTION: int clang_saveTranslationUnit ( CXTranslationUnit TU,
+                                          c-string          FileName,
+                                          uint              options ) ;
+FUNCTION: void clang_disposeTranslationUnit ( CXTranslationUnit ) ;
+
+ENUM: CXReparse_Flags CXReparse_None ;
+
+FUNCTION: uint clang_defaultReparseOptions ( CXTranslationUnit TU ) ;
+FUNCTION: int clang_reparseTranslationUnit ( CXTranslationUnit TU,
+                                             uint              num_unsaved_files,
+                                             CXUnsavedFile*    unsaved_files,
+                                             uint              options ) ;
+
+ENUM: CXTUResourceUsageKind
+    { CXTUResourceUsage_AST                                 1 }
+    { CXTUResourceUsage_Identifiers                         2 }
+    { CXTUResourceUsage_Selectors                           3 }
+    { CXTUResourceUsage_GlobalCompletionResults             4 }
+    { CXTUResourceUsage_SourceManagerContentCache           5 }
+    { CXTUResourceUsage_AST_SideTables                      6 }
+    { CXTUResourceUsage_SourceManager_Membuffer_Malloc      7 }
+    { CXTUResourceUsage_SourceManager_Membuffer_MMap        8 }
+    { CXTUResourceUsage_ExternalASTSource_Membuffer_Malloc  9 }
+    { CXTUResourceUsage_ExternalASTSource_Membuffer_MMap   10 }
+    { CXTUResourceUsage_Preprocessor                       11 }
+    { CXTUResourceUsage_PreprocessingRecord                12 }
+    { CXTUResourceUsage_MEMORY_IN_BYTES_BEGIN               1 }
+    { CXTUResourceUsage_MEMORY_IN_BYTES_END                12 }
+    { CXTUResourceUsage_First                               1 }
+    { CXTUResourceUsage_Last                               12 } ;
+
+FUNCTION: c-string clang_getTUResourceUsageName ( CXTUResourceUsageKind kind ) ;
+
+STRUCT: CXTUResourceUsageEntry
+    { kind   CXTUResourceUsageKind }
+    { amount ulong                 } ;
+
+STRUCT: CXTUResourceUsage
+    { data       void*                   }
+    { numEntries uint                    }
+    { entries    CXTUResourceUsageEntry* } ;
+
+FUNCTION: CXTUResourceUsage clang_getCXTUResourceUsage ( CXTranslationUnit TU ) ;
+FUNCTION: void clang_disposeCXTUResourceUsage ( CXTUResourceUsage usage ) ;
+
+ENUM: CXCursorKind
+    { CXCursor_UnexposedDecl                        1 }
+    { CXCursor_StructDecl                           2 }
+    { CXCursor_UnionDecl                            3 }
+    { CXCursor_ClassDecl                            4 }
+    { CXCursor_EnumDecl                             5 }
+    { CXCursor_FieldDecl                            6 }
+    { CXCursor_EnumConstantDecl                     7 }
+    { CXCursor_FunctionDecl                         8 }
+    { CXCursor_VarDecl                              9 }
+    { CXCursor_ParmDecl                            10 }
+    { CXCursor_ObjCInterfaceDecl                   11 }
+    { CXCursor_ObjCCategoryDecl                    12 }
+    { CXCursor_ObjCProtocolDecl                    13 }
+    { CXCursor_ObjCPropertyDecl                    14 }
+    { CXCursor_ObjCIvarDecl                        15 }
+    { CXCursor_ObjCInstanceMethodDecl              16 }
+    { CXCursor_ObjCClassMethodDecl                 17 }
+    { CXCursor_ObjCImplementationDecl              18 }
+    { CXCursor_ObjCCategoryImplDecl                19 }
+    { CXCursor_TypedefDecl                         20 }
+    { CXCursor_CXXMethod                           21 }
+    { CXCursor_Namespace                           22 }
+    { CXCursor_LinkageSpec                         23 }
+    { CXCursor_Constructor                         24 }
+    { CXCursor_Destructor                          25 }
+    { CXCursor_ConversionFunction                  26 }
+    { CXCursor_TemplateTypeParameter               27 }
+    { CXCursor_NonTypeTemplateParameter            28 }
+    { CXCursor_TemplateTemplateParameter           29 }
+    { CXCursor_FunctionTemplate                    30 }
+    { CXCursor_ClassTemplate                       31 }
+    { CXCursor_ClassTemplatePartialSpecialization  32 }
+    { CXCursor_NamespaceAlias                      33 }
+    { CXCursor_UsingDirective                      34 }
+    { CXCursor_UsingDeclaration                    35 }
+    { CXCursor_TypeAliasDecl                       36 }
+    { CXCursor_FirstDecl                            1 }
+    { CXCursor_LastDecl                            36 }
+    { CXCursor_FirstRef                            40 }
+    { CXCursor_ObjCSuperClassRef                   40 }
+    { CXCursor_ObjCProtocolRef                     41 }
+    { CXCursor_ObjCClassRef                        42 }
+    { CXCursor_TypeRef                             43 }
+    { CXCursor_CXXBaseSpecifier                    44 }
+    { CXCursor_TemplateRef                         45 }
+    { CXCursor_NamespaceRef                        46 }
+    { CXCursor_MemberRef                           47 }
+    { CXCursor_LabelRef                            48 }
+    { CXCursor_OverloadedDeclRef                   49 }
+    { CXCursor_LastRef                             49 }
+    { CXCursor_FirstInvalid                        70 }
+    { CXCursor_InvalidFile                         70 }
+    { CXCursor_NoDeclFound                         71 }
+    { CXCursor_NotImplemented                      72 }
+    { CXCursor_InvalidCode                         73 }
+    { CXCursor_LastInvalid                         73 }
+    { CXCursor_FirstExpr                          100 }
+    { CXCursor_UnexposedExpr                      100 }
+    { CXCursor_DeclRefExpr                        101 }
+    { CXCursor_MemberRefExpr                      102 }
+    { CXCursor_CallExpr                           103 }
+    { CXCursor_ObjCMessageExpr                    104 }
+    { CXCursor_BlockExpr                          105 }
+    { CXCursor_LastExpr                           105 }
+    { CXCursor_FirstStmt                          200 }
+    { CXCursor_UnexposedStmt                      200 }
+    { CXCursor_LabelStmt                          201 }
+    { CXCursor_LastStmt                           201 }
+    { CXCursor_TranslationUnit                    300 }
+    { CXCursor_FirstAttr                          400 }
+    { CXCursor_UnexposedAttr                      400 }
+    { CXCursor_IBActionAttr                       401 }
+    { CXCursor_IBOutletAttr                       402 }
+    { CXCursor_IBOutletCollectionAttr             403 }
+    { CXCursor_LastAttr                           403 }
+    { CXCursor_PreprocessingDirective             500 }
+    { CXCursor_MacroDefinition                    501 }
+    { CXCursor_MacroInstantiation                 502 }
+    { CXCursor_InclusionDirective                 503 }
+    { CXCursor_FirstPreprocessing                 500 }
+    { CXCursor_LastPreprocessing                  503 } ;
+
+STRUCT: CXCursor
+    { kind CXCursorKind }
+    { data void*[3]     } ;
+
+FUNCTION: CXCursor clang_getNullCursor ( ) ;
+FUNCTION: CXCursor clang_getTranslationUnitCursor ( CXTranslationUnit ) ;
+FUNCTION: uint clang_equalCursors ( CXCursor c1, CXCursor c2 ) ;
+FUNCTION: uint clang_hashCursor ( CXCursor ) ;
+FUNCTION: CXCursorKind clang_getCursorKind ( CXCursor ) ;
+FUNCTION: uint clang_isDeclaration ( CXCursorKind ) ;
+FUNCTION: uint clang_isReference ( CXCursorKind ) ;
+FUNCTION: uint clang_isExpression ( CXCursorKind ) ;
+FUNCTION: uint clang_isStatement ( CXCursorKind ) ;
+FUNCTION: uint clang_isInvalid ( CXCursorKind ) ;
+FUNCTION: uint clang_isTranslationUnit ( CXCursorKind ) ;
+FUNCTION: uint clang_isPreprocessing ( CXCursorKind ) ;
+FUNCTION: uint clang_isUnexposed ( CXCursorKind ) ;
+
+ENUM: CXLinkageKind
+  CXLinkage_Invalid
+  CXLinkage_NoLinkage
+  CXLinkage_Internal
+  CXLinkage_UniqueExternal
+  CXLinkage_External ;
+
+ENUM: CXLanguageKind
+  CXLanguage_Invalid
+  CXLanguage_C
+  CXLanguage_ObjC
+  CXLanguage_CPlusPlus ;
+
+FUNCTION: CXLinkageKind clang_getCursorLinkage ( CXCursor cursor ) ;
+FUNCTION: CXAvailabilityKind clang_getCursorAvailability ( CXCursor cursor ) ;
+FUNCTION: CXLanguageKind clang_getCursorLanguage ( CXCursor cursor ) ;
+
+C-TYPE: CXCursorSetImpl
+TYPEDEF: CXCursorSetImpl* CXCursorSet
+
+FUNCTION: CXCursorSet clang_createCXCursorSet ( ) ;
+FUNCTION: void clang_disposeCXCursorSet ( CXCursorSet cset ) ;
+FUNCTION: uint clang_CXCursorSet_contains ( CXCursorSet cset, CXCursor cursor ) ;
+FUNCTION: uint clang_CXCursorSet_insert ( CXCursorSet cset, CXCursor cursor ) ;
+FUNCTION: CXCursor clang_getCursorSemanticParent ( CXCursor cursor ) ;
+FUNCTION: CXCursor clang_getCursorLexicalParent ( CXCursor cursor ) ;
+FUNCTION: void clang_getOverriddenCursors ( CXCursor cursor, CXCursor** overridden, uint* num_overridden ) ;
+FUNCTION: void clang_disposeOverriddenCursors ( CXCursor* overridden ) ;
+FUNCTION: CXFile clang_getIncludedFile ( CXCursor cursor ) ;
+FUNCTION: CXCursor clang_getCursor ( CXTranslationUnit TU,
+                                     CXSourceLocation location ) ;
+FUNCTION: CXSourceLocation clang_getCursorLocation ( CXCursor ) ;
+FUNCTION: CXSourceRange clang_getCursorExtent ( CXCursor ) ;
+
+ENUM: CXTypeKind
+    { CXType_Invalid             0 }
+    { CXType_Unexposed           1 }
+    { CXType_Void                2 }
+    { CXType_Bool                3 }
+    { CXType_Char_U              4 }
+    { CXType_UChar               5 }
+    { CXType_Char16              6 }
+    { CXType_Char32              7 }
+    { CXType_UShort              8 }
+    { CXType_UInt                9 }
+    { CXType_ULong              10 }
+    { CXType_ULongLong          11 }
+    { CXType_UInt128            12 }
+    { CXType_Char_S             13 }
+    { CXType_SChar              14 }
+    { CXType_WChar              15 }
+    { CXType_Short              16 }
+    { CXType_Int                17 }
+    { CXType_Long               18 }
+    { CXType_LongLong           19 }
+    { CXType_Int128             20 }
+    { CXType_Float              21 }
+    { CXType_Double             22 }
+    { CXType_LongDouble         23 }
+    { CXType_NullPtr            24 }
+    { CXType_Overload           25 }
+    { CXType_Dependent          26 }
+    { CXType_ObjCId             27 }
+    { CXType_ObjCClass          28 }
+    { CXType_ObjCSel            29 }
+    { CXType_FirstBuiltin        2 }
+    { CXType_LastBuiltin        29 }
+    { CXType_Complex           100 }
+    { CXType_Pointer           101 }
+    { CXType_BlockPointer      102 }
+    { CXType_LValueReference   103 }
+    { CXType_RValueReference   104 }
+    { CXType_Record            105 }
+    { CXType_Enum              106 }
+    { CXType_Typedef           107 }
+    { CXType_ObjCInterface     108 }
+    { CXType_ObjCObjectPointer 109 }
+    { CXType_FunctionNoProto   110 }
+    { CXType_FunctionProto     111 } ;
+
+STRUCT: CXType
+    { kind CXTypeKind }
+    { data void*[2]   } ;
+
+FUNCTION: CXType clang_getCursorType ( CXCursor C ) ;
+FUNCTION: uint clang_equalTypes ( CXType A, CXType B ) ;
+FUNCTION: CXType clang_getCanonicalType ( CXType T ) ;
+FUNCTION: uint clang_isConstQualifiedType ( CXType T ) ;
+FUNCTION: uint clang_isVolatileQualifiedType ( CXType T ) ;
+FUNCTION: uint clang_isRestrictQualifiedType ( CXType T ) ;
+FUNCTION: CXType clang_getPointeeType ( CXType T ) ;
+FUNCTION: CXCursor clang_getTypeDeclaration ( CXType T ) ;
+FUNCTION: CXString clang_getDeclObjCTypeEncoding ( CXCursor C ) ;
+FUNCTION: CXString clang_getTypeKindSpelling ( CXTypeKind K ) ;
+FUNCTION: CXType clang_getResultType ( CXType T ) ;
+FUNCTION: CXType clang_getCursorResultType ( CXCursor C ) ;
+FUNCTION: uint clang_isPODType ( CXType T ) ;
+FUNCTION: uint clang_isVirtualBase ( CXCursor ) ;
+
+ENUM: CX_CXXAccessSpecifier
+  CX_CXXInvalidAccessSpecifier
+  CX_CXXPublic
+  CX_CXXProtected
+  CX_CXXPrivate ;
+
+FUNCTION: CX_CXXAccessSpecifier clang_getCXXAccessSpecifier ( CXCursor ) ;
+FUNCTION: uint clang_getNumOverloadedDecls ( CXCursor cursor ) ;
+FUNCTION: CXCursor clang_getOverloadedDecl ( CXCursor cursor, uint index ) ;
+FUNCTION: CXType clang_getIBOutletCollectionType ( CXCursor ) ;
+
+ENUM: CXChildVisitResult
+  CXChildVisit_Break
+  CXChildVisit_Continue
+  CXChildVisit_Recurse ;
+
+CALLBACK: CXChildVisitResult CXCursorVisitor ( CXCursor     cursor,
+                                               CXCursor     parent,
+                                               CXClientData client_data ) ;
+
+FUNCTION: uint clang_visitChildren ( CXCursor        parent,
+                                     CXCursorVisitor visitor,
+                                     CXClientData    client_data ) ;
+FUNCTION: CXString clang_getCursorUSR ( CXCursor ) ;
+FUNCTION: CXString clang_constructUSR_ObjCClass ( c-string class_name ) ;
+FUNCTION: CXString clang_constructUSR_ObjCCategory ( c-string class_name,
+                                                     c-string category_name ) ;
+FUNCTION: CXString clang_constructUSR_ObjCProtocol ( c-string protocol_name ) ;
+FUNCTION: CXString clang_constructUSR_ObjCIvar ( c-string name,
+                                                 CXString classUSR ) ;
+FUNCTION: CXString clang_constructUSR_ObjCMethod ( c-string name,
+                                                   uint     isInstanceMethod,
+                                                   CXString classUSR ) ;
+FUNCTION: CXString clang_constructUSR_ObjCProperty ( c-string property,
+                                                     CXString classUSR ) ;
+FUNCTION: CXString clang_getCursorSpelling ( CXCursor ) ;
+FUNCTION: CXString clang_getCursorDisplayName ( CXCursor ) ;
+FUNCTION: CXCursor clang_getCursorReferenced ( CXCursor ) ;
+FUNCTION: CXCursor clang_getCursorDefinition ( CXCursor ) ;
+FUNCTION: uint clang_isCursorDefinition ( CXCursor ) ;
+FUNCTION: CXCursor clang_getCanonicalCursor ( CXCursor ) ;
+FUNCTION: uint clang_CXXMethod_isStatic ( CXCursor C ) ;
+FUNCTION: uint clang_CXXMethod_isVirtual ( CXCursor C ) ;
+FUNCTION: CXCursorKind clang_getTemplateCursorKind ( CXCursor C ) ;
+FUNCTION: CXCursor clang_getSpecializedCursorTemplate ( CXCursor C ) ;
+
+ENUM: CXTokenKind
+  CXToken_Punctuation
+  CXToken_Keyword
+  CXToken_Identifier
+  CXToken_Literal
+  CXToken_Comment ;
+
+STRUCT: CXToken
+    { int_data uint[4] }
+    { ptr_data void*   } ;
+
+FUNCTION: CXTokenKind clang_getTokenKind ( CXToken ) ;
+FUNCTION: CXString clang_getTokenSpelling ( CXTranslationUnit TU,
+                                            CXToken           Token ) ;
+FUNCTION: CXSourceLocation clang_getTokenLocation ( CXTranslationUnit TU,
+                                                    CXToken           Token ) ;
+FUNCTION: CXSourceRange clang_getTokenExtent ( CXTranslationUnit TU,
+                                               CXToken           Token ) ;
+FUNCTION: void clang_tokenize ( CXTranslationUnit TU,
+                                CXSourceRange     Range,
+                                CXToken**         Tokens,
+                                uint*             NumTokens ) ;
+FUNCTION: void clang_annotateTokens ( CXTranslationUnit TU,
+                                      CXToken*          Tokens,
+                                      uint              NumTokens,
+                                      CXCursor*         Cursors ) ;
+FUNCTION: void clang_disposeTokens ( CXTranslationUnit TU,
+                                     CXToken*          Tokens,
+                                     uint              NumTokens ) ;
+
+FUNCTION: CXString clang_getCursorKindSpelling ( CXCursorKind Kind ) ;
+FUNCTION: void clang_getDefinitionSpellingAndExtent ( CXCursor cursor,
+                                                      char**   startBuf,
+                                                      char**   endBuf,
+                                                      uint*    startLine,
+                                                      uint*    startColumn,
+                                                      uint*    endLine,
+                                                      uint*    endColumn ) ;
+FUNCTION: void clang_enableStackTraces ( ) ;
+
+CALLBACK: void executeOnThreadCallback ( void* ) ;
+FUNCTION: void clang_executeOnThread ( executeOnThreadCallback* callback,
+                                       void*                    user_data,
+                                       uint                     stack_size ) ;
+
+TYPEDEF: void* CXCompletionString
+
+STRUCT: CXCompletionResult
+    { CursorKind       CXCursorKind       }
+    { CompletionString CXCompletionString } ;
+
+ENUM: CXCompletionChunkKind
+  CXCompletionChunk_Optional
+  CXCompletionChunk_TypedText
+  CXCompletionChunk_Text
+  CXCompletionChunk_Placeholder
+  CXCompletionChunk_Informative
+  CXCompletionChunk_CurrentParameter
+  CXCompletionChunk_LeftParen
+  CXCompletionChunk_RightParen
+  CXCompletionChunk_LeftBracket
+  CXCompletionChunk_RightBracket
+  CXCompletionChunk_LeftBrace
+  CXCompletionChunk_RightBrace
+  CXCompletionChunk_LeftAngle
+  CXCompletionChunk_RightAngle
+  CXCompletionChunk_Comma
+  CXCompletionChunk_ResultType
+  CXCompletionChunk_Colon
+  CXCompletionChunk_SemiColon
+  CXCompletionChunk_Equal
+  CXCompletionChunk_HorizontalSpace
+  CXCompletionChunk_VerticalSpace ;
+
+FUNCTION: CXCompletionChunkKind clang_getCompletionChunkKind ( CXCompletionString completion_string,
+                                                               uint               chunk_number ) ;
+FUNCTION: CXString clang_getCompletionChunkText ( CXCompletionString completion_string,
+                                                  uint               chunk_number ) ;
+FUNCTION: CXCompletionString clang_getCompletionChunkCompletionString ( CXCompletionString completion_string,
+                                                                        uint               chunk_number ) ;
+FUNCTION: uint clang_getNumCompletionChunks ( CXCompletionString completion_string ) ;
+FUNCTION: uint clang_getCompletionPriority ( CXCompletionString completion_string ) ;
+FUNCTION: CXAvailabilityKind clang_getCompletionAvailability ( CXCompletionString completion_string ) ;
+
+STRUCT: CXCodeCompleteResults
+    { Results CXCompletionResult* }
+    { NumResults uint             } ;
+
+ENUM: CXCodeComplete_Flags
+    { CXCodeComplete_IncludeMacros       1 }
+    { CXCodeComplete_IncludeCodePatterns 2 } ;
+
+FUNCTION: uint clang_defaultCodeCompleteOptions ( ) ;
+
+FUNCTION: CXCodeCompleteResults* clang_codeCompleteAt ( CXTranslationUnit TU,
+                                                        c-string          complete_filename,
+                                                        uint              complete_line,
+                                                        uint              complete_column,
+                                                        CXUnsavedFile*    unsaved_files,
+                                                        uint              num_unsaved_files,
+                                                        uint              options ) ;
+
+FUNCTION: void clang_sortCodeCompletionResults ( CXCompletionResult* Results, uint NumResults ) ;
+FUNCTION: void clang_disposeCodeCompleteResults ( CXCodeCompleteResults* Results ) ;
+FUNCTION: uint clang_codeCompleteGetNumDiagnostics ( CXCodeCompleteResults* Results ) ;
+
+FUNCTION: CXDiagnostic clang_codeCompleteGetDiagnostic ( CXCodeCompleteResults* Results,
+                                                         uint                   Index ) ;
+
+FUNCTION: CXString clang_getClangVersion ( ) ;
+FUNCTION: void clang_toggleCrashRecovery ( uint isEnabled ) ;
+
+CALLBACK: void CXInclusionVisitor ( CXFile            included_file,
+                                    CXSourceLocation* inclusion_stack,
+                                    uint              include_len,
+                                    CXClientData      client_data ) ;
+
+FUNCTION: void clang_getInclusions ( CXTranslationUnit  tu,
+                                     CXInclusionVisitor visitor,
+                                     CXClientData       client_data ) ;
diff --git a/llvm/clang/ffi/platforms.txt b/llvm/clang/ffi/platforms.txt
new file mode 100644 (file)
index 0000000..47e0a69
--- /dev/null
@@ -0,0 +1 @@
+unix
\ No newline at end of file
diff --git a/llvm/core/core.factor b/llvm/core/core.factor
new file mode 100644 (file)
index 0000000..d84a618
--- /dev/null
@@ -0,0 +1,416 @@
+! Copyright (C) 2009 Matthew Willis.
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: alien alien.c-types alien.libraries alien.syntax
+combinators kernel sequences system ;
+
+IN: llvm.core
+
+<<
+: add-llvm-library ( name -- )
+    dup {
+        { [ os macosx? ] [ "lib" ".dylib" surround ] }
+        { [ os unix? ] [ "lib" ".so" surround ] }
+        { [ os windows? ] [ ".dll" append ] }
+    } cond cdecl add-library ;
+
+{ "LLVMSystem" "LLVMSupport" "LLVMCore" "LLVMBitReader" }
+[ add-llvm-library ] each
+>>
+
+! llvm-c/Core.h
+
+LIBRARY: LLVMCore
+
+TYPEDEF: uint unsigned
+TYPEDEF: unsigned enum
+
+ENUM: LLVMAttribute
+    { LLVMZExtAttribute         0b1 }
+    { LLVMSExtAttribute         0b10 }
+    { LLVMNoReturnAttribute     0b100 }
+    { LLVMInRegAttribute        0b1000 }
+    { LLVMStructRetAttribute    0b10000 }
+    { LLVMNoUnwindAttribute     0b100000 }
+    { LLVMNoAliasAttribute      0b1000000 }
+    { LLVMByValAttribute        0b10000000 }
+    { LLVMNestAttribute         0b100000000 }
+    { LLVMReadNoneAttribute     0b1000000000 }
+    { LLVMReadOnlyAttribute     0b10000000000 } ;
+
+ENUM: LLVMTypeKind
+  LLVMVoidTypeKind
+  LLVMFloatTypeKind
+  LLVMDoubleTypeKind
+  LLVMX86_FP80TypeKind
+  LLVMFP128TypeKind
+  LLVMPPC_FP128TypeKind
+  LLVMLabelTypeKind
+  LLVMMetadataTypeKind
+  LLVMIntegerTypeKind
+  LLVMFunctionTypeKind
+  LLVMStructTypeKind
+  LLVMArrayTypeKind
+  LLVMPointerTypeKind
+  LLVMOpaqueTypeKind
+  LLVMVectorTypeKind ;
+
+ENUM: LLVMLinkage
+  LLVMExternalLinkage
+  LLVMLinkOnceLinkage
+  LLVMWeakLinkage
+  LLVMAppendingLinkage
+  LLVMInternalLinkage
+  LLVMDLLImportLinkage
+  LLVMDLLExportLinkage
+  LLVMExternalWeakLinkage
+  LLVMGhostLinkage ;
+
+ENUM: LLVMVisibility
+  LLVMDefaultVisibility
+  LLVMHiddenVisibility
+  LLVMProtectedVisibility ;
+
+ENUM: LLVMCallConv
+  { LLVMCCallConv             0 }
+  { LLVMFastCallConv          8 }
+  { LLVMColdCallConv          9 }
+  { LLVMX86StdcallCallConv    64 }
+  { LLVMX86FastcallCallConv   65 } ;
+
+ENUM: LLVMIntPredicate
+  { LLVMIntEQ                 32 }
+  { LLVMIntNE                 33 }
+  { LLVMIntUGT                34 }
+  { LLVMIntUGE                35 }
+  { LLVMIntULT                36 }
+  { LLVMIntULE                37 }
+  { LLVMIntSGT                38 }
+  { LLVMIntSGE                39 }
+  { LLVMIntSLT                40 }
+  { LLVMIntSLE                41 } ;
+
+ENUM: LLVMRealPredicate
+  LLVMRealPredicateFalse
+  LLVMRealOEQ
+  LLVMRealOGT
+  LLVMRealOGE
+  LLVMRealOLT
+  LLVMRealOLE
+  LLVMRealONE
+  LLVMRealORD
+  LLVMRealUNO
+  LLVMRealUEQ
+  LLVMRealUGT
+  LLVMRealUGE
+  LLVMRealULT
+  LLVMRealULE
+  LLVMRealUNE
+  LLVMRealPredicateTrue ;
+
+! Opaque Types
+
+TYPEDEF: void* LLVMModuleRef
+
+TYPEDEF: void* LLVMPassManagerRef
+
+TYPEDEF: void* LLVMModuleProviderRef
+
+TYPEDEF: void* LLVMTypeRef
+
+TYPEDEF: void* LLVMTypeHandleRef
+
+TYPEDEF: void* LLVMValueRef
+
+TYPEDEF: void* LLVMBasicBlockRef
+
+TYPEDEF: void* LLVMBuilderRef
+
+TYPEDEF: void* LLVMMemoryBufferRef
+
+! Functions
+
+FUNCTION: void LLVMDisposeMessage ( c-string Message ) ;
+
+FUNCTION: LLVMModuleRef LLVMModuleCreateWithName ( c-string ModuleID ) ;
+
+FUNCTION: int LLVMAddTypeName ( LLVMModuleRef M, c-string Name, LLVMTypeRef Ty ) ;
+
+FUNCTION: void LLVMDisposeModule ( LLVMModuleRef M ) ;
+
+FUNCTION: void LLVMDumpModule ( LLVMModuleRef M ) ;
+
+FUNCTION: LLVMModuleProviderRef
+LLVMCreateModuleProviderForExistingModule ( LLVMModuleRef M ) ;
+
+FUNCTION: void LLVMDisposeModuleProvider ( LLVMModuleProviderRef MP ) ;
+
+! Types
+
+! LLVM types conform to the following hierarchy:
+!  
+!    types:
+!      integer type
+!      real type
+!      function type
+!      sequence types:
+!        array type
+!        pointer type
+!        vector type
+!      void type
+!      label type
+!      opaque type
+
+! See llvm::LLVMTypeKind::getTypeID.
+FUNCTION: LLVMTypeKind LLVMGetTypeKind ( LLVMTypeRef Ty ) ;
+
+! Operations on integer types
+FUNCTION: LLVMTypeRef LLVMInt1Type ( ) ;
+FUNCTION: LLVMTypeRef LLVMInt8Type ( ) ;
+FUNCTION: LLVMTypeRef LLVMInt16Type ( ) ;
+FUNCTION: LLVMTypeRef LLVMInt32Type ( ) ;
+FUNCTION: LLVMTypeRef LLVMInt64Type ( ) ;
+FUNCTION: LLVMTypeRef LLVMIntType ( unsigned NumBits ) ;
+FUNCTION: unsigned LLVMGetIntTypeWidth ( LLVMTypeRef IntegerTy ) ;
+
+! Operations on real types
+FUNCTION: LLVMTypeRef LLVMFloatType ( ) ;
+FUNCTION: LLVMTypeRef LLVMDoubleType ( ) ;
+FUNCTION: LLVMTypeRef LLVMX86FP80Type ( ) ;
+FUNCTION: LLVMTypeRef LLVMFP128Type ( ) ;
+FUNCTION: LLVMTypeRef LLVMPPCFP128Type ( ) ;
+
+! Operations on function types
+FUNCTION: LLVMTypeRef
+LLVMFunctionType ( LLVMTypeRef ReturnType, LLVMTypeRef* ParamTypes, unsigned ParamCount, int IsVarArg ) ;
+FUNCTION: int LLVMIsFunctionVarArg ( LLVMTypeRef FunctionTy ) ;
+FUNCTION: LLVMTypeRef LLVMGetReturnType ( LLVMTypeRef FunctionTy ) ;
+FUNCTION: unsigned LLVMCountParamTypes ( LLVMTypeRef FunctionTy ) ;
+FUNCTION: void LLVMGetParamTypes ( LLVMTypeRef FunctionTy, LLVMTypeRef* Dest ) ;
+
+! Operations on struct types
+FUNCTION: LLVMTypeRef
+LLVMStructType ( LLVMTypeRef* ElementTypes, unsigned ElementCount, int Packed ) ;
+FUNCTION: unsigned LLVMCountStructElementTypes ( LLVMTypeRef StructTy ) ;
+FUNCTION: void LLVMGetStructElementTypes ( LLVMTypeRef StructTy, LLVMTypeRef* Dest ) ;
+FUNCTION: int LLVMIsPackedStruct ( LLVMTypeRef StructTy ) ;
+
+! Operations on array, pointer, and vector types (sequence types)
+FUNCTION: LLVMTypeRef LLVMArrayType ( LLVMTypeRef ElementType, unsigned ElementCount ) ;
+FUNCTION: LLVMTypeRef LLVMPointerType ( LLVMTypeRef ElementType, unsigned AddressSpace ) ;
+FUNCTION: LLVMTypeRef LLVMVectorType ( LLVMTypeRef ElementType, unsigned ElementCount ) ;
+
+FUNCTION: LLVMTypeRef LLVMGetElementType ( LLVMTypeRef Ty ) ;
+FUNCTION: unsigned LLVMGetArrayLength ( LLVMTypeRef ArrayTy ) ;
+FUNCTION: unsigned LLVMGetPointerAddressSpace ( LLVMTypeRef PointerTy ) ;
+FUNCTION: unsigned LLVMGetVectorSize ( LLVMTypeRef VectorTy ) ;
+
+! Operations on other types
+FUNCTION: LLVMTypeRef LLVMVoidType ( ) ;
+FUNCTION: LLVMTypeRef LLVMLabelType ( ) ;
+FUNCTION: LLVMTypeRef LLVMOpaqueType ( ) ;
+
+! Operations on type handles
+FUNCTION: LLVMTypeHandleRef LLVMCreateTypeHandle ( LLVMTypeRef PotentiallyAbstractTy ) ;
+FUNCTION: void LLVMRefineType ( LLVMTypeRef AbstractTy, LLVMTypeRef ConcreteTy ) ;
+FUNCTION: LLVMTypeRef LLVMResolveTypeHandle ( LLVMTypeHandleRef TypeHandle ) ;
+FUNCTION: void LLVMDisposeTypeHandle ( LLVMTypeHandleRef TypeHandle ) ;
+
+! Types end
+
+FUNCTION: unsigned LLVMCountParams ( LLVMValueRef Fn ) ;
+
+FUNCTION: void LLVMGetParams ( LLVMValueRef Fn, LLVMValueRef* Params ) ;
+
+FUNCTION: LLVMValueRef
+LLVMAddFunction ( LLVMModuleRef M, c-string Name, LLVMTypeRef FunctionTy ) ;
+
+FUNCTION: LLVMValueRef LLVMGetFirstFunction ( LLVMModuleRef M ) ;
+
+FUNCTION: LLVMValueRef LLVMGetNextFunction ( LLVMValueRef Fn ) ;
+
+FUNCTION: unsigned LLVMGetFunctionCallConv ( LLVMValueRef Fn ) ;
+
+FUNCTION: void LLVMSetFunctionCallConv ( LLVMValueRef Fn, unsigned CC ) ;
+
+FUNCTION: LLVMBasicBlockRef
+LLVMAppendBasicBlock ( LLVMValueRef Fn, c-string Name ) ;
+
+FUNCTION: LLVMValueRef LLVMGetBasicBlockParent ( LLVMBasicBlockRef BB ) ;
+
+! Values
+
+FUNCTION: LLVMTypeRef LLVMTypeOf ( LLVMValueRef Val ) ;
+FUNCTION: c-string LLVMGetValueName ( LLVMValueRef Val ) ;
+FUNCTION: void LLVMSetValueName ( LLVMValueRef Val, c-string Name ) ;
+FUNCTION: void LLVMDumpValue ( LLVMValueRef Val ) ;
+
+! Instruction Builders
+
+FUNCTION: LLVMBuilderRef LLVMCreateBuilder ( ) ;
+FUNCTION: void LLVMPositionBuilder
+( LLVMBuilderRef Builder, LLVMBasicBlockRef Block, LLVMValueRef Instr ) ;
+FUNCTION: void LLVMPositionBuilderBefore
+( LLVMBuilderRef Builder, LLVMValueRef Instr ) ;
+FUNCTION: void LLVMPositionBuilderAtEnd
+( LLVMBuilderRef Builder, LLVMBasicBlockRef Block ) ;
+FUNCTION: LLVMBasicBlockRef LLVMGetInsertBlock
+( LLVMBuilderRef Builder ) ;
+FUNCTION: void LLVMClearInsertionPosition
+( LLVMBuilderRef Builder ) ;
+FUNCTION: void LLVMInsertIntoBuilder
+( LLVMBuilderRef Builder, LLVMValueRef Instr ) ;
+FUNCTION: void LLVMDisposeBuilder
+( LLVMBuilderRef Builder ) ;
+
+! IB Terminators
+
+FUNCTION: LLVMValueRef LLVMBuildRetVoid
+( LLVMBuilderRef Builder ) ;
+FUNCTION: LLVMValueRef LLVMBuildRet
+( LLVMBuilderRef Builder, LLVMValueRef V ) ;
+FUNCTION: LLVMValueRef LLVMBuildBr
+( LLVMBuilderRef Builder, LLVMBasicBlockRef Dest ) ;
+FUNCTION: LLVMValueRef LLVMBuildCondBr
+( LLVMBuilderRef Builder, LLVMValueRef If, LLVMBasicBlockRef Then, LLVMBasicBlockRef Else ) ;
+FUNCTION: LLVMValueRef LLVMBuildSwitch
+( LLVMBuilderRef Builder, LLVMValueRef V, LLVMBasicBlockRef Else, unsigned NumCases ) ;
+FUNCTION: LLVMValueRef LLVMBuildInvoke
+( LLVMBuilderRef Builder, LLVMValueRef Fn, LLVMValueRef* Args, unsigned NumArgs,
+  LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildUnwind
+( LLVMBuilderRef Builder ) ;
+FUNCTION: LLVMValueRef LLVMBuildUnreachable
+( LLVMBuilderRef Builder ) ;
+
+! IB Add Case to Switch
+
+FUNCTION: void LLVMAddCase
+( LLVMValueRef Switch, LLVMValueRef OnVal, LLVMBasicBlockRef Dest ) ;
+
+! IB Arithmetic
+
+FUNCTION: LLVMValueRef LLVMBuildAdd
+( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildSub
+( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildMul
+( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildUDiv
+( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildSDiv
+( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildFDiv
+( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildURem
+( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildSRem
+( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildFRem
+( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildShl
+( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildLShr
+( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildAShr
+( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildAnd
+( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildOr
+( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildXor
+( LLVMBuilderRef Builder, LLVMValueRef LHS, LLVMValueRef RHS, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildNeg
+( LLVMBuilderRef Builder, LLVMValueRef V, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildNot
+( LLVMBuilderRef Builder, LLVMValueRef V, c-string Name ) ;
+
+! IB Memory
+
+FUNCTION: LLVMValueRef LLVMBuildMalloc
+( LLVMBuilderRef Builder, LLVMTypeRef Ty, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildArrayMalloc
+( LLVMBuilderRef Builder, LLVMTypeRef Ty, LLVMValueRef Val, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildAlloca
+( LLVMBuilderRef Builder, LLVMTypeRef Ty, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildArrayAlloca
+( LLVMBuilderRef Builder, LLVMTypeRef Ty, LLVMValueRef Val, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildFree
+( LLVMBuilderRef Builder, LLVMValueRef PointerVal ) ;
+FUNCTION: LLVMValueRef LLVMBuildLoad
+( LLVMBuilderRef Builder, LLVMValueRef PointerVal, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildStore
+( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMValueRef Ptr ) ;
+FUNCTION: LLVMValueRef LLVMBuildGEP
+( LLVMBuilderRef B, LLVMValueRef Pointer, LLVMValueRef* Indices,
+  unsigned NumIndices, c-string Name ) ;
+
+! IB Casts
+
+FUNCTION: LLVMValueRef LLVMBuildTrunc
+( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildZExt
+( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildSExt
+( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildFPToUI
+( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildFPToSI
+( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildUIToFP
+( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildSIToFP
+( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildFPTrunc
+( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildFPExt
+( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildPtrToInt
+( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildIntToPtr
+( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildBitCast
+( LLVMBuilderRef Builder, LLVMValueRef Val, LLVMTypeRef DestTy, c-string Name ) ;
+
+! IB Comparisons
+
+FUNCTION: LLVMValueRef LLVMBuildICmp
+( LLVMBuilderRef Builder, LLVMIntPredicate Op, LLVMValueRef LHS, LLVMValueRef RHS, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildFCmp
+( LLVMBuilderRef Builder, LLVMRealPredicate Op, LLVMValueRef LHS, LLVMValueRef RHS, c-string Name ) ;
+
+! IB Misc Instructions
+
+FUNCTION: LLVMValueRef LLVMBuildPhi
+( LLVMBuilderRef Builder, LLVMTypeRef Ty, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildCall
+( LLVMBuilderRef Builder, LLVMValueRef Fn, LLVMValueRef* Args, unsigned NumArgs, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildSelect
+( LLVMBuilderRef Builder, LLVMValueRef If, LLVMValueRef Then, LLVMValueRef Else, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildVAArg
+( LLVMBuilderRef Builder, LLVMValueRef List, LLVMTypeRef Ty, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildExtractElement
+( LLVMBuilderRef Builder, LLVMValueRef VecVal, LLVMValueRef Index, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildInsertElement
+( LLVMBuilderRef Builder, LLVMValueRef VecVal, LLVMValueRef EltVal, LLVMValueRef Index, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildShuffleVector
+( LLVMBuilderRef Builder, LLVMValueRef V1, LLVMValueRef V2, LLVMValueRef Mask, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildExtractValue
+( LLVMBuilderRef Builder, LLVMValueRef AggVal, unsigned Index, c-string Name ) ;
+FUNCTION: LLVMValueRef LLVMBuildInsertValue
+( LLVMBuilderRef Builder, LLVMValueRef AggVal, LLVMValueRef EltVal, unsigned Index, c-string Name ) ;
+
+! Memory Buffers/Bit Reader
+
+FUNCTION: int LLVMCreateMemoryBufferWithContentsOfFile
+( c-string Path, LLVMMemoryBufferRef* OutMemBuf, c-string* OutMessage ) ;
+
+FUNCTION: void LLVMDisposeMemoryBuffer ( LLVMMemoryBufferRef MemBuf ) ;
+
+LIBRARY: LLVMBitReader
+
+FUNCTION: int LLVMParseBitcode
+( LLVMMemoryBufferRef MemBuf, LLVMModuleRef* OutModule, c-string* OutMessage ) ;
+
+FUNCTION: int LLVMGetBitcodeModuleProvider
+( LLVMMemoryBufferRef MemBuf, LLVMModuleProviderRef* OutMP, c-string* OutMessage ) ;
diff --git a/llvm/core/tags.txt b/llvm/core/tags.txt
new file mode 100644 (file)
index 0000000..700f0dc
--- /dev/null
@@ -0,0 +1 @@
+not tested
diff --git a/llvm/engine/engine.factor b/llvm/engine/engine.factor
new file mode 100644 (file)
index 0000000..e653368
--- /dev/null
@@ -0,0 +1,50 @@
+! Copyright (C) 2009 Matthew Willis.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.c-types alien.libraries alien.syntax kernel
+llvm.core sequences ;
+IN: llvm.engine
+
+<<
+{
+    "LLVMExecutionEngine" "LLVMTarget" "LLVMAnalysis" "LLVMipa"
+    "LLVMTransformUtils" "LLVMScalarOpts" "LLVMCodeGen"
+    "LLVMAsmPrinter" "LLVMSelectionDAG" "LLVMX86CodeGen"
+    "LLVMJIT" "LLVMInterpreter"
+} [ add-llvm-library ] each
+>>
+
+! llvm-c/ExecutionEngine.h
+
+LIBRARY: LLVMExecutionEngine
+
+TYPEDEF: void* LLVMGenericValueRef
+TYPEDEF: void* LLVMExecutionEngineRef
+
+FUNCTION: LLVMGenericValueRef LLVMCreateGenericValueOfInt
+( LLVMTypeRef Ty, ulonglong N, int IsSigned ) ;
+
+FUNCTION: ulonglong LLVMGenericValueToInt
+( LLVMGenericValueRef GenVal, int IsSigned ) ;
+
+FUNCTION: int LLVMCreateExecutionEngine
+( LLVMExecutionEngineRef *OutEE, LLVMModuleProviderRef MP, c-string* OutError ) ;
+
+FUNCTION: int LLVMCreateJITCompiler
+( LLVMExecutionEngineRef* OutJIT, LLVMModuleProviderRef MP, unsigned OptLevel, c-string* OutError ) ;
+
+FUNCTION: void LLVMDisposeExecutionEngine ( LLVMExecutionEngineRef EE ) ;
+
+FUNCTION: void LLVMFreeMachineCodeForFunction ( LLVMExecutionEngineRef EE, LLVMValueRef F ) ;
+
+FUNCTION: void LLVMAddModuleProvider ( LLVMExecutionEngineRef EE, LLVMModuleProviderRef MP ) ;
+
+FUNCTION: int LLVMRemoveModuleProvider
+( LLVMExecutionEngineRef EE, LLVMModuleProviderRef MP, LLVMModuleRef* OutMod, c-string* OutError ) ;
+
+FUNCTION: int LLVMFindFunction
+( LLVMExecutionEngineRef EE, c-string Name, LLVMValueRef* OutFn ) ;
+
+FUNCTION: void* LLVMGetPointerToGlobal ( LLVMExecutionEngineRef EE, LLVMValueRef Global ) ;
+
+FUNCTION: LLVMGenericValueRef LLVMRunFunction
+( LLVMExecutionEngineRef EE, LLVMValueRef F, unsigned NumArgs, LLVMGenericValueRef* Args ) ;
diff --git a/llvm/engine/tags.txt b/llvm/engine/tags.txt
new file mode 100644 (file)
index 0000000..700f0dc
--- /dev/null
@@ -0,0 +1 @@
+not tested
diff --git a/llvm/invoker/invoker-tests.factor b/llvm/invoker/invoker-tests.factor
new file mode 100644 (file)
index 0000000..dca1df2
--- /dev/null
@@ -0,0 +1,7 @@
+! Copyright (C) 2009 Matthew Willis.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.llvm io.pathnames llvm.invoker llvm.reader tools.test ;
+
+{ 3 } [
+    << "resource:extra/llvm/reader/add.bc" install-bc >> 1 2 add
+] unit-test
diff --git a/llvm/invoker/invoker.factor b/llvm/invoker/invoker.factor
new file mode 100644 (file)
index 0000000..64a2ac9
--- /dev/null
@@ -0,0 +1,57 @@
+! Copyright (C) 2009 Matthew Willis.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors alien alien.data arrays assocs compiler.units
+effects io.backend io.pathnames kernel llvm.core llvm.jit
+llvm.reader llvm.types make namespaces sequences
+specialized-arrays vocabs words ;
+QUALIFIED-WITH: alien.c-types c
+SPECIALIZED-ARRAY: c:void*
+IN: llvm.invoker
+
+! get function name, ret type, param types and names
+
+! load module
+! iterate through functions in a module
+
+TUPLE: function name alien return params ;
+
+: params ( llvm-function -- param-list )
+    dup LLVMCountParams c:void* <c-array>
+    [ LLVMGetParams ] keep >array
+    [ [ LLVMGetValueName ] [ LLVMTypeOf tref> ] bi 2array ] map ;
+
+: <function> ( LLVMValueRef -- function )
+    function new
+    over LLVMGetValueName >>name
+    over LLVMTypeOf tref> type>> return>> >>return
+    swap params >>params ;
+
+: (functions) ( llvm-function -- )
+    [ dup , LLVMGetNextFunction (functions) ] when* ;
+
+: functions ( llvm-module -- functions )
+    LLVMGetFirstFunction [ (functions) ] { } make [ <function> ] map ;
+
+: function-effect ( function -- effect )
+    [ params>> keys ] [ return>> void? 0 1 ? ] bi <effect> ;
+
+: install-function ( function -- )
+    dup name>> "alien.llvm" create-vocab drop
+    "alien.llvm" create-word swap
+    [
+        dup name>> function-pointer ,
+        dup return>> c:lookup-c-type ,
+        dup params>> [ second c:lookup-c-type ] map ,
+        cdecl , \ alien-indirect ,
+    ] [ ] make swap function-effect [ define-declared ] with-compilation-unit ;
+
+: install-module ( name -- )
+    current-jit mps>> at [
+        module>> functions [ install-function ] each
+    ] [ "no such module" throw ] if* ;
+
+: install-bc ( path -- )
+    [ normalize-path ] [ file-name ] bi
+    [ load-into-jit ] keep install-module ;
+
+<< "alien.llvm" create-vocab drop >>
diff --git a/llvm/invoker/tags.txt b/llvm/invoker/tags.txt
new file mode 100644 (file)
index 0000000..700f0dc
--- /dev/null
@@ -0,0 +1 @@
+not tested
diff --git a/llvm/jit/jit-tests.factor b/llvm/jit/jit-tests.factor
new file mode 100644 (file)
index 0000000..e9d1fb0
--- /dev/null
@@ -0,0 +1,5 @@
+! Copyright (C) 2009 Matthew Willis.
+! See http://factorcode.org/license.txt for BSD license.
+USING: destructors llvm.jit llvm.wrappers tools.test ;
+
+{ } [ "test" <module> "test" add-module "test" remove-module ] unit-test
diff --git a/llvm/jit/jit.factor b/llvm/jit/jit.factor
new file mode 100644 (file)
index 0000000..eb3bebe
--- /dev/null
@@ -0,0 +1,49 @@
+! Copyright (C) 2009 Matthew Willis.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors alien.c-types alien.data alien.syntax assocs
+destructors kernel llvm.core llvm.engine llvm.wrappers
+namespaces ;
+
+IN: llvm.jit
+
+TUPLE: jit ee mps ;
+
+: empty-engine ( -- engine )
+    "initial-module" <module> <provider> <engine> ;
+
+: <jit> ( -- jit )
+    jit new empty-engine >>ee H{ } clone >>mps ;
+
+: current-jit ( -- jit )
+    \ current-jit global [ drop <jit> ] cache ;
+
+: (remove-functions) ( function -- )
+    current-jit ee>> value>> over LLVMFreeMachineCodeForFunction
+    LLVMGetNextFunction dup ALIEN: 0 = [ drop ] [ (remove-functions) ] if ;
+
+: remove-functions ( module -- )
+    ! free machine code for each function in module
+    LLVMGetFirstFunction dup ALIEN: 0 = [ drop ] [ (remove-functions) ] if ;
+
+: remove-provider ( provider -- )
+    current-jit ee>> value>> swap value>> f void* <ref> f void* <ref>
+    [ LLVMRemoveModuleProvider drop ] 2keep void* deref [ llvm-throw ] when*
+    void* deref module new swap >>value
+    [ value>> remove-functions ] with-disposal ;
+
+: remove-module ( name -- )
+    dup current-jit mps>> at [
+        remove-provider
+        current-jit mps>> delete-at
+    ] [ drop ] if* ;
+
+: add-module ( module name -- )
+    [ <provider> ] dip [ remove-module ] keep
+    current-jit ee>> value>> pick
+    [ [ value>> LLVMAddModuleProvider ] [ t >>disposed drop ] bi ] with-disposal
+    current-jit mps>> set-at ;
+
+: function-pointer ( name -- alien )
+    current-jit ee>> value>> dup
+    rot f void* <ref> [ LLVMFindFunction drop ] keep
+    void* deref LLVMGetPointerToGlobal ;
diff --git a/llvm/jit/tags.txt b/llvm/jit/tags.txt
new file mode 100644 (file)
index 0000000..700f0dc
--- /dev/null
@@ -0,0 +1 @@
+not tested
diff --git a/llvm/reader/add.bc b/llvm/reader/add.bc
new file mode 100644 (file)
index 0000000..c0ba738
Binary files /dev/null and b/llvm/reader/add.bc differ
diff --git a/llvm/reader/add.ll b/llvm/reader/add.ll
new file mode 100644 (file)
index 0000000..4ac57a2
--- /dev/null
@@ -0,0 +1,5 @@
+define i32 @add(i32 %x, i32 %y) {
+entry:
+  %sum = add i32 %x, %y
+  ret i32 %sum
+}
diff --git a/llvm/reader/reader.factor b/llvm/reader/reader.factor
new file mode 100644 (file)
index 0000000..90cf36f
--- /dev/null
@@ -0,0 +1,21 @@
+! Copyright (C) 2009 Matthew Willis.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors alien.c-types alien.data alien.syntax
+destructors kernel llvm.core llvm.engine llvm.jit llvm.wrappers
+;
+
+IN: llvm.reader
+
+: buffer>module ( buffer -- module )
+    [
+        value>> f void* <ref> f void* <ref>
+        [ LLVMParseBitcode drop ] 2keep
+        void* deref [ llvm-throw ] when* void* deref
+        module new swap >>value
+    ] with-disposal ;
+
+: load-module ( path -- module )
+    <buffer> buffer>module ;
+
+: load-into-jit ( path name -- )
+    [ load-module ] dip add-module ;
diff --git a/llvm/reader/tags.txt b/llvm/reader/tags.txt
new file mode 100644 (file)
index 0000000..700f0dc
--- /dev/null
@@ -0,0 +1 @@
+not tested
diff --git a/llvm/tags.txt b/llvm/tags.txt
new file mode 100644 (file)
index 0000000..ba3ee02
--- /dev/null
@@ -0,0 +1,2 @@
+bindings
+not tested
diff --git a/llvm/types/tags.txt b/llvm/types/tags.txt
new file mode 100644 (file)
index 0000000..700f0dc
--- /dev/null
@@ -0,0 +1 @@
+not tested
diff --git a/llvm/types/types-tests.factor b/llvm/types/types-tests.factor
new file mode 100644 (file)
index 0000000..8e57fb1
--- /dev/null
@@ -0,0 +1,40 @@
+! Copyright (C) 2009 Matthew Willis.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel llvm.types sequences tools.test ;
+
+{ T{ integer f 32 }  } [ " i32 " parse-type ] unit-test
+{ float } [ " float " parse-type ] unit-test
+{ T{ pointer f f x86_fp80 } } [ " x86_fp80 * " parse-type ] unit-test
+{ T{ vector f f 4 T{ integer f 32 } } } [ " < 4 x i32 > " parse-type ] unit-test
+{ T{ struct f f { float double } f } } [ TYPE: { float , double } ; ] unit-test
+{ T{ array f f 0 float } } [ TYPE: [ 0 x float ] ; ] unit-test
+
+{ label void metadata }
+[ [ " label " " void " " metadata " ] [ parse-type ] each ] unit-test
+
+{ T{ function f f float { float float } t } }
+[ TYPE: float ( float , float , ... ) ; ] unit-test
+
+{ T{ struct f f { float TYPE: i32 (i32)* ; } t } }
+[ TYPE: < { float, i32 (i32)* } > ; ] unit-test
+
+{ t } [ TYPE: i32 ; TYPE: i32 ; [ >tref ] same? ] unit-test
+{ t } [ TYPE: i32 * ; TYPE: i32 * ; [ >tref ] same? ] unit-test
+
+{ TYPE: i32 ; } [ TYPE: i32 ; >tref tref> ] unit-test
+{ TYPE: float ; } [ TYPE: float ; >tref tref> ] unit-test
+{ TYPE: double ; } [ TYPE: double ; >tref tref> ] unit-test
+{ TYPE: x86_fp80 ; } [ TYPE: x86_fp80 ; >tref tref> ] unit-test
+{ TYPE: fp128 ; } [ TYPE: fp128 ; >tref tref> ] unit-test
+{ TYPE: ppc_fp128 ; } [ TYPE: ppc_fp128 ; >tref tref> ] unit-test
+{ TYPE: opaque ; } [ TYPE: opaque ; >tref tref> ] unit-test
+{ TYPE: label ; } [ TYPE: label ; >tref tref> ] unit-test
+{ TYPE: void ; } [ TYPE: void ; >tref tref> ] unit-test
+{ TYPE: i32* ; } [ TYPE: i32* ; >tref tref> ] unit-test
+{ TYPE: < 2 x i32 > ; } [ TYPE: < 2 x i32 > ; >tref tref> ] unit-test
+{ TYPE: [ 0 x i32 ] ; } [ TYPE: [ 0 x i32 ] ; >tref tref> ] unit-test
+{ TYPE: { i32, i32 } ; } [ TYPE: { i32, i32 } ; >tref tref> ] unit-test
+{ TYPE: < { i32, i32 } > ; } [ TYPE: < { i32, i32 } > ; >tref tref> ] unit-test
+{ TYPE: i32 ( i32 ) ; } [ TYPE: i32 ( i32 ) ; >tref tref> ] unit-test
+{ TYPE: \1* ; } [ TYPE: \1* ; >tref tref> ] unit-test
+{ TYPE: { i32, \2* } ; } [ TYPE: { i32, \2* } ; >tref tref> ] unit-test
diff --git a/llvm/types/types.factor b/llvm/types/types.factor
new file mode 100644 (file)
index 0000000..b53f716
--- /dev/null
@@ -0,0 +1,246 @@
+! Copyright (C) 2009 Matthew Willis.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors alien.c-types alien.data arrays combinators
+kernel llvm.core locals math.parser math multiline namespaces
+parser peg.ebnf sequences sequences.deep specialized-arrays
+strings vocabs words ;
+SPECIALIZED-ARRAY: void*
+IN: llvm.types
+
+! Type resolution strategy:
+!  pass 1:
+!    create the type with uprefs mapped to opaque types
+!    cache typerefs in enclosing types for pass 2
+!    if our type is concrete, then we are done
+!
+!  pass 2:
+!    wrap our abstract type in a type handle
+!    create a second type, using the cached enclosing type info
+!    resolve the first type to the second
+!
+GENERIC: (>tref) ( type -- LLVMTypeRef )
+GENERIC: ((tref>)) ( LLVMTypeRef type -- type )
+GENERIC: c-type ( type -- str )
+
+! default implementation for simple types
+M: object ((tref>)) nip ;
+: unsupported-type ( -- )
+    "cannot generate c-type: unsupported llvm type" throw ;
+M: object c-type unsupported-type ;
+
+TUPLE: integer size ;
+C: <integer> integer
+
+M: integer (>tref) size>> LLVMIntType ;
+M: integer ((tref>)) swap LLVMGetIntTypeWidth >>size ;
+M: integer c-type size>> {
+    { 64 [ "longlong" ] }
+    { 32 [ "int" ] }
+    { 16 [ "short" ] }
+    { 8  [ "char" ] }
+    [ unsupported-type ]
+} case ;
+
+SINGLETONS: float double x86_fp80 fp128 ppc_fp128 ;
+
+M: float (>tref) drop LLVMFloatType ;
+M: double (>tref) drop LLVMDoubleType ;
+M: double c-type drop "double" ;
+M: x86_fp80 (>tref) drop LLVMX86FP80Type ;
+M: fp128 (>tref) drop LLVMFP128Type ;
+M: ppc_fp128 (>tref) drop LLVMPPCFP128Type ;
+
+SINGLETONS: opaque label void metadata ;
+
+M: opaque (>tref) drop LLVMOpaqueType ;
+M: label (>tref) drop LLVMLabelType ;
+M: void (>tref) drop LLVMVoidType ;
+M: void c-type drop "void" ;
+M: metadata (>tref) drop
+    "metadata types unsupported by llvm c bindings" throw ;
+
+! enclosing types cache their llvm refs during
+! the first pass, used in the second pass to
+! resolve uprefs
+TUPLE: enclosing cached ;
+
+GENERIC: clean ( type -- )
+GENERIC: clean* ( type -- )
+M: object clean drop ;
+M: enclosing clean f >>cached clean* ;
+
+! builds the stack of types that uprefs need to refer to
+SYMBOL: types
+:: push-type ( type quot: ( type -- LLVMTypeRef ) -- LLVMTypeRef )
+    type types get push
+    type quot call( type -- LLVMTypeRef )
+    types get pop over >>cached drop ;
+
+DEFER: <up-ref>
+:: push-ref ( ref quot: ( LLVMTypeRef -- type ) -- type )
+    ref types get index
+    [ types get length swap - <up-ref> ] [
+        ref types get push
+        ref quot call( LLVMTypeRef -- type )
+        types get pop drop
+    ] if* ;
+
+GENERIC: (>tref)* ( type -- LLVMTypeRef )
+M: enclosing (>tref) [ (>tref)* ] push-type ;
+
+DEFER: type-kind
+GENERIC: (tref>)* ( LLVMTypeRef type -- type )
+M: enclosing ((tref>)) [ (tref>)* ] curry push-ref ;
+
+: (tref>) ( LLVMTypeRef -- type ) dup type-kind ((tref>)) ;
+
+TUPLE: pointer < enclosing type ;
+: <pointer> ( t -- o ) pointer new swap >>type ;
+
+M: pointer (>tref)* type>> (>tref) 0 LLVMPointerType ;
+M: pointer clean* type>> clean ;
+M: pointer (tref>)* swap LLVMGetElementType (tref>) >>type ;
+M: pointer c-type type>> 8 <integer> = "c-string" "void*" ? ;
+
+TUPLE: vector < enclosing size type ;
+: <vector> ( s t -- o )
+    vector new
+    swap >>type swap >>size ;
+
+M: vector (>tref)* [ type>> (>tref) ] [ size>> ] bi LLVMVectorType ;
+M: vector clean* type>> clean ;
+M: vector (tref>)*
+    over LLVMGetElementType (tref>) >>type
+    swap LLVMGetVectorSize >>size ;
+
+TUPLE: struct < enclosing types packed? ;
+: <struct> ( ts p? -- o )
+    struct new
+    swap >>packed? swap >>types ;
+
+M: struct (>tref)*
+    [ types>> [ (>tref) ] map void* >c-array ]
+    [ types>> length ]
+    [ packed?>> 1 0 ? ] tri LLVMStructType ;
+M: struct clean* types>> [ clean ] each ;
+M: struct (tref>)*
+    over LLVMIsPackedStruct 0 = not >>packed?
+    swap dup LLVMCountStructElementTypes void* <c-array>
+    [ LLVMGetStructElementTypes ] keep >array
+    [ (tref>) ] map >>types ;
+
+TUPLE: array < enclosing size type ;
+: <array> ( s t -- o )
+    array new
+    swap >>type swap >>size ;
+
+M: array (>tref)* [ type>> (>tref) ] [ size>> ] bi LLVMArrayType ;
+M: array clean* type>> clean ;
+M: array (tref>)*
+    over LLVMGetElementType (tref>) >>type
+    swap LLVMGetArrayLength >>size ;
+
+SYMBOL: ...
+TUPLE: function < enclosing return params vararg? ;
+: <function> ( ret params var? -- o )
+    function new
+    swap >>vararg? swap >>params swap >>return ;
+
+M: function (>tref)* {
+    [ return>> (>tref) ]
+    [ params>> [ (>tref) ] map void* >c-array ]
+    [ params>> length ]
+    [ vararg?>> 1 0 ? ]
+} cleave LLVMFunctionType ;
+M: function clean* [ return>> clean ] [ params>> [ clean ] each ] bi ;
+M: function (tref>)*
+    over LLVMIsFunctionVarArg 0 = not >>vararg?
+    over LLVMGetReturnType (tref>) >>return
+    swap dup LLVMCountParamTypes void* <c-array>
+    [ LLVMGetParamTypes ] keep >array
+    [ (tref>) ] map >>params ;
+
+: type-kind ( LLVMTypeRef -- class )
+    LLVMGetTypeKind {
+        { LLVMVoidTypeKind [ void ] }
+        { LLVMFloatTypeKind [ float ] }
+        { LLVMDoubleTypeKind [ double ] }
+        { LLVMX86_FP80TypeKind [ x86_fp80 ] }
+        { LLVMFP128TypeKind [ fp128 ] }
+        { LLVMPPC_FP128TypeKind [ ppc_fp128 ] }
+        { LLVMLabelTypeKind [ label ] }
+        { LLVMIntegerTypeKind [ integer new ] }
+        { LLVMFunctionTypeKind [ function new ] }
+        { LLVMStructTypeKind [ struct new ] }
+        { LLVMArrayTypeKind [ array new ] }
+        { LLVMPointerTypeKind [ pointer new ] }
+        { LLVMOpaqueTypeKind [ opaque ] }
+        { LLVMVectorTypeKind [ vector new ] }
+   } case ;
+
+TUPLE: up-ref height ;
+C: <up-ref> up-ref
+
+M: up-ref (>tref)
+    types get length swap height>> - types get nth
+    cached>> [ LLVMOpaqueType ] unless* ;
+
+: resolve-types ( typeref typeref -- typeref )
+    over LLVMCreateTypeHandle [ LLVMRefineType ] dip
+    [ LLVMResolveTypeHandle ] keep LLVMDisposeTypeHandle ;
+
+: >tref-caching ( type -- LLVMTypeRef )
+    V{ } clone types [ (>tref) ] with-variable ;
+
+: >tref ( type -- LLVMTypeRef )
+    [ >tref-caching ] [ >tref-caching ] [ clean ] tri
+    2dup = [ drop ] [ resolve-types ] if ;
+
+: tref> ( LLVMTypeRef -- type )
+    V{ } clone types [ (tref>) ] with-variable ;
+
+: t. ( type -- )
+    >tref
+    "type-info" LLVMModuleCreateWithName
+    [ "t" rot LLVMAddTypeName drop ]
+    [ LLVMDumpModule ]
+    [ LLVMDisposeModule ] tri ;
+
+EBNF: parse-type
+
+WhiteSpace = " "*
+
+Zero = "0" => [[ drop 0 ]]
+LeadingDigit = [1-9]
+DecimalDigit = [0-9]
+Number = LeadingDigit:d (DecimalDigit)*:ds => [[ ds d prefix string>number ]]
+WhiteNumberSpace = WhiteSpace Number:n WhiteSpace => [[ n ]]
+WhiteZeroSpace = WhiteSpace (Zero | Number):n WhiteSpace => [[ n ]]
+
+Integer = "i" Number:n => [[ n <integer> ]]
+FloatingPoint = ( "float" | "double" | "x86_fp80" | "fp128" | "ppc_fp128" ) => [[ "llvm.types" vocab lookup-word ]]
+LabelVoidMetadata = ( "label" | "void" | "metadata" | "opaque" ) => [[ "llvm.types" vocab lookup-word ]]
+Primitive = LabelVoidMetadata | FloatingPoint
+Pointer = T:t WhiteSpace "*" => [[ t <pointer> ]]
+Vector = "<" WhiteNumberSpace:n "x" Type:t ">" => [[ n t <vector> ]]
+StructureTypesList = "," Type:t => [[ t ]]
+Structure = "{" Type:t (StructureTypesList)*:ts "}" => [[ ts t prefix >array f <struct> ]]
+Array = "[" WhiteZeroSpace:n "x" Type:t "]" => [[ n t <array> ]]
+NoFunctionParams = "(" WhiteSpace ")" => [[ drop { } ]]
+VarArgs = WhiteSpace "..." WhiteSpace => [[ drop ... ]]
+ParamListContinued = "," (Type | VarArgs):t => [[ t ]]
+ParamList = "(" Type:t (ParamListContinued*):ts ")" => [[ ts t prefix ]]
+Function = T:t WhiteSpace ( ParamList | NoFunctionParams ):ts => [[ ... ts member? dup [ ... ts remove! drop ] when t ts >array rot <function> ]]
+PackedStructure = "<" WhiteSpace "{" Type:ty (StructureTypesList)*:ts "}" WhiteSpace ">" => [[ ts ty prefix >array t <struct> ]]
+UpReference = "\\" Number:n => [[ n <up-ref> ]]
+Name = '%' ([a-zA-Z][a-zA-Z0-9]*):id => [[ id flatten >string ]]
+
+T = Pointer | Function | Primitive | Integer | Vector | Structure | PackedStructure | Array | UpReference | Name
+
+Type = WhiteSpace T:t WhiteSpace => [[ t ]]
+
+Program = Type
+
+;EBNF
+
+SYNTAX: TYPE: ";" parse-multiline-string parse-type suffix! ;
diff --git a/llvm/wrappers/tags.txt b/llvm/wrappers/tags.txt
new file mode 100644 (file)
index 0000000..700f0dc
--- /dev/null
@@ -0,0 +1 @@
+not tested
diff --git a/llvm/wrappers/wrappers-tests.factor b/llvm/wrappers/wrappers-tests.factor
new file mode 100644 (file)
index 0000000..6d74932
--- /dev/null
@@ -0,0 +1,7 @@
+! Copyright (C) 2009 Matthew Willis.
+! See http://factorcode.org/license.txt for BSD license.
+USING: destructors kernel llvm.wrappers sequences tools.test vocabs ;
+
+{ } [ "test" <module> dispose ] unit-test
+{ } [ "test" <module> <provider> dispose ] unit-test
+{ } [ "llvm.jit" vocabs member? [ "test" <module> <provider> <engine> dispose ] unless ] unit-test
diff --git a/llvm/wrappers/wrappers.factor b/llvm/wrappers/wrappers.factor
new file mode 100644 (file)
index 0000000..27c8a05
--- /dev/null
@@ -0,0 +1,62 @@
+! Copyright (C) 2009 Matthew Willis.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors alien.c-types alien.data alien.strings
+io.encodings.utf8 destructors kernel
+llvm.core llvm.engine ;
+
+IN: llvm.wrappers
+
+: llvm-throw ( c-string -- )
+    [ utf8 alien>string ] [ LLVMDisposeMessage ] bi throw ;
+
+: <dispose> ( alien class -- disposable ) new swap >>value ;
+
+TUPLE: module value disposed ;
+M: module dispose* value>> LLVMDisposeModule ;
+
+: <module> ( name -- module )
+    LLVMModuleCreateWithName module <dispose> ;
+
+TUPLE: provider value module disposed ;
+M: provider dispose* value>> LLVMDisposeModuleProvider ;
+
+: (provider) ( module -- provider )
+    [ value>> LLVMCreateModuleProviderForExistingModule provider <dispose> ]
+    [ t >>disposed value>> ] bi
+    >>module ;
+
+: <provider> ( module -- provider )
+    [ (provider) ] with-disposal ;
+
+TUPLE: engine value disposed ;
+M: engine dispose* value>> LLVMDisposeExecutionEngine ;
+
+: (engine) ( provider -- engine )
+    [
+        value>> f void* <ref> f void* <ref>
+        [ swapd 0 swap LLVMCreateJITCompiler drop ] 2keep
+        void* deref [ llvm-throw ] when* void* deref
+    ]
+    [ t >>disposed drop ] bi
+    engine <dispose> ;
+
+: <engine> ( provider -- engine )
+    [ (engine) ] with-disposal ;
+
+: (add-block) ( name -- basic-block )
+    "function" swap LLVMAppendBasicBlock ;
+
+TUPLE: builder value disposed ;
+M: builder dispose* value>> LLVMDisposeBuilder ;
+
+: <builder> ( name -- builder )
+    (add-block) LLVMCreateBuilder [ swap LLVMPositionBuilderAtEnd ] keep
+    builder <dispose> ;
+
+TUPLE: buffer value disposed ;
+M: buffer dispose* value>> LLVMDisposeMemoryBuffer ;
+
+: <buffer> ( path -- module )
+    f void* <ref> f void* <ref>
+    [ LLVMCreateMemoryBufferWithContentsOfFile drop ] 2keep
+    void* deref [ llvm-throw ] when* void* deref buffer <dispose> ;
diff --git a/math/derivatives/authors.txt b/math/derivatives/authors.txt
new file mode 100644 (file)
index 0000000..84bc84f
--- /dev/null
@@ -0,0 +1,2 @@
+Reginald Ford
+Eduardo Cavazos
diff --git a/math/derivatives/derivatives-docs.factor b/math/derivatives/derivatives-docs.factor
new file mode 100644 (file)
index 0000000..84f456a
--- /dev/null
@@ -0,0 +1,105 @@
+USING: help.markup help.syntax math math.functions ;
+IN: math.derivatives
+
+HELP: derivative
+{ $values { "x" "a position on the function" } { "function" "a differentiable function" } { "m" number } }
+{ $description
+    "Approximates the slope of the tangent line by using Ridders' "
+    "method of computing derivatives, from the chapter \"Accurate computation "
+    "of F'(x) and F'(x)F''(x)\", from \"Advances in Engineering Software, Vol. 4, pp. 75-76 ."
+}
+{ $examples
+    { $example
+        "USING: math math.derivatives prettyprint ;"
+        "4 [ sq ] derivative >integer ."
+        "8"
+    }
+    { $notes
+        "For applied scientists, you may play with the settings "
+        "in the source file to achieve arbitrary accuracy. "
+    }
+} ;
+
+HELP: (derivative)
+{ $values
+    { "x" "a position on the function" }
+    { "func" "a differentiable function" }
+    {
+        "h" "distance between the points of the first secant line used for "
+        "approximation of the tangent. This distance will be divided "
+        "constantly, by " { $link con } ". See " { $link init-hh }
+        " for the code which enforces this. H should be .001 to .5 -- too "
+        "small can cause bad convergence. Also, h should be small enough "
+        "to give the correct sgn(f'(x)). In other words, if you're expecting "
+        "a positive derivative, make h small enough to give the same "
+        "when plugged into the academic limit definition of a derivative. "
+        "See " { $link update-hh } " for the code which performs this task."
+    }
+    {
+        "err" "maximum tolerance of increase in error. For example, if this "
+        "is set to 2.0, the program will terminate with its nearest answer "
+        "when the error multiplies by 2. See " { $link check-safe } " for "
+        "the enforcing code."
+    }
+    {   "ans" number }
+    {   "error" number }
+}
+{ $description
+    "Approximates the slope of the tangent line by using Ridders' "
+    "method of computing derivatives, from the chapter \"Accurate computation "
+    "of F'(x) and F'(x)F''(x)\", from \"Advances in Engineering Software, "
+    "Vol. 4, pp. 75-76 ."
+}
+{ $examples
+    { $example
+        "USING: math math.derivatives prettyprint ;"
+        "4 [ sq ] derivative >integer ."
+        "8"
+    }
+    { $notes
+        "For applied scientists, you may play with the settings "
+        "in the source file to achieve arbitrary accuracy. "
+    }
+} ;
+
+HELP: derivative-func
+{ $values { "func" "a differentiable function" } { "der" "the derivative" } }
+{ $description
+    "Provides the derivative of the function. The implementation simply "
+    "attaches the " { $link derivative } " word to the end of the function."
+}
+{ $examples
+    { $example
+        "USING: kernel math.derivatives math.functions math.trig prettyprint ;"
+        "60 deg>rad [ sin ] derivative-func call 0.5 .001 ~ ."
+        "t"
+    }
+    { $notes
+        "Without a heavy algebraic system, derivatives must be "
+        "approximated. With the current settings, there is a fair trade of "
+        "speed and accuracy; the first 12 digits "
+        "will always be correct with " { $link sin } " and " { $link cos }
+        ". The following code performs a minumum and maximum error test."
+        { $code
+            "USING: kernel math math.functions math.trig sequences sequences.lib ;"
+            "360"
+            "["
+            "           deg>rad"
+            "            [ [ sin ] derivative-func call ]"
+            "           ! Note: the derivative of sin is cos"
+            "            [ cos ]"
+            "       bi - abs"
+            "] map minmax"
+        }
+    }
+} ;
+
+ARTICLE: "derivatives" "The Derivative Toolkit"
+"A toolkit for computing the derivative of functions."
+{ $subsections
+    derivative
+    derivative-func
+    (derivative)
+} ;
+
+ABOUT: "derivatives"
diff --git a/math/derivatives/derivatives-tests.factor b/math/derivatives/derivatives-tests.factor
new file mode 100644 (file)
index 0000000..cfbc1fa
--- /dev/null
@@ -0,0 +1,5 @@
+USING: math math.derivatives tools.test ;
+IN: math.derivatives.test
+
+[ 8 ] [ 4 [ sq ] derivative >integer ] unit-test
+
diff --git a/math/derivatives/derivatives.factor b/math/derivatives/derivatives.factor
new file mode 100644 (file)
index 0000000..95fd51c
--- /dev/null
@@ -0,0 +1,111 @@
+! Copyright (c) 2008 Reginald Keith Ford II, Eduardo Cavazos.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel continuations combinators sequences math math.order math.ranges
+    accessors float-arrays ;
+IN: math.derivatives
+
+TUPLE: state x func h err i j errt fac hh ans a done ;
+
+: largest-float ( -- x ) 0x7fefffffffffffff bits>double ; foldable
+: ntab ( -- val ) 8 ; inline
+: con ( -- val ) 1.6 ; inline
+: con2 ( -- val ) con con * ; inline
+: big ( -- val ) largest-float ; inline
+: safe ( -- val ) 2.0 ; inline
+
+! Yes, this was ported from C code.
+: a[i][i]     ( state -- elt ) [ i>>     ] [ i>>     ] [ a>> ] tri nth nth ;
+: a[j][i]     ( state -- elt ) [ i>>     ] [ j>>     ] [ a>> ] tri nth nth ;
+: a[j-1][i]   ( state -- elt ) [ i>>     ] [ j>> 1 - ] [ a>> ] tri nth nth ;
+: a[j-1][i-1] ( state -- elt ) [ i>> 1 - ] [ j>> 1 - ] [ a>> ] tri nth nth ;
+: a[i-1][i-1] ( state -- elt ) [ i>> 1 - ] [ i>> 1 - ] [ a>> ] tri nth nth ;
+
+: check-h ( state -- state )
+    dup h>> 0 = [ "h must be nonzero in dfridr" throw ] when ;
+
+: init-a     ( state -- state ) ntab [ ntab <float-array> ] replicate >>a ;
+: init-hh    ( state -- state ) dup h>> >>hh ;
+: init-err   ( state -- state ) big >>err ;
+: update-hh  ( state -- state ) dup hh>> con / >>hh ;
+: reset-fac  ( state -- state ) con2 >>fac ;
+: update-fac ( state -- state ) dup fac>> con2 * >>fac ;
+
+! If error is decreased, save the improved answer
+: error-decreased? ( state -- state ? ) [ ] [ errt>> ] [ err>> ] tri <= ;
+
+: save-improved-answer ( state -- state )
+    dup err>>   >>errt
+    dup a[j][i] >>ans ;
+
+! If higher order is worse by a significant factor SAFE, then quit early.
+: check-safe ( state -- state )
+    dup [ [ a[i][i] ] [ a[i-1][i-1] ] bi - abs ]
+    [ err>> safe * ] bi >= [ t >>done ] when ;
+
+: x+hh ( state -- val ) [ x>> ] [ hh>> ] bi + ;
+: x-hh ( state -- val ) [ x>> ] [ hh>> ] bi - ;
+
+: limit-approx ( state -- val )
+    [
+        [ [ x+hh ] [ func>> ] bi call ]
+        [ [ x-hh ] [ func>> ] bi call ] bi -
+    ] [ hh>> 2.0 * ] bi / ;
+
+: a[0][0]! ( state -- state )
+    { [ ] [ limit-approx ] [ drop 0 ] [ drop 0 ] [ a>> ] } cleave nth set-nth ;
+
+: a[0][i]! ( state -- state )
+    { [ ] [ limit-approx ] [ i>> ] [ drop 0 ] [ a>> ] } cleave nth set-nth ;
+
+: a[j-1][i]*fac ( state -- val ) [ a[j-1][i] ] [ fac>> ] bi * ;
+
+: new-a[j][i] ( state -- val )
+    [ [ a[j-1][i]*fac ] [ a[j-1][i-1] ] bi - ]
+    [ fac>> 1.0 - ] bi / ;
+
+: a[j][i]! ( state -- state )
+    { [ ] [ new-a[j][i] ] [ i>> ] [ j>> ] [ a>> ] } cleave nth set-nth ;
+
+: update-errt ( state -- state )
+    dup [ [ a[j][i] ] [ a[j-1][i] ] bi - abs ]
+    [ [ a[j][i] ] [ a[j-1][i-1] ] bi - abs ] bi max >>errt ;
+
+: not-done? ( state -- state ? ) dup done>> not ;
+
+: derive ( state -- state )
+    init-a
+    check-h
+    init-hh
+    a[0][0]!
+    init-err
+    1 ntab [a,b) [
+        >>i not-done? [
+            update-hh
+            a[0][i]!
+            reset-fac
+            1 over i>> [a,b] [
+                >>j
+                a[j][i]!
+                update-fac
+                update-errt
+                error-decreased? [ save-improved-answer ] when
+            ] each check-safe
+        ] when
+   ] each ;
+
+: derivative-state ( x func h err -- state )
+    state new
+    swap >>err
+    swap >>h
+    swap >>func
+    swap >>x ;
+
+! For scientists:
+! h should be .001 to .5 -- too small can cause bad convergence,
+! h should be small enough to give the correct sgn(f'(x))
+! err is the max tolerance of gain in error for a single iteration-
+: (derivative) ( x func h err -- ans error )
+    derivative-state derive [ ans>> ] [ errt>> ] bi ;
+
+: derivative ( x func -- m ) 0.01 2.0 (derivative) drop ;
+: derivative-func ( func -- der ) [ derivative ] curry ;
diff --git a/math/newtons-method/authors.txt b/math/newtons-method/authors.txt
new file mode 100644 (file)
index 0000000..0f10bf5
--- /dev/null
@@ -0,0 +1 @@
+Reginald Ford
diff --git a/math/newtons-method/newtons-method.factor b/math/newtons-method/newtons-method.factor
new file mode 100644 (file)
index 0000000..4b53b12
--- /dev/null
@@ -0,0 +1,18 @@
+! Copyright (c) 2008 Reginald Keith Ford II.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel math math.derivatives ;
+IN: math.newtons-method
+
+! Newton's method of approximating roots
+
+<PRIVATE
+
+: newton-step ( x function -- x2 )
+    dupd [ call ] [ derivative ] 2bi / - ; inline
+
+: newton-precision ( -- n ) 13 ; inline
+
+PRIVATE>
+
+: newtons-method ( guess function -- x )
+    newton-precision [ [ newton-step ] keep ] times drop ;
diff --git a/models/combinators/authors.txt b/models/combinators/authors.txt
new file mode 100644 (file)
index 0000000..2300f69
--- /dev/null
@@ -0,0 +1 @@
+Sam Anklesaria
diff --git a/models/combinators/combinators-docs.factor b/models/combinators/combinators-docs.factor
new file mode 100644 (file)
index 0000000..a7e3e8c
--- /dev/null
@@ -0,0 +1,41 @@
+USING: help.markup help.syntax models models.arrow sequences monads ;
+IN: models.combinators
+
+HELP: merge
+{ $values { "models" "a list of models" } { "model" basic-model } }
+{ $description "Creates a model that merges the updates of others" } ;
+
+HELP: filter-model
+{ $values { "model" model } { "quot" "quotation with stack effect ( a b -- c )" } { "filter-model" filter-model } }
+{ $description "Creates a model that uses the updates of another model only when they satisfy a given predicate" } ;
+
+HELP: fold
+{ $values { "model" model } { "oldval" "starting value" } { "quot" "applied to update and previous values" } { "model" model } }
+{ $description "Similar to " { $link reduce } " but works on models, applying a quotation to the previous and new values at each update" } ;
+
+HELP: switch-models
+{ $values { "model1" model } { "model2" model } { "model'" model } }
+{ $description "Creates a model that starts with the behavior of model2 and switches to the behavior of model1 on its update" } ;
+
+HELP: <mapped>
+{ $values { "model" model } { "quot" "applied to model's value on updates" } { "model" model } }
+{ $description "An expanded version of " { $link <arrow> } ". Use " { $link fmap } " instead." } ;
+
+HELP: when-model
+{ $values { "model" model } { "quot" "called on the model if the quot yields true" } { "cond" "a quotation called on the model's value, yielding a boolean value"  } }
+{ $description "Calls quot when model updates if its value meets the condition set in cond" } ;
+
+HELP: with-self
+{ $values { "quot" "quotation that recieves its own return value" } { "model" model } }
+{ $description "Fixed points for models: the quot reacts to the same model to gives" } ;
+
+HELP: #1
+{ $values { "model" model } { "model'" model } }
+{ $description "Moves a model to the top of its dependencies' connections, thus being notified before the others" } ;
+
+ARTICLE: "models.combinators" "Extending models"
+"The " { $vocab-link "models.combinators" } " library expands models to have discrete start and end times. "
+"Also, it provides methods of manipulating and combining models, expecially useful when programming user interfaces: "
+"The output models of some gadgets (see " { $vocab-link "ui.gadgets.controls" } " ) can be manipulated and used as the input models of others." ;
+
+ABOUT: "models.combinators"
diff --git a/models/combinators/combinators.factor b/models/combinators/combinators.factor
new file mode 100644 (file)
index 0000000..11e94ed
--- /dev/null
@@ -0,0 +1,105 @@
+USING: accessors arrays kernel models models.product monads
+sequences sequences.extras shuffle ;
+FROM: syntax => >> ;
+IN: models.combinators
+
+TUPLE: multi-model < model important? ;
+GENERIC: (model-changed) ( model observer -- )
+: <multi-model> ( models kind -- model ) f swap new-model [ [ add-dependency ] curry each ] keep ;
+M: multi-model model-changed over value>> [ (model-changed) ] [ 2drop ] if ;
+M: multi-model model-activated dup dependencies>> [ value>> ] find nip
+   [ swap model-changed ] [ drop ] if* ;
+
+: #1 ( model -- model' ) t >>important? ;
+
+IN: models
+: notify-connections ( model -- )
+    dup connections>> dup [ dup multi-model? [ important?>> ] [ drop f ] if ] find-all
+    [ second tuck [ remove ] dip prefix ] each
+    [ model-changed ] with each ;
+IN: models.combinators
+
+TUPLE: basic-model < multi-model ;
+M: basic-model (model-changed) [ value>> ] dip set-model ;
+: merge ( models -- model ) basic-model <multi-model> ;
+: 2merge ( model1 model2 -- model ) 2array merge ;
+: <basic> ( value -- model ) basic-model new-model ;
+
+TUPLE: filter-model < multi-model quot ;
+M: filter-model (model-changed) [ value>> ] dip 2dup quot>> call( a -- ? )
+   [ set-model ] [ 2drop ] if ;
+: filter-model ( model quot -- filter-model ) [ 1array \ filter-model <multi-model> ] dip >>quot ;
+
+TUPLE: fold-model < multi-model quot base values ;
+M: fold-model (model-changed) 2dup base>> =
+    [ [ [ value>> ] [ [ values>> ] [ quot>> ] bi ] bi* swapd reduce* ] keep set-model ]
+    [ [ [ value>> ] [ values>> ] bi* push ]
+      [ [ [ value>> ] [ [ value>> ] [ quot>> ] bi ] bi* call( val oldval -- newval ) ] keep set-model ] 2bi
+    ] if ;
+M: fold-model model-activated drop ;
+: new-fold-model ( deps -- model ) fold-model <multi-model> V{ } clone >>values ;
+: fold ( model oldval quot -- model ) rot 1array new-fold-model swap >>quot
+   swap >>value ;
+: fold* ( model oldmodel quot -- model ) over [ [ 2array new-fold-model ] dip >>quot ]
+    dip [ >>base ] [ value>> >>value ] bi ;
+
+TUPLE: updater-model < multi-model values updates ;
+M: updater-model (model-changed) [ tuck updates>> =
+   [ [ values>> value>> ] keep set-model ]
+   [ drop ] if ] keep f swap value<< ;
+: updates ( values updates -- model ) [ 2array updater-model <multi-model> ] 2keep
+   [ >>values ] [ >>updates ] bi* ;
+
+SYMBOL: switch
+TUPLE: switch-model < multi-model original switcher on ;
+M: switch-model (model-changed) 2dup switcher>> =
+   [ [ value>> ] dip over switch = [ nip [ original>> ] keep f >>on model-changed ] [ t >>on set-model ] if ]
+   [ dup on>> [ 2drop ] [ [ value>> ] dip over [ set-model ] [ 2drop ] if ] if ] if ;
+: switch-models ( model1 model2 -- model' ) swap [ 2array switch-model <multi-model> ] 2keep
+   [ [ value>> >>value ] [ >>original ] bi ] [ >>switcher ] bi* ;
+M: switch-model model-activated [ original>> ] keep model-changed ;
+: >behavior ( event -- behavior ) t >>value ;
+
+TUPLE: mapped-model < multi-model model quot ;
+: new-mapped-model ( model quot class -- mapped-model ) [ over 1array ] dip
+   <multi-model> swap >>quot swap >>model ;
+: <mapped> ( model quot -- model ) mapped-model new-mapped-model ;
+M: mapped-model (model-changed)
+    [ [ value>> ] [ quot>> ] bi* call( old -- new ) ] [ nip ] 2bi
+    set-model ;
+
+TUPLE: side-effect-model < mapped-model ;
+M: side-effect-model (model-changed) [ value>> ] dip [ quot>> call( old -- ) ] 2keep set-model ;
+
+TUPLE: quot-model < mapped-model ;
+M: quot-model (model-changed) nip [ quot>> call( -- b ) ] keep set-model ;
+
+TUPLE: action-value < basic-model parent ;
+: <action-value> ( parent value -- model ) action-value new-model swap >>parent ;
+M: action-value model-activated dup parent>> dup activate-model model-changed ; ! a fake dependency of sorts
+
+TUPLE: action < multi-model quot ;
+M: action (model-changed) [ [ value>> ] [ quot>> ] bi* call( a -- b ) ] keep value>>
+   [ swap add-connection ] 2keep model-changed ;
+: <action> ( model quot -- action-model ) [ 1array action <multi-model> ] dip >>quot dup f <action-value> >>value value>> ;
+
+TUPLE: collection < multi-model ;
+: <collection> ( models -- product ) collection <multi-model> ;
+M: collection (model-changed)
+    nip
+    dup dependencies>> [ value>> ] all?
+    [ dup [ value>> ] product-value swap set-model ]
+    [ drop ] if ;
+M: collection model-activated dup (model-changed) ;
+
+! for side effects
+TUPLE: (when-model) < multi-model quot cond ;
+: when-model ( model quot cond -- model ) rot 1array (when-model) <multi-model> swap >>cond swap >>quot ;
+M: (when-model) (model-changed) [ quot>> ] 2keep
+    [ value>> ] [ cond>> ] bi* call( a -- ? ) [ call( model -- ) ] [ 2drop ] if ;
+
+! only used in construction
+: with-self ( quot: ( model -- model ) -- model ) [ f <basic> dup ] dip call swap [ add-dependency ] keep ; inline
+
+USE: models.combinators.templates
+<< { "$>" "<$" "fmap" } [ fmaps ] each >>
diff --git a/models/combinators/summary.txt b/models/combinators/summary.txt
new file mode 100644 (file)
index 0000000..1e5347e
--- /dev/null
@@ -0,0 +1 @@
+Model combination and manipulation
\ No newline at end of file
diff --git a/models/combinators/templates/templates.factor b/models/combinators/templates/templates.factor
new file mode 100644 (file)
index 0000000..d174efc
--- /dev/null
@@ -0,0 +1,23 @@
+USING: kernel sequences functors fry macros generalizations ;
+IN: models.combinators.templates
+FROM: models.combinators => <collection> #1 ;
+FUNCTOR: fmaps ( W -- )
+W        IS ${W}
+w-n      DEFINES ${W}-n
+w-2      DEFINES 2${W}
+w-3      DEFINES 3${W}
+w-4      DEFINES 4${W}
+w-n*     DEFINES ${W}-n*
+w-2*     DEFINES 2${W}*
+w-3*     DEFINES 3${W}*
+w-4*     DEFINES 4${W}*
+WHERE
+MACRO: w-n ( int -- quot ) dup '[ [ _ narray <collection> ] dip [ _ firstn ] prepend W ] ;
+: w-2 ( a b quot -- mapped ) 2 w-n ; inline
+: w-3 ( a b c quot -- mapped ) 3 w-n ; inline
+: w-4 ( a b c d quot -- mapped ) 4 w-n ; inline
+MACRO: w-n* ( int -- quot ) dup '[ [ _ narray <collection> #1 ] dip [ _ firstn ] prepend W ] ;
+: w-2* ( a b quot -- mapped ) 2 w-n* ; inline
+: w-3* ( a b c quot -- mapped ) 3 w-n* ; inline
+: w-4* ( a b c d quot -- mapped ) 4 w-n* ; inline
+;FUNCTOR
diff --git a/modules/rpc-server/authors.txt b/modules/rpc-server/authors.txt
new file mode 100644 (file)
index 0000000..2300f69
--- /dev/null
@@ -0,0 +1 @@
+Sam Anklesaria
diff --git a/modules/rpc-server/rpc-server-docs.factor b/modules/rpc-server/rpc-server-docs.factor
new file mode 100644 (file)
index 0000000..32af855
--- /dev/null
@@ -0,0 +1,5 @@
+USING: help.syntax help.markup modules.rpc-server modules.using ;
+IN: modules.rpc-server
+HELP: service
+{ $syntax "IN: my-vocab service" }
+{ $description "Allows words defined in the vocabulary to be used as remote procedure calls by " { $link POSTPONE: USING*: } } ;
diff --git a/modules/rpc-server/rpc-server.factor b/modules/rpc-server/rpc-server.factor
new file mode 100644 (file)
index 0000000..d82f13f
--- /dev/null
@@ -0,0 +1,31 @@
+! Copyright (C) 2009 Sam Anklesaria.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors assocs combinators continuations effects
+io.encodings.binary io.servers.connection kernel namespaces
+sequences serialize sets threads vocabs vocabs.parser init io ;
+IN: modules.rpc-server
+
+<PRIVATE
+TUPLE: rpc-request args vocabspec wordname ;
+SYMBOL: serving-vocabs serving-vocabs [ V{ } clone ] initialize
+
+: getter ( -- ) deserialize dup serving-vocabs get-global index
+        [ vocab-words [ stack-effect ] { } assoc-map-as ]
+        [ \ no-vocab boa ] if serialize flush ;
+
+: doer ( -- ) deserialize dup vocabspec>> serving-vocabs get-global index
+        [ [ args>> ] [ wordname>> ] [ vocabspec>> vocab-words ] tri at [ execute ] curry with-datastack ]
+        [ vocabspec>> \ no-vocab boa ] if serialize flush ;
+
+PRIVATE>
+SYNTAX: service current-vocab name>> serving-vocabs get-global adjoin ;
+
+: start-rpc-server ( -- )
+    binary <threaded-server>
+    "rpcs" >>name 9012 >>insecure
+    [ deserialize {
+      { "getter" [ getter ] }
+      {  "doer" [ doer ] }
+      { "loader" [ deserialize vocab serialize flush ] } 
+    } case ] >>handler
+    start-server ;
diff --git a/modules/rpc-server/summary.txt b/modules/rpc-server/summary.txt
new file mode 100644 (file)
index 0000000..3688644
--- /dev/null
@@ -0,0 +1 @@
+Serve factor words as rpcs
\ No newline at end of file
diff --git a/modules/rpc/authors.txt b/modules/rpc/authors.txt
new file mode 100644 (file)
index 0000000..2300f69
--- /dev/null
@@ -0,0 +1 @@
+Sam Anklesaria
diff --git a/modules/rpc/rpc-docs.factor b/modules/rpc/rpc-docs.factor
new file mode 100644 (file)
index 0000000..5a0a8e9
--- /dev/null
@@ -0,0 +1,9 @@
+USING: help.syntax help.markup ;
+IN: modules.rpc
+ARTICLE: { "modules" "protocol" } "RPC Protocol"
+{ $list
+   "Send vocab as string"
+   "Send arglist"
+   "Send word as string"
+   "Receive result list"
+} ;
diff --git a/modules/rpc/rpc.factor b/modules/rpc/rpc.factor
new file mode 100644 (file)
index 0000000..85f9b8a
--- /dev/null
@@ -0,0 +1,27 @@
+! Copyright (C) 2009 Sam Anklesaria.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors assocs fry generalizations io.encodings.binary
+io.sockets kernel locals namespaces parser sequences serialize
+vocabs vocabs.parser words io ;
+IN: modules.rpc
+
+TUPLE: rpc-request args vocabspec wordname ;
+
+: send-with-check ( message -- reply/* )
+    serialize flush deserialize dup no-vocab? [ throw ] when ;
+
+:: define-remote ( str effect addrspec vocabspec -- )
+    str create-word-in effect [ in>> length ] [ out>> length ] bi
+    '[ _ narray vocabspec str rpc-request boa addrspec 9012 <inet> binary
+    [ "doer" serialize send-with-check ] with-client _ firstn ]
+    effect define-declared ;
+
+:: remote-vocab ( addrspec vocabspec -- vocab )
+   vocabspec "-remote" append dup vocab [ dup set-current-vocab
+     vocabspec addrspec 9012 <inet> binary [ "getter" serialize send-with-check ] with-client
+     [ first2 addrspec vocabspec define-remote ] each
+   ] unless ;
+
+: remote-load ( addr vocabspec -- voabspec ) [ swap
+    9012 <inet> binary [ "loader" serialize serialize flush deserialize ] with-client ] keep
+    [ dictionary get-global set-at ] keep ;
diff --git a/modules/rpc/summary.txt b/modules/rpc/summary.txt
new file mode 100644 (file)
index 0000000..cc1501f
--- /dev/null
@@ -0,0 +1 @@
+remote procedure call client
\ No newline at end of file
diff --git a/modules/using/authors.txt b/modules/using/authors.txt
new file mode 100644 (file)
index 0000000..2300f69
--- /dev/null
@@ -0,0 +1 @@
+Sam Anklesaria
diff --git a/modules/using/summary.txt b/modules/using/summary.txt
new file mode 100644 (file)
index 0000000..62fdb05
--- /dev/null
@@ -0,0 +1 @@
+Improved module import syntax with network transparency
\ No newline at end of file
diff --git a/modules/using/using-docs.factor b/modules/using/using-docs.factor
new file mode 100644 (file)
index 0000000..3f8649b
--- /dev/null
@@ -0,0 +1,11 @@
+USING: help.syntax help.markup strings modules.using ;
+IN: modules.using
+ARTICLE: { "modules.using" "use" } "Using the modules.using vocab"
+"This vocabulary defines " { $link POSTPONE: USING*: } " as an alternative to " { $link POSTPONE: USING: } " which makes qualified imports easier. "
+"Secondly, it allows loading vocabularies from remote servers, as long as the remote vocabulary can be accessed at compile time. "
+"Finally, the word can treat words in remote vocabularies as remote procedure calls. Any inputs are passed to the imported words as normal, and the result will appear on the stack- the only difference is that the word isn't called locally." ;
+ABOUT: { "modules.using" "use" }
+
+HELP: USING*:
+{ $syntax "USING: rpc-server::module fetch-sever:module { module qualified-name } { module => word ... } { qualified-module } { module EXCEPT word ... } { module word => importname } ;" }
+{ $description "Adds vocabularies to the search path. Vocabularies can be loaded off a server or called as an rpc if preceded by a valid hostname. Bracketed pairs facilitate all types of qualified imports on both remote and local modules." } ;
diff --git a/modules/using/using.factor b/modules/using/using.factor
new file mode 100644 (file)
index 0000000..acf3471
--- /dev/null
@@ -0,0 +1,28 @@
+! Copyright (C) 2009 Sam Anklesaria.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel modules.rpc peg peg-lexer peg.ebnf sequences
+strings vocabs.parser ;
+IN: modules.using
+
+EBNF: modulize
+tokenpart = (!(':').)+ => [[ >string ]]
+s = ':' => [[ drop ignore ]]
+rpc = tokenpart s s tokenpart => [[ first2 remote-vocab ]]
+remote = tokenpart s tokenpart => [[ first2 remote-load ]]
+module = rpc | remote | tokenpart
+;EBNF
+
+ON-BNF: USING*:
+tokenizer = <foreign factor>
+sym = !(";"|"}"|"=>"|"EXCEPT").
+modspec = sym => [[ modulize ]]
+qualified-with = modspec sym => [[ first2 add-qualified ignore ]]
+qualified = modspec => [[ dup add-qualified ignore ]]
+from = modspec "=>" sym+ => [[ first3 nip add-words-from ignore ]]
+exclude = modspec "EXCEPT" sym+ => [[ first3 nip add-words-excluding ignore ]]
+rename = modspec sym "=>" sym => [[ first4 nip swapd add-renamed-word ignore ]]
+long = "{" ( from | exclude | rename | qualified-with | qualified ) "}" => [[ drop ignore ]]
+short = modspec => [[ use-vocab ignore ]]
+wordSpec = long | short
+using = wordSpec+ ";" => [[ drop ignore ]]
+;ON-BNF
diff --git a/mongodb/gridfs/gridfs/gridfs.factor b/mongodb/gridfs/gridfs/gridfs.factor
new file mode 100644 (file)
index 0000000..57362c9
--- /dev/null
@@ -0,0 +1,285 @@
+USING: accessors arrays assocs base64 bson.constants
+byte-arrays byte-vectors calendar combinators
+combinators.short-circuit destructors formatting fry hashtables
+io kernel linked-assocs locals math math.parser mongodb.cmd
+mongodb.connection mongodb.driver mongodb.msg namespaces
+sequences splitting strings ;
+FROM: mongodb.driver => update ;
+IN: mongodb.gridfs
+
+CONSTANT: default-chunk-size 262144
+
+TUPLE: gridfs 
+    { bucket string } 
+    { files string }
+    { chunks string } ;
+
+
+<PRIVATE
+
+: gridfs> ( -- gridfs )
+    gridfs get ; inline
+
+: files-collection ( -- str ) gridfs> files>> ; inline
+: chunks-collection ( -- str ) gridfs> chunks>> ; inline
+
+
+: init-gridfs ( gridfs -- )
+    chunks>> "ChunkIdx" H{ { "files_id" 1 } { "n" 1 } } 
+    <index-spec> ensure-index ; inline
+
+PRIVATE>
+
+: <gridfs> ( bucket -- gridfs )
+    [  ] 
+    [ "files" "%s.%s" sprintf  ] 
+    [ "chunks" "%s.%s" sprintf ] tri
+    gridfs boa [ init-gridfs ] keep ;
+
+: with-gridfs ( gridfs quot -- * )
+    [ gridfs ] dip with-variable ; inline
+
+TUPLE: entry 
+    { id oid }
+    { filename string }
+    { content-type string }
+    { length integer }
+    { chunk-size integer }
+    { created timestamp }
+    { aliases array }
+    { metadata hashtable }
+    { md5 string } ;
+
+<PRIVATE
+
+: id>base64 ( id -- str )
+    [ a>> >hex ] [ b>> >hex ] bi 
+    2array "#" join >base64 >string ; inline
+
+: base64>id ( str -- objid )
+    base64> >string "#" split 
+    [ first ] [ second ] bi 
+    [ hex> ] bi@ oid boa ; inline
+    
+PRIVATE>
+
+: <entry> ( name content-type -- entry )
+    entry new 
+    swap >>content-type swap >>filename 
+    <oid> >>id 0 >>length default-chunk-size >>chunk-size 
+    now >>created ; inline
+
+<PRIVATE 
+
+TUPLE: chunk 
+    { id oid }
+    { fileid oid }
+    { n integer }
+    { data byte-array } ;
+
+: at> ( assoc key -- value/f )
+    swap at ; inline
+
+:: >set-at ( assoc value key -- )
+    value key assoc set-at ; inline
+
+: (update-file) ( entry assoc -- entry )
+    { 
+        [ "_id" at> >>id ]
+        [ "filename" at> >>filename ]
+        [ "contentType" at> >>content-type ]
+        [ "length" at> >>length ]
+        [ "chunkSize" at> >>chunk-size ]
+        [ "uploadDate" at> >>created ]
+        [ "aliases" at> >>aliases ]
+        [ "metadata" at> >>metadata ]
+        [ "md5" at> >>md5 ]
+    } cleave ; inline
+
+: assoc>chunk ( assoc -- chunk )
+    [ chunk new ] dip
+    {  
+        [ "_id" at> >>id ]
+        [ "files_id" at> >>fileid ]
+        [ "n" at> >>n ]
+        [ "data" at> >>data ]
+    } cleave ;
+
+: assoc>entry ( assoc -- entry )
+    [ entry new ] dip (update-file) ;
+    
+: entry>assoc ( entry -- assoc )
+    [ H{  } clone ] dip
+    {
+        [ id>> "_id" >set-at ]
+        [ filename>> "filename" >set-at ]
+        [ content-type>> "contentType" >set-at ]
+        [ length>> "length" >set-at ]
+        [ chunk-size>> "chunkSize" >set-at ]
+        [ created>> "uploadDate" >set-at ]
+        [ aliases>> "aliases" >set-at ]
+        [ metadata>> "metadata" >set-at ]
+        [ md5>> "md5" >set-at ]
+        [ drop ]
+    } 2cleave ; inline
+
+: create-entry ( entry -- entry )
+    [ [ files-collection ] dip entry>assoc save ] [ ] bi ;
+
+TUPLE: state bytes count ;
+
+: <state> ( -- state )
+    0 0 state boa ; inline
+
+: get-state ( -- n )
+    state get ; inline
+
+: with-state ( quot -- state )
+    [ <state> state ] dip 
+    [ get-state ] compose 
+    with-variable ; inline
+
+: update-state ( bytes -- )
+    [ get-state ] dip
+    '[ _ + ] change-bytes 
+    [ 1 + ] change-count drop ; inline
+
+:: store-chunk ( chunk entry n -- ) 
+    entry id>> :> id
+    H{ { "files_id" id }
+       { "n" n } { "data" chunk } }
+    [ chunks-collection ] dip save ; inline
+
+:: write-chunks ( stream entry -- length )
+    entry chunk-size>> :> chunk-size
+    [
+        [ 
+            chunk-size stream stream-read dup [
+                [ entry get-state count>> store-chunk ]
+                [ length update-state ] bi 
+            ] when*
+        ] loop
+    ] with-state bytes>> ;
+
+: (entry-selector) ( entry -- selector )
+    id>> "_id" associate ; inline
+
+:: file-md5 ( id -- md5-str )
+    filemd5-cmd make-cmd
+    id "filemd5" set-cmd-opt
+    gridfs> bucket>> "root" set-cmd-opt
+    send-cmd "md5" at> ; inline
+
+: update-entry ( bytes entry -- entry )
+    [ swap >>length dup id>> file-md5 >>md5  ]
+    [ nip [ (entry-selector) ] [  ] bi
+        [ length>> "length" associate "$set" associate 
+          [ files-collection ] 2dip <update> update ]
+        [ md5>> "md5" associate "$set" associate 
+          [ files-collection ] 2dip <update> update ] 2bi 
+    ] 2bi ;
+
+TUPLE: gridfs-input-stream entry chunk n offset cpos ;
+
+: <gridfs-input-stream> ( entry -- stream )
+    [ gridfs-input-stream new ] dip
+    >>entry 0 >>offset 0 >>cpos -1 >>n ;
+
+PRIVATE>
+
+: write-entry ( input-stream entry -- entry )
+    create-entry [ write-chunks ] keep update-entry  ;
+
+: get-entry ( id -- entry )
+    [ files-collection ] dip
+    "_id" associate <query> find-one assoc>entry ;
+
+: open-entry ( entry -- input-stream )
+    <gridfs-input-stream> ;
+
+: entry-contents ( entry -- bytearray )
+    <gridfs-input-stream> stream-contents ;
+
+<PRIVATE
+
+: load-chunk ( stream -- chunk/f )
+    [ entry>> id>> "files_id" associate ]
+    [ n>> "n" associate ] bi assoc-union
+    [ chunks-collection ] dip 
+    <query> find-one dup [ assoc>chunk ] when ;
+
+: exhausted? ( stream -- boolean )
+    [ offset>> ] [ entry>> length>> ] bi = ; inline
+
+: fresh? ( stream -- boolean )
+    [ offset>> 0 = ] [ chunk>> f = ] bi and ; inline
+
+: data-available ( stream -- int/f )
+    [ cpos>> ] [ chunk>> data>> length ] bi 
+    2dup < [ swap - ] [ 2drop f ] if ; inline
+
+: next-chunk ( stream -- available chunk/f )
+    0 >>cpos [ 1 + ] change-n
+    [  ] [ load-chunk ] bi >>chunk
+    [ data-available ] [ chunk>> ] bi ; inline
+
+: ?chunk ( stream -- available chunk/f )
+    dup fresh? [ next-chunk ] [ 
+        dup exhausted? [ drop 0 f ] [  
+            dup data-available [ swap chunk>> ] [ next-chunk ] if*
+        ] if
+    ] if ; inline
+
+: set-stream ( n stream -- )
+    swap { 
+        [ >>offset drop ]
+        [ over entry>> chunk-size>> /mod [ >>n ] [ >>cpos ] bi* drop ]
+        [ drop dup load-chunk >>chunk drop ]
+    } 2cleave ; inline
+
+:: advance-stream ( n stream -- )
+    stream [ n + ] change-cpos [ n + ] change-offset drop ; inline
+
+: read-part ( n stream chunk -- seq/f )
+    [ [ cpos>> swap [ drop ] [ + ] 2bi ] [ data>> ] bi* <slice> ]
+    [ drop advance-stream ] 3bi ; inline
+
+:: (stream-read-partial) ( n stream -- seq/f )
+    stream ?chunk :> chunk :> available
+    chunk [
+        n available < 
+        [ n ] [ available ] if 
+        stream chunk read-part 
+    ] [ f ] if ; inline
+
+:: (stream-read) ( n stream acc -- )
+    n stream (stream-read-partial)
+    {
+        { [ dup not ] [ drop ] }
+        { [ dup length n = ] [ acc push-all ] }
+        { [ dup length n < ] [
+            [ acc push-all ] [ length ] bi
+            n swap - stream acc (stream-read) ]
+        }
+    } cond ; inline recursive 
+
+PRIVATE>
+
+M: gridfs-input-stream stream-element-type drop +byte+ ;
+
+M: gridfs-input-stream stream-read ( n stream -- seq/f )
+    over <byte-vector> [ (stream-read) ] [ ] bi
+    [ f ] [ >byte-array ] if-empty ;
+
+M: gridfs-input-stream stream-read-partial ( n stream -- seq/f )
+    (stream-read-partial) ;
+
+M: gridfs-input-stream stream-tell ( stream -- n ) 
+    offset>> ;
+
+M: gridfs-input-stream stream-seek ( n seek-type stream -- )
+    swap seek-absolute = 
+    [ set-stream ] 
+    [ "seek-type not supported" throw ] if ;
+
+M: gridfs-input-stream dispose drop ;
diff --git a/mongodb/gridfs/gridfs/unmaintained-reason.txt b/mongodb/gridfs/gridfs/unmaintained-reason.txt
new file mode 100644 (file)
index 0000000..6503cc3
--- /dev/null
@@ -0,0 +1,6 @@
+Moved to unmaintained by Joe Groff October 13, 2011
+
+The input stream protocol was changed; streams should now provide methods for
+stream-read-unsafe and stream-read-partial-unsafe, which read into a caller-
+provided buffer. This module has no tests so I didn't want to break it in the
+process of updating it.
diff --git a/multi-method-syntax/multi-method-syntax.factor b/multi-method-syntax/multi-method-syntax.factor
new file mode 100644 (file)
index 0000000..4a5cc7c
--- /dev/null
@@ -0,0 +1,23 @@
+
+USING: accessors effects.parser kernel lexer multi-methods
+       parser sequences words ;
+
+IN: multi-method-syntax
+
+! A nicer specializer syntax to hold us over till multi-methods go in
+! officially.
+!
+! Use both 'multi-methods' and 'multi-method-syntax' in that order.
+
+: scan-specializer ( -- specializer )
+
+  scan drop ! eat opening parenthesis
+
+  ")" parse-effect in>> [ search ] map ;
+
+: CREATE-METHOD ( -- method )
+  scan-word scan-specializer swap create-method-in ;
+
+: (METHOD:) ( -- method def ) CREATE-METHOD parse-definition ;
+
+: METHOD: (METHOD:) define ; parsing
diff --git a/ogg/player/authors.txt b/ogg/player/authors.txt
new file mode 100644 (file)
index 0000000..44b06f9
--- /dev/null
@@ -0,0 +1 @@
+Chris Double
diff --git a/ogg/player/player.factor b/ogg/player/player.factor
new file mode 100644 (file)
index 0000000..30ee010
--- /dev/null
@@ -0,0 +1,631 @@
+! Copyright (C) 2007 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+!
+! TODO:
+!   based on number of channels in file.
+! - End of decoding is indicated by an exception when reading the stream.
+!   How to work around this? C player example uses feof but streams don't
+!   have that in Factor.
+! - Work out openal buffer method that plays nicely with streaming over
+!   slow connections.
+! - Have start/stop/seek methods on the player object.
+!
+USING: kernel alien ogg ogg.vorbis ogg.theora io byte-arrays
+       sequences libc shuffle alien.c-types system openal math
+       namespaces threads shuffle opengl arrays ui.gadgets.worlds
+       combinators math.parser ui.gadgets ui.render opengl.gl ui
+       continuations io.files hints combinators.lib sequences.lib
+       io.encodings.binary debugger math.order accessors ;
+
+IN: ogg.player
+
+: audio-buffer-size ( -- number ) 128 1024 * ; inline
+
+TUPLE: player stream temp-state
+       op oy og
+       vo vi vd vb vc vorbis
+       to ti tc td yuv rgb theora video-ready? video-time video-granulepos
+       source buffers buffer-indexes start-time
+       playing? audio-full? audio-index audio-buffer audio-granulepos
+       gadget ;
+
+: init-vorbis ( player -- )
+    dup oy>> ogg_sync_init drop
+    dup vi>> vorbis_info_init
+    vc>> vorbis_comment_init ;
+
+: init-theora ( player -- )
+    dup ti>> theora_info_init
+    tc>> theora_comment_init ;
+
+: init-sound ( player -- )
+    init-openal check-error
+    1 gen-buffers check-error >>buffers
+    2 uint <c-array> >>buffer-indexes
+    1 gen-sources check-error first >>source drop ;
+
+: <player> ( stream -- player )
+    player new
+        swap >>stream
+        0 >>vorbis
+        0 >>theora
+        0 >>video-time
+        0 >>video-granulepos
+        f >>video-ready?
+        f >>audio-full?
+        0 >>audio-index
+        0 >>start-time
+        audio-buffer-size "short" <c-array> >>audio-buffer
+        0 >>audio-granulepos
+        f >>playing?
+        ogg_packet malloc-struct >>op
+        ogg_sync_state malloc-struct >>oy
+        ogg_page malloc-struct >>og
+        ogg_stream_state malloc-struct >>vo
+        vorbis_info malloc-struct >>vi
+        vorbis_dsp_state malloc-struct >>vd
+        vorbis_block malloc-struct >>vb
+        vorbis_comment malloc-struct >>vc
+        ogg_stream_state malloc-struct >>to
+        theora_info malloc-struct >>ti
+        theora_comment malloc-struct >>tc
+        theora_state malloc-struct >>td
+        yuv_buffer <struct> >>yuv
+        ogg_stream_state <struct> >>temp-state
+        dup init-sound
+        dup init-vorbis
+        dup init-theora ;
+
+: num-channels ( player -- channels )
+    vi>> vorbis_info-channels ;
+
+: al-channel-format ( player -- format )
+    num-channels 1 = AL_FORMAT_MONO16 AL_FORMAT_STEREO16 ? ;
+
+: get-time ( player -- time )
+    dup start-time>> zero? [
+        millis >>start-time
+    ] when
+    start-time>> millis swap - 1000.0 /f ;
+
+: clamp ( n -- n )
+    255 min 0 max ; inline
+
+: stride ( line yuv  -- uvy yy )
+    [ uv_stride>> >fixnum swap 2/ * ] 2keep
+    y_stride>> >fixnum * >fixnum ; inline
+
+: each-with4 ( obj obj obj obj seq quot -- )
+    4 each-withn ; inline
+
+: compute-y ( yuv uvy yy x -- y )
+    + >fixnum nip swap y>> uchar-nth 16 - ; inline
+
+: compute-v ( yuv uvy yy x -- v )
+    nip 2/ + >fixnum swap u>> uchar-nth 128 - ; inline
+
+: compute-u ( yuv uvy yy x -- v )
+    nip 2/ + >fixnum swap v>> uchar-nth 128 - ; inline
+
+: compute-yuv ( yuv uvy yy x -- y u v )
+    [ compute-y ] 4keep [ compute-u ] 4keep compute-v ; inline
+
+: compute-blue ( y u v -- b )
+    drop 516 * 128 + swap 298 * + -8 shift clamp ; inline
+
+: compute-green ( y u v -- g )
+    >r >r 298 * r> 100 * - r> 208 * - 128 + -8 shift clamp ;
+    inline
+
+: compute-red ( y u v -- g )
+    nip 409 * swap 298 * + 128 + -8 shift clamp ; inline
+
+: compute-rgb ( y u v -- b g r )
+    [ compute-blue ] 3keep [ compute-green ] 3keep compute-red ;
+    inline
+
+: store-rgb ( index rgb b g r -- index )
+    >r
+    >r pick 0 + >fixnum pick set-uchar-nth
+    r> pick 1 + >fixnum pick set-uchar-nth
+    r> pick 2 + >fixnum pick set-uchar-nth
+    drop ; inline
+
+: yuv>rgb-pixel ( index rgb yuv uvy yy x -- index )
+    compute-yuv compute-rgb store-rgb 3 + >fixnum ; inline
+
+: yuv>rgb-row ( index rgb yuv y -- index )
+    over stride
+    pick y_width>> >fixnum
+    [ yuv>rgb-pixel ] each-with4 ; inline
+
+: yuv>rgb ( rgb yuv -- )
+    0 -rot
+    dup y_height>> >fixnum
+    [ yuv>rgb-row ] each-with2
+    drop ;
+
+HINTS: yuv>rgb byte-array byte-array ;
+
+: process-video ( player -- player )
+    dup gadget>> [
+        {
+            [ [ td>> ] [ yuv>> ] bi theora_decode_YUVout drop ]
+            [ [ rgb>> ] [ yuv>> ] bi yuv>rgb ]
+            [ gadget>> relayout-1 yield ]
+            [ ]
+        } cleave
+    ] when ;
+
+: num-audio-buffers-processed ( player -- player n )
+    dup source>> AL_BUFFERS_PROCESSED 0 uint <ref>
+    [ alGetSourcei check-error ] keep uint deref ;
+
+: append-new-audio-buffer ( player -- player )
+    dup buffers>> 1 gen-buffers append >>buffers
+    [ [ buffers>> second ] keep al-channel-format ] keep
+    [ audio-buffer>> dup length  ] keep
+    [ vi>> rate>> alBufferData check-error ]  keep
+    [ source>> 1 ] keep
+    [ buffers>> second uint <ref> alSourceQueueBuffers check-error ] keep ;
+
+: fill-processed-audio-buffer ( player n -- player )
+    ! n is the number of audio buffers processed
+    over >r >r dup source>> r> pick buffer-indexes>>
+    [ alSourceUnqueueBuffers check-error ] keep
+    uint deref dup r> swap >r al-channel-format rot
+    [ audio-buffer>> dup length  ] keep
+    [ vi>> rate>> alBufferData check-error ]  keep
+    [ source>> 1 ] keep
+    r> uint <ref> swap >r alSourceQueueBuffers check-error r> ;
+
+: append-audio ( player -- player bool )
+    num-audio-buffers-processed {
+        { [ over buffers>> length 1 = over zero? and ] [ drop append-new-audio-buffer t ] }
+        { [ over buffers>> length 2 = over zero? and ] [ yield drop f ] }
+        [ fill-processed-audio-buffer t ]
+    } cond ;
+
+: start-audio ( player -- player bool )
+    [ [ buffers>> first ] keep al-channel-format ] keep
+    [ audio-buffer>> dup length ] keep
+    [ vi>> rate>> alBufferData check-error ]  keep
+    [ source>> 1 ] keep
+    [ buffers>> first uint <ref> alSourceQueueBuffers check-error ] keep
+    [ source>> alSourcePlay check-error ] keep
+    t >>playing? t ;
+
+: process-audio ( player -- player bool )
+    dup playing?>> [ append-audio ] [ start-audio ] if ;
+
+: read-bytes-into ( dest size stream -- len )
+    ! Read the given number of bytes from a stream
+    ! and store them in the destination byte array.
+    stream-read >byte-array dup length [ memcpy ] keep  ;
+
+: check-not-negative ( int -- )
+    0 < [ "Word result was a negative number." throw ] when ;
+
+: buffer-size ( -- number )
+    4096 ; inline
+
+: sync-buffer ( player -- buffer size player )
+    [ oy>> buffer-size ogg_sync_buffer buffer-size ] keep ;
+
+: stream-into-buffer ( buffer size player -- len player )
+    [ stream>> read-bytes-into ] keep ;
+
+: confirm-buffer ( len player -- player eof? )
+  [ oy>> swap ogg_sync_wrote check-not-negative ] 2keep swap zero? ;
+
+: buffer-data ( player -- player eof? )
+    ! Take some compressed bitstream data and sync it for
+    ! page extraction.
+    sync-buffer stream-into-buffer confirm-buffer ;
+
+: queue-page ( player -- player )
+    ! Push a page into the stream for packetization
+    [ [ vo>> ] [ og>> ] bi ogg_stream_pagein drop ]
+    [ [ to>> ] [ og>> ] bi ogg_stream_pagein drop ]
+    [ ] tri ;
+
+: retrieve-page ( player -- player bool )
+    ! Sync the streams and get a page. Return true if a page was
+    ! successfully retrieved.
+    dup [ oy>> ] [ og>> ] bi ogg_sync_pageout 0 > ;
+
+: standard-initial-header? ( player -- player bool )
+    dup og>> ogg_page_bos zero? not ;
+
+: ogg-stream-init ( player -- state player )
+    ! Init the encode/decode logical stream state
+    [ temp-state>> ] keep
+    [ og>> ogg_page_serialno ogg_stream_init check-not-negative ] 2keep ;
+
+: ogg-stream-pagein ( state player -- state player )
+    ! Add the incoming page to the stream state
+    [ og>> ogg_stream_pagein drop ] 2keep ;
+
+: ogg-stream-packetout ( state player -- state player )
+    [ op>> ogg_stream_packetout drop ] 2keep ;
+
+: decode-packet ( player -- state player )
+    ogg-stream-init ogg-stream-pagein ogg-stream-packetout ;
+
+: theora-header? ( player -- player bool )
+    ! Is the current page a theora header?
+    dup [ ti>> ] [ tc>> ] [ op>> ] tri theora_decode_header 0 >= ;
+
+: is-theora-packet? ( player -- player bool )
+    dup theora>> zero? [ theora-header? ] [ f ] if ;
+
+: copy-to-theora-state ( state player -- player )
+    ! Copy the state to the theora state structure in the player
+    [ to>> swap dup length memcpy ] keep ;
+
+: handle-initial-theora-header ( state player -- player )
+    copy-to-theora-state 1 >>theora ;
+
+: vorbis-header? ( player -- player bool )
+    ! Is the current page a vorbis header?
+    dup [ vi>> ] [ vc>> ] [ op>> ] tri vorbis_synthesis_headerin 0 >= ;
+
+: is-vorbis-packet? ( player -- player bool )
+    dup vorbis>> zero? [ vorbis-header? ] [ f ] if ;
+
+: copy-to-vorbis-state ( state player -- player )
+    ! Copy the state to the vorbis state structure in the player
+    [ vo>> swap dup length memcpy ] keep ;
+
+: handle-initial-vorbis-header ( state player -- player )
+    copy-to-vorbis-state 1 >>vorbis ;
+
+: handle-initial-unknown-header ( state player -- player )
+    swap ogg_stream_clear drop ;
+
+: process-initial-header ( player -- player bool )
+    ! Is this a standard initial header? If not, stop parsing
+    standard-initial-header? [
+        decode-packet {
+            { [ is-vorbis-packet? ] [ handle-initial-vorbis-header ] }
+            { [ is-theora-packet? ] [ handle-initial-theora-header ] }
+            [ handle-initial-unknown-header ]
+        } cond t
+    ] [
+        f
+    ] if ;
+
+: parse-initial-headers ( player -- player )
+    ! Parse Vorbis headers, ignoring any other type stored
+    ! in the Ogg container.
+    retrieve-page [
+        process-initial-header [
+            parse-initial-headers
+        ] [
+            ! Don't leak the page, get it into the appropriate stream
+            queue-page
+        ] if
+    ] [
+        buffer-data not [ parse-initial-headers ] when
+    ] if ;
+
+: have-required-vorbis-headers? ( player -- player bool )
+    ! Return true if we need to decode vorbis due to there being
+    ! vorbis headers read from the stream but we don't have them all
+    ! yet.
+    dup vorbis>> 1 2 between? not ;
+
+: have-required-theora-headers? ( player -- player bool )
+    ! Return true if we need to decode theora due to there being
+    ! theora headers read from the stream but we don't have them all
+    ! yet.
+    dup theora>> 1 2 between? not ;
+
+: get-remaining-vorbis-header-packet ( player -- player bool )
+    dup [ vo>> ] [ op>> ] bi ogg_stream_packetout {
+        { [ dup 0 <   ] [ "Error parsing vorbis stream; corrupt stream?" throw ] }
+        { [ dup zero? ] [ drop f ] }
+        { [ t     ] [ drop t ] }
+    } cond ;
+
+: get-remaining-theora-header-packet ( player -- player bool )
+    dup [ to>> ] [ op>> ] bi ogg_stream_packetout {
+        { [ dup 0 <   ] [ "Error parsing theora stream; corrupt stream?" throw ] }
+        { [ dup zero? ] [ drop f ] }
+        { [ t     ] [ drop t ] }
+    } cond ;
+
+: decode-remaining-vorbis-header-packet ( player -- player )
+    dup [ vi>> ] [ vc>> ] [ op>> ] tri vorbis_synthesis_headerin zero? [
+        "Error parsing vorbis stream; corrupt stream?" throw
+    ] unless ;
+
+: decode-remaining-theora-header-packet ( player -- player )
+    dup [ ti>> ] [ tc>> ] [ op>> ] tri theora_decode_header zero? [
+        "Error parsing theora stream; corrupt stream?" throw
+    ] unless ;
+
+: increment-vorbis-header-count ( player -- player )
+    [ 1+ ] change-vorbis ;
+
+: increment-theora-header-count ( player -- player )
+    [ 1+ ] change-theora ;
+
+: parse-remaining-vorbis-headers ( player -- player )
+    have-required-vorbis-headers? not [
+        get-remaining-vorbis-header-packet [
+            decode-remaining-vorbis-header-packet
+            increment-vorbis-header-count
+            parse-remaining-vorbis-headers
+        ] when
+    ] when ;
+
+: parse-remaining-theora-headers ( player -- player )
+    have-required-theora-headers? not [
+        get-remaining-theora-header-packet [
+            decode-remaining-theora-header-packet
+            increment-theora-header-count
+            parse-remaining-theora-headers
+        ] when
+    ] when ;
+
+: get-more-header-data ( player -- player )
+    buffer-data drop ;
+
+: parse-remaining-headers ( player -- player )
+    have-required-vorbis-headers? not swap have-required-theora-headers? not swapd or [
+        parse-remaining-vorbis-headers
+        parse-remaining-theora-headers
+        retrieve-page [ queue-page ] [ get-more-header-data ] if
+        parse-remaining-headers
+    ] when ;
+
+: tear-down-vorbis ( player -- player )
+    dup vi>> vorbis_info_clear
+    dup vc>> vorbis_comment_clear ;
+
+: tear-down-theora ( player -- player )
+    dup ti>> theora_info_clear
+    dup tc>> theora_comment_clear ;
+
+: init-vorbis-codec ( player -- player )
+    dup [ vd>> ] [ vi>> ] bi vorbis_synthesis_init drop
+    dup [ vd>> ] [ vb>> ] bi vorbis_block_init drop ;
+
+: init-theora-codec ( player -- player )
+    dup [ td>> ] [ ti>> ] bi theora_decode_init drop
+    dup ti>> frame_width>> over ti>> frame_height>>
+    4 * * <byte-array> >>rgb ;
+
+
+: display-vorbis-details ( player -- player )
+    [
+        "Ogg logical stream " %
+        dup vo>> serialno>> #
+        " is Vorbis " %
+        dup vi>> channels>> #
+        " channel " %
+        dup vi>> rate>> #
+        " Hz audio." %
+    ] "" make print ;
+
+: display-theora-details ( player -- player )
+    [
+        "Ogg logical stream " %
+        dup to>> serialno>> #
+        " is Theora " %
+        dup ti>> width>> #
+        "x" %
+        dup ti>> height>> #
+        " " %
+        dup ti>> fps_numerator>>
+        over ti>> fps_denominator>> /f #
+        " fps video" %
+    ] "" make print ;
+
+: initialize-decoder ( player -- player )
+    dup vorbis>> zero? [ tear-down-vorbis ] [ init-vorbis-codec display-vorbis-details ] if
+    dup theora>> zero? [ tear-down-theora ] [ init-theora-codec display-theora-details ] if ;
+
+: sync-pages ( player -- player )
+    retrieve-page [
+        queue-page sync-pages
+    ] when ;
+
+: audio-buffer-not-ready? ( player -- player bool )
+    dup vorbis>> zero? not over audio-full?>> not and ;
+
+: pending-decoded-audio? ( player -- player pcm len bool )
+    f <void*> 2dup >r vd>> r> vorbis_synthesis_pcmout dup 0 > ;
+
+: buffer-space-available ( player -- available )
+    audio-buffer-size swap audio-index>> - ;
+
+: samples-to-read ( player available len -- numread )
+    >r swap num-channels / r> min ;
+
+: each-with3 ( obj obj obj seq quot -- ) 3 each-withn ; inline
+
+: add-to-buffer ( player val -- )
+    over audio-index>> pick audio-buffer>> set-short-nth
+    [ 1+ ] change-audio-index drop ;
+
+: get-audio-value ( pcm sample channel -- value )
+    rot *void* void*-nth float-nth ;
+
+: process-channels ( player pcm sample channel -- )
+    get-audio-value 32767.0 * >fixnum 32767 min -32768 max add-to-buffer ;
+
+: (process-sample) ( player pcm sample -- )
+    pick num-channels [ process-channels ] each-with3 ;
+
+: process-samples ( player pcm numread -- )
+    [ (process-sample) ] each-with2 ;
+
+: decode-pending-audio ( player pcm result -- player )
+!     [ "ret = " % dup # ] "" make write
+    pick [ buffer-space-available swap ] keep -rot samples-to-read
+    pick over >r >r process-samples r> r> swap
+    ! numread player
+    dup audio-index>> audio-buffer-size = [
+        t >>audio-full?
+    ] when
+    dup vd>> granulepos>> dup 0 >= [
+        ! numtoread player granulepos
+        ! This is wrong: fix
+        pick - >>audio-granulepos
+    ] [
+        ! numtoread player granulepos
+        pick + >>audio-granulepos
+    ] if
+    [ vd>> swap vorbis_synthesis_read drop ] keep ;
+
+: no-pending-audio ( player -- player bool )
+    ! No pending audio. Is there a pending packet to decode.
+    dup [ vo>> ] [ op>> ] bi ogg_stream_packetout 0 > [
+        dup [ vb>> ] [ op>> ] bi vorbis_synthesis 0 = [
+            dup [ vd>> ] [ vb>> ] bi vorbis_synthesis_blockin drop
+        ] when
+        t
+    ] [
+        ! Need more data. Break out to suck in another page.
+        f
+    ] if ;
+
+: decode-audio ( player -- player )
+    audio-buffer-not-ready? [
+        ! If there's pending decoded audio, grab it
+        pending-decoded-audio? [
+            decode-pending-audio decode-audio
+        ] [
+            2drop no-pending-audio [ decode-audio ] when
+        ] if
+    ] when ;
+
+: video-buffer-not-ready? ( player -- player bool )
+    dup theora>> zero? not over video-ready?>> not and ;
+
+: decode-video ( player -- player )
+    video-buffer-not-ready? [
+        dup [ to>> ] [ op>> ] bi ogg_stream_packetout 0 > [
+            dup [ td>> ] [ op>> ] bi theora_decode_packetin drop
+            dup td>> granulepos>> >>video-granulepos
+            dup [ td>> ] [ video-granulepos>> ] bi theora_granule_time
+            >>video-time
+            t >>video-ready?
+            decode-video
+        ] when
+    ] when ;
+
+: decode ( player -- player )
+    get-more-header-data sync-pages
+    decode-audio
+    decode-video
+    dup audio-full?>> [
+        process-audio [
+            f >>audio-full?
+            0 >>audio-index
+        ] when
+    ] when
+    dup video-ready?>> [
+        dup video-time>> over get-time - dup 0.0 < [
+            -0.1 > [ process-video ] when
+            f >>video-ready?
+        ] [
+            drop
+        ] if
+    ] when
+    decode ;
+
+: free-malloced-objects ( player -- player )
+    {
+        [ op>> free ]
+        [ oy>> free ]
+        [ og>> free ]
+        [ vo>> free ]
+        [ vi>> free ]
+        [ vd>> free ]
+        [ vb>> free ]
+        [ vc>> free ]
+        [ to>> free ]
+        [ ti>> free ]
+        [ tc>> free ]
+        [ td>> free ]
+        [ ]
+    } cleave ;
+
+
+: unqueue-openal-buffers ( player -- player )
+    [
+
+        num-audio-buffers-processed over source>> rot buffer-indexes>> swapd
+        alSourceUnqueueBuffers check-error
+    ] keep ;
+
+: delete-openal-buffers ( player -- player )
+    [
+        buffers>> [
+            1 swap uint <ref> alDeleteBuffers check-error
+        ] each
+    ] keep ;
+
+: delete-openal-source ( player -- player )
+    [ source>> 1 swap uint <ref> alDeleteSources check-error ] keep ;
+
+: cleanup ( player -- player )
+    free-malloced-objects
+    unqueue-openal-buffers
+    delete-openal-buffers
+    delete-openal-source ;
+
+: wait-for-sound ( player -- player )
+    ! Waits for the openal to finish playing remaining sounds
+    dup source>> AL_SOURCE_STATE 0 <int> [ alGetSourcei check-error ] keep
+    *int AL_PLAYING = [
+        100 sleep
+        wait-for-sound
+    ] when ;
+
+TUPLE: theora-gadget < gadget player ;
+
+: <theora-gadget> ( player -- gadget )
+    theora-gadget new-gadget
+        swap >>player ;
+
+M: theora-gadget pref-dim*
+    player>>
+    ti>> dup width>> swap height>> 2array ;
+
+M: theora-gadget draw-gadget* ( gadget -- )
+    0 0 glRasterPos2i
+    1.0 -1.0 glPixelZoom
+    GL_UNPACK_ALIGNMENT 1 glPixelStorei
+    [ pref-dim* first2 GL_RGB GL_UNSIGNED_BYTE ] keep
+    player>> rgb>> glDrawPixels ;
+
+: initialize-gui ( gadget -- )
+    "Theora Player" open-window ;
+
+: play-ogg ( player -- )
+    parse-initial-headers
+    parse-remaining-headers
+    initialize-decoder
+    dup gadget>> [ initialize-gui ] when*
+    [ decode ] try
+    wait-for-sound
+    cleanup
+    drop ;
+
+: play-vorbis-stream ( stream -- )
+    <player> play-ogg ;
+
+: play-vorbis-file ( filename -- )
+    binary <file-reader> play-vorbis-stream ;
+
+: play-theora-stream ( stream -- )
+    <player>
+    dup <theora-gadget> >>gadget
+    play-ogg ;
+
+: play-theora-file ( filename -- )
+    binary <file-reader> play-theora-stream ;
diff --git a/ogg/player/summary.txt b/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/ogg/player/tags.txt b/ogg/player/tags.txt
new file mode 100644 (file)
index 0000000..1adb6f1
--- /dev/null
@@ -0,0 +1,2 @@
+audio
+video
diff --git a/opengl-gadgets/gadgets-tests.factor b/opengl-gadgets/gadgets-tests.factor
new file mode 100644 (file)
index 0000000..499ec97
--- /dev/null
@@ -0,0 +1,4 @@
+IN: opengl.gadgets.tests
+USING: tools.test opengl.gadgets ;
+
+\ render* must-infer
diff --git a/opengl-gadgets/gadgets.factor b/opengl-gadgets/gadgets.factor
new file mode 100644 (file)
index 0000000..70d7758
--- /dev/null
@@ -0,0 +1,116 @@
+! Copyright (C) 2008 Matthew Willis.
+! See http://factorcode.org/license.txt for BSD license.
+USING: locals math.functions math namespaces
+opengl.gl opengl.demo-support accessors kernel opengl ui.gadgets
+fry assocs
+destructors sequences ui.render colors ;
+IN: opengl.gadgets
+
+TUPLE: texture-gadget < gadget ;
+
+GENERIC: render* ( gadget -- texture dims )
+GENERIC: cache-key* ( gadget -- key )
+
+M: texture-gadget cache-key* ;
+
+SYMBOL: textures
+SYMBOL: refcounts
+
+: init-cache ( symbol -- )
+    dup get [ drop ] [ H{ } clone swap set-global ] if ;
+
+textures init-cache
+refcounts init-cache
+
+: refcount-change ( gadget quot -- )
+    [ cache-key* refcounts get [ [ 0 ] unless* ] ] dip compose change-at ;
+
+TUPLE: cache-entry tex dims ;
+C: <entry> cache-entry
+
+: make-entry ( gadget -- entry )
+    dup render* <entry>
+    [ swap cache-key* textures get set-at ] keep ;
+
+: get-entry ( gadget -- {texture,dims} )
+    dup cache-key* textures get at
+    [ ] [ make-entry ] ?if ;
+
+: get-dims ( gadget -- dims )
+    get-entry dims>> ;
+
+: get-texture ( gadget -- texture )
+    get-entry tex>> ;
+
+: release-texture ( gadget -- )
+    cache-key* textures get delete-at*
+    [ tex>> delete-texture ] [ drop ] if ;
+
+: clear-textures ( -- )
+    textures get values [ tex>> delete-texture ] each
+    H{ } clone textures set-global
+    H{ } clone refcounts set-global ;
+
+M: texture-gadget graft* ( gadget -- ) [ 1+ ] refcount-change ;
+
+M: texture-gadget ungraft* ( gadget -- )
+    dup [ 1- ] refcount-change
+    dup cache-key* refcounts get at
+    zero? [ release-texture ] [ drop ] if ;
+
+: 2^-ceil ( x -- y )
+    dup 2 < [ 2 * ] [ 1- log2 1+ 2^ ] if ; foldable flushable
+
+: 2^-bounds ( dim -- dim' )
+    [ 2^-ceil ] map ; foldable flushable
+
+:: (render-bytes) ( dims bytes format texture -- )
+    GL_ENABLE_BIT [
+        GL_TEXTURE_2D glEnable
+        GL_TEXTURE_2D texture glBindTexture
+        GL_TEXTURE_2D
+        0
+        GL_RGBA
+        dims 2^-bounds first2
+        0
+        format
+        GL_UNSIGNED_BYTE
+        bytes
+        glTexImage2D
+        init-texture
+        GL_TEXTURE_2D 0 glBindTexture
+    ] do-attribs ;
+
+: render-bytes ( dims bytes format -- texture )
+    gen-texture [ (render-bytes) ] keep ;
+
+: render-bytes* ( dims bytes format -- texture dims )
+    pick [ render-bytes ] dip ;
+
+:: four-corners ( dim -- )
+    [let* | w [ dim first ]
+            h [ dim second ]
+            dim' [ dim dup 2^-bounds [ /f ] 2map ]
+            w' [ dim' first ]
+            h' [ dim' second ] |
+        0  0  glTexCoord2d 0 0 glVertex2d
+        0  h' glTexCoord2d 0 h glVertex2d
+        w' h' glTexCoord2d w h glVertex2d
+        w' 0  glTexCoord2d w 0 glVertex2d
+    ] ;
+
+M: texture-gadget draw-gadget* ( gadget -- )
+    origin get [
+        GL_ENABLE_BIT [
+            white gl-color
+            1.0 -1.0 glPixelZoom
+            GL_TEXTURE_2D glEnable
+            GL_TEXTURE_2D over get-texture glBindTexture
+            GL_QUADS [
+                get-dims four-corners
+            ] do-state
+            GL_TEXTURE_2D 0 glBindTexture
+        ] do-attribs
+    ] with-translation ;
+
+M: texture-gadget pref-dim* ( gadget -- dim ) get-dims ;
diff --git a/oracle/authors.txt b/oracle/authors.txt
new file mode 100644 (file)
index 0000000..7c29e7c
--- /dev/null
@@ -0,0 +1 @@
+Elie Chaftari
diff --git a/oracle/liboci/authors.txt b/oracle/liboci/authors.txt
new file mode 100644 (file)
index 0000000..7c29e7c
--- /dev/null
@@ -0,0 +1 @@
+Elie Chaftari
diff --git a/oracle/liboci/liboci.factor b/oracle/liboci/liboci.factor
new file mode 100644 (file)
index 0000000..52f09cb
--- /dev/null
@@ -0,0 +1,193 @@
+! 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" {
+    { [ os winnt? ] [ "oci.dll" stdcall ] }
+    { [ os macosx? ] [ "$DYLD_LIBRARY_PATH/libclntsh.dylib" cdecl ] }
+    { [ os unix? ] [ "$DYLD_LIBRARY_PATH/libclntsh.so.10.1" cdecl ] }
+} cond add-library
+
+! ===============================================
+! Attribute Types
+! ===============================================
+
+: OCI_ATTR_USERNAME 22  ; inline ! username attribute
+: OCI_ATTR_PASSWORD 23  ; inline ! password attribute
+
+! ===============================================
+! Various Modes
+! ===============================================
+
+: OCI_DEFAULT   0x00 ; inline ! default value for parameters and attributes
+: OCI_THREADED  0x01 ; inline ! appl. in threaded environment
+: OCI_OBJECT    0x02 ; inline ! application in object environment
+
+! ===============================================
+! Execution Modes
+! ===============================================
+
+: OCI_DESCRIBE_ONLY   0x10 ; 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       0x01 ; inline ! refetching current position
+: OCI_FETCH_NEXT          0x02 ; inline ! next row
+: OCI_FETCH_FIRST         0x04 ; inline ! first row of the result set
+: OCI_FETCH_LAST          0x08 ; inline ! the last row of the result set
+: OCI_FETCH_PRIOR         0x10 ; inline ! the previous row relative to current
+: OCI_FETCH_ABSOLUTE      0x20 ; inline ! absolute offset from first
+: OCI_FETCH_RELATIVE      0x40 ; inline ! offset relative to current
+: OCI_FETCH_RESERVED_1    0x80 ; 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
+
+! ===============================================
+! 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/oracle/oracle-tests.factor b/oracle/oracle-tests.factor
new file mode 100644 (file)
index 0000000..2f957ac
--- /dev/null
@@ -0,0 +1,60 @@
+USING: oracle oracle.liboci prettyprint tools.test
+kernel ;
+
+[
+    "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
+] drop
diff --git a/oracle/oracle.factor b/oracle/oracle.factor
new file mode 100644 (file)
index 0000000..e61a47a
--- /dev/null
@@ -0,0 +1,257 @@
+! 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 alien.strings combinators kernel math
+namespaces oracle.liboci prettyprint sequences
+io.encodings.ascii accessors ;
+
+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
+    ascii alien>string throw ;
+
+: check-result ( result -- )
+    {
+        { OCI_SUCCESS [ ] }
+        { OCI_ERROR [ err get get-oci-error ] }
+        { OCI_INVALID_HANDLE [ "invalid handle" throw ] }
+        [ "operation failed" throw ]
+    } case ;
+
+: check-status ( status -- bool )
+    {
+        { OCI_SUCCESS [ t ] }
+        { OCI_ERROR [ err get get-oci-error ] }
+        { OCI_INVALID_HANDLE [ "invalid handle" throw ] }
+        { OCI_NO_DATA [ f ] }
+        [ "operation failed" throw ]
+    } case ;
+
+! =========================================================
+! 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 username>> dup length swap ascii malloc-string swap 
+    con get password>> dup length swap ascii malloc-string swap
+    con get db>> dup length swap ascii malloc-string swap
+    OCILogon check-result ;
+
+! =========================================================
+! Attach to server and attribute-setting routines
+! =========================================================
+
+: attach-to-server ( -- )
+    srv get err get con get 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 username>> dup length swap ascii malloc-string swap 
+    OCI_ATTR_USERNAME err get OCIAttrSet check-result ;
+
+: set-password-attribute ( -- )
+    ses get OCI_HTYPE_SESSION con get password>> dup length swap ascii malloc-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 ascii malloc-string swap
+    OCI_NTV_SYNTAX OCI_DEFAULT OCIStmtPrepare check-result ;
+
+: calculate-size ( type -- size )
+    {
+        { SQLT_INT [ "int" heap-size ] }
+        { SQLT_FLT [ "float" heap-size ] }
+        { SQLT_CHR [ "char" heap-size ] }
+        { SQLT_NUM [ "int" heap-size 10 * ] }
+        { SQLT_STR [ 64 ] }
+        { SQLT_ODT [ 256 ] }
+    } case ;
+
+: define-by-position ( position type -- )
+    >r >r stm get f <void*> err get
+    r> r> dup calculate-size >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> ascii alien>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 ascii alien>string res get swap suffix res set
+        fetch-each
+    ] [ ] if ;
+
+: run-query ( object -- object )
+    execute-statement [
+        buf get ascii alien>string res get swap suffix res set
+        fetch-each
+    ] [ ] if ;
+
+: gather-results ( -- seq )
+    res get ;
+
+: show-result ( -- )
+    res get [ . ] each ;
+
+: clear-result ( -- )
+    V{ } clone res set ;
diff --git a/oracle/summary.txt b/oracle/summary.txt
new file mode 100644 (file)
index 0000000..0596680
--- /dev/null
@@ -0,0 +1 @@
+Oracle database bindings
diff --git a/oracle/tags.txt b/oracle/tags.txt
new file mode 100644 (file)
index 0000000..aa0d57e
--- /dev/null
@@ -0,0 +1 @@
+database
diff --git a/ori/authors.txt b/ori/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/ori/ori-tests.factor b/ori/ori-tests.factor
new file mode 100644 (file)
index 0000000..6121ab1
--- /dev/null
@@ -0,0 +1,9 @@
+IN: ori.tests
+USING: ori tools.test ;
+
+\ pitch-up   must-infer
+\ pitch-down must-infer
+\ turn-left  must-infer
+\ turn-right must-infer
+\ roll-left  must-infer
+\ roll-right must-infer
diff --git a/ori/ori.factor b/ori/ori.factor
new file mode 100644 (file)
index 0000000..0683c0c
--- /dev/null
@@ -0,0 +1,78 @@
+
+USING: kernel namespaces make accessors
+       math math.constants math.functions math.matrices math.vectors
+       sequences splitting grouping self math.trig ;
+
+IN: ori
+
+TUPLE: ori val ;
+
+C: <ori> ori
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: ori> ( -- val ) self> val>> ;
+
+: >ori ( val -- ) self> val<< ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: make-matrix ( quot width -- matrix ) [ { } make ] dip group ; inline
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! 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/pdf/authors.txt b/pdf/authors.txt
new file mode 100644 (file)
index 0000000..7c29e7c
--- /dev/null
@@ -0,0 +1 @@
+Elie Chaftari
diff --git a/pdf/libhpdf/libhpdf.factor b/pdf/libhpdf/libhpdf.factor
new file mode 100644 (file)
index 0000000..a0d9ca3
--- /dev/null
@@ -0,0 +1,178 @@
+! 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      0x00 ; inline ! No contents are compressed
+: HPDF_COMP_TEXT      0x01 ; inline ! Compress contents stream of page
+: HPDF_COMP_IMAGE     0x02 ; inline ! Compress streams of image objects
+: HPDF_COMP_METADATA  0x04 ; inline ! Compress other data (fonts, cmaps...)
+: HPDF_COMP_ALL       0x0F ; inline ! All stream data are compressed
+: HPDF_COMP_MASK      0xFF ; inline
+
+! page mode
+CONSTANT: HPDF_PAGE_MODE_USE_NONE 0
+CONSTANT: HPDF_PAGE_MODE_USE_OUTLINE 1
+CONSTANT: HPDF_PAGE_MODE_USE_THUMBS 2
+CONSTANT: HPDF_PAGE_MODE_FULL_SCREEN 3
+CONSTANT: HPDF_PAGE_MODE_EOF 4
+
+: error-code ( -- seq ) {
+     { 0x1001  "HPDF_ARRAY_COUNT_ERR\nInternal error. The consistency of the data was lost." }
+     { 0x1002  "HPDF_ARRAY_ITEM_NOT_FOUND\nInternal error. The consistency of the data was lost." }
+     { 0x1003  "HPDF_ARRAY_ITEM_UNEXPECTED_TYPE\nInternal error. The consistency of the data was lost." }
+     { 0x1004  "HPDF_BINARY_LENGTH_ERR\nThe length of the data exceeds HPDF_LIMIT_MAX_STRING_LEN." }
+     { 0x1005  "HPDF_CANNOT_GET_PALLET\nCannot get a pallet data from PNG image." }
+     { 0x1007  "HPDF_DICT_COUNT_ERR\nThe count of elements of a dictionary exceeds HPDF_LIMIT_MAX_DICT_ELEMENT" }
+     { 0x1008  "HPDF_DICT_ITEM_NOT_FOUND\nInternal error. The consistency of the data was lost." }
+     { 0x1009  "HPDF_DICT_ITEM_UNEXPECTED_TYPE\nInternal error. The consistency of the data was lost." }  
+     { 0x100A  "HPDF_DICT_STREAM_LENGTH_NOT_FOUND\nInternal error. The consistency of the data was lost." }  
+     { 0x100B  "HPDF_DOC_ENCRYPTDICT_NOT_FOUND\nHPDF_SetPermission() OR HPDF_SetEncryptMode() was called before a password is set." }
+     { 0x100C  "HPDF_DOC_INVALID_OBJECT\nInternal error. The consistency of the data was lost." }
+     { 0x100E  "HPDF_DUPLICATE_REGISTRATION\nTried to register a font that has been registered." }
+     { 0x100F  "HPDF_EXCEED_JWW_CODE_NUM_LIMIT\nCannot register a character to the japanese word wrap characters list." }
+     { 0x1011  "HPDF_ENCRYPT_INVALID_PASSWORD\nTried to set the owner password to NULL. owner password and user password is the same." }
+     { 0x1013  "HPDF_ERR_UNKNOWN_CLASS\nInternal error. The consistency of the data was lost." }
+     { 0x1014  "HPDF_EXCEED_GSTATE_LIMIT\nThe depth of the stack exceeded HPDF_LIMIT_MAX_GSTATE." }
+     { 0x1015  "HPDF_FAILED_TO_ALLOC_MEM\nMemory allocation failed." }
+     { 0x1016  "HPDF_FILE_IO_ERROR\nFile processing failed. (A detailed code is set.)" }
+     { 0x1017  "HPDF_FILE_OPEN_ERROR\nCannot open a file. (A detailed code is set.)" }
+     { 0x1019  "HPDF_FONT_EXISTS\nTried to load a font that has already been registered." }
+     { 0x101A  "HPDF_FONT_INVALID_WIDTHS_TABLE\nThe format of a font-file is invalid . Internal error. The consistency of the data was lost." }
+     { 0x101B  "HPDF_INVALID_AFM_HEADER\nCannot recognize a header of an afm file." }
+     { 0x101C  "HPDF_INVALID_ANNOTATION\nThe specified annotation handle is invalid." }
+     { 0x101E  "HPDF_INVALID_BIT_PER_COMPONENT\nBit-per-component of a image which was set as mask-image is invalid." }
+     { 0x101F  "HPDF_INVALID_CHAR_MATRICS_DATA\nCannot recognize char-matrics-data  of an afm file." }
+     { 0x1020  "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." }
+     { 0x1021  "HPDF_INVALID_COMPRESSION_MODE\nInvalid value was set when invoking HPDF_SetCommpressionMode()." }
+     { 0x1022  "HPDF_INVALID_DATE_TIME\nAn invalid date-time value was set." }
+     { 0x1023  "HPDF_INVALID_DESTINATION\nAn invalid destination handle was set." }
+     { 0x1025  "HPDF_INVALID_DOCUMENT\nAn invalid document handle is set." }
+     { 0x1026  "HPDF_INVALID_DOCUMENT_STATE\nThe function which is invalid in the present state was invoked." }
+     { 0x1027  "HPDF_INVALID_ENCODER\nAn invalid encoder handle was set." }
+     { 0x1028  "HPDF_INVALID_ENCODER_TYPE\nA combination between font and encoder is wrong." }
+     { 0x102B  "HPDF_INVALID_ENCODING_NAME\nAn Invalid encoding name is specified." }
+     { 0x102C  "HPDF_INVALID_ENCRYPT_KEY_LEN\nThe lengh of the key of encryption is invalid." }
+     { 0x102D  "HPDF_INVALID_FONTDEF_DATA\n1. An invalid font handle was set.\n2. Unsupported font format." }
+     { 0x102E  "HPDF_INVALID_FONTDEF_TYPE\nInternal error. The consistency of the data was lost." }
+     { 0x102F  "HPDF_INVALID_FONT_NAME\nA font which has the specified name is not found." }
+     { 0x1030  "HPDF_INVALID_IMAGE\nUnsupported image format." }
+     { 0x1031  "HPDF_INVALID_JPEG_DATA\nUnsupported image format." }
+     { 0x1032  "HPDF_INVALID_N_DATA\nCannot read a postscript-name from an afm file." }
+     { 0x1033  "HPDF_INVALID_OBJECT\n1. An invalid object is set.\n2. Internal error. The consistency of the data was lost." }
+     { 0x1034  "HPDF_INVALID_OBJ_ID\nInternal error. The consistency of the data was lost." }
+     { 0x1035  "HPDF_INVALID_OPERATION\nInvoked HPDF_Image_SetColorMask() against the image-object which was set a mask-image." }
+     { 0x1036  "HPDF_INVALID_OUTLINE\nAn invalid outline-handle was specified." }
+     { 0x1037  "HPDF_INVALID_PAGE\nAn invalid page-handle was specified." }
+     { 0x1038  "HPDF_INVALID_PAGES\nAn invalid pages-handle was specified. (internal error)" }
+     { 0x1039  "HPDF_INVALID_PARAMETER\nAn invalid value is set." }
+     { 0x103B  "HPDF_INVALID_PNG_IMAGE\nInvalid PNG image format." }
+     { 0x103C  "HPDF_INVALID_STREAM\nInternal error. The consistency of the data was lost." }
+     { 0x103D  "HPDF_MISSING_FILE_NAME_ENTRY\nInternal error. The \"_FILE_NAME\" entry for delayed loading is missing." }
+     { 0x103F  "HPDF_INVALID_TTC_FILE\nInvalid .TTC file format." }
+     { 0x1040  "HPDF_INVALID_TTC_INDEX\nThe index parameter was exceed the number of included fonts" }
+     { 0x1041  "HPDF_INVALID_WX_DATA\nCannot read a width-data from an afm file." }
+     { 0x1042  "HPDF_ITEM_NOT_FOUND\nInternal error. The consistency of the data was lost." }
+     { 0x1043  "HPDF_LIBPNG_ERROR\nAn error has returned from PNGLIB while loading an image." }
+     { 0x1044  "HPDF_NAME_INVALID_VALUE\nInternal error. The consistency of the data was lost." }
+     { 0x1045  "HPDF_NAME_OUT_OF_RANGE\nInternal error. The consistency of the data was lost." }
+     { 0x1049  "HPDF_PAGES_MISSING_KIDS_ENTRY\nInternal error. The consistency of the data was lost." }
+     { 0x104A  "HPDF_PAGE_CANNOT_FIND_OBJECT\nInternal error. The consistency of the data was lost." }
+     { 0x104B  "HPDF_PAGE_CANNOT_GET_ROOT_PAGES\nInternal error. The consistency of the data was lost." }
+     { 0x104C  "HPDF_PAGE_CANNOT_RESTORE_GSTATE\nThere are no graphics-states to be restored." }
+     { 0x104D  "HPDF_PAGE_CANNOT_SET_PARENT\nInternal error. The consistency of the data was lost." }
+     { 0x104E  "HPDF_PAGE_FONT_NOT_FOUND\nThe current font is not set." }
+     { 0x104F  "HPDF_PAGE_INVALID_FONT\nAn invalid font-handle was specified." }
+     { 0x1050  "HPDF_PAGE_INVALID_FONT_SIZE\nAn invalid font-size was set." }
+     { 0x1051  "HPDF_PAGE_INVALID_GMODE\nSee Graphics mode." }
+     { 0x1052  "HPDF_PAGE_INVALID_INDEX\nInternal error. The consistency of the data was lost." }
+     { 0x1053  "HPDF_PAGE_INVALID_ROTATE_VALUE\nThe specified value is not a multiple of 90." }
+     { 0x1054  "HPDF_PAGE_INVALID_SIZE\nAn invalid page-size was set." }
+     { 0x1055  "HPDF_PAGE_INVALID_XOBJECT\nAn invalid image-handle was set." }
+     { 0x1056  "HPDF_PAGE_OUT_OF_RANGE\nThe specified value is out of range." }
+     { 0x1057  "HPDF_REAL_OUT_OF_RANGE\nThe specified value is out of range." }
+     { 0x1058  "HPDF_STREAM_EOF\nUnexpected EOF marker was detected." }
+     { 0x1059  "HPDF_STREAM_READLN_CONTINUE\nInternal error. The consistency of the data was lost." }
+     { 0x105B  "HPDF_STRING_OUT_OF_RANGE\nThe length of the specified text is too long." }
+     { 0x105C  "HPDF_THIS_FUNC_WAS_SKIPPED\nThe execution of a function was skipped because of other errors." }
+     { 0x105D  "HPDF_TTF_CANNOT_EMBEDDING_FONT\nThis font cannot be embedded. (restricted by license.)" }
+     { 0x105E  "HPDF_TTF_INVALID_CMAP\nUnsupported ttf format. (cannot find unicode cmap.)" }
+     { 0x105F  "HPDF_TTF_INVALID_FOMAT\nUnsupported ttf format." }
+     { 0x1060  "HPDF_TTF_MISSING_TABLE\nUnsupported ttf format. (cannot find a necessary table.)" }
+     { 0x1061  "HPDF_UNSUPPORTED_FONT_TYPE\nInternal error. The consistency of the data was lost." }
+     { 0x1062  "HPDF_UNSUPPORTED_FUNC\n1. The library is not configured to use PNGLIB.\n2. Internal error. The consistency of the data was lost." }
+     { 0x1063  "HPDF_UNSUPPORTED_JPEG_FORMAT\nUnsupported Jpeg format." }
+     { 0x1064  "HPDF_UNSUPPORTED_TYPE1_FONT\nFailed to parse .PFB file." }
+     { 0x1065  "HPDF_XREF_COUNT_ERR\nInternal error. The consistency of the data was lost." }
+     { 0x1066  "HPDF_ZLIB_ERROR\nAn error has occurred while executing a function of Zlib." }
+     { 0x1067  "HPDF_INVALID_PAGE_INDEX\nAn error returned from Zlib." }
+     { 0x1068  "HPDF_INVALID_URI\nAn invalid URI was set." }
+     { 0x1069  "HPDF_PAGELAYOUT_OUT_OF_RANGE\nAn invalid page-layout was set." }
+     { 0x1070  "HPDF_PAGEMODE_OUT_OF_RANGE\nAn invalid page-mode was set." }
+     { 0x1071  "HPDF_PAGENUM_STYLE_OUT_OF_RANGE\nAn invalid page-num-style was set." }
+     { 0x1072  "HPDF_ANNOT_INVALID_ICON\nAn invalid icon was set." }
+     { 0x1073  "HPDF_ANNOT_INVALID_BORDER_STYLE\nAn invalid border-style was set." }
+     { 0x1074  "HPDF_PAGE_INVALID_DIRECTION\nAn invalid page-direction was set." }
+     { 0x1075  "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/pdf/pdf-tests.factor b/pdf/pdf-tests.factor
new file mode 100644 (file)
index 0000000..290773a
--- /dev/null
@@ -0,0 +1,98 @@
+USING: io.files kernel math namespaces pdf pdf.libhpdf prettyprint sequences ;
+IN: pdf.tests
+
+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
+
+    "font_test.pdf" temp-file save-to-file
+
+] with-pdf
diff --git a/pdf/pdf.factor b/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/pdf/readme.txt b/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/peg-lexer/authors.txt b/peg-lexer/authors.txt
new file mode 100644 (file)
index 0000000..2300f69
--- /dev/null
@@ -0,0 +1 @@
+Sam Anklesaria
diff --git a/peg-lexer/peg-lexer-docs.factor b/peg-lexer/peg-lexer-docs.factor
new file mode 100644 (file)
index 0000000..df7c628
--- /dev/null
@@ -0,0 +1,14 @@
+USING: peg.ebnf help.syntax help.markup strings ;
+IN: peg-lexer
+
+HELP: ON-BNF:
+{ $syntax "ON-BNF: word ... ;ON-BNF" }
+{ $description "Creates a parsing word using a parser for lexer control, adding the resulting ast to the stack.  Parser syntax is as in " { $link POSTPONE: EBNF: } } ;
+
+HELP: create-bnf
+{ $values { "name" string } { "parser" parser } }
+{ $description "Runtime equivalent of " { $link POSTPONE: ON-BNF: } " also useful with manually constructed parsers." } ;
+
+HELP: factor
+{ $values { "input" string } { "ast" "a sequence of tokens" } }
+{ $description "Tokenizer that acts like standard factor lexer, separating tokens by whitespace." } ;
diff --git a/peg-lexer/peg-lexer-tests.factor b/peg-lexer/peg-lexer-tests.factor
new file mode 100644 (file)
index 0000000..560d60e
--- /dev/null
@@ -0,0 +1,14 @@
+USING: tools.test peg-lexer.test-parsers ;
+IN: peg-lexer.tests
+
+{ V{ "1234" "-end" } } [
+   test1 1234-end
+] unit-test
+
+{ V{ 1234 53 } } [
+   test2 12345
+] unit-test
+
+{ V{ "heavy" "duty" "testing" } } [
+   test3 heavy duty testing
+] unit-test
diff --git a/peg-lexer/peg-lexer.factor b/peg-lexer/peg-lexer.factor
new file mode 100644 (file)
index 0000000..7449b92
--- /dev/null
@@ -0,0 +1,64 @@
+USING: hashtables assocs sequences locals math accessors multiline delegate strings
+delegate.protocols kernel peg peg.ebnf peg.private lexer namespaces combinators parser
+words ;
+IN: peg-lexer
+
+TUPLE: lex-hash hash ;
+CONSULT: assoc-protocol lex-hash hash>> ;
+: <lex-hash> ( a -- lex-hash ) lex-hash boa ;
+
+: pos-or-0 ( neg? -- pos/0 ) dup 0 < [ drop 0 ] when ;
+
+:: prepare-pos ( v i -- c l )
+    [let | n [ i v head-slice ] |
+           v CHAR: \n n last-index -1 or 1 + -
+           n [ CHAR: \n = ] count 1 +
+    ] ;
+
+: store-pos ( v a -- )
+    input of prepare-pos
+    lexer get [ line<< ] keep column<< ;
+
+M: lex-hash set-at
+    swap {
+        { pos [ store-pos ] }
+        [ swap hash>> set-at ]
+    } case ;
+
+:: at-pos ( t l c -- p ) t l head-slice [ length ] map-sum l 1 - + c + ;
+
+M: lex-hash at*
+    swap {
+      { input [ drop lexer get text>> "\n" join t ] }
+      { pos [ drop lexer get [ text>> ] [ line>> 1 - ] [ column>> 1 + ] tri at-pos t ] }
+      [ swap hash>> at* ]
+    } case ;
+
+: with-global-lexer ( quot -- result )
+   [
+       f lrstack set
+       V{ } clone error-stack set H{ } clone \ heads set
+       H{ } clone \ packrat set
+   ] f make-assoc <lex-hash>
+   swap bind ; inline
+
+: parse* ( parser -- ast )
+    compile
+    [ execute [ error-stack get first throw ] unless* ] with-global-lexer
+    ast>> ; inline
+
+: create-bnf ( name parser -- )
+    reset-tokenizer [ lexer get skip-blank parse* dup ignore? [ drop ] [ parsed ] if ] curry
+    define-syntax word make-inline ;
+    
+SYNTAX: ON-BNF:
+    scan-new-word reset-tokenizer ";ON-BNF" parse-multiline-string parse-ebnf
+    main of create-bnf ;
+
+! Tokenizer like standard factor lexer
+EBNF: factor
+space = " " | "\n" | "\t"
+spaces = space* => [[ drop ignore ]]
+chunk = (!(space) .)+ => [[ >string ]]
+expr = spaces chunk
+;EBNF
diff --git a/peg-lexer/summary.txt b/peg-lexer/summary.txt
new file mode 100644 (file)
index 0000000..2de36ba
--- /dev/null
@@ -0,0 +1 @@
+Use peg to write parsing words
diff --git a/peg-lexer/tags.txt b/peg-lexer/tags.txt
new file mode 100644 (file)
index 0000000..44385cf
--- /dev/null
@@ -0,0 +1,2 @@
+extensions
+reflection
diff --git a/peg-lexer/test-parsers/test-parsers.factor b/peg-lexer/test-parsers/test-parsers.factor
new file mode 100644 (file)
index 0000000..188ef32
--- /dev/null
@@ -0,0 +1,17 @@
+USING: peg-lexer math.parser strings ;
+IN: peg-lexer.test-parsers
+
+ON-BNF: test1
+      num = [1-4]* => [[ >string ]]
+      expr = num ( "-end" | "-done" )
+;ON-BNF
+
+ON-BNF: test2
+      num = [1-4]* => [[ >string string>number ]]
+      expr= num [5-9]
+;ON-BNF
+
+ON-BNF: test3
+      tokenizer = <foreign factor>
+      expr= "heavy" "duty" "testing"
+;ON-BNF
diff --git a/persistency/authors.txt b/persistency/authors.txt
new file mode 100644 (file)
index 0000000..2300f69
--- /dev/null
@@ -0,0 +1 @@
+Sam Anklesaria
diff --git a/persistency/persistency.factor b/persistency/persistency.factor
new file mode 100644 (file)
index 0000000..fd284e4
--- /dev/null
@@ -0,0 +1,30 @@
+USING: accessors arrays byte-arrays calendar classes
+classes.tuple classes.tuple.parser combinators db db.queries
+db.tuples db.types kernel math nmake parser sequences strings
+strings.parser unicode urls words ;
+IN: persistency
+
+TUPLE: persistent id ;
+
+: add-types ( table -- table' ) [ dup array? [ [ first dup >upper ] [ second ] bi 3array ]
+        [ dup >upper FACTOR-BLOB 3array ] if
+    ] map { "id" "ID" +db-assigned-id+ } prefix ;
+
+: remove-types ( table -- table' ) [ dup array? [ first ] when ] map ;
+
+SYNTAX: STORED-TUPLE: parse-tuple-definition [ drop persistent ] dip [ remove-types define-tuple-class ]
+   [ nip [ dup name>> >upper ] [ add-types ] bi* define-persistent ] 3bi ;
+
+: define-db ( database class -- ) swap [ [ ensure-table ] with-db ] [ "database" set-word-prop ] 2bi ;
+
+: query>tuple ( tuple/query -- tuple ) dup query? [ tuple>> ] when ;
+: w/db ( query quot -- ) [ dup query>tuple class-of "database" word-prop ] dip with-db ; inline
+: get-tuples ( query -- tuples ) [ select-tuples ] w/db ;
+: get-tuple ( query -- tuple ) [ select-tuple ] w/db ;
+: store-tuple ( tuple -- ) [ insert-tuple ] w/db ;
+: modify-tuple ( tuple -- ) [ update-tuple ] w/db ;
+: remove-tuples ( tuple -- ) [ delete-tuples ] w/db ;
+
+TUPLE: pattern value ; C: <pattern> pattern
+SYNTAX: %" parse-string <pattern> suffix! ;
+M: pattern where value>> over column-name>> 0% " LIKE " 0% bind# ;
diff --git a/physics/pos/pos.factor b/physics/pos/pos.factor
new file mode 100644 (file)
index 0000000..6915568
--- /dev/null
@@ -0,0 +1,17 @@
+
+USING: kernel sequences multi-methods accessors math.vectors ;
+
+IN: math.physics.pos
+
+TUPLE: pos pos ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+GENERIC: distance ( a b -- c )
+
+METHOD: distance { sequence sequence } v- norm ;
+
+METHOD: distance { pos pos } [ pos>> ] bi@ distance ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
diff --git a/physics/vel/vel.factor b/physics/vel/vel.factor
new file mode 100644 (file)
index 0000000..5fc815e
--- /dev/null
@@ -0,0 +1,7 @@
+
+USING: math.physics.pos ;
+
+IN: math.physics.vel
+
+TUPLE: vel < pos vel ;
+
diff --git a/random-weighted/authors.txt b/random-weighted/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/random-weighted/random-weighted.factor b/random-weighted/random-weighted.factor
new file mode 100644 (file)
index 0000000..47c85a6
--- /dev/null
@@ -0,0 +1,20 @@
+
+USING: kernel namespaces arrays quotations sequences assocs combinators
+       mirrors math math.vectors random macros fry ;
+
+IN: random-weighted
+
+: probabilities ( weights -- probabilities ) dup sum v/n ;
+
+: layers ( probabilities -- layers )
+dup length 1+ [ head ] with map rest [ 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 ;
+
+MACRO: call-random-weighted ( exp -- )
+  [ keys ] [ values <enum> >alist ] bi
+  '[ _ random-weighted _ case ] ;
diff --git a/recipes/authors.txt b/recipes/authors.txt
new file mode 100644 (file)
index 0000000..2300f69
--- /dev/null
@@ -0,0 +1 @@
+Sam Anklesaria
diff --git a/recipes/icons/back.tiff b/recipes/icons/back.tiff
new file mode 100644 (file)
index 0000000..27b8112
Binary files /dev/null and b/recipes/icons/back.tiff differ
diff --git a/recipes/icons/hate.tiff b/recipes/icons/hate.tiff
new file mode 100644 (file)
index 0000000..d7d5f8e
Binary files /dev/null and b/recipes/icons/hate.tiff differ
diff --git a/recipes/icons/love.tiff b/recipes/icons/love.tiff
new file mode 100644 (file)
index 0000000..ae2fa7b
Binary files /dev/null and b/recipes/icons/love.tiff differ
diff --git a/recipes/icons/more.tiff b/recipes/icons/more.tiff
new file mode 100644 (file)
index 0000000..b4ec27b
Binary files /dev/null and b/recipes/icons/more.tiff differ
diff --git a/recipes/icons/submit.tiff b/recipes/icons/submit.tiff
new file mode 100644 (file)
index 0000000..7c98267
Binary files /dev/null and b/recipes/icons/submit.tiff differ
diff --git a/recipes/recipes.factor b/recipes/recipes.factor
new file mode 100644 (file)
index 0000000..0216b2b
--- /dev/null
@@ -0,0 +1,61 @@
+USING: accessors arrays colors.constants combinators
+db.sqlite db.tuples db.types kernel locals math
+monads persistency sequences sequences.extras ui ui.gadgets.controls
+ui.gadgets.layout models.combinators ui.gadgets.labels
+ui.gadgets.scrollers ui.pens.solid io.files.temp ;
+FROM: sets => prune ;
+IN: recipes
+
+STORED-TUPLE: recipe { title { VARCHAR 100 } } { votes INTEGER } { txt TEXT } { genre { VARCHAR 100 } } ;
+: <recipe> ( title genre text -- recipe ) recipe new swap >>txt swap >>genre swap >>title 0 >>votes ;
+"recipes.db" temp-file <sqlite-db> recipe define-db
+: top-recipes ( offset search -- recipes ) <query> T{ recipe } rot >>title >>tuple
+    "votes" >>order 30 >>limit swap >>offset get-tuples ;
+: top-genres ( -- genres ) f f top-recipes [ genre>> ] map prune 4 short head-slice ;
+
+: interface ( -- book ) [ 
+     [
+        [ $ TOOLBAR $ ] <hbox> COLOR: AliceBlue <solid> >>interior ,
+        [ "Genres:" <label> , <spacer> $ ALL $ $ GENRES $ ] <hbox>
+            { 5 0 } >>gap COLOR: gray <solid> >>interior ,
+        $ RECIPES $
+     ] <vbox> ,
+     [
+        [ "Title:" <label> , $ TITLE $ "Genre:" <label> , $ GENRE $ ] <hbox> ,
+        $ BODY $
+        $ BUTTON $
+     ] <vbox> ,
+  ] <book*> { 350 245 } >>pref-dim ;
+  
+:: recipe-browser ( -- ) [ [
+    interface
+      <table*> :> tbl
+      "okay" <model-border-btn> BUTTON -> :> ok
+      IMG-MODEL-BTN: submit [ store-tuple ] >>value TOOLBAR -> :> submit
+      IMG-MODEL-BTN: love 1 >>value TOOLBAR ->
+      IMG-MODEL-BTN: hate -1 >>value -> 2array merge :> votes
+      IMG-MODEL-BTN: back -> [ -30 ] <$
+      IMG-MODEL-BTN: more -> [ 30 ] <$ 2array merge :> viewed
+      <spacer> <model-field*> ->% 1 :> search
+      submit ok [ [ drop ] ] <$ 2array merge [ drop ] >>value :> quot
+      viewed 0 [ + ] fold search ok t <basic> "all" <model-btn> ALL ->
+      tbl selection>> votes [ [ + ] curry change-votes modify-tuple ] 2$>
+        4array merge
+        [ drop [ f ] [ "%" dup surround <pattern> ] if-empty top-recipes ] 3fmap :> ups
+      ups [ top-genres [ <model-btn> GENRES -> ] map merge ] bind*
+        [ text>> T{ recipe } swap >>genre get-tuples ] fmap
+      tbl swap ups 2merge >>model
+        [ [ title>> ] [ genre>> ] bi 2array ] >>quot
+        { "Title" "Genre" } >>column-titles dup <scroller> RECIPES ,% 1 actions>>
+      submit [ "" dup dup <recipe> ] <$ 2array merge
+        { [ [ title>> ] fmap <model-field> TITLE ->% .5 ]
+          [ [ genre>> ] fmap <model-field> GENRE ->% .5 ]
+          [ [ txt>> ] fmap <model-editor> BODY ->% 1 ]
+        } cleave
+        [ <recipe> ] 3fmap
+      [ [ 1 ] <$ ]
+      [ quot ok updates #1 [ call( recipe -- ) 0 ] 2fmap ] bi
+      2merge 0 <basic> switch-models >>model
+   ] with-interface "recipes" open-window ] with-ui ;
+
+MAIN: recipe-browser
diff --git a/recipes/summary.txt b/recipes/summary.txt
new file mode 100644 (file)
index 0000000..98b1ece
--- /dev/null
@@ -0,0 +1 @@
+Database backed recipe sharing
\ No newline at end of file
diff --git a/run-desc/run-desc.factor b/run-desc/run-desc.factor
new file mode 100644 (file)
index 0000000..6acf66d
--- /dev/null
@@ -0,0 +1,3 @@
+USING: io io.encodings.utf8 io.launcher kernel sequences ;
+IN: run-desc
+: run-desc ( desc -- result ) utf8 [ contents [ but-last ] [ f ] if* ] with-process-reader ;
diff --git a/sandbox/authors.txt b/sandbox/authors.txt
new file mode 100644 (file)
index 0000000..f97e1bf
--- /dev/null
@@ -0,0 +1 @@
+Maxim Savchenko
diff --git a/sandbox/sandbox-tests.factor b/sandbox/sandbox-tests.factor
new file mode 100644 (file)
index 0000000..5d0496e
--- /dev/null
@@ -0,0 +1,57 @@
+! Copyright (C) 2009 Maxim Savchenko
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: kernel accessors continuations lexer vocabs vocabs.parser
+       combinators.short-circuit sandbox tools.test ;
+
+IN: sandbox.tests
+
+<< "sandbox.syntax" load-vocab drop >>
+USE: sandbox.syntax.private
+
+: run-script ( x lines -- y )
+    H{ { "kernel" "kernel" } { "math" "math" } { "sequences" "sequences" } }
+    parse-sandbox call( x -- x! ) ;
+
+[ 120 ]
+[
+    5
+    {
+        "! Simple factorial example"
+        "APPLYING: kernel math sequences ;"
+        "1 swap [ 1+ * ] each"
+    } run-script
+] unit-test
+
+[
+    5
+    {
+        "! Jailbreak attempt with USE:"
+        "USE: io"
+        "\"Hello world!\" print"
+    } run-script
+]
+[
+    {
+        [ lexer-error? ]
+        [ error>> condition? ]
+        [ error>> error>> no-word-error? ]
+        [ error>> error>> name>> "USE:" = ]
+    } 1&&
+] must-fail-with
+
+[
+    5
+    {
+        "! Jailbreak attempt with unauthorized APPLY:"
+        "APPLY: io"
+        "\"Hello world!\" print"
+    } run-script
+]
+[
+    {
+        [ lexer-error? ]
+        [ error>> sandbox-error? ]
+        [ error>> vocab>> "io" = ]
+    } 1&&
+] must-fail-with
diff --git a/sandbox/sandbox.factor b/sandbox/sandbox.factor
new file mode 100644 (file)
index 0000000..097a7c8
--- /dev/null
@@ -0,0 +1,23 @@
+! Copyright (C) 2009 Maxim Savchenko.
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: kernel sequences vectors assocs namespaces parser lexer vocabs
+       combinators.short-circuit vocabs.parser ;
+
+IN: sandbox
+
+SYMBOL: whitelist
+
+: with-sandbox-vocabs ( quot -- )
+    "sandbox.syntax" load-vocab vocab-words 1vector
+    use [ auto-use? off call ] with-variable ; inline
+
+: parse-sandbox ( lines assoc -- quot )
+    whitelist [ [ parse-lines ] with-sandbox-vocabs ] with-variable ;
+
+: reveal-in ( name -- )
+    [ { [ search ] [ no-word ] } 1|| ] keep current-vocab vocab-words set-at ;
+
+SYNTAX: REVEAL: scan reveal-in ;
+
+SYNTAX: REVEALING: ";" parse-tokens [ reveal-in ] each ;
diff --git a/sandbox/summary.txt b/sandbox/summary.txt
new file mode 100644 (file)
index 0000000..3ca1e25
--- /dev/null
@@ -0,0 +1 @@
+Basic sandboxing
diff --git a/sandbox/syntax/syntax.factor b/sandbox/syntax/syntax.factor
new file mode 100644 (file)
index 0000000..474ce12
--- /dev/null
@@ -0,0 +1,26 @@
+! Copyright (C) 2009 Maxim Savchenko.
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: kernel sequences assocs namespaces lexer vocabs.parser sandbox ;
+IN: sandbox.syntax
+
+<PRIVATE
+
+ERROR: sandbox-error vocab ;
+
+: sandbox-use+ ( alias -- )
+    dup whitelist get at [ add-use ] [ sandbox-error ] ?if ;
+
+PRIVATE>
+
+SYNTAX: APPLY: scan sandbox-use+ ;
+
+SYNTAX: APPLYING: ";" parse-tokens [ sandbox-use+ ] each ;
+
+REVEALING:
+    ! !
+    HEX: OCT: BIN: f t CHAR: "
+    [ { T{
+    ] } ;
+
+REVEAL: ;
diff --git a/semantic-db/authors.txt b/semantic-db/authors.txt
new file mode 100644 (file)
index 0000000..e9c193b
--- /dev/null
@@ -0,0 +1 @@
+Alex Chapman
diff --git a/semantic-db/semantic-db-tests.factor b/semantic-db/semantic-db-tests.factor
new file mode 100644 (file)
index 0000000..6747141
--- /dev/null
@@ -0,0 +1,67 @@
+USING: accessors arrays continuations db db.sqlite db.tuples io.files
+kernel math namespaces semantic-db sequences sorting tools.test
+tools.walker ;
+IN: semantic-db.tests
+
+SYMBOL: context
+
+: db-path "semantic-db-test.db" temp-file ;
+: test-db db-path sqlite-db ;
+: delete-db db-path ?delete-file ;
+
+delete-db
+
+test-db [
+    node create-table arc create-table
+    [ 1 ] [ "first node" create-node id>> ] unit-test
+    [ 2 ] [ "second node" create-node id>> ] unit-test
+    [ 3 ] [ "third node" create-node id>> ] unit-test
+    [ 4 ] [ f create-node id>> ] unit-test
+    [ ] [ 1 f <node> 2 f <node> 3 f <node> create-arc ] unit-test
+    [ { 1 2 3 4 } ] [ all-node-ids ] unit-test
+] with-db delete-db
+
+ test-db [
+     init-semantic-db
+     "test content" create-context context set
+     [ T{ node f 3 "test content" } ] [ context get ] unit-test
+     [ T{ node f 4 "is test content" } ] [ "is test content" context get create-relation ] unit-test
+     [ T{ node f 4 "is test content" } ] [ "is test content" context get get-relation ] unit-test
+     [ T{ node f 4 "is test content" } ] [ "is test content" context get ensure-relation ] unit-test
+     [ T{ node f 5 "has parent" } ] [ "has parent" context get ensure-relation ] unit-test
+     [ T{ node f 5 "has parent" } ] [ "has parent" context get ensure-relation ] unit-test
+     [ "has parent" ] [ "has parent" context get ensure-relation node-content ] unit-test
+     [ "test content" ] [ context get node-content ] unit-test
+ ] with-db delete-db
+ ! "test1" "test1-relation-id-word" f f f f <relation-definition> define-relation
+ ! "test2" t t t t t <relation-definition> define-relation
+ RELATION: test3
+ test-db [
+     init-semantic-db
+     ! [ T{ node f 3 "test1" } ] [ test1-relation-id-word ] unit-test
+     ! [ T{ node f 4 "test2" } ] [ test2-relation ] unit-test
+     [ T{ node f 4 "test3" } ] [ test3-relation ] unit-test
+ ] with-db delete-db
+ ! test hierarchy
+ RELATION: has-parent
+ test-db [
+     init-semantic-db
+     "adam" create-node "adam" set
+     "eve" create-node "eve" set
+     "bob" create-node "bob" set
+     "fran" create-node "fran" set
+     "charlie" create-node "charlie" set
+     "gertrude" create-node "gertrude" set
+      [ ] [ "bob" get "adam" get has-parent ] unit-test
+     { { "bob" "eve" } { "fran" "eve" } { "gertrude" "bob" } { "fran" "bob" } { "charlie" "fran" } } [ first2 [ get ] bi@ has-parent ] each
+     [ { "bob" "fran" } ] [ "eve" get has-parent-relation children [ node-content ] map ] unit-test
+     [ { "adam" "eve" } ] [ "bob" get has-parent-relation parents [ node-content ] map ] unit-test
+     [ "fran" { "charlie" } ] [ "fran" get has-parent-relation get-node-tree-s dup node>> node-content swap children>> [ node>> node-content ] map ] unit-test
+     [ { "adam" "eve" } ] [ "charlie" get has-parent-relation get-root-nodes [ node-content ] map natural-sort >array ] unit-test
+     [ { } ] [ "charlie" get dup "fran" get !has-parent has-parent-relation parents [ node-content ] map ] unit-test
+     [ { "adam" "eve" } ] [ has-parent-relation ultimate-objects node-results [ node-content ] map ] unit-test
+     [ { "fran" "gertrude" } ] [ has-parent-relation ultimate-subjects node-results [ node-content ] map ] unit-test
+ ] with-db delete-db
diff --git a/semantic-db/semantic-db.factor b/semantic-db/semantic-db.factor
new file mode 100644 (file)
index 0000000..f2bf9ad
--- /dev/null
@@ -0,0 +1,285 @@
+! Copyright (C) 2008 Alex Chapman
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors arrays combinators combinators.cleave combinators.lib
+continuations db db.tuples db.types db.sqlite kernel math
+math.parser namespaces parser lexer sets sequences sequences.deep
+sequences.lib strings words destructors ;
+IN: semantic-db
+
+TUPLE: node id content ;
+C: <node> node
+
+node "node"
+{
+    { "id" "id" +db-assigned-id+ +autoincrement+ }
+    { "content" "content" TEXT }
+} define-persistent
+
+: delete-node ( node -- ) delete-tuples ;
+: create-node ( content -- node ) f swap <node> dup insert-tuple ;
+: load-node ( id -- node ) f <node> select-tuple ;
+
+: node-content ( node -- content )
+    dup content>> [ ] [ select-tuple content>> ] ?if ;
+
+: node= ( node node -- ? ) [ id>> ] same? ;
+
+! TODO: get rid of arc id and write our own sql
+TUPLE: arc id subject object relation ;
+
+: <arc> ( subject object relation -- arc )
+    arc new swap >>relation swap >>object swap >>subject ;
+
+: <id-arc> ( id -- arc )
+    arc new swap >>id ;
+
+: delete-arc ( arc -- ) delete-tuples ;
+
+: create-arc ( subject object relation -- )
+    [ id>> ] tri@ <arc> insert-tuple ;
+
+: nodes>arc ( subject object relation -- arc )
+    [ [ id>> ] [ f ] if* ] tri@ <arc> ;
+
+: select-arcs ( subject object relation -- arcs )
+    nodes>arc select-tuples ;
+
+: has-arc? ( subject object relation -- ? )
+    select-arcs length 0 > ;
+
+: select-arc-subjects ( subject object relation -- subjects )
+    select-arcs [ subject>> f <node> ] map ;
+
+: select-arc-subject ( subject object relation -- subject )
+    select-arcs ?first [ subject>> f <node> ] [ f ] if* ;
+
+: select-subjects ( object relation -- subjects )
+    f -rot select-arc-subjects ;
+
+: select-subject ( object relation -- subject )
+    f -rot select-arc-subject ;
+
+: select-arc-objects ( subject object relation -- objects )
+    select-arcs [ object>> f <node> ] map ;
+
+: select-arc-object ( subject object relation -- object )
+    select-arcs ?first [ object>> f <node> ] [ f ] if* ;
+
+: select-objects ( subject relation -- objects )
+    f swap select-arc-objects ;
+
+: select-object ( subject relation -- object )
+    f swap select-arc-object ;
+
+: delete-arcs ( subject object relation -- )
+    select-arcs [ delete-arc ] each ;
+
+arc "arc"
+{
+    { "id" "id" +db-assigned-id+ +autoincrement+ }
+    { "relation" "relation" INTEGER +not-null+ }
+    { "subject" "subject" INTEGER +not-null+ }
+    { "object" "object" INTEGER +not-null+ }
+} define-persistent
+
+: create-bootstrap-nodes ( -- )
+    "semantic-db" create-node drop
+    "has-context" create-node drop ;
+
+: semantic-db-context  T{ node f 1 "semantic-db" } ;
+: has-context-relation T{ node f 2 "has-context" } ;
+
+: create-bootstrap-arcs ( -- )
+    has-context-relation semantic-db-context has-context-relation create-arc ;
+
+: init-semantic-db ( -- )
+    node create-table arc create-table
+    create-bootstrap-nodes create-bootstrap-arcs ;
+
+! db utilities
+: results ( bindings sql -- array )
+    f f <simple-statement> [ do-bound-query ] with-disposal ;
+
+: node-result ( result -- node )
+    dup first string>number swap second <node> ;
+
+: ?1node-result ( results -- node )
+    ?first [ node-result ] [ f ] if* ;
+
+: node-results ( results -- nodes )
+    [ node-result ] map ;
+
+: param ( value key type -- param )
+    swapd <sqlite-low-level-binding> ;
+
+: all-node-ids ( -- seq )
+    f "select n.id from node n" results [ first string>number ] map ;
+
+: subjects-with-cor ( content object relation -- sql-results )
+    [ id>> ] bi@
+    [
+        ":relation" INTEGER param ,
+        ":object" INTEGER param ,
+        ":content" TEXT param ,
+    ] { } make
+    "select n.id, n.content from node n, arc a where n.content = :content and n.id = a.subject and a.relation = :relation and a.object = :object" results ;
+
+: objects-with-csr ( content subject relation -- sql-results )
+    [ id>> ] bi@
+    [
+        ":relation" INTEGER param ,
+        ":subject" INTEGER param ,
+        ":content" TEXT param ,
+    ] { } make
+    "select n.id, n.content from node n, arc a where n.content = :content and n.id = a.object and a.relation = :relation and a.subject = :subject" results ;
+
+: (with-relation) ( content relation -- bindings sql )
+    id>> [ ":relation" INTEGER param , ":content" TEXT param , ] { } make
+    "select distinct n.id, n.content from node n, arc a where n.content = :content and a.relation = :relation" ;
+
+: subjects-with-relation ( content relation -- sql-results )
+    (with-relation) " and a.object = n.id" append results ;
+
+: objects-with-relation ( content relation -- sql-results )
+    (with-relation) " and a.subject = n.id" append results ;
+
+: (ultimate) ( relation b a -- sql-results )
+    [
+        "select distinct n.id, n.content from node n, arc a where a.relation = :relation and n.id = a." % % " and n.id not in (select b." % % " from arc b where b.relation = :relation)" %
+    ] "" make [ id>> ":relation" INTEGER param 1array ] dip results ;
+
+: ultimate-objects ( relation -- sql-results )
+    "subject" "object" (ultimate) ;
+
+: ultimate-subjects ( relation -- sql-results )
+    "object" "subject" (ultimate) ;
+
+! contexts:
+!  - a node n is a context iff there exists a relation r such that r has context n
+: create-context ( context-name -- context ) create-node ;
+
+: get-context ( context-name -- context/f )
+    has-context-relation subjects-with-relation ?1node-result ;
+
+: ensure-context ( context-name -- context )
+    dup get-context [
+        nip
+    ] [
+        create-context
+    ] if* ;
+
+! relations:
+!  - have a context in context 'semantic-db'
+
+: create-relation ( relation-name context -- relation )
+    [ create-node dup ] dip has-context-relation create-arc ;
+
+: get-relation ( relation-name context -- relation/f )
+    has-context-relation subjects-with-cor ?1node-result ;
+
+: ensure-relation ( relation-name context -- relation )
+    2dup get-relation [
+        2nip
+    ] [
+        create-relation
+    ] if* ;
+
+TUPLE: relation-definition relate id-word unrelate related? subjects objects ;
+C: <relation-definition> relation-definition
+
+<PRIVATE
+
+: default-word-name ( relate-word-name word-type -- name>> )
+    {
+        { "relate" [ ] }
+        { "id-word" [ "-relation" append ] }
+        { "unrelate" [ "!" swap append ] }
+        { "related?" [ "?" append ] }
+        { "subjects" [ "-subjects" append ] }
+        { "objects" [ "-objects" append ] }
+    } case ;
+
+: choose-word-name ( relation-definition given-word-name word-type -- name>> )
+    over string? [
+        drop nip
+    ] [
+        nip [ relate>> ] dip default-word-name
+    ] if ;
+
+: (define-relation-word) ( id-word name>> definition -- id-word )
+    >r create-word-in over [ execute ] curry r> compose define ;
+
+: define-relation-word ( relation-definition id-word given-word-name word-type definition -- relation-definition id-word )
+    >r >r [
+        pick swap r> choose-word-name r> (define-relation-word)
+    ] [
+        r> r> 2drop
+    ] if*  ;
+
+: define-relation-words ( relation-definition id-word -- )
+    over relate>> "relate" [ create-arc ] define-relation-word
+    over unrelate>> "unrelate" [ delete-arcs ] define-relation-word
+    over related?>> "related?" [ has-arc? ] define-relation-word
+    over subjects>> "subjects" [ select-subjects ] define-relation-word
+    over objects>> "objects" [ select-objects ] define-relation-word
+    2drop ;
+
+: define-id-word ( relation-definition id-word -- )
+    [ relate>> ] dip tuck vocabulary>>
+    [ ensure-context ensure-relation ] 2curry define ;
+
+: create-id-word ( relation-definition -- id-word )
+    dup id-word>> "id-word" choose-word-name create-word-in ;
+
+PRIVATE>
+
+: define-relation ( relation-definition -- )
+    dup create-id-word 2dup define-id-word define-relation-words ;
+
+: RELATION:
+    scan t t t t t <relation-definition> define-relation ; parsing
+
+! hierarchy
+TUPLE: node-tree node children ;
+C: <node-tree> node-tree
+
+: children ( node has-parent-relation -- children ) select-subjects ;
+: parents ( node has-parent-relation -- parents ) select-objects ;
+
+: get-node-tree ( node child-selector -- node-tree )
+    2dup call >r [ get-node-tree ] curry r> swap map <node-tree> ;
+
+! : get-node-tree ( node has-parent-relation -- node-tree )
+!     2dup children >r [ get-node-tree ] curry r> swap map <node-tree> ;
+: get-node-tree-s ( node has-parent-relation -- tree )
+    [ select-subjects ] curry get-node-tree ;
+
+: get-node-tree-o ( node has-child-relation -- tree )
+    [ select-objects ] curry get-node-tree ;
+
+: (get-node-chain) ( node next-selector seq -- seq )
+    pick [
+        suffix! >r [ call ] keep r> (get-node-chain)
+    ] [
+        2nip
+    ] if* ;
+
+: get-node-chain ( node next-selector -- seq )
+    V{ } clone (get-node-chain) ;
+
+: get-node-chain-o ( node relation -- seq )
+    [ select-object ] curry get-node-chain ;
+
+: get-node-chain-s ( node relation -- seq )
+    [ select-subject ] curry get-node-chain ;
+
+: (get-root-nodes) ( node has-parent-relation -- root-nodes/node )
+    2dup parents dup empty? [
+        2drop
+    ] [
+        >r nip [ (get-root-nodes) ] curry r> swap map
+    ] if ;
+
+: get-root-nodes ( node has-parent-relation -- root-nodes )
+    (get-root-nodes) flatten prune ;
+
diff --git a/set-n/set-n.factor b/set-n/set-n.factor
new file mode 100644 (file)
index 0000000..0807b76
--- /dev/null
@@ -0,0 +1,9 @@
+USING: accessors assocs fry generalizations kernel locals math
+namespaces parser sequences shuffle words effects.parser ;
+IN: set-n
+: get* ( var n -- val ) namestack dup length rot - head assoc-stack ;
+
+: set* ( val var n -- ) 1 + namestack [ length swap - ] keep nth set-at ;
+
+! dynamic lambda
+SYNTAX: :| (:) dup in>> dup length [ spin '[ _ narray _ swap zip _ bind ] ] 2curry dip define-declared ;
diff --git a/size-of/size-of.factor b/size-of/size-of.factor
new file mode 100644 (file)
index 0000000..c5fae3c
--- /dev/null
@@ -0,0 +1,61 @@
+
+USING: io io.encodings.ascii io.files io.files.temp io.launcher
+       locals math.parser sequences sequences.deep
+       help.syntax
+       easy-help ;
+
+IN: size-of
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+Word: size-of
+
+Values:
+
+    HEADERS sequence : List of header files
+    TYPE    string : A C type
+    n       integer : Size in number of bytes ..
+
+Description:
+
+    Use 'size-of' to find out the size in bytes of a C type. 
+
+    The 'headers' argument is a list of header files to use. You may 
+    pass 'f' to only use 'stdio.h'. ..
+
+Example:
+
+    ! Find the size of 'int'
+
+    f "int" size-of .    ..
+
+Example:
+
+    ! Find the size of the 'XAnyEvent' struct from Xlib.h
+
+    { "X11/Xlib.h" } "XAnyEvent" size-of .    ..
+
+;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+:: size-of ( HEADERS TYPE -- n )
+
+  [let | C-FILE   [ "size-of.c" temp-file ]
+         EXE-FILE [ "size-of"   temp-file ]
+         INCLUDES [ HEADERS [| FILE | { "#include <" FILE ">" } concat ] map ] |
+
+    {
+      "#include <stdio.h>"
+      INCLUDES
+      "main() { printf( \"%i\" , sizeof( " TYPE " ) ) ; }"
+    }
+
+    flatten C-FILE  ascii  set-file-lines
+
+    { "gcc" C-FILE "-o" EXE-FILE } try-process
+
+    EXE-FILE ascii <process-reader> contents string>number ] ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
diff --git a/sniffer/channels/backend/backend.factor b/sniffer/channels/backend/backend.factor
new file mode 100644 (file)
index 0000000..c7c2e42
--- /dev/null
@@ -0,0 +1,3 @@
+USING: io.backend ;
+
+HOOK: sniff-channel io-backend ( -- channel ) 
diff --git a/sniffer/channels/bsd/bsd.factor b/sniffer/channels/bsd/bsd.factor
new file mode 100644 (file)
index 0000000..f986f11
--- /dev/null
@@ -0,0 +1,16 @@
+! 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.backend
+threads io io.sniffer.backend io.sniffer.bsd
+io.unix.backend ;
+IN: channels.sniffer.bsd
+
+M: unix-io sniff-channel ( -- channel ) 
+  "/dev/bpf0" "en1" <sniffer-spec> <sniffer> <channel> [
+    [
+      (sniff-channel) 
+    ] 3curry spawn drop
+  ] keep ;
+
diff --git a/sniffer/channels/sniffer.factor b/sniffer/channels/sniffer.factor
new file mode 100644 (file)
index 0000000..cbf31c7
--- /dev/null
@@ -0,0 +1,11 @@
+! 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 io io.backend io.sniffer
+io.sniffer.backend system vocabs.loader ;
+
+: (sniff-channel) ( stream channel -- ) 
+  4096 pick stream-read-partial over to (sniff-channel) ;
+
+bsd? [ "channels.sniffer.bsd" require ] when
diff --git a/sniffer/io/authors.txt b/sniffer/io/authors.txt
new file mode 100644 (file)
index 0000000..7a1ef51
--- /dev/null
@@ -0,0 +1,2 @@
+Doug Coleman
+Elie Chaftari
diff --git a/sniffer/io/backend/authors.txt b/sniffer/io/backend/authors.txt
new file mode 100644 (file)
index 0000000..7a1ef51
--- /dev/null
@@ -0,0 +1,2 @@
+Doug Coleman
+Elie Chaftari
diff --git a/sniffer/io/backend/backend.factor b/sniffer/io/backend/backend.factor
new file mode 100644 (file)
index 0000000..53bf37a
--- /dev/null
@@ -0,0 +1,6 @@
+USING: io.backend kernel system vocabs.loader ;
+IN: io.sniffer.backend
+
+SYMBOL: sniffer-type
+TUPLE: sniffer ;
+HOOK: <sniffer> io-backend ( obj -- sniffer )
diff --git a/sniffer/io/bsd/authors.txt b/sniffer/io/bsd/authors.txt
new file mode 100644 (file)
index 0000000..7a1ef51
--- /dev/null
@@ -0,0 +1,2 @@
+Doug Coleman
+Elie Chaftari
diff --git a/sniffer/io/bsd/bsd.factor b/sniffer/io/bsd/bsd.factor
new file mode 100644 (file)
index 0000000..f20469c
--- /dev/null
@@ -0,0 +1,89 @@
+! 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.sockets
+io.unix.backend io.unix.files kernel libc locals math qualified
+sequences io.sniffer.backend ;
+QUALIFIED: unix
+IN: io.sniffer.bsd
+
+M: unix-io destruct-handle ( obj -- ) unix:close ;
+
+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   0x1fff ; inline
+: IOCPARM_MAX    IOCPARM_MASK 1+ ; inline
+: IOC_VOID       0x20000000 ; inline
+: IOC_OUT        0x40000000 ; inline
+: IOC_IN         0x80000000 ; inline
+: IOC_INOUT      IOC_IN IOC_OUT bitor ; inline
+: IOC_DIRMASK    0xe0000000 ; inline
+
+:: ioc ( inout group num len -- n )
+    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-always
+    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 close-later
+        ] keep
+        dupd sniffer-spec-ifname ioctl-sniffer-fd
+        dup make-ioctl-buffer
+        input-port <port> <line-reader>
+        \ sniffer construct-delegate
+    ] with-destructors ;
+
diff --git a/sniffer/io/filter/authors.txt b/sniffer/io/filter/authors.txt
new file mode 100644 (file)
index 0000000..7a1ef51
--- /dev/null
@@ -0,0 +1,2 @@
+Doug Coleman
+Elie Chaftari
diff --git a/sniffer/io/filter/backend/authors.txt b/sniffer/io/filter/backend/authors.txt
new file mode 100644 (file)
index 0000000..7a1ef51
--- /dev/null
@@ -0,0 +1,2 @@
+Doug Coleman
+Elie Chaftari
diff --git a/sniffer/io/filter/backend/backend.factor b/sniffer/io/filter/backend/backend.factor
new file mode 100644 (file)
index 0000000..2e0415c
--- /dev/null
@@ -0,0 +1,17 @@
+USING: byte-arrays combinators io io.backend
+io.sockets.headers io.sniffer.backend kernel
+prettyprint sequences ;
+IN: io.sniffer.filter.backend
+
+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 {
+        ! 0x800 [ ] ! IP
+        ! 0x806 [ ] ! ARP
+        [ "Unknown type: " write .h ]
+    } case 2drop ;
diff --git a/sniffer/io/filter/bsd/authors.txt b/sniffer/io/filter/bsd/authors.txt
new file mode 100644 (file)
index 0000000..7a1ef51
--- /dev/null
@@ -0,0 +1,2 @@
+Doug Coleman
+Elie Chaftari
diff --git a/sniffer/io/filter/bsd/bsd.factor b/sniffer/io/filter/bsd/bsd.factor
new file mode 100644 (file)
index 0000000..3c32e34
--- /dev/null
@@ -0,0 +1,33 @@
+USING: alien.c-types hexdump io io.backend io.sockets.headers
+io.sockets.headers.bsd kernel io.sniffer io.sniffer.bsd
+io.streams.string io.unix.backend math
+sequences system byte-arrays io.sniffer.filter.backend
+io.sniffer.filter.backend io.sniffer.backend ;
+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 align ;
+
+M: unix-io packet. ( string -- )
+    18 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/sniffer/io/filter/filter.factor b/sniffer/io/filter/filter.factor
new file mode 100644 (file)
index 0000000..91c0ab5
--- /dev/null
@@ -0,0 +1,8 @@
+USING: alien.c-types byte-arrays combinators hexdump io
+io.backend io.streams.string io.sockets.headers kernel math
+prettyprint io.sniffer sequences system vocabs.loader
+io.sniffer.filter.backend ;
+IN: io.sniffer.filter
+
+
+bsd? [ "io.sniffer.filter.bsd" require ] when
diff --git a/sniffer/io/sniffer.factor b/sniffer/io/sniffer.factor
new file mode 100644 (file)
index 0000000..6fd74f9
--- /dev/null
@@ -0,0 +1,4 @@
+USING: io.backend kernel system vocabs.loader ;
+IN: io.sniffer
+
+bsd? [ "io.sniffer.bsd" require ] when
diff --git a/specialized/specialized.factor b/specialized/specialized.factor
new file mode 100644 (file)
index 0000000..73fe2f6
--- /dev/null
@@ -0,0 +1,54 @@
+! Copyright (C) 2009, 2010 Daniel Ehrenberg
+! See http://factorcode.org/license.txt for BSD license.
+USING: words kernel locals accessors compiler.tree.propagation.info
+sequences kernel.private assocs fry parser math quotations
+effects arrays definitions compiler.units namespaces
+compiler.tree.debugger generalizations stack-checker ;
+IN: specialized
+
+: in-compilation-unit? ( -- ? )
+    changed-definitions get >boolean ;
+
+: define-temp-in-unit ( quot effect -- word )
+    in-compilation-unit?
+    [ [ define-temp ] with-nested-compilation-unit ]
+    [ [ define-temp ] with-compilation-unit ]
+    if ;
+
+: final-info-quot ( word -- quot )
+    [ stack-effect in>> length '[ _ ndrop ] ]
+    [ def>> [ final-info ] with-scope >quotation ] bi
+    compose ;
+
+ERROR: bad-outputs word quot ;
+
+: define-outputs ( word quot -- )
+    2dup [ stack-effect ] [ infer ] bi* effect<=
+    [ "outputs" set-word-prop ] [ bad-outputs ] if ;
+
+: record-final-info ( word -- )
+    dup final-info-quot define-outputs ;
+
+:: lookup-specialized ( #call word n -- special-word/f )
+    #call in-d>> n tail* >array [ value-info class>> ] map
+    dup [ object = ] all? [ drop f ] [
+        word "specialized-defs" word-prop [
+            [ declare ] curry word def>> compose
+            word stack-effect define-temp-in-unit
+            dup record-final-info
+            1quotation
+        ] cache
+    ] if ;
+
+: specialized-quot ( word n -- quot )
+    '[ _ _ lookup-specialized ] ;
+
+: make-specialized ( word n -- )
+    [ drop H{ } clone "specialized-defs" set-word-prop ]
+    [ dupd specialized-quot "custom-inlining" set-word-prop ] 2bi ;
+
+SYNTAX: specialized
+    last-word dup stack-effect in>> length make-specialized ;
+
+PREDICATE: specialized-word < word
+   "specialized-defs" word-prop >boolean ;
diff --git a/springies/authors.txt b/springies/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/springies/models/2snake/2snake.factor b/springies/models/2snake/2snake.factor
new file mode 100644 (file)
index 0000000..1dfd287
--- /dev/null
@@ -0,0 +1,123 @@
+
+USING: kernel namespaces arrays sequences math math.vectors random
+       springies springies.ui ;
+
+IN: springies.models.2snake
+
+: model ( -- )
+
+{ } clone >nodes
+{ } clone >springs
+0.001 >time-slice
+gravity off
+
+1 19.0 328.0 0.0 0.0 1.0 1.0 mass
+2 36.0 328.0 0.0 0.0 1.0 1.0 mass
+3 54.0 328.0 0.0 0.0 1.0 1.0 mass
+4 72.0 328.0 0.0 0.0 1.0 1.0 mass
+5 90.0 328.0 0.0 0.0 1.0 1.0 mass
+6 108.0 328.0 0.0 0.0 1.0 1.0 mass
+7 126.0 328.0 0.0 0.0 1.0 1.0 mass
+8 144.0 328.0 0.0 0.0 1.0 1.0 mass
+9 162.0 328.0 0.0 0.0 1.0 1.0 mass
+10 180.0 328.0 0.0 0.0 1.0 1.0 mass
+11 198.0 328.0 0.0 0.0 1.0 1.0 mass
+12 216.0 328.0 0.0 0.0 1.0 1.0 mass
+13 234.0 328.0 0.0 0.0 1.0 1.0 mass
+14 252.0 328.0 0.0 0.0 1.0 1.0 mass
+15 270.0 328.0 0.0 0.0 1.0 1.0 mass
+16 288.0 328.0 0.0 0.0 1.0 1.0 mass
+17 306.0 328.0 0.0 0.0 1.0 1.0 mass
+18 324.0 328.0 0.0 0.0 1.0 1.0 mass
+19 342.0 328.0 0.0 0.0 1.0 1.0 mass
+20 360.0 328.0 0.0 0.0 1.0 1.0 mass
+21 378.0 328.0 0.0 0.0 1.0 1.0 mass
+22 396.0 328.0 0.0 0.0 1.0 1.0 mass
+23 414.0 328.0 0.0 0.0 1.0 1.0 mass
+24 432.0 328.0 0.0 0.0 1.0 1.0 mass
+25 450.0 328.0 0.0 0.0 1.0 1.0 mass
+26 468.0 328.0 0.0 0.0 1.0 1.0 mass
+27 504.0 328.0 0.0 0.0 1.0 1.0 mass
+28 486.0 328.0 0.0 0.0 1.0 1.0 mass
+29 522.0 328.0 0.0 0.0 1.0 1.0 mass
+30 540.0 328.0 0.0 0.0 1.0 1.0 mass
+31 558.0 328.0 0.0 0.0 1.0 1.0 mass
+32 576.0 328.0 0.0 0.0 1.0 1.0 mass
+33 594.0 328.0 0.0 0.0 1.0 1.0 mass
+34 612.0 328.0 0.0 0.0 1.0 1.0 mass
+35 630.0 328.0 0.0 0.0 1.0 1.0 mass
+1 1 2 200.0 1.500000 18.0 spng
+2 3 2 200.0 1.500000 18.0 spng
+3 3 4 200.0 1.500000 18.0 spng
+4 4 5 200.0 1.500000 18.0 spng
+5 5 6 200.0 1.500000 18.0 spng
+6 6 7 200.0 1.500000 18.0 spng
+7 7 8 200.0 1.500000 18.0 spng
+8 8 9 200.0 1.500000 18.0 spng
+9 9 10 200.0 1.500000 18.0 spng
+10 10 11 200.0 1.500000 18.0 spng
+11 11 12 200.0 1.500000 18.0 spng
+12 12 13 200.0 1.500000 18.0 spng
+13 13 14 200.0 1.500000 18.0 spng
+14 14 15 200.0 1.500000 18.0 spng
+15 15 16 200.0 1.500000 18.0 spng
+16 16 17 200.0 1.500000 18.0 spng
+17 17 18 200.0 1.500000 18.0 spng
+18 18 19 200.0 1.500000 18.0 spng
+19 19 20 200.0 1.500000 18.0 spng
+20 20 21 200.0 1.500000 18.0 spng
+21 21 22 200.0 1.500000 18.0 spng
+22 22 23 200.0 1.500000 18.0 spng
+23 23 24 200.0 1.500000 18.0 spng
+24 24 25 200.0 1.500000 18.0 spng
+25 25 26 200.0 1.500000 18.0 spng
+26 26 28 200.0 1.500000 18.0 spng
+27 28 27 200.0 1.500000 18.0 spng
+28 27 29 200.0 1.500000 18.0 spng
+29 29 30 200.0 1.500000 18.0 spng
+30 30 31 200.0 1.500000 18.0 spng
+31 31 32 200.0 1.500000 18.0 spng
+32 32 33 200.0 1.500000 18.0 spng
+33 33 34 200.0 1.500000 18.0 spng
+34 34 35 200.0 1.500000 18.0 spng
+35 1 3 200.0 1.500000 36.0 spng
+36 2 4 200.0 1.500000 36.0 spng
+37 3 5 200.0 1.500000 36.0 spng
+38 4 6 200.0 1.500000 36.0 spng
+39 5 7 200.0 1.500000 36.0 spng
+40 6 8 200.0 1.500000 36.0 spng
+41 7 9 200.0 1.500000 36.0 spng
+42 8 10 200.0 1.500000 36.0 spng
+43 9 11 200.0 1.500000 36.0 spng
+44 10 12 200.0 1.500000 36.0 spng
+45 11 13 200.0 1.500000 36.0 spng
+46 12 14 200.0 1.500000 36.0 spng
+47 13 15 200.0 1.500000 36.0 spng
+48 14 16 200.0 1.500000 36.0 spng
+49 15 17 200.0 1.500000 36.0 spng
+50 16 18 200.0 1.500000 36.0 spng
+51 17 19 200.0 1.500000 36.0 spng
+52 18 20 200.0 1.500000 36.0 spng
+53 19 21 200.0 1.500000 36.0 spng
+54 20 22 200.0 1.500000 36.0 spng
+55 21 23 200.0 1.500000 36.0 spng
+56 22 24 200.0 1.500000 36.0 spng
+57 23 25 200.0 1.500000 36.0 spng
+58 24 26 200.0 1.500000 36.0 spng
+59 25 28 200.0 1.500000 36.0 spng
+60 26 27 200.0 1.500000 36.0 spng
+61 28 29 200.0 1.500000 36.0 spng
+62 27 30 200.0 1.500000 36.0 spng
+63 29 31 200.0 1.500000 36.0 spng
+64 30 32 200.0 1.500000 36.0 spng
+65 31 33 200.0 1.500000 36.0 spng
+66 32 34 200.0 1.500000 36.0 spng
+67 33 35 200.0 1.500000 36.0 spng
+
+nodes> [ 400 random -200 + 400 random -200 + 2array swap set-node-vel ] each ;
+
+USING: threads ui ;
+
+: go ( -- ) [ [ springies-window* 1000 sleep model ] with-scope ] with-ui ;
+
+MAIN: go
diff --git a/springies/models/2snake/authors.txt b/springies/models/2snake/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/springies/models/2snake/tags.txt b/springies/models/2snake/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/springies/models/2x2snake/2x2snake.factor b/springies/models/2x2snake/2x2snake.factor
new file mode 100644 (file)
index 0000000..4868072
--- /dev/null
@@ -0,0 +1,223 @@
+
+USING: kernel namespaces arrays sequences threads math math.vectors
+       ui random springies springies.ui ;
+
+IN: springies.models.2x2snake
+
+: model ( -- )
+
+{ } clone >nodes
+{ } clone >springs
+0.002 >time-slice
+gravity off
+
+1 147.0 324.0 0.0 0.0 1.0 1.0 mass
+2 164.0 324.0 0.0 0.0 1.0 1.0 mass
+3 182.0 324.0 0.0 0.0 1.0 1.0 mass
+4 200.0 324.0 0.0 0.0 1.0 1.0 mass
+5 218.0 324.0 0.0 0.0 1.0 1.0 mass
+6 236.0 324.0 0.0 0.0 1.0 1.0 mass
+7 254.0 324.0 0.0 0.0 1.0 1.0 mass
+8 272.0 324.0 0.0 0.0 1.0 1.0 mass
+9 290.0 324.0 0.0 0.0 1.0 1.0 mass
+10 308.0 324.0 0.0 0.0 1.0 1.0 mass
+11 326.0 324.0 0.0 0.0 1.0 1.0 mass
+12 344.0 324.0 0.0 0.0 1.0 1.0 mass
+13 362.0 324.0 0.0 0.0 1.0 1.0 mass
+14 380.0 324.0 0.0 0.0 1.0 1.0 mass
+15 398.0 324.0 0.0 0.0 1.0 1.0 mass
+16 416.0 324.0 0.0 0.0 1.0 1.0 mass
+17 434.0 324.0 0.0 0.0 1.0 1.0 mass
+18 452.0 324.0 0.0 0.0 1.0 1.0 mass
+19 470.0 324.0 0.0 0.0 1.0 1.0 mass
+20 147.0 298.0 0.0 0.0 1.0 1.0 mass
+21 164.0 298.0 0.0 0.0 1.0 1.0 mass
+22 182.0 298.0 0.0 0.0 1.0 1.0 mass
+23 200.0 298.0 0.0 0.0 1.0 1.0 mass
+24 218.0 298.0 0.0 0.0 1.0 1.0 mass
+25 236.0 298.0 0.0 0.0 1.0 1.0 mass
+26 254.0 298.0 0.0 0.0 1.0 1.0 mass
+27 272.0 298.0 0.0 0.0 1.0 1.0 mass
+28 290.0 298.0 0.0 0.0 1.0 1.0 mass
+29 308.0 298.0 0.0 0.0 1.0 1.0 mass
+30 326.0 298.0 0.0 0.0 1.0 1.0 mass
+31 344.0 298.0 0.0 0.0 1.0 1.0 mass
+32 362.0 298.0 0.0 0.0 1.0 1.0 mass
+33 380.0 298.0 0.0 0.0 1.0 1.0 mass
+34 398.0 298.0 0.0 0.0 1.0 1.0 mass
+35 416.0 298.0 0.0 0.0 1.0 1.0 mass
+36 434.0 298.0 0.0 0.0 1.0 1.0 mass
+37 452.0 298.0 0.0 0.0 1.0 1.0 mass
+38 470.0 298.0 0.0 0.0 1.0 1.0 mass
+1 1 2 200.0 1.500000 18.0 spng
+2 3 2 200.0 1.500000 18.0 spng
+3 3 4 200.0 1.500000 18.0 spng
+4 4 5 200.0 1.500000 18.0 spng
+5 5 6 200.0 1.500000 18.0 spng
+6 6 7 200.0 1.500000 18.0 spng
+7 7 8 200.0 1.500000 18.0 spng
+8 8 9 200.0 1.500000 18.0 spng
+9 9 10 200.0 1.500000 18.0 spng
+10 10 11 200.0 1.500000 18.0 spng
+11 11 12 200.0 1.500000 18.0 spng
+12 12 13 200.0 1.500000 18.0 spng
+13 13 14 200.0 1.500000 18.0 spng
+14 14 15 200.0 1.500000 18.0 spng
+15 15 16 200.0 1.500000 18.0 spng
+16 16 17 200.0 1.500000 18.0 spng
+17 17 18 200.0 1.500000 18.0 spng
+18 18 19 200.0 1.500000 18.0 spng
+19 1 3 200.0 1.500000 36.0 spng
+20 2 4 200.0 1.500000 36.0 spng
+21 3 5 200.0 1.500000 36.0 spng
+22 4 6 200.0 1.500000 36.0 spng
+23 5 7 200.0 1.500000 36.0 spng
+24 6 8 200.0 1.500000 36.0 spng
+25 7 9 200.0 1.500000 36.0 spng
+26 8 10 200.0 1.500000 36.0 spng
+27 9 11 200.0 1.500000 36.0 spng
+28 10 12 200.0 1.500000 36.0 spng
+29 11 13 200.0 1.500000 36.0 spng
+30 12 14 200.0 1.500000 36.0 spng
+31 13 15 200.0 1.500000 36.0 spng
+32 14 16 200.0 1.500000 36.0 spng
+33 15 17 200.0 1.500000 36.0 spng
+34 16 18 200.0 1.500000 36.0 spng
+35 17 19 200.0 1.500000 36.0 spng
+36 20 21 200.0 1.500000 18.0 spng
+37 22 21 200.0 1.500000 18.0 spng
+38 22 23 200.0 1.500000 18.0 spng
+39 23 24 200.0 1.500000 18.0 spng
+40 24 25 200.0 1.500000 18.0 spng
+41 25 26 200.0 1.500000 18.0 spng
+42 26 27 200.0 1.500000 18.0 spng
+43 27 28 200.0 1.500000 18.0 spng
+44 28 29 200.0 1.500000 18.0 spng
+45 29 30 200.0 1.500000 18.0 spng
+46 30 31 200.0 1.500000 18.0 spng
+47 31 32 200.0 1.500000 18.0 spng
+48 32 33 200.0 1.500000 18.0 spng
+49 33 34 200.0 1.500000 18.0 spng
+50 34 35 200.0 1.500000 18.0 spng
+51 35 36 200.0 1.500000 18.0 spng
+52 36 37 200.0 1.500000 18.0 spng
+53 37 38 200.0 1.500000 18.0 spng
+54 20 22 200.0 1.500000 36.0 spng
+55 21 23 200.0 1.500000 36.0 spng
+56 22 24 200.0 1.500000 36.0 spng
+57 23 25 200.0 1.500000 36.0 spng
+58 24 26 200.0 1.500000 36.0 spng
+59 25 27 200.0 1.500000 36.0 spng
+60 26 28 200.0 1.500000 36.0 spng
+61 27 29 200.0 1.500000 36.0 spng
+62 28 30 200.0 1.500000 36.0 spng
+63 29 31 200.0 1.500000 36.0 spng
+64 30 32 200.0 1.500000 36.0 spng
+65 31 33 200.0 1.500000 36.0 spng
+66 32 34 200.0 1.500000 36.0 spng
+67 33 35 200.0 1.500000 36.0 spng
+68 34 36 200.0 1.500000 36.0 spng
+69 35 37 200.0 1.500000 36.0 spng
+70 36 38 200.0 1.500000 36.0 spng
+71 1 20 200.0 1.500000 26.0 spng
+72 2 21 200.0 1.500000 26.0 spng
+73 3 22 200.0 1.500000 26.0 spng
+74 4 23 200.0 1.500000 26.0 spng
+75 5 24 200.0 1.500000 26.0 spng
+76 25 6 200.0 1.500000 26.0 spng
+77 7 26 200.0 1.500000 26.0 spng
+78 27 8 200.0 1.500000 26.0 spng
+79 9 28 200.0 1.500000 26.0 spng
+80 29 10 200.0 1.500000 26.0 spng
+81 11 30 200.0 1.500000 26.0 spng
+82 31 12 200.0 1.500000 26.0 spng
+83 13 32 200.0 1.500000 26.0 spng
+84 33 14 200.0 1.500000 26.0 spng
+85 15 34 200.0 1.500000 26.0 spng
+86 35 16 200.0 1.500000 26.0 spng
+87 17 36 200.0 1.500000 26.0 spng
+88 37 18 200.0 1.500000 26.0 spng
+89 19 38 200.0 1.500000 26.0 spng
+90 1 21 200.0 1.500000 31.064449 spng
+91 2 20 200.0 1.500000 31.064449 spng
+92 2 22 200.0 1.500000 31.622777 spng
+93 3 21 200.0 1.500000 31.622777 spng
+94 3 23 200.0 1.500000 31.622777 spng
+95 4 22 200.0 1.500000 31.622777 spng
+96 4 24 200.0 1.500000 31.622777 spng
+97 5 23 200.0 1.500000 31.622777 spng
+98 5 25 200.0 1.500000 31.622777 spng
+99 6 24 200.0 1.500000 31.622777 spng
+100 6 26 200.0 1.500000 31.622777 spng
+101 7 25 200.0 1.500000 31.622777 spng
+102 7 27 200.0 1.500000 31.622777 spng
+103 8 26 200.0 1.500000 31.622777 spng
+104 8 28 200.0 1.500000 31.622777 spng
+105 9 27 200.0 1.500000 31.622777 spng
+106 9 29 200.0 1.500000 31.622777 spng
+107 10 28 200.0 1.500000 31.622777 spng
+108 10 30 200.0 1.500000 31.622777 spng
+109 11 29 200.0 1.500000 31.622777 spng
+110 11 31 200.0 1.500000 31.622777 spng
+111 12 30 200.0 1.500000 31.622777 spng
+112 12 32 200.0 1.500000 31.622777 spng
+113 13 31 200.0 1.500000 31.622777 spng
+114 13 33 200.0 1.500000 31.622777 spng
+115 14 32 200.0 1.500000 31.622777 spng
+116 14 34 200.0 1.500000 31.622777 spng
+117 15 33 200.0 1.500000 31.622777 spng
+118 15 35 200.0 1.500000 31.622777 spng
+119 16 34 200.0 1.500000 31.622777 spng
+120 16 36 200.0 1.500000 31.622777 spng
+121 17 35 200.0 1.500000 31.622777 spng
+122 17 37 200.0 1.500000 31.622777 spng
+123 18 36 200.0 1.500000 31.622777 spng
+124 18 38 200.0 1.500000 31.622777 spng
+125 19 37 200.0 1.500000 31.622777 spng
+126 1 22 200.0 1.500000 43.600459 spng
+127 3 20 200.0 1.500000 43.600459 spng
+128 2 23 200.0 1.500000 44.407207 spng
+129 4 21 200.0 1.500000 44.407207 spng
+130 3 24 200.0 1.500000 44.407207 spng
+131 5 22 200.0 1.500000 44.407207 spng
+132 4 25 200.0 1.500000 44.407207 spng
+133 6 23 200.0 1.500000 44.407207 spng
+134 5 26 200.0 1.500000 44.407207 spng
+135 7 24 200.0 1.500000 44.407207 spng
+136 6 27 200.0 1.500000 44.407207 spng
+137 8 25 200.0 1.500000 44.407207 spng
+138 7 28 200.0 1.500000 44.407207 spng
+139 9 26 200.0 1.500000 44.407207 spng
+140 8 29 200.0 1.500000 44.407207 spng
+141 10 27 200.0 1.500000 44.407207 spng
+142 9 30 200.0 1.500000 44.407207 spng
+143 11 28 200.0 1.500000 44.407207 spng
+144 10 31 200.0 1.500000 44.407207 spng
+145 12 29 200.0 1.500000 44.407207 spng
+146 11 32 200.0 1.500000 44.407207 spng
+147 13 30 200.0 1.500000 44.407207 spng
+148 12 33 200.0 1.500000 44.407207 spng
+149 14 31 200.0 1.500000 44.407207 spng
+150 13 34 200.0 1.500000 44.407207 spng
+151 15 33 200.0 1.500000 31.622777 spng
+152 32 15 200.0 1.500000 44.407207 spng
+153 14 35 200.0 1.500000 44.407207 spng
+154 16 33 200.0 1.500000 44.407207 spng
+155 15 36 200.0 1.500000 44.407207 spng
+156 34 17 200.0 1.500000 44.407207 spng
+157 16 37 200.0 1.500000 44.407207 spng
+158 18 35 200.0 1.500000 44.407207 spng
+159 17 38 200.0 1.500000 44.407207 spng
+160 19 36 200.0 1.500000 44.407207 spng
+
+! Send the half of the snake in a random direction
+
+nodes> 10 [ swap nth ]      with map
+nodes> 10 [ 19 + swap nth ] with map append
+100 random -50 +   100 random 100 + { -1 1 } random *  2array
+[ swap set-node-vel ] curry
+each ;
+
+: go ( -- ) [ model ] go* ;
+
+MAIN: go
diff --git a/springies/models/2x2snake/authors.txt b/springies/models/2x2snake/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/springies/models/2x2snake/deploy.factor b/springies/models/2x2snake/deploy.factor
new file mode 100644 (file)
index 0000000..1ad6cfe
--- /dev/null
@@ -0,0 +1,13 @@
+USING: tools.deploy.config ;
+H{
+    { deploy-compiler? t }
+    { deploy-word-props? f }
+    { deploy-ui? t }
+    { deploy-reflection 1 }
+    { deploy-name "springies.models.2x2snake" }
+    { deploy-c-types? f }
+    { deploy-word-defs? f }
+    { "stop-after-last-window?" t }
+    { deploy-math? t }
+    { deploy-io 1 }
+}
diff --git a/springies/models/2x2snake/tags.txt b/springies/models/2x2snake/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/springies/models/3snake/3snake.factor b/springies/models/3snake/3snake.factor
new file mode 100644 (file)
index 0000000..171a042
--- /dev/null
@@ -0,0 +1,170 @@
+
+USING: kernel namespaces arrays sequences threads math ui random fry
+       springies springies.ui ;
+
+IN: springies.models.3snake
+
+: random-range ( a b -- n ) 1+ over - random + ;
+
+: model ( -- )
+
+{ } clone >nodes
+{ } clone >springs
+0.001 >time-slice
+gravity off
+
+1 19.0 328.0 0.0 0.0 1.0 1.0 mass
+2 36.0 328.0 0.0 0.0 1.0 1.0 mass
+3 54.0 328.0 0.0 0.0 1.0 1.0 mass
+4 72.0 328.0 0.0 0.0 1.0 1.0 mass
+5 90.0 328.0 0.0 0.0 1.0 1.0 mass
+6 108.0 328.0 0.0 0.0 1.0 1.0 mass
+7 126.0 328.0 0.0 0.0 1.0 1.0 mass
+8 144.0 328.0 0.0 0.0 1.0 1.0 mass
+9 162.0 328.0 0.0 0.0 1.0 1.0 mass
+10 180.0 328.0 0.0 0.0 1.0 1.0 mass
+11 198.0 328.0 0.0 0.0 1.0 1.0 mass
+12 216.0 328.0 0.0 0.0 1.0 1.0 mass
+13 234.0 328.0 0.0 0.0 1.0 1.0 mass
+14 252.0 328.0 0.0 0.0 1.0 1.0 mass
+15 270.0 328.0 0.0 0.0 1.0 1.0 mass
+16 288.0 328.0 0.0 0.0 1.0 1.0 mass
+17 306.0 328.0 0.0 0.0 1.0 1.0 mass
+18 324.0 328.0 0.0 0.0 1.0 1.0 mass
+19 342.0 328.0 0.0 0.0 1.0 1.0 mass
+20 360.0 328.0 0.0 0.0 1.0 1.0 mass
+21 378.0 328.0 0.0 0.0 1.0 1.0 mass
+22 396.0 328.0 0.0 0.0 1.0 1.0 mass
+23 414.0 328.0 0.0 0.0 1.0 1.0 mass
+24 432.0 328.0 0.0 0.0 1.0 1.0 mass
+25 450.0 328.0 0.0 0.0 1.0 1.0 mass
+26 468.0 328.0 0.0 0.0 1.0 1.0 mass
+27 504.0 328.0 0.0 0.0 1.0 1.0 mass
+28 486.0 328.0 0.0 0.0 1.0 1.0 mass
+29 522.0 328.0 0.0 0.0 1.0 1.0 mass
+30 540.0 328.0 0.0 0.0 1.0 1.0 mass
+31 558.0 328.0 0.0 0.0 1.0 1.0 mass
+32 576.0 328.0 0.0 0.0 1.0 1.0 mass
+33 594.0 328.0 0.0 0.0 1.0 1.0 mass
+34 612.0 328.0 0.0 0.0 1.0 1.0 mass
+35 626.0 328.0 0.0 0.0 1.0 1.0 mass
+1 1 2 200.0 1.500000 18.0 spng
+2 3 2 200.0 1.500000 18.0 spng
+3 3 4 200.0 1.500000 18.0 spng
+4 4 5 200.0 1.500000 18.0 spng
+5 5 6 200.0 1.500000 18.0 spng
+6 6 7 200.0 1.500000 18.0 spng
+7 7 8 200.0 1.500000 18.0 spng
+8 8 9 200.0 1.500000 18.0 spng
+9 9 10 200.0 1.500000 18.0 spng
+10 10 11 200.0 1.500000 18.0 spng
+11 11 12 200.0 1.500000 18.0 spng
+12 12 13 200.0 1.500000 18.0 spng
+13 13 14 200.0 1.500000 18.0 spng
+14 14 15 200.0 1.500000 18.0 spng
+15 15 16 200.0 1.500000 18.0 spng
+16 16 17 200.0 1.500000 18.0 spng
+17 17 18 200.0 1.500000 18.0 spng
+18 18 19 200.0 1.500000 18.0 spng
+19 19 20 200.0 1.500000 18.0 spng
+20 20 21 200.0 1.500000 18.0 spng
+21 21 22 200.0 1.500000 18.0 spng
+22 22 23 200.0 1.500000 18.0 spng
+23 23 24 200.0 1.500000 18.0 spng
+24 24 25 200.0 1.500000 18.0 spng
+25 25 26 200.0 1.500000 18.0 spng
+26 26 28 200.0 1.500000 18.0 spng
+27 28 27 200.0 1.500000 18.0 spng
+28 27 29 200.0 1.500000 18.0 spng
+29 29 30 200.0 1.500000 18.0 spng
+30 30 31 200.0 1.500000 18.0 spng
+31 31 32 200.0 1.500000 18.0 spng
+32 32 33 200.0 1.500000 18.0 spng
+33 33 34 200.0 1.500000 18.0 spng
+34 34 35 200.0 1.500000 18.0 spng
+35 1 3 200.0 1.500000 36.0 spng
+36 2 4 200.0 1.500000 36.0 spng
+37 3 5 200.0 1.500000 36.0 spng
+38 4 6 200.0 1.500000 36.0 spng
+39 5 7 200.0 1.500000 36.0 spng
+40 6 8 200.0 1.500000 36.0 spng
+41 7 9 200.0 1.500000 36.0 spng
+42 8 10 200.0 1.500000 36.0 spng
+43 9 11 200.0 1.500000 36.0 spng
+44 10 12 200.0 1.500000 36.0 spng
+45 11 13 200.0 1.500000 36.0 spng
+46 12 14 200.0 1.500000 36.0 spng
+47 13 15 200.0 1.500000 36.0 spng
+48 14 16 200.0 1.500000 36.0 spng
+49 15 17 200.0 1.500000 36.0 spng
+50 16 18 200.0 1.500000 36.0 spng
+51 17 19 200.0 1.500000 36.0 spng
+52 18 20 200.0 1.500000 36.0 spng
+53 19 21 200.0 1.500000 36.0 spng
+54 20 22 200.0 1.500000 36.0 spng
+55 21 23 200.0 1.500000 36.0 spng
+56 22 24 200.0 1.500000 36.0 spng
+57 23 25 200.0 1.500000 36.0 spng
+58 24 26 200.0 1.500000 36.0 spng
+59 25 28 200.0 1.500000 36.0 spng
+60 26 27 200.0 1.500000 36.0 spng
+61 28 29 200.0 1.500000 36.0 spng
+62 27 30 200.0 1.500000 36.0 spng
+63 29 31 200.0 1.500000 36.0 spng
+64 30 32 200.0 1.500000 36.0 spng
+65 31 33 200.0 1.500000 36.0 spng
+66 32 34 200.0 1.500000 36.0 spng
+67 33 35 200.0 1.500000 36.0 spng
+68 1 4 200.0 1.500000 53.0 spng
+69 2 5 200.0 1.500000 54.0 spng
+70 3 6 200.0 1.500000 54.0 spng
+71 4 7 200.0 1.500000 54.0 spng
+72 5 8 200.0 1.500000 54.0 spng
+73 6 9 200.0 1.500000 54.0 spng
+74 7 10 200.0 1.500000 54.0 spng
+75 8 11 200.0 1.500000 54.0 spng
+76 9 12 200.0 1.500000 54.0 spng
+77 10 13 200.0 1.500000 54.0 spng
+78 11 14 200.0 1.500000 54.0 spng
+79 12 15 200.0 1.500000 54.0 spng
+80 13 16 200.0 1.500000 54.0 spng
+81 14 17 200.0 1.500000 54.0 spng
+82 15 18 200.0 1.500000 54.0 spng
+83 16 19 200.0 1.500000 54.0 spng
+84 17 20 200.0 1.500000 54.0 spng
+85 18 21 200.0 1.500000 54.0 spng
+86 19 22 200.0 1.500000 54.0 spng
+87 20 23 200.0 1.500000 54.0 spng
+88 21 24 200.0 1.500000 54.0 spng
+89 22 25 200.0 1.500000 54.0 spng
+90 23 26 200.0 1.500000 54.0 spng
+91 24 28 200.0 1.500000 54.0 spng
+92 25 27 200.0 1.500000 54.0 spng
+93 26 29 200.0 1.500000 54.0 spng
+94 28 30 200.0 1.500000 54.0 spng
+95 27 31 200.0 1.500000 54.0 spng
+96 29 32 200.0 1.500000 54.0 spng
+97 30 33 200.0 1.500000 54.0 spng
+98 31 34 200.0 1.500000 54.0 spng
+99 32 35 200.0 1.500000 50.0 spng
+
+10
+[
+    -400 400 random-range   -400 400 random-range   2array
+    nodes> random
+    set-node-vel
+]
+times
+
+;
+
+! : go* ( quot -- )
+!   [ [ [ springies-window* 1000 sleep % ] with-scope ] with-ui ] bake call ;
+
+: go* ( quot -- ) '[ [ springies-window* 1000 sleep @ ] with-scope ] with-ui ;
+
+! : go ( -- ) [ [ springies-window* 1000 sleep model ] with-scope ] with-ui ;
+
+: go ( -- ) [ model ] go* ;
+
+MAIN: go
diff --git a/springies/models/3snake/authors.txt b/springies/models/3snake/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/springies/models/3snake/tags.txt b/springies/models/3snake/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/springies/models/ball/authors.txt b/springies/models/ball/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/springies/models/ball/ball.factor b/springies/models/ball/ball.factor
new file mode 100644 (file)
index 0000000..100ffdd
--- /dev/null
@@ -0,0 +1,255 @@
+
+USING: kernel namespaces sequences springies springies.ui ;
+
+IN: springies.models.ball
+
+: model ( -- )
+
+{ } clone >nodes
+{ } clone >springs
+0.01 >time-slice
+gravity on
+
+1 325.191871 140.872641 40.832215 -5.301529 1.0 1.0 mass
+2 313.933994 149.011616 55.240875 5.026852 1.0 1.0 mass
+3 309.133386 162.523019 72.798059 5.594199 1.0 1.0 mass
+4 312.887152 176.436760 83.754277 -1.370025 1.0 1.0 mass
+5 321.660596 187.895952 91.634021 -8.308630 1.0 1.0 mass
+6 335.256132 192.503856 94.772924 -18.985044 1.0 1.0 mass
+7 348.254504 188.731936 92.657963 -29.982110 1.0 1.0 mass
+8 359.050972 180.780059 86.668616 -39.817638 1.0 1.0 mass
+9 363.685639 167.752177 76.554871 -47.987107 1.0 1.0 mass
+10 360.449954 154.092353 57.992242 -48.045772 1.0 1.0 mass
+11 352.201411 142.382665 41.200547 -39.924209 1.0 1.0 mass
+12 338.754859 137.460615 32.306364 -22.707784 1.0 1.0 mass
+13 312.911184 114.835962 8.342965 5.878311 1.0 1.0 mass
+14 290.521818 132.872407 33.212103 28.391710 1.0 1.0 mass
+15 281.048450 160.314206 66.319674 32.935324 1.0 1.0 mass
+16 287.450075 188.730522 93.898071 21.966741 1.0 1.0 mass
+17 305.987715 211.206959 112.571044 5.089593 1.0 1.0 mass
+18 333.289699 220.830317 121.166705 -17.204713 1.0 1.0 mass
+19 361.089678 214.901909 117.183695 -41.776506 1.0 1.0 mass
+20 382.690515 197.005784 101.789802 -63.980298 1.0 1.0 mass
+21 392.095364 170.108402 75.453780 -78.414351 1.0 1.0 mass
+22 386.286391 142.033621 41.812216 -77.402424 1.0 1.0 mass
+23 368.355658 119.326317 12.658676 -58.885262 1.0 1.0 mass
+24 341.159901 109.253775 -0.645459 -27.346079 1.0 1.0 mass
+25 300.792976 88.652764 -23.770230 17.788258 1.0 1.0 mass
+26 266.917041 116.942125 11.387083 52.603190 1.0 1.0 mass
+27 252.824303 157.992984 59.144863 62.163730 1.0 1.0 mass
+28 261.812599 201.245775 103.542171 47.141708 1.0 1.0 mass
+29 290.323965 234.792944 133.016945 18.136362 1.0 1.0 mass
+30 330.805232 249.331769 145.899409 -16.478401 1.0 1.0 mass
+31 373.715232 241.181453 141.068680 -55.103677 1.0 1.0 mass
+32 406.314817 213.217096 116.087430 -90.844012 1.0 1.0 mass
+33 420.647493 172.661774 73.304028 -110.880720 1.0 1.0 mass
+34 412.375908 129.697207 24.072484 -106.129512 1.0 1.0 mass
+35 384.555754 95.915740 -16.565355 -77.142380 1.0 1.0 mass
+36 344.134757 80.886540 -34.250916 -30.871105 1.0 1.0 mass
+37 288.774590 62.672780 -55.431084 28.821437 1.0 1.0 mass
+38 244.055965 100.457489 -9.756397 76.701354 1.0 1.0 mass
+39 224.574635 156.693148 53.845562 91.755892 1.0 1.0 mass
+40 235.856891 213.935639 112.462316 73.437061 1.0 1.0 mass
+41 273.697931 257.991035 152.320671 33.701056 1.0 1.0 mass
+42 329.129445 277.782400 170.727571 -15.899371 1.0 1.0 mass
+43 386.065290 267.474982 165.436658 -68.761273 1.0 1.0 mass
+44 429.946314 229.605765 132.087682 -116.795195 1.0 1.0 mass
+45 449.164590 174.189613 73.084826 -143.228528 1.0 1.0 mass
+46 438.674101 117.351918 9.340834 -136.225613 1.0 1.0 mass
+47 401.586435 72.955570 -42.523445 -98.317857 1.0 1.0 mass
+48 346.207804 52.561279 -67.447974 -34.980297 1.0 1.0 mass
+1 1 2 150.0 2.0 14.0 spng
+2 2 3 150.0 2.0 14.0 spng
+3 3 4 150.0 2.0 14.0 spng
+4 4 5 150.0 2.0 14.0 spng
+5 5 6 150.0 2.0 14.0 spng
+6 6 7 150.0 2.0 14.0 spng
+7 7 8 150.0 2.0 14.0 spng
+8 8 9 150.0 2.0 14.0 spng
+9 9 10 150.0 2.0 14.0 spng
+10 10 11 150.0 2.0 14.0 spng
+11 11 12 150.0 2.0 14.0 spng
+12 12 1 150.0 2.0 14.0 spng
+13 13 14 150.0 2.0 28.0 spng
+14 14 15 150.0 2.0 28.0 spng
+15 15 16 150.0 2.0 28.0 spng
+16 16 17 150.0 2.0 28.0 spng
+17 17 18 150.0 2.0 28.0 spng
+18 18 19 150.0 2.0 28.0 spng
+19 19 20 150.0 2.0 28.0 spng
+20 20 21 150.0 2.0 28.0 spng
+21 21 22 150.0 2.0 28.0 spng
+22 22 23 150.0 2.0 28.0 spng
+23 23 24 150.0 2.0 28.0 spng
+24 24 13 150.0 2.0 28.0 spng
+25 25 26 150.0 2.0 44.0 spng
+26 26 27 150.0 2.0 43.0 spng
+27 27 28 150.0 2.0 44.0 spng
+28 28 29 150.0 2.0 44.0 spng
+29 29 30 150.0 2.0 43.0 spng
+30 30 31 150.0 2.0 44.0 spng
+31 31 32 150.0 2.0 43.0 spng
+32 32 33 150.0 2.0 43.0 spng
+33 33 34 150.0 2.0 44.0 spng
+34 34 35 150.0 2.0 44.0 spng
+35 35 36 150.0 2.0 43.0 spng
+36 36 25 150.0 2.0 44.0 spng
+37 37 38 150.0 2.0 58.0 spng
+38 38 39 150.0 2.0 59.0 spng
+39 39 40 150.0 2.0 58.0 spng
+40 40 41 150.0 2.0 58.0 spng
+41 41 42 150.0 2.0 59.0 spng
+42 42 43 150.0 2.0 58.0 spng
+43 43 44 150.0 2.0 58.0 spng
+44 44 45 150.0 2.0 59.0 spng
+45 45 46 150.0 2.0 58.0 spng
+46 46 47 150.0 2.0 58.0 spng
+47 47 48 150.0 2.0 59.0 spng
+48 48 37 150.0 2.0 58.0 spng
+49 1 13 150.0 2.0 29.0 spng
+50 2 14 150.0 2.0 28.0 spng
+51 3 15 150.0 2.0 28.0 spng
+52 4 16 150.0 2.0 29.0 spng
+53 5 17 150.0 2.0 28.0 spng
+54 6 18 150.0 2.0 28.0 spng
+55 7 19 150.0 2.0 29.0 spng
+56 8 20 150.0 2.0 28.0 spng
+57 9 21 150.0 2.0 28.0 spng
+58 10 22 150.0 2.0 29.0 spng
+59 11 23 150.0 2.0 28.0 spng
+60 12 24 150.0 2.0 28.0 spng
+61 13 25 150.0 2.0 29.0 spng
+62 14 26 150.0 2.0 28.0 spng
+63 15 27 150.0 2.0 28.0 spng
+64 16 28 150.0 2.0 29.0 spng
+65 17 29 150.0 2.0 28.0 spng
+66 18 30 150.0 2.0 28.0 spng
+67 19 31 150.0 2.0 29.0 spng
+68 20 32 150.0 2.0 28.0 spng
+69 21 33 150.0 2.0 28.0 spng
+70 22 34 150.0 2.0 29.0 spng
+71 23 35 150.0 2.0 28.0 spng
+72 24 36 150.0 2.0 28.0 spng
+73 25 37 150.0 2.0 29.0 spng
+74 26 38 150.0 2.0 28.0 spng
+75 27 39 150.0 2.0 28.0 spng
+76 28 40 150.0 2.0 29.0 spng
+77 29 41 150.0 2.0 28.0 spng
+78 30 42 150.0 2.0 28.0 spng
+79 31 43 150.0 2.0 29.0 spng
+80 32 44 150.0 2.0 28.0 spng
+81 33 45 150.0 2.0 28.0 spng
+82 34 46 150.0 2.0 29.0 spng
+83 35 47 150.0 2.0 28.0 spng
+84 36 48 150.0 2.0 28.0 spng
+85 1 14 150.0 2.0 35.0 spng
+86 2 15 150.0 2.0 35.0 spng
+87 3 16 150.0 2.0 34.0 spng
+88 4 17 150.0 2.0 35.0 spng
+89 5 18 150.0 2.0 35.0 spng
+90 6 19 150.0 2.0 34.0 spng
+91 7 20 150.0 2.0 35.0 spng
+92 8 21 150.0 2.0 35.0 spng
+93 9 22 150.0 2.0 34.0 spng
+94 10 23 150.0 2.0 35.0 spng
+95 11 24 150.0 2.0 35.0 spng
+96 12 13 150.0 2.0 34.0 spng
+97 13 26 150.0 2.0 46.0 spng
+98 14 27 150.0 2.0 45.0 spng
+99 15 28 150.0 2.0 45.0 spng
+100 16 29 150.0 2.0 46.0 spng
+101 17 30 150.0 2.0 45.0 spng
+102 18 31 150.0 2.0 45.0 spng
+103 19 32 150.0 2.0 45.0 spng
+104 20 33 150.0 2.0 45.0 spng
+105 21 34 150.0 2.0 45.0 spng
+106 22 35 150.0 2.0 46.0 spng
+107 23 36 150.0 2.0 45.0 spng
+108 24 25 150.0 2.0 45.0 spng
+109 25 38 150.0 2.0 58.0 spng
+110 26 39 150.0 2.0 58.0 spng
+111 27 40 150.0 2.0 58.0 spng
+112 28 41 150.0 2.0 58.0 spng
+113 29 42 150.0 2.0 58.0 spng
+114 30 43 150.0 2.0 58.0 spng
+115 31 44 150.0 2.0 58.0 spng
+116 32 45 150.0 2.0 58.0 spng
+117 33 46 150.0 2.0 58.0 spng
+118 34 47 150.0 2.0 58.0 spng
+119 35 48 150.0 2.0 58.0 spng
+120 36 37 150.0 2.0 58.0 spng
+121 1 24 150.0 2.0 35.0 spng
+122 2 13 150.0 2.0 34.0 spng
+123 3 14 150.0 2.0 35.0 spng
+124 4 15 150.0 2.0 35.0 spng
+125 5 16 150.0 2.0 34.0 spng
+126 6 17 150.0 2.0 35.0 spng
+127 7 18 150.0 2.0 35.0 spng
+128 8 19 150.0 2.0 34.0 spng
+129 9 20 150.0 2.0 35.0 spng
+130 10 21 150.0 2.0 35.0 spng
+131 11 22 150.0 2.0 34.0 spng
+132 12 23 150.0 2.0 35.0 spng
+133 13 36 150.0 2.0 46.0 spng
+134 14 25 150.0 2.0 45.0 spng
+135 15 26 150.0 2.0 45.0 spng
+136 16 27 150.0 2.0 46.0 spng
+137 17 28 150.0 2.0 45.0 spng
+138 18 29 150.0 2.0 45.0 spng
+139 19 30 150.0 2.0 46.0 spng
+140 20 31 150.0 2.0 45.0 spng
+141 21 32 150.0 2.0 45.0 spng
+142 22 33 150.0 2.0 46.0 spng
+143 23 34 150.0 2.0 45.0 spng
+144 24 35 150.0 2.0 45.0 spng
+145 25 48 150.0 2.0 58.0 spng
+146 26 37 150.0 2.0 58.0 spng
+147 27 38 150.0 2.0 58.0 spng
+148 28 39 150.0 2.0 58.0 spng
+149 29 40 150.0 2.0 58.0 spng
+150 30 41 150.0 2.0 58.0 spng
+151 31 42 150.0 2.0 58.0 spng
+152 32 43 150.0 2.0 58.0 spng
+153 33 44 150.0 2.0 58.0 spng
+154 34 45 150.0 2.0 58.0 spng
+155 35 46 150.0 2.0 58.0 spng
+156 36 47 150.0 2.0 58.0 spng
+157 10 4 150.0 2.0 52.331631 spng
+158 7 1 150.0 2.0 52.436772 spng
+159 12 6 150.0 2.0 54.680698 spng
+160 5 11 150.0 2.0 54.589379 spng
+161 9 3 150.0 2.0 54.451569 spng
+162 2 8 150.0 2.0 54.482231 spng
+163 45 11 150.0 2.0 101.408150 spng
+164 46 12 150.0 2.0 101.542452 spng
+165 47 1 150.0 2.0 101.963064 spng
+166 48 2 150.0 2.0 101.517329 spng
+167 37 3 150.0 2.0 101.603694 spng
+168 38 4 150.0 2.0 102.014031 spng
+169 39 5 150.0 2.0 101.547660 spng
+170 40 6 150.0 2.0 101.573762 spng
+171 41 7 150.0 2.0 101.897300 spng
+172 42 8 150.0 2.0 101.497982 spng
+173 43 9 150.0 2.0 101.870594 spng
+174 44 10 150.0 2.0 102.043753 spng
+175 45 11 150.0 2.0 101.408150 spng
+176 46 8 150.0 2.0 101.548938 spng
+177 47 10 150.0 2.0 90.645939 spng
+178 48 10 150.0 2.0 101.952119 spng
+179 37 11 150.0 2.0 101.552352 spng
+180 38 12 150.0 2.0 101.491447 spng
+181 39 1 150.0 2.0 101.971524 spng
+182 40 2 150.0 2.0 101.587400 spng
+183 41 3 150.0 2.0 101.519279 spng
+184 42 4 150.0 2.0 101.976181 spng
+185 43 5 150.0 2.0 101.714570 spng
+186 44 6 150.0 2.0 101.388747 spng
+187 45 7 150.0 2.0 101.773286 spng
+
+nodes> [ { 0 100 } swap set-node-vel ] each ;
+
+USING: threads ui ;
+
+: go ( -- ) [ [ springies-window* 1000 sleep model ] with-scope ] with-ui ;
+
+MAIN: go
diff --git a/springies/models/ball/tags.txt b/springies/models/ball/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/springies/models/belt-tire/authors.txt b/springies/models/belt-tire/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/springies/models/belt-tire/belt-tire.factor b/springies/models/belt-tire/belt-tire.factor
new file mode 100644 (file)
index 0000000..cd48e65
--- /dev/null
@@ -0,0 +1,307 @@
+
+USING: kernel namespaces arrays sequences threads math ui random
+       springies springies.ui ;
+
+IN: springies.models.belt-tire
+
+: model ( -- )
+
+{ } clone >nodes
+{ } clone >springs
+0.008 >time-slice
+gravity on
+
+1 274.078806900597328 346.307117178664043 0 0 1 0.5 mass
+2 284.142891110742823 329.83402842231834 0 0 1 0.5 mass
+3 295.307158356938658 355.695013578746227 0 0 1 0.5 mass
+4 300.698527801927128 337.003548930923216 0 0 1 0.5 mass
+5 318.093036910029696 359.203044347904552 0 0 1 0.5 mass
+6 318.542098798246286 339.592403450546044 0 0 1 0.5 mass
+7 340.949296214486822 356.831259237330983 0 0 1 0.5 mass
+8 336.494524828869885 337.754019325244656 0 0 1 0.5 mass
+9 362.534986907234952 348.770558940029559 0 0 1 0.5 mass
+10 353.491265306914897 331.642140359094469 0 0 1 0.5 mass
+11 381.368850422101502 335.37878701564847 0 0 1 0.5 mass
+12 368.085531061140216 321.055018811315335 0 0 1 0.5 mass
+13 396.117634938806759 317.519287773537314 0 0 1 0.5 mass
+14 379.675208211408915 307.277961968837246 0 0 1 0.5 mass
+15 405.655157991023771 296.391903048606025 0 0 1 0.5 mass
+16 387.124676448692242 290.862310093183567 0 0 1 0.5 mass
+17 409.337178964708642 273.594658653786666 0 0 1 0.5 mass
+18 389.76569804010461 273.012494879567555 0 0 1 0.5 mass
+19 407.11203230551871 250.712646124396059 0 0 1 0.5 mass
+20 387.966228461346304 255.061007930370067 0 0 1 0.5 mass
+21 399.188308328902735 229.098161823607285 0 0 1 0.5 mass
+22 381.896222954111181 238.073977723246998 0 0 1 0.5 mass
+23 385.883224011375262 210.148208473511374 0 0 1 0.5 mass
+24 371.614761646970464 223.279700317395225 0 0 1 0.5 mass
+25 367.955378160003875 195.334436550727929 0 0 1 0.5 mass
+26 357.817091674528911 211.717360072075536 0 0 1 0.5 mass
+27 346.743525482831387 185.884698478394085 0 0 1 0.5 mass
+28 341.291169697238729 204.55711005838188 0 0 1 0.5 mass
+29 323.935265230381788 182.330460182137188 0 0 1 0.5 mass
+30 323.466187791799882 201.937076877994031 0 0 1 0.5 mass
+31 301.04141769400843 184.703602685435726 0 0 1 0.5 mass
+32 305.532794735419941 203.763859300438838 0 0 1 0.5 mass
+33 279.442362700896183 192.851996602076866 0 0 1 0.5 mass
+34 288.551113492738239 209.893932668644339 0 0 1 0.5 mass
+35 260.65997798024199 206.334196608396638 0 0 1 0.5 mass
+36 273.960657978745814 220.516324161880476 0 0 1 0.5 mass
+37 246.029909853431349 224.197583023911335 0 0 1 0.5 mass
+38 262.719165304227545 234.58428660123181 0 0 1 0.5 mass
+39 236.458142984593252 245.235572499606377 0 0 1 0.5 mass
+40 254.870454491934908 250.81914136861181 0 0 1 0.5 mass
+41 232.703447579492519 268.042376651164432 0 0 1 0.5 mass
+42 252.226120754560156 268.679895159358864 0 0 1 0.5 mass
+43 234.96767702938331 291.007702051922024 0 0 1 0.5 mass
+44 254.040589506795527 286.621843971355872 0 0 1 0.5 mass
+45 242.759412026738119 312.577114225657738 0 0 1 0.5 mass
+46 260.111088599530603 303.593264087352964 0 0 1 0.5 mass
+47 256.101782779606651 331.52509923420655 0 0 1 0.5 mass
+48 270.373388641766439 318.366074596339615 0 0 1 0.5 mass
+49 320.448537383965288 270.292364746678743 0 0 10 0.5 mass
+1 1 4 200 2 28.284271247461902 spng
+2 4 5 200 2 28.284271247461902 spng
+3 5 8 200 2 28.284271247461902 spng
+4 8 9 200 2 28.284271247461902 spng
+5 9 12 200 2 28.284271247461902 spng
+6 12 13 200 2 28.284271247461902 spng
+7 13 16 200 2 28.284271247461902 spng
+8 16 17 200 2 28.284271247461902 spng
+9 17 20 200 2 28.284271247461902 spng
+10 20 21 200 2 28.284271247461902 spng
+11 21 24 200 2 28.284271247461902 spng
+12 24 25 200 2 28.284271247461902 spng
+13 25 28 200 2 28.284271247461902 spng
+14 28 29 200 2 28.284271247461902 spng
+15 29 32 200 2 28.284271247461902 spng
+16 32 33 200 2 28.284271247461902 spng
+17 33 36 200 2 28.284271247461902 spng
+18 36 37 200 2 28.284271247461902 spng
+19 37 40 200 2 28.284271247461902 spng
+20 40 41 200 2 28.284271247461902 spng
+21 41 44 200 2 28.284271247461902 spng
+22 44 45 200 2 28.284271247461902 spng
+23 45 48 200 2 28.284271247461902 spng
+24 3 6 200 2 28.284271247461902 spng
+25 7 10 200 2 28.284271247461902 spng
+26 11 14 200 2 28.284271247461902 spng
+27 15 18 200 2 28.284271247461902 spng
+28 19 22 200 2 28.284271247461902 spng
+29 23 26 200 2 28.284271247461902 spng
+30 27 30 200 2 28.284271247461902 spng
+31 31 34 200 2 28.284271247461902 spng
+32 35 38 200 2 28.284271247461902 spng
+33 39 44 200 2 44.7213595499957961 spng
+34 39 42 200 2 28.284271247461902 spng
+35 43 46 200 2 28.284271247461902 spng
+36 47 46 200 2 28.284271247461902 spng
+37 43 42 200 2 28.284271247461902 spng
+38 39 38 200 2 28.284271247461902 spng
+39 35 34 200 2 28.284271247461902 spng
+40 2 3 200 2 28.284271247461902 spng
+41 6 7 200 2 28.284271247461902 spng
+42 10 11 200 2 28.284271247461902 spng
+43 14 15 200 2 28.284271247461902 spng
+44 18 19 200 2 28.284271247461902 spng
+45 22 23 200 2 28.284271247461902 spng
+46 26 27 200 2 28.284271247461902 spng
+47 30 31 200 2 28.284271247461902 spng
+48 1 6 200 2 44.7213595499957961 spng
+49 3 8 200 2 44.7213595499957961 spng
+50 5 10 200 2 44.7213595499957961 spng
+51 7 12 200 2 44.7213595499957961 spng
+52 9 14 200 2 44.7213595499957961 spng
+53 11 16 200 2 44.7213595499957961 spng
+54 13 18 200 2 44.7213595499957961 spng
+55 15 20 200 2 44.7213595499957961 spng
+56 17 22 200 2 44.7213595499957961 spng
+57 19 24 200 2 44.7213595499957961 spng
+58 21 26 200 2 44.7213595499957961 spng
+59 23 28 200 2 44.7213595499957961 spng
+60 25 30 200 2 44.7213595499957961 spng
+61 27 32 200 2 44.7213595499957961 spng
+62 29 34 200 2 44.7213595499957961 spng
+63 31 36 200 2 44.7213595499957961 spng
+64 33 38 200 2 44.7213595499957961 spng
+65 35 40 200 2 44.7213595499957961 spng
+66 37 42 200 2 44.7213595499957961 spng
+67 41 46 200 2 44.7213595499957961 spng
+68 43 48 200 2 44.7213595499957961 spng
+69 2 5 200 2 44.7213595499957961 spng
+70 4 7 200 2 44.7213595499957961 spng
+71 6 9 200 2 44.7213595499957961 spng
+72 8 11 200 2 44.7213595499957961 spng
+73 10 13 200 2 44.7213595499957961 spng
+74 12 15 200 2 44.7213595499957961 spng
+75 14 17 200 2 44.7213595499957961 spng
+76 16 19 200 2 44.7213595499957961 spng
+77 18 21 200 2 44.7213595499957961 spng
+78 20 23 200 2 44.7213595499957961 spng
+79 22 25 200 2 44.7213595499957961 spng
+80 24 27 200 2 44.7213595499957961 spng
+81 26 29 200 2 44.7213595499957961 spng
+82 28 31 200 2 44.7213595499957961 spng
+83 30 33 200 2 44.7213595499957961 spng
+84 32 35 200 2 44.7213595499957961 spng
+85 34 37 200 2 44.7213595499957961 spng
+86 36 39 200 2 44.7213595499957961 spng
+87 38 41 200 2 44.7213595499957961 spng
+88 40 43 200 2 44.7213595499957961 spng
+89 42 45 200 2 44.7213595499957961 spng
+90 44 47 200 2 44.7213595499957961 spng
+91 1 8 200 2 63.2455532033675851 spng
+92 3 10 200 2 63.2455532033675851 spng
+93 5 12 200 2 63.2455532033675851 spng
+94 7 14 200 2 63.2455532033675851 spng
+95 9 16 200 2 63.2455532033675851 spng
+96 11 18 200 2 63.2455532033675851 spng
+97 13 20 200 2 63.2455532033675851 spng
+98 15 22 200 2 63.2455532033675851 spng
+99 17 24 200 2 63.2455532033675851 spng
+100 19 26 200 2 63.2455532033675851 spng
+101 21 28 200 2 63.2455532033675851 spng
+102 23 30 200 2 63.2455532033675851 spng
+103 25 32 200 2 63.2455532033675851 spng
+104 27 34 200 2 63.2455532033675851 spng
+105 29 36 200 2 63.2455532033675851 spng
+106 31 38 200 2 63.2455532033675851 spng
+107 33 40 200 2 63.2455532033675851 spng
+108 35 42 200 2 63.2455532033675851 spng
+109 37 44 200 2 63.2455532033675851 spng
+110 39 46 200 2 63.2455532033675851 spng
+111 48 41 200 2 63.2455532033675851 spng
+112 2 7 200 2 63.2455532033675851 spng
+113 4 9 200 2 63.2455532033675851 spng
+114 6 11 200 2 63.2455532033675851 spng
+115 8 13 200 2 63.2455532033675851 spng
+116 10 15 200 2 63.2455532033675851 spng
+117 12 17 200 2 63.2455532033675851 spng
+118 14 19 200 2 63.2455532033675851 spng
+119 16 21 200 2 63.2455532033675851 spng
+120 18 23 200 2 63.2455532033675851 spng
+121 20 25 200 2 63.2455532033675851 spng
+122 22 27 200 2 63.2455532033675851 spng
+123 24 29 200 2 63.2455532033675851 spng
+124 26 31 200 2 63.2455532033675851 spng
+125 28 33 200 2 63.2455532033675851 spng
+126 30 35 200 2 63.2455532033675851 spng
+127 32 37 200 2 63.2455532033675851 spng
+128 34 39 200 2 63.2455532033675851 spng
+129 36 41 200 2 63.2455532033675851 spng
+130 38 43 200 2 63.2455532033675851 spng
+131 40 45 200 2 63.2455532033675851 spng
+132 42 47 200 2 63.2455532033675851 spng
+133 1 3 200 2 20 spng
+134 3 5 200 2 20 spng
+135 5 7 200 2 20 spng
+136 7 9 200 2 20 spng
+137 9 11 200 2 20 spng
+138 11 13 200 2 20 spng
+139 13 15 200 2 20 spng
+140 15 17 200 2 20 spng
+141 17 19 200 2 20 spng
+142 19 21 200 2 20 spng
+143 21 23 200 2 20 spng
+144 23 25 200 2 20 spng
+145 25 27 200 2 20 spng
+146 27 29 200 2 20 spng
+147 29 31 200 2 20 spng
+148 31 33 200 2 20 spng
+149 33 35 200 2 20 spng
+150 35 37 200 2 20 spng
+151 37 39 200 2 20 spng
+152 39 41 200 2 20 spng
+153 41 43 200 2 20 spng
+154 43 45 200 2 20 spng
+155 45 47 200 2 20 spng
+156 2 4 200 2 20 spng
+157 4 6 200 2 20 spng
+158 6 8 200 2 20 spng
+159 8 10 200 2 20 spng
+160 10 12 200 2 20 spng
+161 12 14 200 2 20 spng
+162 14 16 200 2 20 spng
+163 16 18 200 2 20 spng
+164 18 20 200 2 20 spng
+165 20 22 200 2 20 spng
+166 22 24 200 2 20 spng
+167 24 26 200 2 20 spng
+168 26 28 200 2 20 spng
+169 28 30 200 2 20 spng
+170 30 32 200 2 20 spng
+171 32 34 200 2 20 spng
+172 34 36 200 2 20 spng
+173 36 38 200 2 20 spng
+174 38 40 200 2 20 spng
+175 40 42 200 2 20 spng
+176 42 44 200 2 20 spng
+177 44 46 200 2 20 spng
+178 46 48 200 2 20 spng
+179 1 2 200 2 20 spng
+180 3 4 200 2 20 spng
+181 5 6 200 2 20 spng
+182 7 8 200 2 20 spng
+183 9 10 200 2 20 spng
+184 11 12 200 2 20 spng
+185 13 14 200 2 20 spng
+186 15 16 200 2 20 spng
+187 17 18 200 2 20 spng
+188 19 20 200 2 20 spng
+189 21 22 200 2 20 spng
+190 23 24 200 2 20 spng
+191 25 26 200 2 20 spng
+192 27 28 200 2 20 spng
+193 29 30 200 2 20 spng
+194 31 32 200 2 20 spng
+195 33 34 200 2 20 spng
+196 35 36 200 2 20 spng
+197 37 38 200 2 20 spng
+198 39 40 200 2 20 spng
+199 41 42 200 2 20 spng
+200 43 44 200 2 20 spng
+201 45 46 200 2 20 spng
+202 47 48 200 2 20 spng
+203 47 2 200 2 28.284271247461902 spng
+204 1 48 200 2 28.284271247461902 spng
+205 1 46 200 2 44.7213595499957961 spng
+206 1 44 200 2 63.2455532033675851 spng
+207 47 4 200 2 44.7213595499957961 spng
+208 48 3 200 2 44.7213595499957961 spng
+209 47 6 200 2 63.2455532033675851 spng
+210 48 5 200 2 63.2455532033675851 spng
+211 46 3 200 2 63.2455532033675851 spng
+212 45 4 200 2 63.2455532033675851 spng
+213 47 1 200 2 20 spng
+214 48 2 200 2 20 spng
+215 18 49 300 3 69.2603782836911677 spng
+216 49 20 300 3 69.050706006528273 spng
+217 22 49 300 3 69.3541635375988079 spng
+218 49 24 300 3 69.5269731830747872 spng
+219 26 49 300 3 69.6347614342147381 spng
+220 49 28 300 3 68.9492567037527948 spng
+221 30 49 300 3 68.2641926635040477 spng
+222 49 32 300 3 68.0661443009665419 spng
+223 34 49 300 3 68.4470598345904051 spng
+224 49 36 300 3 68.1175454637056106 spng
+225 38 49 300 3 67.6756972627545252 spng
+226 49 40 300 3 68.6221538571910514 spng
+227 42 49 300 3 68.1835757349231386 spng
+228 49 44 300 3 68.249542123006222 spng
+229 46 49 300 3 68.8767014308902503 spng
+230 49 48 300 3 69.4262198308391305 spng
+231 2 49 300 3 69.8927750200262068 spng
+232 49 4 300 3 69.5701085237043486 spng
+233 6 49 300 3 69.1809222257119103 spng
+234 8 49 300 3 69.2314957226839027 spng
+235 49 10 300 3 69.7782200976780445 spng
+236 12 49 300 3 69.5269731830747872 spng
+237 49 14 300 3 69.8927750200262068 spng
+238 16 49 300 3 69.8927750200262068 spng
+
+
+nodes> 200 random -100 + 100 2array  [ swap set-node-vel ] curry each ;
+
+: go ( -- ) [ model ] go* ;
+
+MAIN: go
diff --git a/springies/models/belt-tire/deploy.factor b/springies/models/belt-tire/deploy.factor
new file mode 100644 (file)
index 0000000..ed522d5
--- /dev/null
@@ -0,0 +1,13 @@
+USING: tools.deploy.config ;
+V{
+    { deploy-ui? t }
+    { deploy-io 2 }
+    { deploy-reflection 1 }
+    { deploy-compiler? t }
+    { deploy-math? t }
+    { deploy-word-props? f }
+    { deploy-word-defs? f }
+    { deploy-c-types? f }
+    { "stop-after-last-window?" t }
+    { "bundle-name" "Belt Tire.app" }
+}
diff --git a/springies/models/belt-tire/tags.txt b/springies/models/belt-tire/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/springies/models/nifty/authors.txt b/springies/models/nifty/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/springies/models/nifty/nifty.factor b/springies/models/nifty/nifty.factor
new file mode 100644 (file)
index 0000000..b23f633
--- /dev/null
@@ -0,0 +1,80 @@
+
+USING: kernel namespaces arrays sequences threads math math.vectors
+       ui random springies springies.ui ;
+
+IN: springies.models.nifty
+
+: model ( -- )
+
+{ } clone >nodes
+{ } clone >springs
+0.007 >time-slice
+gravity off
+
+1 148.581450999999987 350.573888000000011 0 -7.75 1 0.1 mass
+2 168.564277000000004 351.402524000000028 0 -7.75 1 0.1 mass
+3 188.54710399999999 352.231158999999991 0 -7.75 1 0.1 mass
+4 208.529931000000005 353.059794000000011 0 -7.75 1 0.1 mass
+5 228.512757999999991 353.888428999999974 0 -7.75 1 0.1 mass
+6 248.495584000000008 354.717063999999993 0 -7.75 1 0.1 mass
+7 149.410086000000007 330.591061000000025 0 -7.75 1 0.1 mass
+8 150.238720999999998 310.608234999999979 0 -7.75 1 0.1 mass
+9 151.06735599999999 290.625407999999993 0 -7.75 1 0.1 mass
+10 151.895991000000009 270.642581000000007 0 -7.75 1 0.1 mass
+11 152.724626000000001 250.65975499999999 0 -7.75 1 0.1 mass
+12 172.707452999999987 251.48839000000001 0 -7.749999 1 0.1 mass
+13 192.690280000000001 252.317025000000001 0 -7.75 1 0.1 mass
+14 212.67310599999999 253.145659999999992 0 -7.75 1 0.1 mass
+15 232.655933000000005 253.974295000000012 0 -7.75 1 0.1 mass
+16 252.638759999999991 254.802930000000003 0 -7.75 1 0.1 mass
+17 251.810124999999999 274.78575699999999 0 -7.75 1 0.1 mass
+18 250.98148900000001 294.768583999999976 0 -7.75 1 0.1 mass
+19 249.324218999999999 334.734237000000007 0 -7.75 1 0.1 mass
+20 250.152853999999991 314.751410000000021 0 -7.75 1 0.1 mass
+1 1 2 200 1.5 20 spng
+2 2 3 200 1.5 20 spng
+3 3 4 200 1.5 20 spng
+4 4 5 200 1.5 20 spng
+5 5 6 200 1.5 20 spng
+6 6 19 200 1.5 20 spng
+7 19 20 200 1.5 20 spng
+8 20 18 200 1.5 20 spng
+9 18 17 200 1.5 20 spng
+10 17 16 200 1.5 20 spng
+11 16 15 200 1.5 20 spng
+12 15 14 200 1.5 20 spng
+13 14 13 200 1.5 20 spng
+14 13 12 200 1.5 20 spng
+15 12 11 200 1.5 20 spng
+16 11 10 200 1.5 20 spng
+17 10 9 200 1.5 20 spng
+18 9 8 200 1.5 20 spng
+19 8 7 200 1.5 20 spng
+20 7 1 200 1.5 20 spng
+21 1 19 200 1.5 101.98039 spng
+22 19 14 200 1.5 89.4427189999999968 spng
+23 14 8 200 1.5 84.8528139999999951 spng
+24 8 5 200 1.5 89.4427189999999968 spng
+25 5 16 200 1.5 101.98039 spng
+26 16 10 200 1.5 101.98039 spng
+27 10 3 200 1.5 89.4427189999999968 spng
+28 3 18 200 1.5 84.8528139999999951 spng
+29 18 12 200 1.5 89.4427189999999968 spng
+30 12 1 200 1.5 101.98039 spng
+31 2 20 200 1.5 89.4427189999999968 spng
+32 20 13 200 1.5 84.8528139999999951 spng
+33 13 7 200 1.5 89.4427189999999968 spng
+34 7 6 200 1.5 101.98039 spng
+35 6 15 200 1.5 101.98039 spng
+36 15 9 200 1.5 89.4427189999999968 spng
+37 9 4 200 1.5 84.8528139999999951 spng
+38 4 17 200 1.5 89.4427189999999968 spng
+39 17 11 200 1.5 101.98039 spng
+40 11 2 200 1.5 101.98039 spng
+
+nodes> 200 random -100 + 200 random -100 + 2array [ swap set-node-vel ] curry
+each ;
+
+: go ( -- ) [ model ] go* ;
+
+MAIN: go
diff --git a/springies/models/nifty/tags.txt b/springies/models/nifty/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/springies/models/urchin/authors.txt b/springies/models/urchin/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/springies/models/urchin/tags.txt b/springies/models/urchin/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/springies/models/urchin/urchin.factor b/springies/models/urchin/urchin.factor
new file mode 100644 (file)
index 0000000..03b2c88
--- /dev/null
@@ -0,0 +1,113 @@
+
+USING: kernel namespaces arrays sequences threads math math.vectors
+       ui random
+       springies springies.ui ;
+
+IN: springies.models.urchin
+
+: model ( -- )
+
+{ } clone >nodes
+{ } clone >springs
+0.007 >time-slice
+gravity on
+
+1 507.296953 392.174236 -11.451186 -71.267273 1.0 1.0 mass
+2 514.879820 372.128025 11.950035 -70.858717 1.0 1.0 mass
+3 536.571268 364.423706 18.394466 -41.159445 1.0 1.0 mass
+4 554.886966 369.953895 15.173664 -11.009243 1.0 1.0 mass
+5 572.432935 379.927626 8.228103 -1.120846 1.0 1.0 mass
+6 585.774508 392.380791 5.443281 -8.186599 1.0 1.0 mass
+7 584.650543 411.934530 -15.582843 -24.911756 1.0 1.0 mass
+8 569.409148 424.155713 -24.100159 -42.285960 1.0 1.0 mass
+9 553.751996 434.663690 -26.069217 -41.610454 1.0 1.0 mass
+10 536.684374 444.915694 -30.702349 -45.021926 1.0 1.0 mass
+11 516.677286 435.936238 -33.128410 -60.977340 1.0 1.0 mass
+12 514.170680 414.649472 -24.471518 -64.104425 1.0 1.0 mass
+13 602.101547 478.298945 1.612646 -53.040881 1.0 1.0 mass
+14 637.0 427.598266 0.0 0.0 1.0 1.0 mass
+15 608.000171 350.425575 31.812856 23.456940 1.0 1.0 mass
+16 484.367809 332.414622 42.575378 -91.238351 1.0 1.0 mass
+17 480.857379 475.215663 -24.240991 -53.909049 1.0 1.0 mass
+18 548.580015 492.173168 -34.565312 -52.436468 1.0 1.0 mass
+19 578.155338 487.173526 22.544495 -71.920721 1.0 1.0 mass
+20 630.992588 379.333707 16.662115 37.873709 1.0 1.0 mass
+21 591.256916 324.817423 63.036114 27.988433 1.0 1.0 mass
+22 539.051461 311.597938 159.501014 -27.955219 1.0 1.0 mass
+23 448.396171 396.882674 -15.045910 -138.652372 1.0 1.0 mass
+24 448.194414 419.993896 -27.625008 -84.936708 1.0 1.0 mass
+1 1 2 200.0 3.0 20.0 spng
+2 2 3 200.0 3.0 20.0 spng
+3 3 4 200.0 3.0 20.0 spng
+4 4 5 200.0 3.0 20.0 spng
+5 5 6 200.0 3.0 20.0 spng
+6 6 7 200.0 3.0 20.0 spng
+7 7 8 200.0 3.0 20.0 spng
+8 8 9 200.0 3.0 20.0 spng
+9 9 10 200.0 3.0 20.0 spng
+10 10 11 200.0 3.0 20.0 spng
+11 11 12 200.0 3.0 20.0 spng
+12 1 3 200.0 3.0 40.0 spng
+13 2 4 200.0 3.0 40.0 spng
+14 3 5 200.0 3.0 40.0 spng
+15 4 6 200.0 3.0 40.0 spng
+16 6 8 200.0 3.0 40.0 spng
+17 7 9 200.0 3.0 40.0 spng
+18 8 10 200.0 3.0 40.0 spng
+19 9 11 200.0 3.0 40.0 spng
+20 10 12 200.0 3.0 40.0 spng
+21 12 1 200.0 3.0 21.0 spng
+22 12 2 200.0 3.0 41.0 spng
+23 11 1 200.0 3.0 41.0 spng
+24 6 12 200.0 3.0 72.681733 spng
+25 5 11 200.0 3.0 81.191259 spng
+26 10 4 200.0 3.0 76.026311 spng
+27 3 9 200.0 3.0 72.615425 spng
+28 8 2 200.0 3.0 74.966659 spng
+29 1 7 200.0 3.0 80.280757 spng
+30 17 11 200.0 3.0 55.036352 spng
+31 10 18 200.0 3.0 49.819675 spng
+32 19 9 200.0 3.0 54.918121 spng
+33 8 13 200.0 3.0 62.201286 spng
+34 14 7 200.0 3.0 58.600341 spng
+35 6 20 200.0 3.0 46.400431 spng
+36 15 5 200.0 3.0 44.045431 spng
+37 4 21 200.0 3.0 57.454330 spng
+38 22 3 200.0 3.0 53.823787 spng
+39 2 16 200.0 3.0 51.039201 spng
+40 23 1 200.0 3.0 58.668561 spng
+41 12 24 200.0 3.0 64.404969 spng
+42 24 11 200.0 3.0 71.217975 spng
+43 17 12 200.0 3.0 65.0 spng
+44 11 18 200.0 3.0 60.745370 spng
+45 18 9 200.0 3.0 60.406953 spng
+46 9 13 200.0 3.0 67.779053 spng
+47 13 7 200.0 3.0 66.708320 spng
+48 7 20 200.0 3.0 55.659680 spng
+49 20 5 200.0 3.0 60.0 spng
+50 5 21 200.0 3.0 61.846584 spng
+51 21 3 200.0 3.0 64.031242 spng
+52 3 16 200.0 3.0 63.568860 spng
+53 16 1 200.0 3.0 59.774577 spng
+54 1 24 200.0 3.0 65.802736 spng
+55 17 10 200.0 3.0 64.845971 spng
+56 10 19 200.0 3.0 58.249464 spng
+57 19 8 200.0 3.0 67.268120 spng
+58 8 14 200.0 3.0 67.268120 spng
+59 14 6 200.0 3.0 64.629715 spng
+60 6 15 200.0 3.0 50.089919 spng
+61 15 4 200.0 3.0 56.320511 spng
+62 4 22 200.0 3.0 60.728906 spng
+63 22 2 200.0 3.0 61.032778 spng
+64 2 23 200.0 3.0 66.528190 spng
+65 23 12 200.0 3.0 72.277244 spng
+
+nodes>
+    75 random -75 + 0 2array [ over node-vel v+ swap set-node-vel ]
+curry each
+
+;
+
+: go ( -- ) [ model ] go* ;
+
+MAIN: go
diff --git a/springies/springies.factor b/springies/springies.factor
new file mode 100644 (file)
index 0000000..e5dec90
--- /dev/null
@@ -0,0 +1,251 @@
+
+USING: kernel combinators sequences arrays math math.vectors
+       generalizations vars accessors math.physics.vel ;
+
+IN: springies
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: scalar-projection ( a b -- n ) [ v. ] [ nip norm ] 2bi / ;
+
+: vector-projection ( a b -- vec )
+  [ nip normalize ] [ scalar-projection ] 2bi v*n ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+VAR: nodes
+VAR: springs
+VAR: time-slice
+VAR: world-size
+
+: world-width ( -- width ) world-size> first ;
+
+: world-height ( -- height ) world-size> second ;
+
+VAR: gravity
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! node
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+TUPLE: node < vel mass elas force ;
+
+C: <node> node
+
+: node-vel ( node -- vel ) vel>> ;
+
+: set-node-vel ( vel node -- ) swap >>vel drop ;
+
+: pos-x ( node -- x ) pos>> first ;
+: pos-y ( node -- y ) pos>> second ;
+: vel-x ( node -- y ) vel>> first ;
+: vel-y ( node -- y ) vel>> second ;
+
+: >>pos-x ( node x -- node ) over pos>> set-first ;
+: >>pos-y ( node y -- node ) over pos>> set-second ;
+: >>vel-x ( node x -- node ) over vel>> set-first ;
+: >>vel-y ( node y -- node ) over vel>> set-second ;
+
+: apply-force ( node vec -- ) over force>> v+ >>force drop ;
+
+: reset-force ( node -- node ) 0 0 2array >>force ;
+
+: node-id ( id -- node ) 1- nodes> nth ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! spring
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+TUPLE: spring rest-length k damp node-a node-b ;
+
+C: <spring> spring
+
+: end-points ( spring -- b-pos a-pos )
+  [ node-b>> pos>> ] [ node-a>> pos>> ] bi ;
+
+: spring-length ( spring -- length ) end-points v- norm ;
+
+: stretch-length ( spring -- length )
+  [ spring-length ] [ rest-length>> ] bi - ;
+
+: dir ( spring -- vec ) end-points v- normalize ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! Hooke
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! 
+! F = -kx
+! 
+! k :: spring constant
+! x :: distance stretched beyond rest length
+! 
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: hooke-force-mag ( spring -- mag ) [ k>> ] [ stretch-length ] bi * ;
+
+: hooke-force ( spring -- force ) [ dir ] [ hooke-force-mag ] bi v*n ;
+
+: hooke-forces ( spring -- a b ) hooke-force dup vneg ;
+
+: act-on-nodes-hooke ( spring -- )
+  [ node-a>> ] [ node-b>> ] [ ] tri hooke-forces swapd
+  apply-force
+  apply-force ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! damping
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! 
+! F = -bv
+! 
+! b :: Damping constant
+! v :: Velocity
+! 
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! : damping-force-a ( spring -- vec )
+!   [ spring-node-a node-vel ] [ spring-damp ] bi v*n vneg ;
+
+! : damping-force-b ( spring -- vec )
+!   [ spring-node-b node-vel ] [ spring-damp ] bi v*n vneg ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: relative-velocity-a ( spring -- vel )
+  [ node-a>> vel>> ] [ node-b>> vel>> ] bi v- ;
+
+: unit-vec-b->a ( spring -- vec )
+  [ node-a>> pos>> ] [ node-b>> pos>> ] bi v- ;
+
+: relative-velocity-along-spring-a ( spring -- vel )
+  [ relative-velocity-a ] [ unit-vec-b->a ] bi vector-projection ;
+
+: damping-force-a ( spring -- vec )
+  [ relative-velocity-along-spring-a ] [ damp>> ] bi v*n vneg ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: relative-velocity-b ( spring -- vel )
+  [ node-b>> vel>> ] [ node-a>> vel>> ] bi v- ;
+
+: unit-vec-a->b ( spring -- vec )
+  [ node-b>> pos>> ] [ node-a>> pos>> ] bi v- ;
+
+: relative-velocity-along-spring-b ( spring -- vel )
+  [ relative-velocity-b ] [ unit-vec-a->b ] bi vector-projection ;
+
+: damping-force-b ( spring -- vec )
+  [ relative-velocity-along-spring-b ] [ damp>> ] bi v*n vneg ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: act-on-nodes-damping ( spring -- )
+  dup
+  [ node-a>> ] [ damping-force-a ] bi apply-force
+  [ node-b>> ] [ damping-force-b ] bi apply-force ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: below? ( node -- ? ) pos-y 0 < ;
+
+: above? ( node -- ? ) pos-y world-height >= ;
+
+: beyond-left? ( node -- ? ) pos-x 0 < ; 
+
+: beyond-right? ( node -- ? ) pos-x world-width >= ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: bounce-top ( node -- )
+  world-height 1- >>pos-y
+  dup [ vel-y ] [ elas>> ] bi * neg >>vel-y
+  drop ;
+
+: bounce-bottom ( node -- )
+  0 >>pos-y
+  dup [ vel-y ] [ elas>> ] bi * neg >>vel-y
+  drop ;
+
+: bounce-left ( node -- )
+  0 >>pos-x
+  dup [ vel-x ] [ elas>> ] bi * neg >>vel-x
+  drop ;
+
+: bounce-right ( node -- )
+  world-width 1- >>pos-x
+  dup [ vel-x ] [ elas>> ] bi * neg >>vel-x
+  drop ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: handle-bounce ( node -- )
+  { { [ dup above? ]        [ bounce-top ] }
+    { [ dup below? ]        [ bounce-bottom ] }
+    { [ dup beyond-left? ]  [ bounce-left ] }
+    { [ dup beyond-right? ] [ bounce-right ] }
+    { [ t ]                 [ drop ] } }
+  cond ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: act-on-nodes ( spring -- )
+  dup
+  act-on-nodes-hooke
+  act-on-nodes-damping ;
+
+! : act-on-nodes ( spring -- ) act-on-nodes-hooke ;
+
+: loop-over-springs ( -- ) springs> [ act-on-nodes ] each ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: apply-gravity ( node -- ) { 0 -9.8 } apply-force ;
+
+: do-gravity ( -- ) gravity> [ nodes> [ apply-gravity ] each ] when ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! F = ma
+
+: calc-acceleration ( node -- vec ) [ force>> ] [ mass>> ] bi v/n ;
+
+: new-vel ( node -- vel )
+  [ vel>> ] [ calc-acceleration time-slice> v*n ] bi v+ ;
+
+: new-pos ( node -- pos ) [ pos>> ] [ vel>> time-slice> v*n ] bi v+ ;
+
+: iterate-node ( node -- )
+  dup new-pos >>pos
+  dup new-vel >>vel
+  reset-force
+  handle-bounce ;
+
+: iterate-nodes ( -- ) nodes> [ iterate-node ] each ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: iterate-system ( -- ) do-gravity loop-over-springs iterate-nodes ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! Reading xspringies data files
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: mass ( id x y x-vel y-vel mass elas -- )
+  node new
+    swap >>elas
+    swap >>mass
+    -rot 2array >>vel
+    -rot 2array >>pos
+    0 0  2array >>force
+  nodes> swap suffix >nodes
+  drop ;
+
+: spng ( id id-a id-b k damp rest-length -- )
+   spring new
+     swap >>rest-length
+     swap >>damp
+     swap >>k
+     swap node-id >>node-b
+     swap node-id >>node-a
+   springs> swap suffix >springs
+   drop ;
diff --git a/springies/summary.txt b/springies/summary.txt
new file mode 100644 (file)
index 0000000..edd2bf3
--- /dev/null
@@ -0,0 +1 @@
+Mass and spring simulation (inspired by xspringies)
diff --git a/springies/tags.txt b/springies/tags.txt
new file mode 100644 (file)
index 0000000..375ac57
--- /dev/null
@@ -0,0 +1,3 @@
+simulation
+physics
+demos
\ No newline at end of file
diff --git a/springies/ui/authors.txt b/springies/ui/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/springies/ui/ui.factor b/springies/ui/ui.factor
new file mode 100644 (file)
index 0000000..21e97a1
--- /dev/null
@@ -0,0 +1,65 @@
+
+USING: kernel namespaces threads sequences math math.vectors
+       opengl.gl opengl colors ui ui.gadgets ui.gadgets.slate
+       fry rewrite-closures vars springies accessors math.geometry.rect ;
+
+IN: springies.ui
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: draw-node ( node -- ) pos>> { -5 -5 } v+ [ { 10 10 } gl-rect ] with-translation ;
+
+: draw-spring ( spring -- )
+  [ node-a>> pos>> ] [ node-b>> pos>> ] bi gl-line ;
+
+: draw-nodes ( -- ) nodes> [ draw-node ] each ;
+
+: draw-springs ( -- ) springs> [ draw-spring ] each ;
+
+: set-projection ( -- )
+  GL_PROJECTION glMatrixMode
+  glLoadIdentity
+  0 world-width 1- 0 world-height 1- -1 1 glOrtho
+  GL_MODELVIEW glMatrixMode
+  glLoadIdentity ;
+
+! : display ( -- ) set-projection black gl-color draw-nodes draw-springs ;
+
+: display ( -- ) set-projection black gl-color draw-nodes draw-springs ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+VAR: slate
+
+VAR: loop
+
+: update-world-size ( -- ) slate> rect-dim >world-size ;
+
+: refresh-slate ( -- ) slate> relayout-1 ;
+
+DEFER: maybe-loop
+
+: run ( -- )
+  update-world-size
+  iterate-system
+  refresh-slate
+  yield
+  maybe-loop ;
+
+: maybe-loop ( -- ) loop> [ run ] when ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: springies-window* ( -- )
+
+  C[ display ] <slate>
+    { 800 600 } >>pdim
+    C[ { 500 500 } >world-size loop on [ run ] in-thread ] >>graft
+    C[ loop off ] >>ungraft
+  [ >slate ] [ "Springies" open-window ] bi ;
+
+: springies-window ( -- ) [ [ springies-window* ] with-scope ] with-ui ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: go* ( quot -- ) '[ [ springies-window* 1000 sleep @ ] with-scope ] with-ui ;
diff --git a/sto/sto.factor b/sto/sto.factor
new file mode 100644 (file)
index 0000000..b43c9cc
--- /dev/null
@@ -0,0 +1,20 @@
+
+USING: kernel lexer parser words quotations compiler.units ;
+
+IN: sto
+
+! Use 'sto' to bind a value on the stack to a word.
+!
+! Example:
+!
+!   10 sto A
+
+: sto
+  \ 1quotation parsed
+  scan
+    current-vocab create
+    dup set-word
+  literalize parsed
+  \ swap parsed
+  [ define ] parsed
+  \ with-compilation-unit parsed ;                              parsing
diff --git a/sudokus/authors.txt b/sudokus/authors.txt
new file mode 100644 (file)
index 0000000..2300f69
--- /dev/null
@@ -0,0 +1 @@
+Sam Anklesaria
diff --git a/sudokus/sudokus.factor b/sudokus/sudokus.factor
new file mode 100644 (file)
index 0000000..a45df31
--- /dev/null
@@ -0,0 +1,40 @@
+USING: accessors arrays combinators.short-circuit grouping kernel lists
+lists.lazy locals math math.functions math.parser math.ranges
+models.product monads random sequences sets ui ui.gadgets.controls
+ui.gadgets.layout models.combinators ui.gadgets.alerts vectors fry
+ui.gadgets.labels shuffle ;
+IN: sudokus
+
+: row ( index -- row ) 1 + 9 / ceiling ;
+: col ( index -- col ) 9 mod 1 + ;
+: sq ( index -- square ) [ row ] [ col ] bi [ 3 / ceiling ] bi@ 2array ;
+: near ( a pos -- ? ) { [ [ row ] same? ] [ [ col ] same? ] [ [ sq ] same? ] } 2|| ;
+: nth-or-lower ( n seq -- elt ) [ length 1 - 2dup > [ nip ] [ drop ] if ] keep nth ;
+
+:: solutions ( puzzle random? -- solutions )
+    f puzzle random? [ indices [ f ] [ random? swap nth-or-lower ] if-empty ] [ index ] if
+    [ :> pos
+      1 9 [a,b] 80 <iota> [ pos near ] filter [ puzzle nth ] map prune diff
+      [ 1array puzzle pos cut-slice rest surround ] map >list [ random? solutions ] bind
+    ] [ puzzle list-monad return ] if* ;
+
+: solution ( puzzle random? -- solution ) dupd solutions dup +nil+ = [ drop "Unsolvable" alert* ] [ nip car ] if ;
+: hint ( puzzle -- puzzle' ) [ [ f swap indices random dup ] [ f solution ] bi nth ] keep swapd >vector [ set-nth ] keep ;
+: create ( difficulty -- puzzle ) 81 [ f ] replicate
+    40 random solution [ [ f swap [ length random ] keep set-nth ] curry times ] keep ;
+
+: do-sudoku ( -- ) [ [
+        [
+            81 [ "" ] replicate <basic> switch-models [ [ <basic> ] map 9 group [ 3 group ] map 3 group
+               [ [ [ <spacer> [ [ <model-field> ->% 2 [ string>number ] fmap ]
+                    map <spacer> ] map concat ] <hbox> , ] map concat <spacer> ] map concat <product>
+               [ "Difficulty:" <label> , "1" <basic> <model-field> -> [ string>number 1 or 1 + 10 * ] fmap
+               "Generate" <model-border-btn> -> updates [ create ] fmap <spacer>
+               "Hint" <model-border-btn> -> "Solve" <model-border-btn> -> ] <hbox> ,
+               roll [ swap updates ] curry bi@
+               [ [ hint ] fmap ] [ [ f solution ] fmap ] bi* 3array merge [ [ [ number>string ] [ "" ] if* ] map ] fmap
+           ] bind
+        ] with-self , ] <vbox> { 280 220 } >>pref-dim
+    "Sudoku Sleuth" open-window ] with-ui ;
+
+MAIN: do-sudoku
diff --git a/sudokus/summary.txt b/sudokus/summary.txt
new file mode 100644 (file)
index 0000000..d66e7be
--- /dev/null
@@ -0,0 +1 @@
+graphical sudoku solver
\ No newline at end of file
diff --git a/tabs/authors.txt b/tabs/authors.txt
new file mode 100644 (file)
index 0000000..9366723
--- /dev/null
@@ -0,0 +1 @@
+William Schlieper
diff --git a/tabs/summary.txt b/tabs/summary.txt
new file mode 100644 (file)
index 0000000..a55610b
--- /dev/null
@@ -0,0 +1 @@
+Tabbed windows
\ No newline at end of file
diff --git a/tabs/tabs.factor b/tabs/tabs.factor
new file mode 100644 (file)
index 0000000..d05890c
--- /dev/null
@@ -0,0 +1,62 @@
+! Copyright (C) 2008 William Schlieper
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: accessors kernel fry math math.vectors sequences arrays vectors assocs
+       hashtables models models.range models.product combinators
+       ui ui.gadgets ui.gadgets.buttons ui.gadgets.frames ui.gadgets.packs
+       ui.gadgets.grids ui.gadgets.viewports ui.gadgets.books locals ;
+
+IN: ui.gadgets.tabs
+
+TUPLE: tabbed < frame names toggler content ;
+
+DEFER: (del-page)
+
+:: add-toggle ( n name model toggler -- )
+  <frame>
+    n name toggler parent>> '[ drop _ _ _ (del-page) ] "X" swap <bevel-button>
+      @right grid-add
+    n model name <toggle-button> @center grid-add
+  toggler swap add-gadget drop ;
+
+: redo-toggler ( tabbed -- )
+     [ names>> ] [ model>> ] [ toggler>> ] tri
+     [ clear-gadget ] keep
+     [ [ length ] keep ] 2dip
+     '[ _ _ add-toggle ] 2each ;
+
+: refresh-book ( tabbed -- )
+    model>> [ ] change-model ;
+
+: (del-page) ( n name tabbed -- )
+    { [ [ remove ] change-names redo-toggler ]
+      [ dupd [ names>> length ] [ model>> ] bi
+        [ [ = ] keep swap [ 1- ] when
+          [ < ] keep swap [ 1- ] when ] change-model ]
+      [ content>> nth-gadget unparent ]
+      [ refresh-book ]
+    } cleave ;
+
+: add-page ( page name tabbed -- )
+    [ names>> push ] 2keep
+    [ [ names>> length 1 - swap ]
+      [ model>> ]
+      [ toggler>> ] tri add-toggle ]
+    [ content>> swap add-gadget drop ]
+    [ refresh-book ] tri ;
+
+: del-page ( name tabbed -- )
+    [ names>> index ] 2keep (del-page) ;
+
+: new-tabbed ( assoc class -- tabbed )
+    new-frame
+    0 <model> >>model
+    <pile> 1 >>fill >>toggler
+    dup toggler>> @left grid-add
+    swap
+      [ keys >vector >>names ]
+      [ values over model>> <book> >>content dup content>> @center grid-add ]
+    bi
+    dup redo-toggler ;
+    
+: <tabbed> ( assoc -- tabbed ) tabbed new-tabbed ;
diff --git a/tangle/authors.txt b/tangle/authors.txt
new file mode 100644 (file)
index 0000000..e9c193b
--- /dev/null
@@ -0,0 +1 @@
+Alex Chapman
diff --git a/tangle/html/html-tests.factor b/tangle/html/html-tests.factor
new file mode 100644 (file)
index 0000000..88ad748
--- /dev/null
@@ -0,0 +1,7 @@
+USING: kernel semantic-db tangle.html tools.test ;
+IN: tangle.html.tests
+
+[ "test" ] [ "test" >html ] unit-test
+[ "<ul><li>An Item</li></ul>" ] [ { "An Item" } <ulist> >html ] unit-test
+[ "<ul><li>One</li><li>Two</li><li>Three, ah ah ah</li></ul>" ] [ { "One" "Two" "Three, ah ah ah" } <ulist> >html ] unit-test
+[ "<a href='foo/bar'>some link</a>" ] [ "foo/bar" "some link" <link> >html ] unit-test
diff --git a/tangle/html/html.factor b/tangle/html/html.factor
new file mode 100644 (file)
index 0000000..2ec6b52
--- /dev/null
@@ -0,0 +1,33 @@
+! Copyright (C) 2008 Alex Chapman
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors html.elements io io.streams.string kernel namespaces semantic-db sequences strings tangle.path ;
+IN: tangle.html
+
+TUPLE: element attributes ;
+
+TUPLE: ulist < element items ;
+: <ulist> ( items -- element )
+    H{ } clone swap ulist boa ;
+
+TUPLE: link < element href text ;
+: <link> ( href text -- element )
+    H{ } clone -rot link boa ;
+
+GENERIC: >html ( element -- str )
+
+M: string >html ( str -- str ) ;
+
+M: link >html ( link -- str )
+    [ <a dup href>> =href a> text>> write </a> ] with-string-writer ;
+
+M: node >html ( node -- str )
+    dup node>path [
+        swap node-content <link> >html
+    ] [
+        node-content
+    ] if* ;
+
+M: ulist >html ( ulist -- str )
+    [
+        <ul> items>> [ <li> >html write </li> ] each </ul>
+    ] with-string-writer ;
diff --git a/tangle/menu/menu.factor b/tangle/menu/menu.factor
new file mode 100644 (file)
index 0000000..828db5d
--- /dev/null
@@ -0,0 +1,22 @@
+! Copyright (C) 2008 Alex Chapman
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors kernel semantic-db sequences tangle.html ;
+IN: tangle.menu
+
+RELATION: subitem-of
+RELATION: before
+
+: get-menus ( -- nodes )
+    subitem-of-relation ultimate-objects node-results ;
+
+: get-menu ( name -- node )
+    get-menus [ node-content = ] with find nip ;
+
+: ensure-menu ( name -- node )
+    dup get-menu [ ] [ create-node ] ?if ;
+
+: load-menu ( name -- menu )
+    get-menu subitem-of-relation get-node-tree-s ;
+
+: menu>ulist ( menu -- str ) children>> <ulist> ;
+: menu>html ( menu -- str ) menu>ulist >html ;
diff --git a/tangle/page/page.factor b/tangle/page/page.factor
new file mode 100644 (file)
index 0000000..db3d58d
--- /dev/null
@@ -0,0 +1,23 @@
+! Copyright (C) 2008 Alex Chapman
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors kernel semantic-db sequences sequences.lib ;
+IN: tangle.page
+
+RELATION: has-abbreviation
+RELATION: has-content
+RELATION: has-subsection
+RELATION: before
+RELATION: authored-by
+RELATION: authored-on
+
+TUPLE: page name abbreviation author created content ;
+C: <page> page
+
+: load-page-content ( node -- content )
+    has-content-objects [ node-content ] map concat ;
+
+: load-page ( node -- page )
+    dup [ has-abbreviation-objects ?first ] keep
+    [ authored-by-objects ?first ] keep
+    [ authored-on-objects ?first ] keep
+    load-page-content <page> ;
diff --git a/tangle/path/path.factor b/tangle/path/path.factor
new file mode 100644 (file)
index 0000000..b4151ce
--- /dev/null
@@ -0,0 +1,56 @@
+! Copyright (C) 2008 Alex Chapman
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel semantic-db sequences sequences.lib splitting ;
+IN: tangle.path
+
+RELATION: has-filename
+RELATION: in-directory
+
+: create-root ( -- node ) "" create-node ;
+
+: get-root ( -- node )
+    in-directory-relation ultimate-objects ?1node-result ;
+
+: ensure-root ( -- node ) get-root [ create-root ] unless* ;
+
+: create-file ( parent name -- node )
+    create-node swap dupd in-directory ;
+
+: files-in-directory ( node -- nodes ) in-directory-subjects ;
+
+: file-in-directory ( name node -- node )
+    in-directory-relation subjects-with-cor ?1node-result ;
+
+: parent-directory ( file-node -- dir-node )
+    in-directory-objects ?first ;
+
+: (path>node) ( node name -- node )
+    swap [ file-in-directory ] [ drop f ] if* ;
+
+: path>node ( path -- node )
+    ensure-root swap [ (path>node) ] each ;
+
+: path>file ( path -- file )
+    path>node [ has-filename-subjects ?first ] [ f ] if* ;
+
+: (node>path) ( root seq node -- seq )
+    pick over node= [
+        drop nip
+    ] [
+        dup node-content pick push
+        parent-directory [
+            (node>path)
+        ] [
+            2drop f
+        ] if*
+    ] if ;
+
+: node>path* ( root node -- path )
+    V{ } clone swap (node>path) dup empty?
+    [ drop f ] [ <reversed> ] if ;
+
+: node>path ( node -- path )
+    ensure-root swap node>path* ;
+
+: file>path ( node -- path )
+    has-filename-objects ?first [ node>path ] [ f ] if* ;
diff --git a/tangle/resources/jquery-1.2.3.min.js b/tangle/resources/jquery-1.2.3.min.js
new file mode 100644 (file)
index 0000000..3747929
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * jQuery 1.2.3 - New Wave Javascript
+ *
+ * Copyright (c) 2008 John Resig (jquery.com)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * $Date: 2008-02-06 00:21:25 -0500 (Wed, 06 Feb 2008) $
+ * $Rev: 4663 $
+ */
+(function(){if(window.jQuery)var _jQuery=window.jQuery;var jQuery=window.jQuery=function(selector,context){return new jQuery.prototype.init(selector,context);};if(window.$)var _$=window.$;window.$=jQuery;var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/;var isSimple=/^.[^:#\[\.]*$/;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}else if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem)if(elem.id!=match[3])return jQuery().find(selector);else{this[0]=elem;this.length=1;return this;}else
+selector=[];}}else
+return new jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return new jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(selector.constructor==Array&&selector||(selector.jquery||selector.length&&selector!=window&&!selector.nodeType&&selector[0]!=undefined&&selector[0].nodeType)&&jQuery.makeArray(selector)||[selector]);},jquery:"1.2.3",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;this.each(function(i){if(this==elem)ret=i;});return ret;},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value==undefined)return this.length&&jQuery[type||"attr"](this[0],name)||undefined;else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else
+return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else
+selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return!selector?this:this.pushStack(jQuery.merge(this.get(),selector.constructor==String?jQuery(selector).get():selector.length!=undefined&&(!selector.nodeName||jQuery.nodeName(selector,"form"))?selector:[selector]));},is:function(selector){return selector?jQuery.multiFilter(selector,this).length>0:false;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)return value;values.push(value);}}return values;}else
+return(this[0].value||"").replace(/\r/g,"");}return undefined;}return this.each(function(){if(this.nodeType!=1)return;if(value.constructor==Array&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=value.constructor==Array?value:[value];jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else
+this.value=value;});},html:function(value){return value==undefined?(this.length?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value==null){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data==undefined&&this.length)data=jQuery.data(this[0],key);return data==null&&parts[1]?this.data(parts[0]):data;}else
+return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script")){scripts=scripts.add(elem);}else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.prototype.init.prototype=jQuery.prototype;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else
+jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==1){target=this;i=0;}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){if(target===options[name])continue;if(deep&&options[name]&&typeof options[name]=="object"&&target[name]&&!options[name].nodeType)target[name]=jQuery.extend(target[name],options[name]);else if(options[name]!=undefined)target[name]=options[name];}return target;};var expando="jQuery"+(new Date()).getTime(),uuid=0,windowData={};var exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i;jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return!!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/function/i.test(fn+"");},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;else
+script.appendChild(document.createTextNode(data));head.appendChild(script);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])jQuery.cache[id]={};if(data!=undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)elem.removeAttribute(expando);}delete jQuery.cache[id];}},each:function(object,callback,args){if(args){if(object.length==undefined){for(var name in object)if(callback.apply(object[name],args)===false)break;}else
+for(var i=0,length=object.length;i<length;i++)if(callback.apply(object[i],args)===false)break;}else{if(object.length==undefined){for(var name in object)if(callback.call(object[name],name,object[name])===false)break;}else
+for(var i=0,length=object.length,value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else
+jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret;function color(elem){if(!jQuery.browser.safari)return false;var ret=document.defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(elem.style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=elem.style.outline;elem.style.outline="0 solid black";elem.style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&elem.style&&elem.style[name])ret=elem.style[name];else if(document.defaultView&&document.defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var getComputedStyle=document.defaultView.getComputedStyle(elem,null);if(getComputedStyle&&!color(elem))ret=getComputedStyle.getPropertyValue(name);else{var swap=[],stack=[];for(var a=elem;a&&color(a);a=a.parentNode)stack.unshift(a);for(var i=0;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(getComputedStyle&&getComputedStyle.getPropertyValue(name))||"";for(var i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}if(name=="opacity"&&ret=="")ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var style=elem.style.left,runtimeStyle=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;elem.style.left=ret||0;ret=elem.style.pixelLeft+"px";elem.style.left=style;elem.runtimeStyle.left=runtimeStyle;}}return ret;},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem=elem.toString();if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else
+ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var fix=jQuery.isXMLDoc(elem)?{}:jQuery.props;if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(fix[name]){if(value!=undefined)elem[fix[name]]=value;return elem[fix[name]];}else if(jQuery.browser.msie&&name=="style")return jQuery.attr(elem.style,"cssText",value);else if(value==undefined&&jQuery.browser.msie&&jQuery.nodeName(elem,"form")&&(name=="action"||name=="method"))return elem.getAttributeNode(name).nodeValue;else if(elem.tagName){if(value!=undefined){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem.setAttribute(name,""+value);}if(jQuery.browser.msie&&/href|src/.test(name)&&!jQuery.isXMLDoc(elem))return elem.getAttribute(name,2);return elem.getAttribute(name);}else{if(name=="opacity"&&jQuery.browser.msie){if(value!=undefined){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseFloat(value).toString()=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100).toString():"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(value!=undefined)elem[name]=value;return elem[name];}},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(typeof array!="array")for(var i=0,length=array.length;i<length;i++)ret.push(array[i]);else
+ret=array.slice(0);return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]==elem)return i;return-1;},merge:function(first,second){if(jQuery.browser.msie){for(var i=0;second[i];i++)if(second[i].nodeType!=8)first.push(second[i]);}else
+for(var i=0;second[i];i++)first.push(second[i]);return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)if(!inv&&callback(elems[i],i)||inv&&!callback(elems[i],i))ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!==null&&value!=undefined){if(value.constructor!=Array)value=[value];ret=ret.concat(value);}}return ret;}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,innerHTML:"innerHTML",className:"className",value:"value",disabled:"disabled",checked:"checked",readonly:"readOnly",selected:"selected",maxlength:"maxLength",selectedIndex:"selectedIndex",defaultValue:"defaultValue",tagName:"tagName",nodeName:"nodeName"}});jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false;var re=quickChild;var m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}r=tmp;}ret=r;}t=t.replace(re2,"");}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift();done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))z=jQuery.attr(a,m[2])||'';if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)if(n.nodeType==1)n.nodeIndex=c++;merge[id]=true;}var add=false;if(first==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[];var cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&(!elem||n!=elem))r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval!=undefined)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=function(){return fn.apply(this,arguments);};handler.data=data;handler.guid=fn.guid;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){var val;if(typeof jQuery=="undefined"||jQuery.event.triggered)return val;val=jQuery.event.handle.apply(arguments.callee.elem,arguments);return val;});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else
+for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data||[]);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event)data.unshift(this.fix({type:type,target:elem}));data[0].type=type;if(exclusive)data[0].exclusive=true;if(jQuery.isFunction(jQuery.data(elem,"handle")))val=jQuery.data(elem,"handle").apply(elem,data);if(!fn&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val;event=jQuery.event.fix(event||window.event||{});var parts=event.type.split(".");event.type=parts[0];var handlers=jQuery.data(this,"events")&&jQuery.data(this,"events")[event.type],args=Array.prototype.slice.call(arguments,1);args.unshift(event);for(var j in handlers){var handler=handlers[j];args[0].handler=handler;args[0].data=handler.data;if(!parts[1]&&!event.exclusive||handler.type==parts[1]){var ret=handler.apply(this,args);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}if(jQuery.browser.msie)event.target=event.preventDefault=event.stopPropagation=event.handler=event.data=null;return val;},fix:function(event){var originalEvent=event;event=jQuery.extend({},originalEvent);event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=originalEvent.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;arguments[0].type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;arguments[0].type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){return this.each(function(){jQuery.event.add(this,type,function(event){jQuery(this).unbind(event);return(fn||data).apply(this,arguments);},fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){if(this[0])return jQuery.event.trigger(type,data,this[0],false,fn);return undefined;},toggle:function(){var args=arguments;return this.click(function(event){this.lastToggle=0==this.lastToggle?1:0;event.preventDefault();return args[this.lastToggle].apply(this,arguments)||false;});},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else
+jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.apply(document);});jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}jQuery.ready();})();}jQuery.event.add(window,"load",jQuery.ready);}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});jQuery.fn.extend({load:function(url,params,callback){if(jQuery.isFunction(url))return this.bind("load",url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=(new Date).getTime();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){var jsonp,jsre=/=\?(&|$)/g,status,data;s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(s.type.toLowerCase()=="get"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&s.type.toLowerCase()=="get"){var ts=(new Date()).getTime();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&s.type.toLowerCase()=="get"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");if((!s.url.indexOf("http")||!s.url.indexOf("//"))&&s.dataType=="script"&&s.type.toLowerCase()=="get"){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xml=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();xml.open(s.type,s.url,s.async,s.username,s.password);try{if(s.data)xml.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xml.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xml.setRequestHeader("X-Requested-With","XMLHttpRequest");xml.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend)s.beforeSend(xml);if(s.global)jQuery.event.trigger("ajaxSend",[xml,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xml&&(xml.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xml)&&"error"||s.ifModified&&jQuery.httpNotModified(xml,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xml,s.dataType);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xml.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else
+jQuery.handleError(s,xml,status);complete();if(s.async)xml=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xml){xml.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xml.send(s.data);}catch(e){jQuery.handleError(s,xml,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xml,s]);}function complete(){if(s.complete)s.complete(xml,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xml,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xml;},handleError:function(s,xml,status,e){if(s.error)s.error(xml,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xml,s,e]);},active:0,httpSuccess:function(r){try{return!r.status&&location.protocol=="file:"||(r.status>=200&&r.status<300)||r.status==304||r.status==1223||jQuery.browser.safari&&r.status==undefined;}catch(e){}return false;},httpNotModified:function(xml,url){try{var xmlRes=xml.getResponseHeader("Last-Modified");return xml.status==304||xmlRes==jQuery.lastModified[url]||jQuery.browser.safari&&xml.status==undefined;}catch(e){}return false;},httpData:function(r,type){var ct=r.getResponseHeader("content-type");var xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0;var data=xml?r.responseXML:r.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else
+for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else
+s.push(encodeURIComponent(j)+"="+encodeURIComponent(a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle(fn,fn2):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall);var hidden=jQuery(this).is(":hidden"),self=this;for(var p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return jQuery.isFunction(opt.complete)&&opt.complete.apply(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else
+e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.apply(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(!elem)return undefined;type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",array?jQuery.makeArray(array):[]);return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].apply(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:{slow:600,fast:200}[opt.duration])||400;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.apply(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.apply(this.elem,[this.now,this]);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=(new Date()).getTime();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)if(!timers[i]())timers.splice(i--,1);if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")this.elem.style[this.prop]="1px";jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=(new Date()).getTime();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done&&jQuery.isFunction(this.options.complete))this.options.complete.apply(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.fx.step={scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}};jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),fixed=jQuery.css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&jQuery.css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(jQuery.css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&jQuery.css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||jQuery.css(offsetChild,"position")=="absolute"))||(mozilla&&jQuery.css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l)||0;top+=parseInt(t)||0;}return results;};})();
\ No newline at end of file
diff --git a/tangle/resources/weave.html b/tangle/resources/weave.html
new file mode 100644 (file)
index 0000000..570a3fc
--- /dev/null
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script type="text/javascript" src="jquery-1.2.3.min.js"></script>
+        <script type="text/javascript" src="weave.js"></script>
+    </head>
+    <body>
+        <form id="node-form">
+            <select id="nodes">
+                <option value="new">New</option>
+            </select>
+            <div id="node-content" style="display: none;"></div>
+            <div id="edit-wrapper">
+                <textarea id="node-content-edit"></textarea>
+                <button id='node-submit'>Save Node</button>
+            </div>
+        </form>
+    </body>
+</html>
diff --git a/tangle/resources/weave.js b/tangle/resources/weave.js
new file mode 100644 (file)
index 0000000..2b36982
--- /dev/null
@@ -0,0 +1,27 @@
+$(function() { $.getJSON("/all", false, function(json) {
+    var nodes = $('#nodes');
+    for (node in json) {
+        nodes.append("<option value='" + json[node] + "'>" + json[node] + "</option>");
+    }
+    nodes.change(function(){
+        if (this.value == 'new') {
+            $('#node-content').hide();
+            $('#edit-wrapper').show();
+        } else {
+            $('#node-content').show();
+            $('#edit-wrapper').hide();
+            $.get('/node', { node_id: this.value }, function(data){
+                $('#node-content').text(data);
+            });
+        }
+    });
+    $('#node-submit').click(function(){
+        $.post('/node', { node_content: $('#node-content-edit').val() }, function(data){
+            nodes.append("<option value='" + data + "'>" + data + "</option>");
+            var option = nodes.get(0).options[data];
+            option.selected = true;
+            nodes.change();
+        });
+        return false;
+    });
+});})
diff --git a/tangle/sandbox/sandbox.factor b/tangle/sandbox/sandbox.factor
new file mode 100644 (file)
index 0000000..6939131
--- /dev/null
@@ -0,0 +1,18 @@
+USING: continuations db db.sqlite http.server io.files kernel namespaces semantic-db tangle tangle.path ;
+IN: tangle.sandbox
+
+: db-path "tangle-sandbox.db" temp-file ;
+: sandbox-db db-path sqlite-db ;
+: delete-db db-path ?delete-file ;
+
+: make-sandbox ( tangle -- )
+    [
+        init-semantic-db
+        ensure-root "foo" create-file "First Page" create-node swap has-filename
+    ] with-tangle ;
+
+: new-sandbox ( -- )
+    development? on
+    delete-db sandbox-db f <tangle>
+    [ make-sandbox ] [ <tangle-dispatcher> ] bi
+    main-responder set ;
diff --git a/tangle/summary.txt b/tangle/summary.txt
new file mode 100644 (file)
index 0000000..26f0a3e
--- /dev/null
@@ -0,0 +1 @@
+A web framework using semantic-db as a backend
diff --git a/tangle/tangle-tests.factor b/tangle/tangle-tests.factor
new file mode 100644 (file)
index 0000000..a054fca
--- /dev/null
@@ -0,0 +1,26 @@
+USING: accessors arrays continuations db db.sqlite io.files kernel semantic-db sequences tangle tangle.html tangle.menu tangle.page tangle.path tools.test tools.walker tuple-syntax ;
+IN: tangle.tests
+
+: db-path "tangle-test.db" temp-file ;
+: test-db db-path sqlite-db ;
+: delete-db db-path ?delete-file ;
+
+: test-tangle ( -- )
+    ensure-root "foo" create-file "bar" create-file "pluck_eggs" create-file
+    "How to Pluck Eggs" create-node swap has-filename
+    "Main Menu" ensure-menu "home" create-node swap subitem-of ;
+
+test-db [
+    init-semantic-db test-tangle
+    [ "pluck_eggs" ] [ { "foo" "bar" "pluck_eggs" } path>node [ node-content ] when* ] unit-test
+    [ "How to Pluck Eggs" ] [ { "foo" "bar" "pluck_eggs" } path>node [ has-filename-subjects first node-content ] when* ] unit-test
+    [ { "foo" "bar" "pluck_eggs" } ] [ { "foo" "bar" "pluck_eggs" } path>node node>path >array ] unit-test
+    [ f ] [ TUPLE{ node id: 666 content: "some content" } parent-directory ] unit-test
+    [ f ] [ TUPLE{ node id: 666 content: "some content" } node>path ] unit-test
+    [ "Main Menu" ] [ "Main Menu" ensure-menu node-content ] unit-test
+    [ t ] [ "Main Menu" ensure-menu "Main Menu" ensure-menu node= ] unit-test
+    [ "Main Menu" { "home" } ] [ "Main Menu" load-menu dup node>> node-content swap children>> [ node>> node-content ] map >array ] unit-test
+    [ { "home" } ] [ "Main Menu" load-menu menu>ulist items>> [ node>> node-content ] map >array ] unit-test
+    [ f ] [ TUPLE{ node id: 666 content: "node text" } node>path ] unit-test
+    [ "node text" ] [ TUPLE{ node id: 666 content: "node text" } >html ] unit-test
+] with-db delete-db
diff --git a/tangle/tangle.factor b/tangle/tangle.factor
new file mode 100644 (file)
index 0000000..f20ed52
--- /dev/null
@@ -0,0 +1,73 @@
+! Copyright (C) 2008 Alex Chapman
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors assocs db db.sqlite db.postgresql
+http http.server http.server.dispatchers http.server.responses
+http.server.static furnace.actions furnace.json
+io io.files json.writer kernel math.parser namespaces
+semantic-db sequences strings tangle.path ;
+IN: tangle
+
+GENERIC: render* ( content templater -- output )
+GENERIC: render ( content templater -- )
+
+TUPLE: echo-template ;
+C: <echo-template> echo-template
+
+M: echo-template render* drop ;
+! METHOD: render* { string echo-template } drop ;
+M: object render render* write ;
+
+TUPLE: tangle db seq templater ;
+C: <tangle> tangle
+
+: with-tangle ( tangle quot -- )
+    [ [ db>> ] [ seq>> ] bi ] dip with-db ;
+
+: node-response ( id -- response )
+    load-node [ node-content <text-content> ] [ <404> ] if* ;
+
+: display-node ( params -- response )
+    [
+        "node_id" swap at* [
+            string>number node-response
+        ] [
+            drop <400>
+        ] if
+    ] [
+        <400>
+    ] if* ;
+
+: submit-node ( params -- response )
+    [
+        "node_content" swap at* [
+            create-node id>> number>string <text-content>
+        ] [
+            drop <400>
+        ] if
+    ] [
+        <400>
+    ] if* ;
+
+: <node-responder> ( -- responder )
+    <action> [ params get display-node ] >>display
+    [ params get submit-node ] >>submit ;
+
+TUPLE: path-responder ;
+C: <path-responder> path-responder
+
+M: path-responder call-responder* ( path responder -- response )
+    drop path>file [ node-content <text-content> ] [ <404> ] if* ;
+
+TUPLE: tangle-dispatcher < dispatcher tangle ;
+
+: <tangle-dispatcher> ( tangle -- dispatcher )
+    tangle-dispatcher new-dispatcher swap >>tangle
+    <path-responder> >>default
+    "resource:extra/tangle/resources" <static> "resources" add-responder
+    <node-responder> "node" add-responder
+    <action> [ all-node-ids <json-content> ] >>display "all" add-responder ;
+
+M: tangle-dispatcher call-responder* ( path dispatcher -- response )
+    dup tangle>> [
+        find-responder call-responder
+    ] with-tangle ;
diff --git a/triggers/authors.txt b/triggers/authors.txt
new file mode 100644 (file)
index 0000000..e9c193b
--- /dev/null
@@ -0,0 +1 @@
+Alex Chapman
diff --git a/triggers/summary.txt b/triggers/summary.txt
new file mode 100644 (file)
index 0000000..34353dc
--- /dev/null
@@ -0,0 +1 @@
+triggers allow you to register code to be 'triggered'
diff --git a/triggers/triggers-tests.factor b/triggers/triggers-tests.factor
new file mode 100644 (file)
index 0000000..744a4b1
--- /dev/null
@@ -0,0 +1,14 @@
+USING: triggers kernel tools.test ;
+IN: triggers.tests
+
+SYMBOL: test-trigger
+test-trigger reset-trigger
+: add-test-trigger test-trigger add-trigger ;
+[ ] [ test-trigger call-trigger ] unit-test
+[ "op called" ] [ "op" [ "op called" ] add-test-trigger test-trigger call-trigger ] unit-test
+[ "first called" "second called" ] [
+    test-trigger reset-trigger
+    "second op" [ "second called" ] add-test-trigger
+    "first op" [ "first called" ] add-test-trigger
+    test-trigger call-trigger
+] unit-test
diff --git a/triggers/triggers.factor b/triggers/triggers.factor
new file mode 100644 (file)
index 0000000..83dc4c5
--- /dev/null
@@ -0,0 +1,28 @@
+! Copyright (C) 2008 Alex Chapman
+! See http://factorcode.org/license.txt for BSD license.
+USING: assocs digraphs kernel namespaces sequences ;
+IN: triggers
+
+: triggers ( -- triggers )
+    \ triggers global [ drop H{ } clone ] cache ;
+
+: trigger-graph ( trigger -- graph )
+    triggers [ drop <digraph> ] cache ;
+
+: reset-trigger ( trigger -- )
+    <digraph> swap triggers set-at ;
+
+: add-trigger ( key quot trigger -- )
+    ! trigger should be a symbol. Note that symbols with the same name but
+    ! different vocab are not equal
+    trigger-graph add-vertex ; 
+
+: before ( key1 key2 trigger -- )
+    trigger-graph add-edge ;
+
+: after ( key1 key2 trigger -- )
+    swapd before ;
+
+: call-trigger ( trigger -- )
+    trigger-graph topological-sorted-values [ call ] each ;
+
diff --git a/ui/gadgets/alerts/alerts.factor b/ui/gadgets/alerts/alerts.factor
new file mode 100644 (file)
index 0000000..70943e6
--- /dev/null
@@ -0,0 +1,29 @@
+USING: accessors models monads macros generalizations kernel
+ui ui.gadgets.controls models.combinators ui.gadgets.layout ui.gadgets
+ui.gadgets.labels ui.gadgets.editors ui.gadgets.buttons
+ui.gadgets.packs locals sequences fonts io.styles
+wrap.strings ;
+
+IN: ui.gadgets.alerts
+:: alert ( quot string -- ) <pile> { 10 10 } >>gap 1 >>align
+   string 22 wrap-lines <label> T{ font { name "sans-serif" } { size 18 } } >>font { 200 100 } >>pref-dim add-gadget 
+   "okay" [ close-window ] quot append <border-button> add-gadget "" open-window ;
+
+: alert* ( str -- ) [ ] swap alert ;
+
+:: ask-user ( string -- model' )
+    [
+        string <label>  T{ font { name "sans-serif" } { size 14 } } >>font dup , :> lbl
+        <model-field*> ->% 1 :> fldm
+        "okay" <model-border-btn> :> btn
+        btn -> [ fldm swap updates ]
+               [ [ drop lbl close-window ] $> , ] bi
+    ] <vbox> { 161 86 } >>pref-dim "" open-window ;
+
+MACRO: ask-buttons ( buttons -- quot ) dup length [
+      [ swap
+         [ 22 wrap-lines <label> T{ font { name "sans-serif" } { size 18 } } >>font ,
+         [ [ <model-border-btn> [ close-window ] >>hook -> ] map ] <hbox> , ] <vbox>
+         "" open-window
+      ] dip firstn
+   ] 2curry ;
diff --git a/ui/gadgets/alerts/authors.txt b/ui/gadgets/alerts/authors.txt
new file mode 100644 (file)
index 0000000..2300f69
--- /dev/null
@@ -0,0 +1 @@
+Sam Anklesaria
diff --git a/ui/gadgets/alerts/summary.txt b/ui/gadgets/alerts/summary.txt
new file mode 100644 (file)
index 0000000..f1cd420
--- /dev/null
@@ -0,0 +1 @@
+Really simple dialog boxes
\ No newline at end of file
diff --git a/ui/gadgets/comboboxes/authors.txt b/ui/gadgets/comboboxes/authors.txt
new file mode 100644 (file)
index 0000000..2300f69
--- /dev/null
@@ -0,0 +1 @@
+Sam Anklesaria
diff --git a/ui/gadgets/comboboxes/comboboxes.factor b/ui/gadgets/comboboxes/comboboxes.factor
new file mode 100644 (file)
index 0000000..a2a7585
--- /dev/null
@@ -0,0 +1,22 @@
+USING: accessors arrays kernel math.rectangles sequences
+ui.gadgets.controls models.combinators ui.gadgets ui.gadgets.glass
+ui.gadgets.labels ui.gestures ;
+QUALIFIED-WITH: ui.gadgets.tables tbl
+IN: ui.gadgets.comboboxes
+
+TUPLE: combo-table < table spawner ;
+
+M: combo-table handle-gesture [ call-next-method drop ] 2keep swap
+   T{ button-up } = [
+      [ spawner>> ]
+      [ tbl:selected-row [ swap set-control-value ] [ 2drop ] if ]
+      [ hide-glass ] tri
+   ] [ drop ] if t ;
+
+TUPLE: combobox < label-control table ;
+combobox H{
+   { T{ button-down } [ dup table>> over >>spawner <zero-rect> show-glass ] }
+} set-gestures
+
+: <combobox> ( options -- combobox ) [ first [ combobox new-label ] keep <basic> >>model ] keep
+    <basic> combo-table new-table [ 1array ] >>quot >>table ;
diff --git a/ui/gadgets/comboboxes/summary.txt b/ui/gadgets/comboboxes/summary.txt
new file mode 100644 (file)
index 0000000..0f2ce2b
--- /dev/null
@@ -0,0 +1 @@
+Combo boxes have a model choosen from a list of options
\ No newline at end of file
diff --git a/ui/gadgets/controls/authors.txt b/ui/gadgets/controls/authors.txt
new file mode 100644 (file)
index 0000000..2300f69
--- /dev/null
@@ -0,0 +1 @@
+Sam Anklesaria
diff --git a/ui/gadgets/controls/controls-docs.factor b/ui/gadgets/controls/controls-docs.factor
new file mode 100644 (file)
index 0000000..a8106a0
--- /dev/null
@@ -0,0 +1,71 @@
+USING: accessors help.markup help.syntax ui.gadgets.buttons
+ui.gadgets.editors models ui.gadgets ;
+IN: ui.gadgets.controls
+
+HELP: <model-btn>
+{ $values { "gadget" "the button's label" } { "button" button } }
+{ $description "Creates an button whose signal updates on clicks.  " } ;
+
+HELP: <model-border-btn>
+{ $values { "text" "the button's label" } { "button" button } }
+{ $description "Creates an button whose signal updates on clicks.  " } ;
+
+HELP: <table>
+{ $values { "model" "values the table is to display" } { "table" table } }
+{ $description "Creates an " { $link table } } ;
+
+HELP: <table*>
+{ $values { "table" table } }
+{ $description "Creates an " { $link table } " with no initial values to display" } ;
+
+HELP: <list>
+{ $values { "column-model" "values the table is to display" } { "table" table } }
+{ $description "Creates an " { $link table } " with a val-quot that renders each element as its own row" } ;
+
+HELP: <list*>
+{ $values { "table" table } }
+{ $description "Creates an model-list with no initial values to display" } ;
+
+HELP: indexed
+{ $values { "table" table } }
+{ $description "Sets the output model of an table to the selected-index, rather than the selected-value" } ;
+
+HELP: <model-field>
+{ $values { "model" model } { "gadget" model-field } }
+{ $description "Creates a field with an initial value" } ;
+
+HELP: <model-field*>
+{ $values { "field" model-field } }
+{ $description "Creates a field with an empty initial value" } ;
+
+HELP: <empty-field>
+{ $values { "model" model } { "field" model-field } }
+{ $description "Creates a field with an empty initial value that switches to another signal on its update" } ;
+
+HELP: <model-editor>
+{ $values { "model" model } { "gadget" model-field } }
+{ $description "Creates an editor with an initial value" } ;
+
+HELP: <model-editor*>
+{ $values { "editor" "an editor" } }
+{ $description "Creates a editor with an empty initial value" } ;
+
+HELP: <empty-editor>
+{ $values { "model" model } { "editor" "an editor" } }
+{ $description "Creates a field with an empty initial value that switches to another signal on its update" } ;
+
+HELP: <model-action-field>
+{ $values { "field" action-field } }
+{ $description "Field that updates its model with its contents when the user hits the return key" } ;
+
+HELP: IMG-MODEL-BTN:
+{ $syntax "IMAGE-MODEL-BTN: filename" }
+{ $description "Creates a button using a tiff image named as specified found in the icons subdirectory of the vocabulary path" } ;
+
+HELP: IMG-BTN:
+{ $syntax "[ do-something ] IMAGE-BTN: filename" }
+{ $description "Creates a button using a tiff image named as specified found in the icons subdirectory of the vocabulary path, calling the specified quotation on click" } ;
+
+HELP: output-model
+{ $values { "gadget" gadget } { "model" model } }
+{ $description "Returns the model a gadget uses for output. Often the same as " { $link model>> } } ;
diff --git a/ui/gadgets/controls/controls.factor b/ui/gadgets/controls/controls.factor
new file mode 100644 (file)
index 0000000..ebdb3be
--- /dev/null
@@ -0,0 +1,83 @@
+USING: accessors assocs arrays kernel models monads sequences
+models.combinators ui.gadgets ui.gadgets.borders ui.gadgets.buttons
+ui.gadgets.buttons.private ui.gadgets.editors ui.gadgets.editors.private
+words images.loader ui.gadgets.scrollers ui.images vocabs.parser lexer
+models.range ui.gadgets.sliders ;
+QUALIFIED-WITH: ui.gadgets.sliders slider
+QUALIFIED-WITH: ui.gadgets.tables tbl
+EXCLUDE: ui.gadgets.editors => model-field ;
+IN: ui.gadgets.controls
+
+TUPLE: model-btn < button hook value ;
+: <model-btn> ( gadget -- button ) [
+      [ dup hook>> [ call( button -- ) ] [ drop ] if* ]
+      [ [ [ value>> ] [ ] bi or ] keep set-control-value ]
+      [ model>> f swap value<< ] tri
+   ] model-btn new-button f <basic> >>model ;
+: <model-border-btn> ( text -- button ) <model-btn> border-button-theme ;
+
+TUPLE: table < tbl:table { quot initial: [ ] } { val-quot initial: [ ] } color-quot column-titles column-alignment actions ;
+M: table tbl:column-titles column-titles>> ;
+M: table tbl:column-alignment column-alignment>> ;
+M: table tbl:row-columns quot>> [ call( a -- b ) ] [ drop f ] if* ;
+M: table tbl:row-value val-quot>> [ call( a -- b ) ]  [ drop f ] if* ;
+M: table tbl:row-color color-quot>> [ call( a -- b ) ]  [ drop f ] if* ;
+
+: new-table ( model class -- table ) f swap tbl:new-table dup >>renderer
+   f <basic> >>actions dup actions>> [ set-model ] curry >>action ;
+: <table> ( model -- table ) table new-table ;
+: <table*> ( -- table ) V{ } clone <model> <table> ;
+: <list> ( column-model -- table ) <table> [ 1array ] >>quot ;
+: <list*> ( -- table ) V{ } clone <model> <list> ;
+: indexed ( table -- table ) f >>val-quot ;
+
+TUPLE: model-field < field model* ;
+: init-field ( model -- model' ) [ [ ] [ "" ] if* ] change-value ;
+: <model-field> ( model -- gadget ) model-field new-field swap init-field >>model* ;
+M: model-field graft*
+    [ [ model*>> value>> ] [ editor>> ] bi set-editor-string ]
+    [ dup editor>> model>> add-connection ]
+    [ dup model*>> add-connection ] tri ;
+M: model-field ungraft*
+   [ dup editor>> model>> remove-connection ]
+   [ dup model*>> remove-connection ] bi ;
+M: model-field model-changed 2dup model*>> =
+    [ [ value>> ] [ editor>> ] bi* set-editor-string ]
+    [ nip [ editor>> editor-string ] [ model*>> ] bi set-model ] if ;
+: (new-field) ( editor field -- gadget ) [ new-editor ] dip new-border dup gadget-child >>editor
+    field-theme { 1 0 } >>align ; inline
+: <model-field*> ( -- field ) "" <model> <model-field> ;
+: <empty-field> ( model -- field ) "" <model> switch-models <model-field> ;
+: <model-editor> ( model -- gadget ) multiline-editor model-field (new-field) swap init-field >>model* ;
+: <model-editor*> ( -- editor ) "" <model> <model-editor> ;
+: <empty-editor> ( model -- editor ) "" <model> switch-models <model-editor> ;
+
+: <model-action-field> ( -- field ) f <action-field> dup [ set-control-value ] curry >>quot
+    f <model> >>model ;
+
+: <slider> ( init page min max step -- slider ) <range> horizontal slider:<slider> ;
+
+: image-prep ( -- image ) scan current-vocab name>> "vocab:" "/icons/" surround ".tiff" surround <image-name> dup cached-image drop ;
+SYNTAX: IMG-MODEL-BTN: image-prep [ <model-btn> ] curry append! ;
+
+SYNTAX: IMG-BTN: image-prep [ swap <button> ] curry append! ;
+
+GENERIC: output-model ( gadget -- model )
+M: gadget output-model model>> ;
+M: table output-model dup val-quot>> [ selection>> ] [ selection-index>> ] if ;
+M: model-field output-model model*>> ;
+M: scroller output-model viewport>> children>> first output-model ;
+M: slider output-model model>> range-model ;
+
+IN: accessors
+M: model-btn text>> children>> first text>> ;
+
+IN: ui.gadgets.controls
+
+SINGLETON: gadget-monad
+INSTANCE: gadget-monad monad
+INSTANCE: gadget monad
+M: gadget monad-of drop gadget-monad ;
+M: gadget-monad return drop <gadget> swap >>model ;
+M: gadget >>= output-model [ swap call( x -- y ) ] curry ; 
diff --git a/ui/gadgets/controls/summary.txt b/ui/gadgets/controls/summary.txt
new file mode 100644 (file)
index 0000000..eeef94d
--- /dev/null
@@ -0,0 +1 @@
+Gadgets with expanded model usage
\ No newline at end of file
diff --git a/ui/gadgets/corners/authors.txt b/ui/gadgets/corners/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/ui/gadgets/corners/corners.factor b/ui/gadgets/corners/corners.factor
new file mode 100644 (file)
index 0000000..a37a695
--- /dev/null
@@ -0,0 +1,43 @@
+! Copyright (C) 2009 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors kernel namespaces sequences ui.gadgets.frames
+ui.gadgets.grids ui.gadgets.icons ui.gadgets.theme ;
+IN: ui.gadgets.corners
+
+CONSTANT: @center { 1 1 }
+CONSTANT: @left { 0 1 }
+CONSTANT: @right { 2 1 }
+CONSTANT: @top { 1 0 }
+CONSTANT: @bottom { 1 2 }
+
+CONSTANT: @top-left { 0 0 }
+CONSTANT: @top-right { 2 0 }
+CONSTANT: @bottom-left { 0 2 }
+CONSTANT: @bottom-right { 2 2 }
+
+SYMBOL: name
+
+: corner-image ( name -- image )
+    [ name get "-" ] dip 3append theme-image ;
+
+: corner-icon ( name -- icon )
+    corner-image <icon> ;
+
+: /-----\ ( corner -- corner )
+    "top-left" corner-icon @top-left grid-add
+    "top-middle" corner-icon @top grid-add
+    "top-right" corner-icon @top-right grid-add ;
+
+: |-----| ( gadget corner -- corner )
+    "left-edge" corner-icon @left grid-add
+    swap @center grid-add
+    "right-edge" corner-icon @right grid-add ;
+
+: \-----/ ( corner -- corner )
+    "bottom-left" corner-icon @bottom-left grid-add
+    "bottom-middle" corner-icon @bottom grid-add
+    "bottom-right" corner-icon @bottom-right grid-add ;
+
+: make-corners ( class name quot -- corners )
+    [ [ [ 3 3 ] dip new-frame { 1 1 } >>filled-cell ] dip name ] dip
+    with-variable ; inline
diff --git a/ui/gadgets/layout/authors.txt b/ui/gadgets/layout/authors.txt
new file mode 100644 (file)
index 0000000..2300f69
--- /dev/null
@@ -0,0 +1 @@
+Sam Anklesaria
diff --git a/ui/gadgets/layout/layout-docs.factor b/ui/gadgets/layout/layout-docs.factor
new file mode 100644 (file)
index 0000000..47f8fcb
--- /dev/null
@@ -0,0 +1,53 @@
+USING: help.markup help.syntax models ui.gadgets.tracks ;
+IN: ui.gadgets.layout
+
+HELP: ,
+{ $values { "item" "a gadget or model" } }
+{ $description "Used in a series of gadgets created by a box, accumulating the gadget" } ;
+
+HELP: ,%
+{ $syntax "gadget ,% width" }
+{ $description "Like ',' but stretches the gadget to always fill a percent of the parent" } ;
+
+HELP: ->
+{ $values { "uiitem" "a gadget or model" } { "model" model } }
+{ $description "Like ',' but passes its model on for further use." } ;
+
+HELP: ->%
+{ $syntax "gadget ,% width" }
+{ $description "Like '->' but stretches the gadget to always fill a percent of the parent" } ;
+
+HELP: <spacer>
+{ $description "Grows to fill any empty space in a box" } ;
+
+HELP: <hbox>
+{ $values { "gadgets" "a list of gadgets" } { "track" track } }
+{ $syntax "[ gadget , gadget , ... ] <hbox>" }
+{ $description "Creates an horizontal track containing the gadgets listed in the quotation" } ;
+
+HELP: <vbox>
+{ $values { "gadgets" "a list of gadgets" } { "track" track } }
+{ $syntax "[ gadget , gadget , ... ] <hbox>" }
+{ $description "Creates an vertical track containing the gadgets listed in the quotation" } ;
+
+HELP: $
+{ $syntax "$ PLACEHOLDER-NAME $" }
+{ $description "Defines an insertion point in a template named PLACEHOLDER-NAME which can be used by calling its name" } ;
+
+HELP: with-interface
+{ $values { "quot" "quotation that builds a template and inserts into it" } }
+{ $description "Create templates, used with " { $link POSTPONE: $ } } ;
+
+ARTICLE: "ui.gadgets.layout" "GUI Layout"
+"Laying out GUIs works the same way as building lists with " { $vocab-link "make" }
+". Gadgets are layed out using " { $vocab-link "ui.gadgets.tracks" } " through " { $link <hbox> } " and " { $link <vbox> } ", which allow both fixed and percentage widths. "
+{ $link , } " and " { $link -> }  " add a model or gadget to the gadget you're building. "
+"Also, books can be made with " { $link <book> } ". "
+{ $link <spacer> } "s add flexable space between items. " $nl
+"Using " { $link with-interface } ", one can pre-build templates to add items to later: "
+"Like in the StringTemplate framework for java, placeholders are defined using $ PLACERHOLDER-NAME $ "
+"Using PLACEHOLDER-NAME again sets it as the current insertion point. "
+"For examples using normal layout, see the " { $vocab-link "sudokus" } " demo. "
+"For examples of templating, see the " { $vocab-link "recipes" } " demo." ;
+
+ABOUT: "ui.gadgets.layout"
diff --git a/ui/gadgets/layout/layout.factor b/ui/gadgets/layout/layout.factor
new file mode 100644 (file)
index 0000000..06ec26c
--- /dev/null
@@ -0,0 +1,90 @@
+USING: accessors assocs arrays fry kernel lexer make math.parser
+models monads namespaces parser sequences
+sequences.extras models.combinators ui.gadgets
+ui.gadgets.tracks words ui.gadgets.controls ;
+QUALIFIED: make
+QUALIFIED-WITH: ui.gadgets.books book
+IN: ui.gadgets.layout
+
+SYMBOL: templates
+TUPLE: layout gadget size ; C: <layout> layout
+TUPLE: placeholder < gadget members ;
+: <placeholder> ( -- placeholder ) placeholder new V{ } clone >>members ;
+
+: (remove-members) ( placeholder members -- ) [ [ model? ] filter swap parent>> model>> [ remove-connection ] curry each ]
+    [ nip [ gadget? ] filter [ unparent ] each ] 2bi ;
+
+: remove-members ( placeholder -- ) dup members>> [ drop ] [ [ (remove-members) ] keep delete-all ] if-empty ;
+: add-member ( obj placeholder -- ) over layout? [ [ gadget>> ] dip ] when members>> push ;
+
+: , ( item -- ) make:, ;
+: make* ( quot -- list ) { } make ; inline
+
+! Just take the previous mentioned placeholder and use it
+! If there is no previously mentioned placeholder, we're probably making a box, and will create the placeholder ourselves
+DEFER: with-interface
+: insertion-quot ( quot -- quot' )
+    make:building get [ [ placeholder? ] find-last nip [ <placeholder> dup , ] unless*
+    [ templates get ] 2dip swap '[ [ _ templates set _ , @ ] with-interface ] ] when* ;
+
+SYNTAX: ,% scan string>number [ <layout> , ] curry append! ;
+SYNTAX: ->% scan string>number '[ [ _ <layout> , ] [ output-model ] bi ] append! ;
+
+GENERIC: -> ( uiitem -- model )
+M: gadget -> dup , output-model ;
+M: model -> dup , ;
+
+: <spacer> ( -- ) <gadget> 1 <layout> , ;
+
+: add-layout ( track layout -- track ) [ gadget>> ] [ size>> ] bi track-add ;
+: layouts ( sized? gadgets -- layouts ) [ [ gadget? ] [ layout? ] bi or ] filter swap
+   [ [ dup layout? [ f <layout> ] unless ] map ]
+   [ [ dup gadget? [ gadget>> ] unless ] map ] if ;
+: make-layout ( building sized? -- models layouts ) [ swap layouts ] curry
+   [ make* [ [ model? ] filter ] ] dip bi ; inline
+: <box> ( gadgets type -- track )
+   [ t make-layout ] dip <track>
+   swap [ add-layout ] each
+   swap [ <collection> >>model ] unless-empty ; inline
+: <hbox> ( gadgets -- track ) horizontal <box> ; inline
+: <vbox> ( gadgets -- track ) vertical <box> ; inline
+
+: make-book ( models gadgets model -- book ) book:<book> swap [ "No models in books" throw ] unless-empty ;
+: <book> ( quot: ( -- model ) -- book ) f make-layout rot 0 >>value make-book ; inline
+: <book*> ( quot -- book ) f make-layout f make-book ; inline
+
+ERROR: not-in-template word ;
+SYNTAX: $ scan-new-word dup
+    [ [ dup templates get at [ nip , ] [ not-in-template ] if* ] curry ( -- ) define-declared "$" expect ]
+    [ [ <placeholder> [ swap templates get set-at ] keep , ] curry ] bi append! ;
+
+: insert-gadget ( number parent gadget -- ) -rot [ but-last insert-nth ] change-children drop ;
+: insert-size ( number parent size -- ) -rot [ but-last insert-nth ] change-sizes drop ;
+: insertion-point ( placeholder -- number parent ) dup parent>> [ children>> index ] keep ;
+
+GENERIC: >layout ( gadget -- layout )
+M: gadget >layout f <layout> ;
+M: layout >layout ;
+
+GENERIC#: (add-gadget-at) 2 ( parent item n -- )
+M: gadget (add-gadget-at) -rot [ add-gadget ] keep insert-gadget ;
+M: track (add-gadget-at) -rot >layout [ add-layout ] keep [ gadget>> insert-gadget ] [ size>> insert-size ] 3bi ;
+
+GENERIC#: add-gadget-at 1 ( item location -- )
+M: object add-gadget-at insertion-point -rot (add-gadget-at) ;
+M: model add-gadget-at parent>> dup book:book? [ "No models in books" throw ]
+   [ dup model>> dup collection? [ nip swap add-connection ] [ drop [ 1array <collection> ] dip model<< ] if ] if ;
+: track-add-at ( item location size -- ) swap [ <layout> ] dip add-gadget-at ;
+: (track-add-at) ( parent item n size -- ) swap [ <layout> ] dip (add-gadget-at) ;
+
+: insert-item ( item location -- ) [ dup get [ drop ] [ remove-members ] if ] [ on ] [ ] tri
+    [ add-member ] 2keep add-gadget-at ;
+
+: insert-items ( makelist -- ) t swap [ dup placeholder? [ nip ] [ over insert-item ] if ] each drop ;
+
+: with-interface ( quot -- ) [ make* ] curry H{ } clone templates rot with-variable [ insert-items ] with-scope ; inline
+
+M: model >>= [ swap insertion-quot <action> ] curry ;
+M: model fmap insertion-quot <mapped> ;
+M: model $> insertion-quot side-effect-model new-mapped-model ;
+M: model <$ insertion-quot quot-model new-mapped-model ;
diff --git a/ui/gadgets/layout/summary.txt b/ui/gadgets/layout/summary.txt
new file mode 100644 (file)
index 0000000..30b5ef5
--- /dev/null
@@ -0,0 +1 @@
+Syntax for easily building GUIs and using templates
\ No newline at end of file
diff --git a/ui/gadgets/plot/plot.factor b/ui/gadgets/plot/plot.factor
new file mode 100644 (file)
index 0000000..5320517
--- /dev/null
@@ -0,0 +1,166 @@
+
+USING: kernel quotations arrays sequences math math.ranges fry
+       opengl opengl.gl ui.render ui.gadgets.cartesian processing.shapes
+       accessors
+       help.syntax
+       easy-help ;
+
+IN: ui.gadgets.plot
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+ARTICLE: "ui.gadgets.plot" "Plot Gadget"
+
+Summary:
+
+    A simple gadget for ploting two dimentional functions.
+
+    Use the arrow keys to move around.
+
+    Use 'a' and 'z' keys to zoom in and out. ..
+
+Example:
+
+    <plot> [ sin ] add-function gadget.    ..
+
+Example:
+
+    <plot>
+      [ sin ] red  function boa add-function
+      [ cos ] blue function boa add-function
+    gadget.    ..
+
+;
+
+ABOUT: "ui.gadgets.plot"
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+TUPLE: plot < cartesian functions points ;
+
+: init-plot ( plot -- plot )
+  init-cartesian
+    { } >>functions
+    100 >>points ;
+
+: <plot> ( -- plot ) plot new init-plot ;
+
+: step-size ( plot -- step-size )
+  [ [ x-max>> ] [ x-min>> ] bi - ] [ points>> ] bi / ;
+
+: plot-range ( plot -- range )
+  [ x-min>> ] [ x-max>> ] [ step-size ] tri <range> ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+TUPLE: function function color ;
+
+GENERIC: plot-function ( plot object -- plot )
+
+M: callable plot-function ( plot quotation -- plot )
+  [ dup plot-range ] dip '[ dup @ 2array ] map line-strip ;
+
+M: function plot-function ( plot function -- plot )
+   dup color>> dup [ >stroke-color ] [ drop ] if
+   [ dup plot-range ] dip function>> '[ dup @ 2array ] map line-strip ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: plot-functions ( plot -- plot ) dup functions>> [ plot-function ] each ;
+
+: draw-axis ( plot -- plot )
+  dup
+    [ [ x-min>> ] [ drop 0  ] bi 2array ]
+    [ [ x-max>> ] [ drop 0  ] bi 2array ] bi line*
+  dup
+    [ [ drop 0  ] [ y-min>> ] bi 2array ]
+    [ [ drop 0  ] [ y-max>> ] bi 2array ] bi line* ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+USING: ui.gadgets.slate ;
+
+M: plot draw-slate ( plot -- plot )
+   2 glLineWidth
+   draw-axis
+   plot-functions
+   fill-mode
+   1 glLineWidth ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: add-function ( plot function -- plot )
+  over functions>> swap suffix >>functions ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: x-span ( plot -- span ) [ x-max>> ] [ x-min>> ] bi - ;
+: y-span ( plot -- span ) [ y-max>> ] [ y-min>> ] bi - ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+USING: ui.gestures ui.gadgets ;
+
+: left ( plot -- plot )
+  dup [ x-min>> ] [ x-span 1/10 * ] bi - >>x-min
+  dup [ x-max>> ] [ x-span 1/10 * ] bi - >>x-max
+  dup relayout-1 ;
+
+: right ( plot -- plot )
+  dup [ x-min>> ] [ x-span 1/10 * ] bi + >>x-min
+  dup [ x-max>> ] [ x-span 1/10 * ] bi + >>x-max
+  dup relayout-1 ;
+
+: down ( plot -- plot )
+  dup [ y-min>> ] [ y-span 1/10 * ] bi - >>y-min
+  dup [ y-max>> ] [ y-span 1/10 * ] bi - >>y-max
+  dup relayout-1 ;
+
+: up ( plot -- plot )
+  dup [ y-min>> ] [ y-span 1/10 * ] bi + >>y-min
+  dup [ y-max>> ] [ y-span 1/10 * ] bi + >>y-max
+  dup relayout-1 ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: zoom-in-horizontal ( plot -- plot )
+  dup [ x-min>> ] [ x-span 1/10 * ] bi + >>x-min
+  dup [ x-max>> ] [ x-span 1/10 * ] bi - >>x-max ;
+
+: zoom-in-vertical ( plot -- plot )
+  dup [ y-min>> ] [ y-span 1/10 * ] bi + >>y-min
+  dup [ y-max>> ] [ y-span 1/10 * ] bi - >>y-max ;
+
+: zoom-in ( plot -- plot )
+  zoom-in-horizontal
+  zoom-in-vertical
+  dup relayout-1 ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: zoom-out-horizontal ( plot -- plot )
+  dup [ x-min>> ] [ x-span 1/10 * ] bi - >>x-min
+  dup [ x-max>> ] [ x-span 1/10 * ] bi + >>x-max ;
+
+: zoom-out-vertical ( plot -- plot )
+  dup [ y-min>> ] [ y-span 1/10 * ] bi - >>y-min
+  dup [ y-max>> ] [ y-span 1/10 * ] bi + >>y-max ;
+
+: zoom-out ( plot -- plot )
+  zoom-out-horizontal
+  zoom-out-vertical
+  dup relayout-1 ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+plot
+  H{
+    { T{ mouse-enter } [ request-focus ] }
+    { T{ key-down f f "LEFT"  } [ left drop  ] }
+    { T{ key-down f f "RIGHT" } [ right drop ] }
+    { T{ key-down f f "DOWN"  } [ down drop  ] }
+    { T{ key-down f f "UP"    } [ up drop    ] }
+    { T{ key-down f f "a"     } [ zoom-in  drop ] }
+    { T{ key-down f f "z"     } [ zoom-out drop ] }
+  }
+set-gestures
diff --git a/ui/gadgets/poppers/authors.txt b/ui/gadgets/poppers/authors.txt
new file mode 100644 (file)
index 0000000..2300f69
--- /dev/null
@@ -0,0 +1 @@
+Sam Anklesaria
diff --git a/ui/gadgets/poppers/poppers.factor b/ui/gadgets/poppers/poppers.factor
new file mode 100644 (file)
index 0000000..ef7fc98
--- /dev/null
@@ -0,0 +1,50 @@
+! Copyright (C) 2009 Sam Anklesaria
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays accessors combinators kernel math
+models models.combinators namespaces sequences
+ui.gadgets ui.gadgets.controls ui.gadgets.layout
+ui.gadgets.tracks ui.gestures ui.gadgets.line-support ;
+EXCLUDE: ui.gadgets.editors => model-field ;
+IN: ui.gadgets.poppers
+
+TUPLE: popped < model-field { fatal? initial: t } ;
+TUPLE: popped-editor < multiline-editor ;
+: <popped> ( text -- gadget ) <basic> init-field popped-editor popped (new-field) swap >>model* ;
+
+: set-expansion ( popped size -- ) over dup parent>> [ children>> index ] [ sizes>> ] bi set-nth relayout ;
+: new-popped ( popped -- ) insertion-point "" <popped>
+    [ rot 1 + f (track-add-at) ] keep [ relayout ] [ request-focus ] bi ;
+: focus-prev ( popped -- ) dup parent>> children>> length 1 =
+    [ drop ] [
+        insertion-point [ 1 - dup -1 = [ drop 1 ] when ] [ children>> ] bi* nth
+        [ request-focus ] [ editor>> end-of-document ] bi
+    ] if ;
+: initial-popped ( popper -- ) "" <popped> [ f track-add drop ] keep request-focus ;
+
+TUPLE: popper < track { unfocus-hook initial: [ drop ] } ;
+! list of strings is model (make shown objects implement sequence protocol)
+: <popper> ( model -- popper ) vertical popper new-track swap >>model ;
+
+M: popped handle-gesture swap {
+    { gain-focus [ 1 set-expansion f ] }
+    { lose-focus [ dup parent>>
+        [ [ unfocus-hook>> call( a -- ) ] curry [ f set-expansion ] bi ]
+        [ drop ] if* f
+    ] }
+    { T{ key-up f f "RET" } [ dup editor>> delete-previous-character new-popped f ] }
+    { T{ key-up f f "BACKSPACE" } [ dup editor>> editor-string "" =
+        [ dup fatal?>> [ [ focus-prev ] [ unparent ] bi ] [ t >>fatal? drop ] if ]
+        [ f >>fatal? drop ] if f
+    ] }
+    [ swap call-next-method ]
+} case ;
+
+M: popper handle-gesture swap T{ button-down f f 1 } =
+    [ hand-click# get 2 = [ initial-popped ] [ drop ] if ] [ drop ] if f ;
+
+M: popper model-changed
+    [ children>> [ unparent ] each ]
+    [ [ value>> [ <popped> ] map ] dip [ f track-add ] reduce request-focus ] bi ;
+
+M: popped pref-dim* editor>> [ pref-dim* first ] [ line-height ] bi 2array ;
+M: popper focusable-child* children>> [ t ] [ first ] if-empty ;
diff --git a/ui/gadgets/tiling/tiling.factor b/ui/gadgets/tiling/tiling.factor
new file mode 100644 (file)
index 0000000..8a3c878
--- /dev/null
@@ -0,0 +1,185 @@
+
+USING: kernel sequences math math.order
+       ui.gadgets ui.gadgets.tracks ui.gestures accessors fry
+       help.syntax
+       easy-help ;
+
+IN: ui.gadgets.tiling
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+ARTICLE: "ui.gadgets.tiling" "Tiling Layout Gadgets"
+
+Summary:
+
+    A gadget which tiles it's children.
+
+    A tiling gadget may contain any number of children, but only a
+    fixed number is displayed at one time. How many are displayed can
+    be controlled via Control-[ and Control-].
+
+    The focus may be switched with Alt-Left and Alt-Right.
+
+    The focused child may be moved via Shift-Alt-Left and
+    Shift-Alt-Right. ..
+
+Example:
+
+    <tiling-shelf>
+      "resource:" directory-files
+        [ [ drop ] <bevel-button> tiling-add ]
+      each
+    "Files" open-window ..
+
+;
+
+ABOUT: "ui.gadgets.tiling"
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+TUPLE: tiling < track gadgets tiles first focused ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: init-tiling ( tiling -- tiling )
+  init-track
+  { 1 0 }    >>orientation
+  V{ } clone >>gadgets
+  2          >>tiles
+  0          >>first
+  0          >>focused ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: <tiling> ( -- gadget ) tiling new init-tiling ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: bounded-subseq ( seq a b -- seq )
+  [ 0 max ] dip
+  pick length [ min ] curry bi@
+  rot
+  subseq ;
+
+: tiling-gadgets-to-map ( tiling -- gadgets )
+  [ gadgets>> ]
+  [ first>> ]
+  [ [ first>> ] [ tiles>> ] bi + ]
+  tri
+  bounded-subseq ;
+
+: tiling-map-gadgets ( tiling -- tiling )
+  dup clear-track
+  dup tiling-gadgets-to-map [ 1 track-add ] each ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: tiling-add ( tiling gadget -- tiling )
+  over gadgets>> push
+  tiling-map-gadgets ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: first-gadget ( tiling -- index ) drop 0 ;
+
+: last-gadget ( tiling -- index ) gadgets>> length 1 - ;
+
+: first-viewable ( tiling -- index ) first>> ;
+
+: last-viewable ( tiling -- index ) [ first>> ] [ tiles>> ] bi + 1 - ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: make-focused-mapped ( tiling -- tiling )
+
+  dup [ focused>> ] [ first>> ] bi <
+    [ dup first>> 1 - >>first ]
+    [ ]
+  if
+
+  dup [ last-viewable ] [ focused>> ] bi <
+    [ dup first>> 1 + >>first ]
+    [ ]
+  if ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: check-focused-bounds ( tiling -- tiling )
+  dup focused>> 0 max over gadgets>> length 1 - min >>focused ;
+
+: focus-prev ( tiling -- tiling )
+  dup focused>> 1 - >>focused
+  check-focused-bounds
+  make-focused-mapped
+  tiling-map-gadgets
+  dup request-focus ;
+
+: focus-next ( tiling -- tiling )
+  dup focused>> 1 + >>focused
+  check-focused-bounds
+  make-focused-mapped
+  tiling-map-gadgets
+  dup request-focus ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: exchanged! ( seq a b -- )
+                   [ 0 max ] bi@
+  pick length 1 - '[ _ min ] bi@
+  rot exchange ;
+
+: move-prev ( tiling -- tiling )
+  dup [ gadgets>> ] [ focused>> 1 - ] [ focused>> ] tri exchanged!
+  focus-prev ;
+
+: move-next ( tiling -- tiling )
+  dup [ gadgets>> ] [ focused>> ] [ focused>> 1 + ] tri exchanged!
+  focus-next ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: add-tile ( tiling -- tiling )
+  dup tiles>> 1 + >>tiles
+  tiling-map-gadgets ;
+
+: del-tile ( tiling -- tiling )
+  dup tiles>> 1 - 1 max >>tiles
+  tiling-map-gadgets ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+M: tiling focusable-child* ( tiling -- child/t )
+   [ focused>> ] [ gadgets>> ] bi nth ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+TUPLE: tiling-shelf < tiling ;
+TUPLE: tiling-pile  < tiling ;
+
+: <tiling-shelf> ( -- gadget )
+  tiling-shelf new init-tiling { 1 0 } >>orientation ;
+
+: <tiling-pile> ( -- gadget )
+  tiling-pile new init-tiling { 0 1 } >>orientation ;
+
+tiling-shelf
+ H{
+    { T{ key-down f { A+    } "LEFT"  } [ focus-prev  drop ] }
+    { T{ key-down f { A+    } "RIGHT" } [ focus-next drop ] }
+    { T{ key-down f { S+ A+ } "LEFT"  } [ move-prev   drop ] }
+    { T{ key-down f { S+ A+ } "RIGHT" } [ move-next  drop ] }
+    { T{ key-down f { C+    } "["     } [ del-tile  drop ] }
+    { T{ key-down f { C+    } "]"     } [ add-tile  drop ] }
+  }
+set-gestures
+
+tiling-pile
+ H{
+    { T{ key-down f { A+    } "UP"  } [ focus-prev  drop ] }
+    { T{ key-down f { A+    } "DOWN" } [ focus-next drop ] }
+    { T{ key-down f { S+ A+ } "UP"  } [ move-prev   drop ] }
+    { T{ key-down f { S+ A+ } "DOWN" } [ move-next  drop ] }
+    { T{ key-down f { C+    } "["     } [ del-tile  drop ] }
+    { T{ key-down f { C+    } "]"     } [ add-tile  drop ] }
+  }
+set-gestures
diff --git a/ui/offscreen/authors.txt b/ui/offscreen/authors.txt
new file mode 100644 (file)
index 0000000..f13c9c1
--- /dev/null
@@ -0,0 +1 @@
+Joe Groff
diff --git a/ui/offscreen/offscreen-docs.factor b/ui/offscreen/offscreen-docs.factor
new file mode 100644 (file)
index 0000000..7fea48a
--- /dev/null
@@ -0,0 +1,67 @@
+! Copyright (C) 2008 Joe Groff.
+! See http://factorcode.org/license.txt for BSD license.
+USING: help.markup help.syntax kernel quotations ui.gadgets
+images strings ui.gadgets.worlds ;
+IN: ui.offscreen
+
+HELP: <offscreen-world>
+{ $values
+     { "gadget" gadget } { "title" string } { "status" "a boolean" }
+     { "world" offscreen-world }
+}
+{ $description "Constructs an " { $link offscreen-world } " gadget with " { $snippet "gadget" } " as its only child. Generally you should use " { $link open-offscreen } " or " { $link do-offscreen } " instead of calling this word directly." } ;
+
+HELP: close-offscreen
+{ $values
+     { "world" offscreen-world }
+}
+{ $description "Releases the resources used by the rendering buffer for " { $snippet "world" } "." } ;
+
+HELP: do-offscreen
+{ $values
+     { "gadget" gadget } { "quot" quotation }
+}
+{ $description "Constructs an " { $link offscreen-world } " around " { $snippet "gadget" } " with " { $link open-offscreen } ", calls " { $snippet "quotation" } " with the world on the top of the stack, and cleans up the world with " { $link close-offscreen } " at the end of " { $snippet "quotation" } "." } ;
+
+HELP: gadget>bitmap
+{ $values
+     { "gadget" gadget }
+     { "image" image }
+}
+{ $description "Renders " { $snippet "gadget" } " to an " { $link offscreen-world } " and creates an " { $link image } " from its contents." } ;
+
+HELP: offscreen-world
+{ $class-description "The class of " { $link world } " objects that render to an offscreen buffer." } ;
+
+HELP: offscreen-world>bitmap
+{ $values
+     { "world" offscreen-world }
+     { "image" image }
+}
+{ $description "Saves a copy of the contents of " { $snippet "world" } " to a " { $link image } " object." } ;
+
+HELP: open-offscreen
+{ $values
+     { "gadget" gadget }
+     { "world" offscreen-world }
+}
+{ $description "Creates and sets up an " { $link offscreen-world } " with " { $snippet "gadget" } " as its only child." } ;
+
+{ offscreen-world open-offscreen close-offscreen do-offscreen } related-words
+
+ARTICLE: "ui.offscreen" "Offscreen UI rendering"
+"The " { $vocab-link "ui.offscreen" } " provides words for rendering gadgets to an offscreen buffer so that bitmaps can be made from their contents."
+{ $subsections offscreen-world }
+"Opening gadgets offscreen:"
+{ $subsections
+    open-offscreen
+    close-offscreen
+    do-offscreen
+}
+"Creating bitmaps from offscreen buffers:"
+{ $subsections
+    offscreen-world>bitmap
+    gadget>bitmap
+} ;
+
+ABOUT: "ui.offscreen"
diff --git a/ui/offscreen/offscreen.factor b/ui/offscreen/offscreen.factor
new file mode 100644 (file)
index 0000000..c6669eb
--- /dev/null
@@ -0,0 +1,45 @@
+! (c) 2008 Joe Groff, see license for details
+USING: accessors alien.c-types continuations images kernel math
+sequences ui.gadgets ui.gadgets.private ui.gadgets.worlds
+ui.private ui ui.backend destructors locals ;
+IN: ui.offscreen
+
+TUPLE: offscreen-world < world ;
+
+M: offscreen-world world-pixel-format-attributes
+    { offscreen T{ depth-bits { value 16 } } } ;
+
+: <offscreen-world> ( gadget title status -- world )
+    offscreen-world new-world ;
+
+M: offscreen-world graft*
+    (open-offscreen-buffer) ;
+
+M: offscreen-world ungraft*
+    [ (ungraft-world) ]
+    [ handle>> (close-offscreen-buffer) ]
+    [ reset-world ] tri ;
+
+: open-offscreen ( gadget -- world )
+    "" f <offscreen-world>
+    [ open-world-window ] [ relayout-1 ] [ ] tri
+    notify-queued ;
+
+: close-offscreen ( world -- )
+    ungraft notify-queued ;
+
+:: bgrx>bitmap ( alien w h -- image )
+    <image>
+        { w h } >>dim
+        alien w h * 4 * memory>byte-array >>bitmap
+        BGRX >>component-order ;
+
+: offscreen-world>bitmap ( world -- image )
+    offscreen-pixels bgrx>bitmap ;
+
+: do-offscreen ( gadget quot: ( offscreen-world -- ) -- )
+    [ open-offscreen ] dip
+    over [ slip ] [ close-offscreen ] [ ] cleanup ; inline
+
+: gadget>bitmap ( gadget -- image )
+    [ offscreen-world>bitmap ] do-offscreen ;
diff --git a/ui/offscreen/summary.txt b/ui/offscreen/summary.txt
new file mode 100644 (file)
index 0000000..51ef124
--- /dev/null
@@ -0,0 +1 @@
+Offscreen world gadgets for rendering UI elements to bitmaps
diff --git a/ui/offscreen/tags.txt b/ui/offscreen/tags.txt
new file mode 100644 (file)
index 0000000..46f6dcd
--- /dev/null
@@ -0,0 +1,2 @@
+ui
+graphics
diff --git a/update/backup/backup.factor b/update/backup/backup.factor
new file mode 100644 (file)
index 0000000..3f7dc8f
--- /dev/null
@@ -0,0 +1,27 @@
+USING: namespaces debugger io.files io.directories
+bootstrap.image update.util ;
+IN: update.backup
+
+: backup-boot-image ( -- )
+  my-boot-image-name
+  { "boot." my-arch-name "-" [ "datestamp" get ] ".image" } to-string
+  move-file ;
+
+: backup-image ( -- )
+  "factor.image"
+  { "factor" "-" [ "datestamp" get ] ".image" } to-string
+  move-file ;
+
+: backup-vm ( -- )
+  "factor"
+  { "factor" "-" [ "datestamp" get ] } to-string
+  move-file ;
+
+: backup ( -- )
+  datestamp "datestamp" set
+    [
+      backup-boot-image
+      backup-image
+      backup-vm
+    ]
+  try ;
diff --git a/update/latest/latest.factor b/update/latest/latest.factor
new file mode 100644 (file)
index 0000000..fea50f5
--- /dev/null
@@ -0,0 +1,51 @@
+USING: kernel namespaces system io.files io.pathnames io.directories
+bootstrap.image http.client update update.backup update.util ;
+IN: update.latest
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: git-pull-master ( -- )
+  image-path parent-directory
+    [
+      { "git" "pull" "git://factorcode.org/git/factor.git" "master" }
+      run-command
+    ]
+  with-directory ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: remote-latest-image ( -- url )
+  { "http://factorcode.org/images/latest/" my-boot-image-name } to-string ;
+
+: download-latest-image ( -- ) remote-latest-image download ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: rebuild-latest ( -- )
+  image-path parent-directory
+    [
+      backup
+      download-latest-image
+      make-clean
+      make
+      boot
+    ]
+  with-directory ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: update-latest ( -- )
+  image-path parent-directory
+    [
+      git-id
+      git-pull-master
+      git-id
+      = not
+        [ rebuild-latest ]
+      when
+    ]
+  with-directory ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+MAIN: update-latest
diff --git a/update/update.factor b/update/update.factor
new file mode 100644 (file)
index 0000000..d027264
--- /dev/null
@@ -0,0 +1,55 @@
+USING: kernel system sequences io.files io.directories
+io.pathnames io.launcher bootstrap.image http.client update.util ;
+IN: update
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: run-command ( cmd -- ) to-strings try-process ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: git-pull-clean ( -- )
+    image-path parent-directory [
+        { "git" "pull" "git://factorcode.org/git/factor.git" branch-name }
+        run-command
+    ] with-directory ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: remote-clean-image ( -- url )
+    { "http://factorcode.org/images/clean/" platform "/" my-boot-image-name }
+    to-string ;
+
+: download-clean-image ( -- ) remote-clean-image download ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: make-clean ( -- ) { gnu-make "clean" } run-command ;
+: make       ( -- ) { gnu-make         } run-command ;
+: boot       ( -- ) { "./factor" { "-i=" my-boot-image-name } } run-command ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: rebuild ( -- )
+    image-path parent-directory [
+        download-clean-image
+        make-clean
+        make
+        boot
+    ] with-directory ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: update ( -- )
+    image-path parent-directory [
+        git-id
+        git-pull-clean
+        git-id
+        = not
+        [ rebuild ]
+        when
+    ] with-directory ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+MAIN: update
diff --git a/update/util/util.factor b/update/util/util.factor
new file mode 100644 (file)
index 0000000..56916cf
--- /dev/null
@@ -0,0 +1,62 @@
+
+USING: kernel classes strings quotations words math math.parser arrays
+       combinators.smart
+       accessors
+       system prettyprint splitting
+       sequences combinators sequences.deep
+       io
+       io.launcher
+       io.encodings.utf8
+       calendar
+       calendar.format ;
+
+IN: update.util
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+DEFER: to-strings
+
+: to-string ( obj -- str )
+  dup class-of
+    {
+      { \ string    [ ] }
+      { \ quotation [ call( -- string ) ] }
+      { \ word      [ execute( -- string ) ] }
+      { \ fixnum    [ number>string ] }
+      { \ array     [ to-strings concat ] }
+    }
+  case ;
+
+: to-strings ( seq -- str )
+  dup [ string? ] all?
+    [ ]
+    [ [ to-string ] map flatten ]
+  if ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: cpu- ( -- cpu ) cpu unparse "." split "-" join ;
+
+: platform ( -- string ) { [ os unparse ] cpu- } to-strings "-" join ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: branch-name ( -- string ) "clean-" platform append ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: gnu-make ( -- string )
+    "make" ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: git-id ( -- id )
+  { "git" "show" } utf8 [ readln ] with-process-reader
+  " " split second ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: datestamp ( -- string )
+  now
+  [ { [ year>> ] [ month>> ] [ day>> ] [ hour>> ] [ minute>> ] } cleave ] output>array
+  [ pad-00 ] map "-" join ;
diff --git a/webapps/numbers/authors.txt b/webapps/numbers/authors.txt
new file mode 100644 (file)
index 0000000..44b06f9
--- /dev/null
@@ -0,0 +1 @@
+Chris Double
diff --git a/webapps/numbers/numbers.factor b/webapps/numbers/numbers.factor
new file mode 100644 (file)
index 0000000..d141ad1
--- /dev/null
@@ -0,0 +1,97 @@
+! 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 webapps.continuation ;
+
+IN: webapps.numbers
+
+: web-print ( str -- )
+  ! Display the string in a web page.
+  [
+    swap dup
+    "<!DOCTYPE html>" print
+    <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 ( -- )
+  [
+    "<!DOCTYPE html>" print
+    <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