Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Berry <bryan@olenepal.org>2009-11-02 20:45:18 (GMT)
committer Bryan Berry <bryan@olenepal.org>2009-11-02 20:45:18 (GMT)
commit25099db20a3e533c0ac6aabdf96c97431993dec8 (patch)
tree78e5ffe3d2842aa0f055348f5ec4bfad9485c6c6
parent441f538b4ac4ef05105f59357a32a122602d4aae (diff)
moved useful stuff in the utils/ directory to bin/ and deleted the rest of the stuff in utils/
-rwxr-xr-xbin/chakra.js (renamed from utils/chakra.js)0
-rwxr-xr-xbin/karma.js (renamed from utils/karma.js)0
-rwxr-xr-xutils/.tusk/catalog.json160
-rwxr-xr-xutils/.tusk/notes.json64
-rwxr-xr-xutils/README.md82
-rwxr-xr-xutils/bin/.gitignore7
l---------utils/bin/activate1
-rwxr-xr-xutils/bin/activate.bash50
-rwxr-xr-xutils/bin/activate.cmd3
l---------utils/bin/js1
-rwxr-xr-xutils/bin/narwhal48
-rwxr-xr-xutils/bin/narwhal.cmd29
-rwxr-xr-xutils/bin/sea36
-rwxr-xr-xutils/bin/sea.cmd26
-rwxr-xr-xutils/bin/tusk2
-rwxr-xr-xutils/bin/tusk.cmd1
-rwxr-xr-xutils/catalog.json166
-rwxr-xr-xutils/docs/index.md102
-rwxr-xr-xutils/docs/lib/binary.wiki242
-rwxr-xr-xutils/docs/lib/file.wiki325
-rwxr-xr-xutils/docs/lib/os/popen.md70
-rwxr-xr-xutils/docs/modules.md38
-rwxr-xr-xutils/docs/narwhal.md478
-rwxr-xr-xutils/docs/packages-howto.md31
-rwxr-xr-xutils/docs/packages.md30
-rwxr-xr-xutils/docs/platforms.md32
-rwxr-xr-xutils/docs/posts/2009-07-29-hello-0.1.md19
-rwxr-xr-xutils/docs/quick-start.md55
-rwxr-xr-xutils/docs/sea.md49
-rwxr-xr-xutils/examples/hello2
-rwxr-xr-xutils/examples/narwhal3
-rwxr-xr-xutils/examples/not-quite-a-quine.js1
-rwxr-xr-xutils/getopt.js273
-rwxr-xr-xutils/i18n/#test.pot#41
-rwxr-xr-xutils/i18n/jquery.js19
-rwxr-xr-xutils/i18n/test.html38
-rwxr-xr-xutils/i18n/test.pot26
-rwxr-xr-xutils/i18n/testnw.txt26
-rwxr-xr-xutils/jsdoc-toolkit/README.txt186
-rwxr-xr-xutils/jsdoc-toolkit/app/frame.js33
-rwxr-xr-xutils/jsdoc-toolkit/app/frame/Chain.js102
-rwxr-xr-xutils/jsdoc-toolkit/app/frame/Dumper.js144
-rwxr-xr-xutils/jsdoc-toolkit/app/frame/Hash.js84
-rwxr-xr-xutils/jsdoc-toolkit/app/frame/Link.js153
-rwxr-xr-xutils/jsdoc-toolkit/app/frame/Namespace.js10
-rwxr-xr-xutils/jsdoc-toolkit/app/frame/Opt.js134
-rwxr-xr-xutils/jsdoc-toolkit/app/frame/Reflection.js26
-rwxr-xr-xutils/jsdoc-toolkit/app/frame/String.js93
-rwxr-xr-xutils/jsdoc-toolkit/app/frame/Testrun.js129
-rwxr-xr-xutils/jsdoc-toolkit/app/handlers/FOODOC.js26
-rwxr-xr-xutils/jsdoc-toolkit/app/handlers/XMLDOC.js26
-rwxr-xr-xutils/jsdoc-toolkit/app/handlers/XMLDOC/DomReader.js159
-rwxr-xr-xutils/jsdoc-toolkit/app/handlers/XMLDOC/XMLDoc.js16
-rwxr-xr-xutils/jsdoc-toolkit/app/handlers/XMLDOC/XMLParse.js292
-rwxr-xr-xutils/jsdoc-toolkit/app/lib/JSDOC.js104
-rwxr-xr-xutils/jsdoc-toolkit/app/lib/JSDOC/DocComment.js200
-rwxr-xr-xutils/jsdoc-toolkit/app/lib/JSDOC/DocTag.js294
-rwxr-xr-xutils/jsdoc-toolkit/app/lib/JSDOC/JsDoc.js126
-rwxr-xr-xutils/jsdoc-toolkit/app/lib/JSDOC/JsPlate.js109
-rwxr-xr-xutils/jsdoc-toolkit/app/lib/JSDOC/Lang.js144
-rwxr-xr-xutils/jsdoc-toolkit/app/lib/JSDOC/Parser.js145
-rwxr-xr-xutils/jsdoc-toolkit/app/lib/JSDOC/PluginManager.js33
-rwxr-xr-xutils/jsdoc-toolkit/app/lib/JSDOC/Symbol.js645
-rwxr-xr-xutils/jsdoc-toolkit/app/lib/JSDOC/SymbolSet.js241
-rwxr-xr-xutils/jsdoc-toolkit/app/lib/JSDOC/TextStream.js41
-rwxr-xr-xutils/jsdoc-toolkit/app/lib/JSDOC/Token.js18
-rwxr-xr-xutils/jsdoc-toolkit/app/lib/JSDOC/TokenReader.js332
-rwxr-xr-xutils/jsdoc-toolkit/app/lib/JSDOC/TokenStream.js133
-rwxr-xr-xutils/jsdoc-toolkit/app/lib/JSDOC/Util.js32
-rwxr-xr-xutils/jsdoc-toolkit/app/lib/JSDOC/Walker.js474
-rwxr-xr-xutils/jsdoc-toolkit/app/main.js111
-rwxr-xr-xutils/jsdoc-toolkit/app/plugins/commentSrcJson.js20
-rwxr-xr-xutils/jsdoc-toolkit/app/plugins/frameworkPrototype.js16
-rwxr-xr-xutils/jsdoc-toolkit/app/plugins/functionCall.js10
-rwxr-xr-xutils/jsdoc-toolkit/app/plugins/publishSrcHilite.js62
-rwxr-xr-xutils/jsdoc-toolkit/app/plugins/symbolLink.js10
-rwxr-xr-xutils/jsdoc-toolkit/app/plugins/tagParamConfig.js31
-rwxr-xr-xutils/jsdoc-toolkit/app/plugins/tagSynonyms.js43
-rwxr-xr-xutils/jsdoc-toolkit/app/run.js348
-rwxr-xr-xutils/jsdoc-toolkit/app/t/TestDoc.js144
-rwxr-xr-xutils/jsdoc-toolkit/app/t/runner.js13
-rwxr-xr-xutils/jsdoc-toolkit/app/test.js325
-rwxr-xr-xutils/jsdoc-toolkit/app/test/addon.js24
-rwxr-xr-xutils/jsdoc-toolkit/app/test/anon_inner.js14
-rwxr-xr-xutils/jsdoc-toolkit/app/test/augments.js31
-rwxr-xr-xutils/jsdoc-toolkit/app/test/augments2.js26
-rwxr-xr-xutils/jsdoc-toolkit/app/test/borrows.js46
-rwxr-xr-xutils/jsdoc-toolkit/app/test/borrows2.js23
-rwxr-xr-xutils/jsdoc-toolkit/app/test/config.js22
-rwxr-xr-xutils/jsdoc-toolkit/app/test/constructs.js18
-rwxr-xr-xutils/jsdoc-toolkit/app/test/encoding.js10
-rwxr-xr-xutils/jsdoc-toolkit/app/test/encoding_other.js12
-rwxr-xr-xutils/jsdoc-toolkit/app/test/event.js54
-rwxr-xr-xutils/jsdoc-toolkit/app/test/exports.js14
-rwxr-xr-xutils/jsdoc-toolkit/app/test/functions_anon.js39
-rwxr-xr-xutils/jsdoc-toolkit/app/test/functions_nested.js33
-rwxr-xr-xutils/jsdoc-toolkit/app/test/global.js13
-rwxr-xr-xutils/jsdoc-toolkit/app/test/globals.js25
-rwxr-xr-xutils/jsdoc-toolkit/app/test/ignore.js10
-rwxr-xr-xutils/jsdoc-toolkit/app/test/inner.js16
-rwxr-xr-xutils/jsdoc-toolkit/app/test/jsdoc_test.js477
-rwxr-xr-xutils/jsdoc-toolkit/app/test/lend.js33
-rwxr-xr-xutils/jsdoc-toolkit/app/test/memberof.js19
-rwxr-xr-xutils/jsdoc-toolkit/app/test/memberof_constructor.js17
-rwxr-xr-xutils/jsdoc-toolkit/app/test/module.js17
-rwxr-xr-xutils/jsdoc-toolkit/app/test/name.js19
-rwxr-xr-xutils/jsdoc-toolkit/app/test/namespace_nested.js23
-rwxr-xr-xutils/jsdoc-toolkit/app/test/nocode.js13
-rwxr-xr-xutils/jsdoc-toolkit/app/test/oblit_anon.js20
-rwxr-xr-xutils/jsdoc-toolkit/app/test/overview.js20
-rwxr-xr-xutils/jsdoc-toolkit/app/test/param_inline.js37
-rwxr-xr-xutils/jsdoc-toolkit/app/test/params_optional.js8
-rwxr-xr-xutils/jsdoc-toolkit/app/test/prototype.js17
-rwxr-xr-xutils/jsdoc-toolkit/app/test/prototype_nested.js9
-rwxr-xr-xutils/jsdoc-toolkit/app/test/prototype_oblit.js13
-rwxr-xr-xutils/jsdoc-toolkit/app/test/prototype_oblit_constructor.js24
-rwxr-xr-xutils/jsdoc-toolkit/app/test/public.js10
-rwxr-xr-xutils/jsdoc-toolkit/app/test/scripts/code.js5
-rwxr-xr-xutils/jsdoc-toolkit/app/test/scripts/notcode.txt5
-rwxr-xr-xutils/jsdoc-toolkit/app/test/shared.js42
-rwxr-xr-xutils/jsdoc-toolkit/app/test/shared2.js2
-rwxr-xr-xutils/jsdoc-toolkit/app/test/shortcuts.js22
-rwxr-xr-xutils/jsdoc-toolkit/app/test/static_this.js13
-rwxr-xr-xutils/jsdoc-toolkit/app/test/synonyms.js31
-rwxr-xr-xutils/jsdoc-toolkit/app/test/tosource.js23
-rwxr-xr-xutils/jsdoc-toolkit/app/test/variable_redefine.js14
-rwxr-xr-xutils/jsdoc-toolkit/changes.txt96
-rwxr-xr-xutils/jsdoc-toolkit/conf/sample.conf31
-rwxr-xr-xutils/jsdoc-toolkit/java/build.xml36
-rwxr-xr-xutils/jsdoc-toolkit/java/build_1.4.xml36
-rwxr-xr-xutils/jsdoc-toolkit/java/classes/js.jarbin819369 -> 0 bytes
-rwxr-xr-xutils/jsdoc-toolkit/java/src/JsDebugRun.java21
-rwxr-xr-xutils/jsdoc-toolkit/java/src/JsRun.java21
-rwxr-xr-xutils/jsdoc-toolkit/jsdebug.jarbin1307 -> 0 bytes
-rwxr-xr-xutils/jsdoc-toolkit/jsrun.jarbin1303 -> 0 bytes
-rwxr-xr-xutils/jsdoc-toolkit/jsrun.sh52
-rwxr-xr-xutils/jsdoc-toolkit/templates/jsdoc/allclasses.tmpl17
-rwxr-xr-xutils/jsdoc-toolkit/templates/jsdoc/allfiles.tmpl56
-rwxr-xr-xutils/jsdoc-toolkit/templates/jsdoc/class.tmpl646
-rwxr-xr-xutils/jsdoc-toolkit/templates/jsdoc/index.tmpl39
-rwxr-xr-xutils/jsdoc-toolkit/templates/jsdoc/publish.js200
-rwxr-xr-xutils/jsdoc-toolkit/templates/jsdoc/static/default.css162
-rwxr-xr-xutils/jsdoc-toolkit/templates/jsdoc/static/header.html2
-rwxr-xr-xutils/jsdoc-toolkit/templates/jsdoc/static/index.html19
-rwxr-xr-xutils/jsdoc-toolkit/templates/jsdoc/symbol.tmpl35
-rwxr-xr-xutils/lib/.args.js.swpbin32768 -> 0 bytes
-rwxr-xr-xutils/lib/args.js702
-rwxr-xr-xutils/lib/base16.js16
-rwxr-xr-xutils/lib/base64.js120
-rwxr-xr-xutils/lib/codec/base64.js7
-rwxr-xr-xutils/lib/crc32.js60
-rwxr-xr-xutils/lib/env.rhino.js9041
-rwxr-xr-xutils/lib/file-bootstrap.js170
-rwxr-xr-xutils/lib/file.js447
-rwxr-xr-xutils/lib/hash.js28
-rwxr-xr-xutils/lib/hashp.js65
-rwxr-xr-xutils/lib/http.js17
-rwxr-xr-xutils/lib/io.js38
-rwxr-xr-xutils/lib/jsmin.js315
-rwxr-xr-xutils/lib/logger.js53
-rwxr-xr-xutils/lib/md4.js146
-rwxr-xr-xutils/lib/md5.js164
-rwxr-xr-xutils/lib/mime.js166
-rwxr-xr-xutils/lib/narwhal.js117
-rwxr-xr-xutils/lib/narwhal/repl.js96
-rwxr-xr-xutils/lib/narwhal/server-test.js3
-rwxr-xr-xutils/lib/narwhal/server.js211
-rwxr-xr-xutils/lib/narwhal/tusk.js169
-rwxr-xr-xutils/lib/narwhal/tusk/bin.js13
-rwxr-xr-xutils/lib/narwhal/tusk/bundle.js0
-rwxr-xr-xutils/lib/narwhal/tusk/catalog.js15
-rwxr-xr-xutils/lib/narwhal/tusk/clone.js66
-rwxr-xr-xutils/lib/narwhal/tusk/consolidate.js25
-rwxr-xr-xutils/lib/narwhal/tusk/create-catalog.js79
-rwxr-xr-xutils/lib/narwhal/tusk/freeze.js0
-rwxr-xr-xutils/lib/narwhal/tusk/init.js60
-rwxr-xr-xutils/lib/narwhal/tusk/install.js215
-rwxr-xr-xutils/lib/narwhal/tusk/list.js20
-rwxr-xr-xutils/lib/narwhal/tusk/orphans.js0
-rwxr-xr-xutils/lib/narwhal/tusk/platform.js33
-rwxr-xr-xutils/lib/narwhal/tusk/reheat.js15
-rwxr-xr-xutils/lib/narwhal/tusk/remove.js15
-rwxr-xr-xutils/lib/narwhal/tusk/search.js0
-rwxr-xr-xutils/lib/narwhal/tusk/update.js21
-rwxr-xr-xutils/lib/narwhal/tusk/upgrade.js0
-rwxr-xr-xutils/lib/os.js29
-rwxr-xr-xutils/lib/packages.js336
-rwxr-xr-xutils/lib/promise.js257
-rwxr-xr-xutils/lib/regexp.js12
-rwxr-xr-xutils/lib/sandbox.js394
-rwxr-xr-xutils/lib/sha.js108
-rwxr-xr-xutils/lib/sha256.js102
-rwxr-xr-xutils/lib/struct.js228
-rwxr-xr-xutils/lib/term.js166
-rwxr-xr-xutils/lib/test/assert.js91
-rwxr-xr-xutils/lib/test/equiv.js188
-rwxr-xr-xutils/lib/test/jsdump.js165
-rwxr-xr-xutils/lib/test/runner.js80
-rwxr-xr-xutils/lib/tusk.js202
-rwxr-xr-xutils/lib/unload.js13
-rwxr-xr-xutils/lib/uri.js55
-rwxr-xr-xutils/lib/url.js323
-rwxr-xr-xutils/lib/utf8.js64
-rwxr-xr-xutils/lib/util.js864
-rwxr-xr-xutils/lib/xregexp.js521
-rwxr-xr-xutils/local.json.template1
-rwxr-xr-xutils/narwhal.conf.template9
-rwxr-xr-xutils/narwhal.gemspec105
-rwxr-xr-xutils/narwhal.js208
-rwxr-xr-xutils/package.json12
-rwxr-xr-xutils/platforms/browser/inline.js56
-rwxr-xr-xutils/platforms/browser/lib/binary.js2
-rwxr-xr-xutils/platforms/browser/lib/modules.js1449
-rwxr-xr-xutils/platforms/browser/lib/reactor.js21
-rwxr-xr-xutils/platforms/browser/lib/system.js3
-rwxr-xr-xutils/platforms/default/lib/array.js160
-rwxr-xr-xutils/platforms/default/lib/binary-platform.js53
-rwxr-xr-xutils/platforms/default/lib/binary.js719
-rwxr-xr-xutils/platforms/default/lib/date.js8
-rwxr-xr-xutils/platforms/default/lib/file-platform.js119
-rwxr-xr-xutils/platforms/default/lib/function.js19
-rwxr-xr-xutils/platforms/default/lib/global.js11
-rwxr-xr-xutils/platforms/default/lib/io-platform.js26
-rwxr-xr-xutils/platforms/default/lib/json.js487
-rwxr-xr-xutils/platforms/default/lib/object.js27
-rwxr-xr-xutils/platforms/default/lib/os-platform.js3
-rwxr-xr-xutils/platforms/default/lib/reactor.js12
-rwxr-xr-xutils/platforms/default/lib/string.js89
-rwxr-xr-xutils/platforms/default/lib/system.js16
-rwxr-xr-xutils/platforms/k7/bin/narwhal-k732
-rwxr-xr-xutils/platforms/k7/bootstrap.js78
-rwxr-xr-xutils/platforms/k7/lib/binary.js2
-rwxr-xr-xutils/platforms/k7/lib/file-platform.js116
-rwxr-xr-xutils/platforms/k7/lib/io-platform.js8
-rwxr-xr-xutils/platforms/k7/lib/system.js25
-rwxr-xr-xutils/platforms/rhino/bin/narwhal-rhino42
-rwxr-xr-xutils/platforms/rhino/bin/narwhal-rhino.cmd25
-rwxr-xr-xutils/platforms/rhino/bootstrap.js105
-rwxr-xr-xutils/platforms/rhino/jars/jline.jarbin87325 -> 0 bytes
-rwxr-xr-xutils/platforms/rhino/jars/js.jarbin996593 -> 0 bytes
-rwxr-xr-xutils/platforms/rhino/lib/binary-platform.js44
-rwxr-xr-xutils/platforms/rhino/lib/binary.js435
-rwxr-xr-xutils/platforms/rhino/lib/file-platform.js224
-rwxr-xr-xutils/platforms/rhino/lib/http-platform.js10
-rwxr-xr-xutils/platforms/rhino/lib/io-platform.js358
-rwxr-xr-xutils/platforms/rhino/lib/md5.js40
-rwxr-xr-xutils/platforms/rhino/lib/os-platform.js114
-rwxr-xr-xutils/platforms/rhino/lib/packages-platform.js71
-rwxr-xr-xutils/platforms/rhino/lib/process.js5
-rwxr-xr-xutils/platforms/rhino/lib/sandbox-platform.js70
-rwxr-xr-xutils/platforms/rhino/lib/system.js24
-rwxr-xr-xutils/platforms/rhino/lib/zip.js78
-rwxr-xr-xutils/platforms/secure/lib/file.js6
-rwxr-xr-xutils/platforms/secure/lib/system.js6
-rwxr-xr-xutils/platforms/template/bin/narwhal-platform-name32
-rwxr-xr-xutils/platforms/template/bootstrap.js38
-rwxr-xr-xutils/platforms/template/lib/file-platform.js118
-rwxr-xr-xutils/platforms/template/lib/system.js17
-rwxr-xr-xutils/platforms/v8cgi/bootstrap.js41
-rwxr-xr-xutils/platforms/xulrunner/.gitignore1
-rwxr-xr-xutils/platforms/xulrunner/LICENSE33
-rwxr-xr-xutils/platforms/xulrunner/README.md16
-rwxr-xr-xutils/platforms/xulrunner/apps/firenarwhal/application.ini14
-rwxr-xr-xutils/platforms/xulrunner/apps/firenarwhal/chrome/branding/about.pngbin25950 -> 0 bytes
-rwxr-xr-xutils/platforms/xulrunner/apps/firenarwhal/chrome/branding/aboutCredits.pngbin25948 -> 0 bytes
-rwxr-xr-xutils/platforms/xulrunner/apps/firenarwhal/chrome/branding/aboutFooter.pngbin764 -> 0 bytes
-rwxr-xr-xutils/platforms/xulrunner/apps/firenarwhal/chrome/branding/icon48.pngbin6848 -> 0 bytes
-rwxr-xr-xutils/platforms/xulrunner/apps/firenarwhal/chrome/branding/icon64.pngbin10929 -> 0 bytes
-rwxr-xr-xutils/platforms/xulrunner/apps/firenarwhal/chrome/chrome.manifest3
-rwxr-xr-xutils/platforms/xulrunner/apps/firenarwhal/chrome/content/main.xul11
-rwxr-xr-xutils/platforms/xulrunner/apps/firenarwhal/chrome/locale/branding/brand.dtd7
-rwxr-xr-xutils/platforms/xulrunner/apps/firenarwhal/chrome/locale/branding/brand.properties3
-rwxr-xr-xutils/platforms/xulrunner/apps/firenarwhal/defaults/preferences/prefs.js20
l---------utils/platforms/xulrunner/apps/firenarwhal/extensions/mozrepl@hyperstruct.net1
l---------utils/platforms/xulrunner/apps/firenarwhal/extensions/narwhal@narwhaljs.org1
-rwxr-xr-xutils/platforms/xulrunner/apps/firenarwhal/firenarwhal27
-rwxr-xr-xutils/platforms/xulrunner/bin/narwhal-xulrunner53
-rwxr-xr-xutils/platforms/xulrunner/bootstrap.js109
-rwxr-xr-xutils/platforms/xulrunner/extensions/narwhal@narwhaljs.org/chrome.manifest5
l---------utils/platforms/xulrunner/extensions/narwhal@narwhaljs.org/chrome/content/narwhal.js1
l---------utils/platforms/xulrunner/extensions/narwhal@narwhaljs.org/components/nsINarwhal.idl1
l---------utils/platforms/xulrunner/extensions/narwhal@narwhaljs.org/components/nsINarwhal.js1
l---------utils/platforms/xulrunner/extensions/narwhal@narwhaljs.org/components/nsINarwhal.xpt1
-rwxr-xr-xutils/platforms/xulrunner/extensions/narwhal@narwhaljs.org/defaults/preferences/prefs.js1
-rwxr-xr-xutils/platforms/xulrunner/extensions/narwhal@narwhaljs.org/install.rdf22
l---------utils/platforms/xulrunner/extensions/narwhal@narwhaljs.org/modules/narwhal.js1
l---------utils/platforms/xulrunner/extensions/narwhal@narwhaljs.org/narwhal1
-rwxr-xr-xutils/platforms/xulrunner/lib/binary.js439
-rwxr-xr-xutils/platforms/xulrunner/lib/file-platform.js159
-rwxr-xr-xutils/platforms/xulrunner/lib/io-platform.js201
-rwxr-xr-xutils/platforms/xulrunner/lib/os-platform.js44
-rwxr-xr-xutils/platforms/xulrunner/lib/system.js40
-rwxr-xr-xutils/platforms/xulrunner/post-commit36
-rwxr-xr-xutils/sources.json73
-rwxr-xr-xutils/temp.txt3
-rwxr-xr-xutils/test.pot65
-rwxr-xr-xutils/tests/all-tests.js12
-rwxr-xr-xutils/tests/base64.js23
-rwxr-xr-xutils/tests/codecs.js65
-rwxr-xr-xutils/tests/file/all-tests.js31
-rwxr-xr-xutils/tests/iojs/absolute/b.js1
-rwxr-xr-xutils/tests/iojs/absolute/program.js5
-rwxr-xr-xutils/tests/iojs/absolute/submodule/a.js3
-rwxr-xr-xutils/tests/iojs/absolute/test.js9
-rwxr-xr-xutils/tests/iojs/config.js11
-rwxr-xr-xutils/tests/iojs/cyclic/a.js4
-rwxr-xr-xutils/tests/iojs/cyclic/b.js4
-rwxr-xr-xutils/tests/iojs/cyclic/program.js10
-rwxr-xr-xutils/tests/iojs/cyclic/test.js9
-rwxr-xr-xutils/tests/iojs/determinism/program.js3
-rwxr-xr-xutils/tests/iojs/determinism/submodule/a.js8
-rwxr-xr-xutils/tests/iojs/determinism/submodule/b.js2
-rwxr-xr-xutils/tests/iojs/determinism/test.js9
-rwxr-xr-xutils/tests/iojs/exactExports/a.js3
-rwxr-xr-xutils/tests/iojs/exactExports/program.js4
-rwxr-xr-xutils/tests/iojs/exactExports/test.js9
-rwxr-xr-xutils/tests/iojs/hasOwnProperty/hasOwnProperty.js0
-rwxr-xr-xutils/tests/iojs/hasOwnProperty/program.js3
-rwxr-xr-xutils/tests/iojs/hasOwnProperty/test.js9
-rwxr-xr-xutils/tests/iojs/hasOwnProperty/toString.js0
-rwxr-xr-xutils/tests/iojs/method/a.js12
-rwxr-xr-xutils/tests/iojs/method/program.js8
-rwxr-xr-xutils/tests/iojs/method/test.js9
-rwxr-xr-xutils/tests/iojs/missing/program.js8
-rwxr-xr-xutils/tests/iojs/missing/test.js9
-rwxr-xr-xutils/tests/iojs/monkeys/a.js1
-rwxr-xr-xutils/tests/iojs/monkeys/program.js4
-rwxr-xr-xutils/tests/iojs/monkeys/test.js9
-rwxr-xr-xutils/tests/iojs/nested/a/b/c/d.js3
-rwxr-xr-xutils/tests/iojs/nested/program.js3
-rwxr-xr-xutils/tests/iojs/nested/test.js9
-rwxr-xr-xutils/tests/iojs/program.js47
-rwxr-xr-xutils/tests/iojs/relative/program.js5
-rwxr-xr-xutils/tests/iojs/relative/submodule/a.js1
-rwxr-xr-xutils/tests/iojs/relative/submodule/b.js2
-rwxr-xr-xutils/tests/iojs/relative/test.js9
-rwxr-xr-xutils/tests/iojs/transitive/a.js1
-rwxr-xr-xutils/tests/iojs/transitive/b.js1
-rwxr-xr-xutils/tests/iojs/transitive/c.js3
-rwxr-xr-xutils/tests/iojs/transitive/program.js3
-rwxr-xr-xutils/tests/iojs/transitive/test.js9
-rwxr-xr-xutils/tests/os/all-tests.js3
-rwxr-xr-xutils/tests/os/popen.js23
-rwxr-xr-xutils/tests/sandbox/byte-io.js20
-rwxr-xr-xutils/tests/sandbox/fileName.js3
-rwxr-xr-xutils/tests/serverjs/all-tests.js9
-rwxr-xr-xutils/tests/serverjs/bytearray-tests.js273
-rwxr-xr-xutils/tests/serverjs/bytestring-tests.js263
-rwxr-xr-xutils/tests/serverjs/file-tests.js237
-rwxr-xr-xutils/tests/serverjs/file/extension.js45
-rwxr-xr-xutils/tests/serverjs/file/iterator.js101
-rwxr-xr-xutils/tests/serverjs/file/normal.js27
-rwxr-xr-xutils/tests/serverjs/file/resolve.js44
-rwxr-xr-xutils/tests/serverjs/module-tests.js9
-rwxr-xr-xutils/tests/string-tests.js34
-rwxr-xr-xutils/tests/uri-tests.js18
356 files changed, 0 insertions, 36825 deletions
diff --git a/utils/chakra.js b/bin/chakra.js
index 4628e75..4628e75 100755
--- a/utils/chakra.js
+++ b/bin/chakra.js
diff --git a/utils/karma.js b/bin/karma.js
index 2f03b1c..2f03b1c 100755
--- a/utils/karma.js
+++ b/bin/karma.js
diff --git a/utils/.tusk/catalog.json b/utils/.tusk/catalog.json
deleted file mode 100755
index d32df16..0000000
--- a/utils/.tusk/catalog.json
+++ /dev/null
@@ -1,160 +0,0 @@
-{
- "!": "This file is generated by 'tusk create-catalog', copied from '.tusk', and committed only so that it may be downloaded from Github with 'tusk update'.",
- "version": 1,
- "packages": {
- "narwhal": {
- "name": "narwhal",
- "author": "Tom Robinson",
- "contributors": [
- "Kris Kowal",
- "George Mosochovitis",
- "Kevin Dangoor",
- "Hannes Wallnöfer"
- ],
- "main": "examples/narwhal",
- "lib": [
- "lib"
- ],
- "githubName": "narwhal",
- "type": "zip",
- "location": "http://github.com/tlrobinson/narwhal/zipball/master"
- },
- "jack": {
- "name": "jack",
- "author": "Tom Robinson",
- "dependencies": [
- "narwhal"
- ],
- "jars": [
- "jars/simple-4.1.10.jar"
- ],
- "githubName": "jack",
- "type": "zip",
- "location": "http://github.com/tlrobinson/jack/zipball/master"
- },
- "nitro": {
- "name": "nitro",
- "author": "George Moschovitis",
- "email": "george.moschovitis@gmail.com",
- "dependencies": [
- "jack",
- "template"
- ],
- "js": "lib",
- "main": "examples/simple/jackconfig",
- "githubName": "nitro",
- "type": "zip",
- "location": "http://github.com/gmosx/nitro/zipball/master"
- },
- "chiron": {
- "author": "Kris Kowal",
- "dependencies": [],
- "lib": "src",
- "githubName": "chiron",
- "type": "zip",
- "location": "http://github.com/kriskowal/chiron/zipball/master"
- },
- "narcissus": {
- "author": "Brendan Eich <brendan@mozilla.org>",
- "contributors": [
- "Kris Kowal <kris@cixar.com>"
- ],
- "license": "MPL 1.1/GPL 2.0/LGPL 2.1",
- "githubName": "narcissus",
- "type": "zip",
- "location": "http://github.com/kriskowal/narcissus/zipball/master"
- },
- "creolejs": {
- "author": "Ivan Fomichev",
- "contributors": [
- "Chris Purcell",
- "Kris Kowal"
- ],
- "js": "src",
- "githubName": "creolejs",
- "type": "zip",
- "location": "http://github.com/kriskowal/creolejs/zipball/master"
- },
- "browserjs": {
- "name": "browser",
- "author": "Tom Robinson",
- "dependencies": [],
- "js": "lib",
- "githubName": "browserjs",
- "type": "zip",
- "location": "http://github.com/tlrobinson/browserjs/zipball/master"
- },
- "inspec": {
- "name": "inspec",
- "version": {
- "label": "0.1",
- "numeric": [
- 0,
- 1
- ],
- "status": "development"
- },
- "githubName": "inspec",
- "type": "zip",
- "location": "http://github.com/aq1018/inspec/zipball/master"
- },
- "kupo": {
- "name": "kupo_site",
- "author": "Jan Varwig",
- "githubName": "kupo",
- "type": "zip",
- "location": "http://github.com/janv/kupo/zipball/master"
- },
- "appengine": {
- "name": "appengine",
- "author": "George Moschovitis",
- "email": "george.moschovitis@gmail.com",
- "contributors": [],
- "js": "lib",
- "githubName": "appengine",
- "type": "zip",
- "location": "http://github.com/gmosx/appengine/zipball/master"
- },
- "jack-servlet": {
- "name": "jack-servelet",
- "author": "Tom Robinson",
- "dependencies": [
- "narwhal",
- "jack"
- ],
- "githubName": "jack-servlet",
- "type": "zip",
- "location": "http://github.com/tlrobinson/jack-servlet/zipball/master"
- },
- "gae": {
- "name": "gae",
- "title": "Google App Engine Java SDK",
- "description": "Java components necessary for depolying applications on Google's App Engine.",
- "author": "Google",
- "version": "1.2.1",
- "dependencies": [
- "jack-servlet",
- "jack",
- "narwhal"
- ],
- "lib": [],
- "type": "zip",
- "location": "http://googleappengine.googlecode.com/files/appengine-java-sdk-1.2.1.zip"
- },
- "env": {
- "githubName": "env-js",
- "type": "zip",
- "location": "http://github.com/kriskowal/env-js/zipball/master"
- },
- "template": {
- "name": "template",
- "author": "George Moschovitis",
- "email": "george.moschovitis@gmail.com",
- "dependencies": [],
- "js": "lib",
- "githubName": "template",
- "type": "zip",
- "location": "http://github.com/gmosx/template/zipball/master"
- }
- }
-} \ No newline at end of file
diff --git a/utils/.tusk/notes.json b/utils/.tusk/notes.json
deleted file mode 100755
index 06d9430..0000000
--- a/utils/.tusk/notes.json
+++ /dev/null
@@ -1,64 +0,0 @@
-{
- "jack": {
- "files": [
- "/home/hitman/karma/mainline/utils/packages/jack/.gitignore",
- "/home/hitman/karma/mainline/utils/packages/jack/README.md",
- "/home/hitman/karma/mainline/utils/packages/jack/bin/fcgi-test.sh",
- "/home/hitman/karma/mainline/utils/packages/jack/bin/jackup",
- "/home/hitman/karma/mainline/utils/packages/jack/examples/comet.js",
- "/home/hitman/karma/mainline/utils/packages/jack/examples/example.js",
- "/home/hitman/karma/mainline/utils/packages/jack/examples/hello/main.js",
- "/home/hitman/karma/mainline/utils/packages/jack/examples/hello/package.json",
- "/home/hitman/karma/mainline/utils/packages/jack/examples/shorty.js",
- "/home/hitman/karma/mainline/utils/packages/jack/examples/upload.js",
- "/home/hitman/karma/mainline/utils/packages/jack/jackconfig.js",
- "/home/hitman/karma/mainline/utils/packages/jack/jars/simple-4.1.10.jar",
- "/home/hitman/karma/mainline/utils/packages/jack/lib/jack.js",
- "/home/hitman/karma/mainline/utils/packages/jack/lib/jack/cascade.js",
- "/home/hitman/karma/mainline/utils/packages/jack/lib/jack/commonlogger.js",
- "/home/hitman/karma/mainline/utils/packages/jack/lib/jack/contentlength.js",
- "/home/hitman/karma/mainline/utils/packages/jack/lib/jack/file.js",
- "/home/hitman/karma/mainline/utils/packages/jack/lib/jack/handler/fastcgi-k7.js",
- "/home/hitman/karma/mainline/utils/packages/jack/lib/jack/handler/fastcgi-rhino.js",
- "/home/hitman/karma/mainline/utils/packages/jack/lib/jack/handler/fastcgi.js",
- "/home/hitman/karma/mainline/utils/packages/jack/lib/jack/handler/jetty.js",
- "/home/hitman/karma/mainline/utils/packages/jack/lib/jack/handler/servlet.js",
- "/home/hitman/karma/mainline/utils/packages/jack/lib/jack/handler/shttpd.js",
- "/home/hitman/karma/mainline/utils/packages/jack/lib/jack/handler/simple.js",
- "/home/hitman/karma/mainline/utils/packages/jack/lib/jack/handler/v8cgi.js",
- "/home/hitman/karma/mainline/utils/packages/jack/lib/jack/head.js",
- "/home/hitman/karma/mainline/utils/packages/jack/lib/jack/jsonp.js",
- "/home/hitman/karma/mainline/utils/packages/jack/lib/jack/lint.js",
- "/home/hitman/karma/mainline/utils/packages/jack/lib/jack/methodoverride.js",
- "/home/hitman/karma/mainline/utils/packages/jack/lib/jack/middleware.js",
- "/home/hitman/karma/mainline/utils/packages/jack/lib/jack/mime.js",
- "/home/hitman/karma/mainline/utils/packages/jack/lib/jack/mock.js",
- "/home/hitman/karma/mainline/utils/packages/jack/lib/jack/narwhal.js",
- "/home/hitman/karma/mainline/utils/packages/jack/lib/jack/reloader.js",
- "/home/hitman/karma/mainline/utils/packages/jack/lib/jack/request.js",
- "/home/hitman/karma/mainline/utils/packages/jack/lib/jack/response.js",
- "/home/hitman/karma/mainline/utils/packages/jack/lib/jack/showexceptions.js",
- "/home/hitman/karma/mainline/utils/packages/jack/lib/jack/static.js",
- "/home/hitman/karma/mainline/utils/packages/jack/lib/jack/urlmap.js",
- "/home/hitman/karma/mainline/utils/packages/jack/lib/jack/utils.js",
- "/home/hitman/karma/mainline/utils/packages/jack/lib/jackup.js",
- "/home/hitman/karma/mainline/utils/packages/jack/package.json",
- "/home/hitman/karma/mainline/utils/packages/jack/support/servlet/README",
- "/home/hitman/karma/mainline/utils/packages/jack/support/v8cgi/jack.ssjs",
- "/home/hitman/karma/mainline/utils/packages/jack/tests/jack-tests.js",
- "/home/hitman/karma/mainline/utils/packages/jack/tests/jack/all-tests.js",
- "/home/hitman/karma/mainline/utils/packages/jack/tests/jack/multipart/README",
- "/home/hitman/karma/mainline/utils/packages/jack/tests/jack/multipart/binary",
- "/home/hitman/karma/mainline/utils/packages/jack/tests/jack/multipart/empty",
- "/home/hitman/karma/mainline/utils/packages/jack/tests/jack/multipart/file1.txt",
- "/home/hitman/karma/mainline/utils/packages/jack/tests/jack/multipart/ie",
- "/home/hitman/karma/mainline/utils/packages/jack/tests/jack/multipart/nested",
- "/home/hitman/karma/mainline/utils/packages/jack/tests/jack/multipart/none",
- "/home/hitman/karma/mainline/utils/packages/jack/tests/jack/multipart/text",
- "/home/hitman/karma/mainline/utils/packages/jack/tests/jack/request-tests.js",
- "/home/hitman/karma/mainline/utils/packages/jack/tests/jack/utils-tests.js"
- ],
- "requester": "user",
- "finished": true
- }
-} \ No newline at end of file
diff --git a/utils/README.md b/utils/README.md
deleted file mode 100755
index e586bf9..0000000
--- a/utils/README.md
+++ /dev/null
@@ -1,82 +0,0 @@
-Narwhal
-=======
-
-A general purpose JavaScript platform
--------------------------------------
-
-Narwhal is a cross-platform, multi-interpreter, general purpose JavaScript platform. It aims to provide a solid foundation for building JavaScript applications, primarily outside the web browser. Narwhal includes a package manager, module system, and standard library for multiple JavaScript interpreters. Currently Narwhal's [Rhino](http://www.mozilla.org/rhino/) support is the most complete, but [other platforms](platforms.html) are available too.
-
-Narwhal's standard library conforms to the [ServerJS standard](https://wiki.mozilla.org/ServerJS). It is designed to work with multiple JavaScript interpreters, and to be easy to add support for new interpreters. Wherever possible, it is implemented in pure JavaScript to maximize reuse of code among platforms.
-
-Combined with [Jack](http://jackjs.org/), a [Rack](http://rack.rubyforge.org/)-like [JSGI](http://jackjs.org/jsgi-spec.html) compatible library, Narwhal provides a platform for creating server-side JavaScript web applications and frameworks such as [Nitro](http://www.nitrojs.org/).
-
-
-### Homepage:
-
-* [http://narwhaljs.org/](http://narwhaljs.org/)
-
-### Source & Download:
-
-* [http://github.com/tlrobinson/narwhal/](http://github.com/tlrobinson/narwhal/)
-
-### Mailing list:
-
-* [http://groups.google.com/group/narwhaljs](http://groups.google.com/group/narwhaljs)
-
-### IRC:
-
-* [\#narwhal on irc.freenode.net](http://webchat.freenode.net/?channels=narwhal)
-
-
-Documentation
--------------
-
-* [Quick Start](quick-start.html)
-* [Packages](packages.html)
-* [How to Install Packages](packages.html)
-* [How to Build Packages](packages-howto.html)
-* [Modules](modules.html)
-* [Virtual Environments / Seas](sea.html)
-* [How to Build Platforms](platforms.html)
-* [How Narwhal Works](narwhal.html)
-
-
-Contributors
-------------
-
-* [Tom Robinson](http://tlrobinson.net/)
-* [Kris Kowal](http://askawizard.blogspot.com/)
-* [George Moschovitis](http://blog.gmosx.com/)
-* [Kevin Dangoor](http://www.blueskyonmars.com/)
-* Hannes Wallnöfer
-* Sébastien Pierre
-* Irakli Gozalishvili
-* Christoph Dorn
-* Zach Carter
-* Nathan L. Smith
-* Jan Varwig
-* Mark Porter
-
-
-License
--------
-
-Copyright (c) 2009 Thomas Robinson < 280north.com >
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to
-deal in the Software without restriction, including without limitation the
-rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-sell copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
diff --git a/utils/bin/.gitignore b/utils/bin/.gitignore
deleted file mode 100755
index 5c9571b..0000000
--- a/utils/bin/.gitignore
+++ /dev/null
@@ -1,7 +0,0 @@
-appcfg.cmd
-appcfg.sh
-dev_appserver.cmd
-dev_appserver.sh
-fcgi-test.sh
-jackup
-narwhal-platform
diff --git a/utils/bin/activate b/utils/bin/activate
deleted file mode 120000
index c2a8369..0000000
--- a/utils/bin/activate
+++ /dev/null
@@ -1 +0,0 @@
-activate.bash \ No newline at end of file
diff --git a/utils/bin/activate.bash b/utils/bin/activate.bash
deleted file mode 100755
index e3cf2c7..0000000
--- a/utils/bin/activate.bash
+++ /dev/null
@@ -1,50 +0,0 @@
-
-if [ -z "${BASH_ARGV[0]}" ]; then
-
- # as a last recourse, use the present working directory
- PACKAGE_HOME=$(pwd)
-
-else
-
- # get the absolute path of the executable
- SELF_PATH=$(
- cd -P -- "$(dirname -- "${BASH_ARGV[0]}")" \
- && pwd -P
- ) && SELF_PATH=$SELF_PATH/$(basename -- "${BASH_ARGV[0]}")
-
- # resolve symlinks
- while [ -h "$SELF_PATH" ]; do
- DIR=$(dirname -- "$SELF_PATH")
- SYM=$(readlink -- "$SELF_PATH")
- SELF_PATH=$(cd -- "$DIR" && cd -- $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
- done
-
- PACKAGE_HOME=$(dirname -- "$(dirname -- "$SELF_PATH")")
-
-fi
-
-export PACKAGE_HOME
-
-# which -s narwhal doesn't work (os x 10.5, kriskowal)
-if [ -f "$PACKAGE_HOME"/bin/narwhal ]; then
- NARWHAL="$PACKAGE_HOME"/bin/narwhal
-elif [ -f "$PACKAGE_HOME"/packages/narwhal/bin/narwhal ]; then
- NARWHAL="$PACKAGE_HOME"/packages/narwhal/bin/narwhal
-else
- env narwhal -e '' >/dev/null 2>&1
- if [ "$?" -ne 127 ]; then
- NARWHAL=narwhal
- else
- echo "ERROR: narwhal is not in your PATH nor in $PACKAGE_HOME/bin." >&2
- fi
-fi
-
-if [ -f "$PACKAGE_HOME"/narwhal.conf ]; then
- source "$PACKAGE_HOME"/narwhal.conf
- export NARWHAL_DEFAULT_PLATFORM
-fi
-
-if [ "$NARWHAL" ]; then
- export PATH="$("$NARWHAL" --package "$PACKAGE_HOME" --path :)"
-fi
-
diff --git a/utils/bin/activate.cmd b/utils/bin/activate.cmd
deleted file mode 100755
index 8619da8..0000000
--- a/utils/bin/activate.cmd
+++ /dev/null
@@ -1,3 +0,0 @@
-@echo off
-
-set PATH=%~dp0;%PATH%
diff --git a/utils/bin/js b/utils/bin/js
deleted file mode 120000
index c6f91aa..0000000
--- a/utils/bin/js
+++ /dev/null
@@ -1 +0,0 @@
-narwhal \ No newline at end of file
diff --git a/utils/bin/narwhal b/utils/bin/narwhal
deleted file mode 100755
index 01fd4b1..0000000
--- a/utils/bin/narwhal
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/bash
-
-# get the absolute path of the executable
-SELF_PATH=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && SELF_PATH="$SELF_PATH/$(basename -- "$0")"
-
-# resolve symlinks
-while [ -h "$SELF_PATH" ]; do
- DIR=$(dirname -- "$SELF_PATH")
- SYM=$(readlink -- "$SELF_PATH")
- SELF_PATH=$(cd -- "$DIR" && cd -- $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
-done
-
-# NARWHAL_HOME is the 2nd ancestor directory of this shell script
-NARWHAL_HOME=$(dirname -- "$(dirname -- "$SELF_PATH")")
-
-# use Rhino as the default if none is specified in narwhal.conf
-NARWHAL_DEFAULT_PLATFORM="rhino"
-
-# load narwhal.conf if it exists
-if [ -f "$NARWHAL_HOME/narwhal.conf" ]; then
- source "$NARWHAL_HOME"/narwhal.conf
-fi
-
-# if NARWHAL_PLATFORM isn't yet set, set it to the default platform, and export it
-if [ -z "$NARWHAL_PLATFORM" ]; then
- NARWHAL_PLATFORM=$NARWHAL_DEFAULT_PLATFORM
-fi
-export NARWHAL_HOME
-
-# build the executable name for the platform
-EXECUTABLE_NAME="narwhal-$NARWHAL_PLATFORM"
-
-# search for the platform home directory
-# try narwhal.conf setting
-if [ "$NARWHAL_PLATFORM_HOME" ]; then
- export NARWHAL_PLATFORM_HOME
-# try relative
-elif [ -f "$NARWHAL_HOME/platforms/$NARWHAL_PLATFORM/bin/$EXECUTABLE_NAME" ]; then
- export NARWHAL_PLATFORM_HOME="$NARWHAL_HOME/platforms/$NARWHAL_PLATFORM"
-# try $PATH
-elif which -s "$EXECUTABLE_NAME"; then
- export NARWHAL_PLATFORM_HOME=$(dirname -- "$(dirname -- "$EXECUTABLE_NAME")")
-else
- echo "Can't find executable for $NARWHAL_PLATFORM"
- exit 1
-fi
-
-exec "$NARWHAL_PLATFORM_HOME"/bin/"$EXECUTABLE_NAME" "$@"
diff --git a/utils/bin/narwhal.cmd b/utils/bin/narwhal.cmd
deleted file mode 100755
index 98a9bfc..0000000
--- a/utils/bin/narwhal.cmd
+++ /dev/null
@@ -1,29 +0,0 @@
-@echo off
-setlocal
-
-:: NARWHAL_HOME is the parent the bin directory
-set NARWHAL_HOME=%~dp0..
-
-:: use Rhino as the default if none is specified in narwhal.conf
-set NARWHAL_DEFAULT_PLATFORM=rhino
-
-:: TODO: load narwhal.conf if it exists
-
-:: if NARWHAL_PLATFORM isn't yet set, set it to the default platform, and export it
-if "%NARWHAL_PLATFORM%" == "" (
- set NARWHAL_PLATFORM=%NARWHAL_DEFAULT_PLATFORM%
-)
-
-:: build the executable name for the platform
-set EXECUTABLE_NAME=narwhal-%NARWHAL_PLATFORM%.cmd
-
-:: search for the platform home directory
-:: TODO: look for more, including ".exe"?
-if exist %NARWHAL_HOME%\platforms\%NARWHAL_PLATFORM%. (
- set NARWHAL_PLATFORM_HOME=%NARWHAL_HOME%\platforms\%NARWHAL_PLATFORM%
-) else (
- echo "Can't find executable for $NARWHAL_PLATFORM"
- exit
-)
-
-call %NARWHAL_PLATFORM_HOME%\bin\%EXECUTABLE_NAME% %*
diff --git a/utils/bin/sea b/utils/bin/sea
deleted file mode 100755
index 13f7f52..0000000
--- a/utils/bin/sea
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/bash
-
-# this script is intended to work both in narwhal/bin and in
-# any project's bin dir; it's copied by tusk --init.
-
-# get the absolute path of the executable
-SELF_PATH=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && SELF_PATH=$SELF_PATH/$(basename -- "$0")
-
-# resolve symlinks
-while [ -h "$SELF_PATH" ]; do
- DIR=$(dirname -- "$SELF_PATH")
- SYM=$(readlink -- "$SELF_PATH")
- SELF_PATH=$(cd -- "$DIR" && cd -- $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
-done
-
-export PACKAGE_HOME=$(dirname -- "$(dirname -- "$SELF_PATH")")
-
-source "$PACKAGE_HOME/bin/activate.bash"
-
-export OLDSEA="$SEA"
-export SEA="$PACKAGE_HOME"
-export SEALVL="$((SEALVL + 1))"
-
-if [ "$#" -lt 1 ]; then
- echo PATH="$PATH" >&2
- echo SEA="$SEA" >&2
- echo SEALVL="$SEALVL" >&2
- "$SHELL"
-else
- "$SHELL" -c "$*"
-fi
-if [ "$OLDSEA" != "" ]; then
- echo SEA="$OLDSEA" >&2
-fi
-echo SEALVL="$((SEALVL - 1))" >&2
-
diff --git a/utils/bin/sea.cmd b/utils/bin/sea.cmd
deleted file mode 100755
index bf3f2ad..0000000
--- a/utils/bin/sea.cmd
+++ /dev/null
@@ -1,26 +0,0 @@
-@echo off
-setlocal
-
-set SHELL=cmd.exe
-
-set PACKAGE_HOME=%~dp0\..
-
-call %PACKAGE_HOME%\bin\activate.cmd
-
-set OLDSEA=%SEA%
-set SEA=%PACKAGE_HOME%
-set /a SEALVL=%SEALVL% + 1
-
-if "%1" == "" (
- echo SEALVL=%SEALVL%
- echo SEA=%SEA%
- echo PATH=%PATH%
- %SHELL%
-) else (
-echo "asdfasdfadsf"
- %SHELL% %*
-)
-
-set /a SEALVL=%SEALVL% - 1
-echo SEALVL=%SEALVL%
-echo SEA=%OLDSEA%
diff --git a/utils/bin/tusk b/utils/bin/tusk
deleted file mode 100755
index 85e2daf..0000000
--- a/utils/bin/tusk
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/usr/bin/env narwhal
-require('narwhal/tusk').main(system.args);
diff --git a/utils/bin/tusk.cmd b/utils/bin/tusk.cmd
deleted file mode 100755
index d6f225e..0000000
--- a/utils/bin/tusk.cmd
+++ /dev/null
@@ -1 +0,0 @@
-narwhal.cmd %~dpn0 %*
diff --git a/utils/catalog.json b/utils/catalog.json
deleted file mode 100755
index 302c53b..0000000
--- a/utils/catalog.json
+++ /dev/null
@@ -1,166 +0,0 @@
-{
- "!": "This file is generated by 'tusk create-catalog', copied from '.tusk', and committed only so that it may be downloaded from Github with 'tusk update'.",
- "version": 1,
- "packages": {
- "narwhal": {
- "name": "narwhal",
- "author": "Tom Robinson",
- "contributors": [
- "Kris Kowal",
- "George Mosochovitis",
- "Kevin Dangoor",
- "Hannes Wallnöfer"
- ],
- "main": "examples/narwhal",
- "lib": [
- "lib"
- ],
- "githubName": "narwhal",
- "type": "zip",
- "location": "http://github.com/tlrobinson/narwhal/zipball/master"
- },
- "jack": {
- "name": "jack",
- "author": "Tom Robinson",
- "dependencies": [
- "narwhal"
- ],
- "jars": [
- "jars/simple-4.1.10.jar"
- ],
- "githubName": "jack",
- "type": "zip",
- "location": "http://github.com/tlrobinson/jack/zipball/master"
- },
- "nitro": {
- "name": "nitro",
- "author": "George Moschovitis",
- "email": "george.moschovitis@gmail.com",
- "dependencies": [
- "jack",
- "template"
- ],
- "contributors": [
- "Kris Kowal"
- ],
- "js": "lib",
- "main": "examples/simple/jackconfig",
- "lean": [
- "lib"
- ],
- "githubName": "nitro",
- "type": "zip",
- "location": "http://github.com/gmosx/nitro/zipball/master"
- },
- "chiron": {
- "author": "Kris Kowal",
- "dependencies": [],
- "lib": "src",
- "githubName": "chiron",
- "type": "zip",
- "location": "http://github.com/kriskowal/chiron/zipball/master"
- },
- "narcissus": {
- "author": "Brendan Eich <brendan@mozilla.org>",
- "contributors": [
- "Kris Kowal <kris@cixar.com>"
- ],
- "license": "MPL 1.1/GPL 2.0/LGPL 2.1",
- "githubName": "narcissus",
- "type": "zip",
- "location": "http://github.com/kriskowal/narcissus/zipball/master"
- },
- "creolejs": {
- "author": "Ivan Fomichev",
- "contributors": [
- "Chris Purcell",
- "Kris Kowal"
- ],
- "js": "src",
- "githubName": "creolejs",
- "type": "zip",
- "location": "http://github.com/kriskowal/creolejs/zipball/master"
- },
- "browserjs": {
- "name": "browser",
- "author": "Tom Robinson",
- "dependencies": [],
- "js": "lib",
- "githubName": "browserjs",
- "type": "zip",
- "location": "http://github.com/tlrobinson/browserjs/zipball/master"
- },
- "inspec": {
- "name": "inspec",
- "version": {
- "label": "0.1",
- "numeric": [
- 0,
- 1
- ],
- "status": "development"
- },
- "githubName": "inspec",
- "type": "zip",
- "location": "http://github.com/aq1018/inspec/zipball/master"
- },
- "kupo": {
- "name": "kupo_site",
- "author": "Jan Varwig",
- "githubName": "kupo",
- "type": "zip",
- "location": "http://github.com/janv/kupo/zipball/master"
- },
- "appengine": {
- "name": "appengine",
- "author": "George Moschovitis",
- "email": "george.moschovitis@gmail.com",
- "contributors": [],
- "js": "lib",
- "githubName": "appengine",
- "type": "zip",
- "location": "http://github.com/gmosx/appengine/zipball/master"
- },
- "jack-servlet": {
- "name": "jack-servelet",
- "author": "Tom Robinson",
- "dependencies": [
- "narwhal",
- "jack"
- ],
- "githubName": "jack-servlet",
- "type": "zip",
- "location": "http://github.com/tlrobinson/jack-servlet/zipball/master"
- },
- "appengine-java-sdk": {
- "name": "gae",
- "title": "Google App Engine Java SDK",
- "description": "Java components necessary for deploying applications on Google's App Engine.",
- "author": "Google",
- "version": "1.2.2",
- "dependencies": [
- "jack-servlet",
- "jack",
- "narwhal"
- ],
- "lib": [],
- "type": "zip",
- "location": "http://googleappengine.googlecode.com/files/appengine-java-sdk-1.2.2.zip"
- },
- "env": {
- "githubName": "env-js",
- "type": "zip",
- "location": "http://github.com/kriskowal/env-js/zipball/master"
- },
- "template": {
- "name": "template",
- "author": "George Moschovitis",
- "email": "george.moschovitis@gmail.com",
- "dependencies": [],
- "js": "lib",
- "githubName": "template",
- "type": "zip",
- "location": "http://github.com/gmosx/template/zipball/master"
- }
- }
-} \ No newline at end of file
diff --git a/utils/docs/index.md b/utils/docs/index.md
deleted file mode 100755
index 85ce2b0..0000000
--- a/utils/docs/index.md
+++ /dev/null
@@ -1,102 +0,0 @@
-
-Narwhal
-=======
-
-A flexible JavaScript standard library
---------------------------------------
-
-Narwhal is a server-side JavaScript standard library conforming to the [ServerJS standard](https://wiki.mozilla.org/ServerJS). It is designed to work with multiple JavaScript interpreters, and to be easy to add support for new interpreters. Wherever possible, it is implemented in pure JavaScript to maximize reuse of code between platforms.
-
-
-Packages
---------
-
-A package consists of a directory of modules conforming to the ServerJS [Securable Modules](https://wiki.mozilla.org/ServerJS/Modules/SecurableModules) specification, and a `packages.json` file in the root of the package containing the location of the modules, dependencies, and other metadata.
-
-A package directory might have the following files and directories:
-
-* `package.json` for package metadata like dependencies and overrides for the conventional directory names.
-* `local.json` for overrides on `package.json` provided by the user.
-* `bin` for executables.
-* `lib` for all object code, including JavaScript modules, and C extensions.
-* `src` for all buildable source code, including C and Java source code.
-* `jars` for Java class trees and archives.
-* `packages/{name}` for installed sub-packages.
-* `platforms/{platform}` for platform-specific packages.
-* `parent` for an inherited package tree, like the `narwhal` package installed by the system administrator or OS package management system.
-
-`package.json` and `local.json` may contain the following attributes:
-
-* `name` - the name of the package. The package system will only load one package with a given name. The name defaults to the name of the parent directory.
-* `lib` - a path or array of paths to top-level module directories provided in this package. Defaults to `["lib"]`.
-* `jars` - for Rhino platforms, a path or array of paths to directories to add to the Java CLASSPATH (uses a Java URLClassLoader, so accepts `.jar` paths and directory paths ending with `/`).
-* `packages` - a path or array of paths to directories containing additional packages, defaults to `["packages"]`.
-* `platforms` - a path or array of paths to directories containing platform-specific packages, defaults to `["platforms"]`. These platform packages will be loaded if and in the prioritized order they appear in the `system.platforms` array, and with higher priority that those in this package's generic `lib` path so that they can override platform-specific modules.
-* `main` - a path to a main program if the package is run with `bin/narwhal` and its directory instead of a specific script.
-* `author` - may be a comment on the package's author and email in angle brackets.
-* `contributors` - may be an array of additional author names and email addresses in angle brackets.
-* `parent` - a path to a package tree to inherit, like the `narwhal` package installed by the system administrator. Defaults to `parent` if a symlink exists by that name.
-
-
-Platforms
----------
-
-To add Narwhal to a new platform, you need two main things:
-
-1. A `thunk` which sets up a fixtures object with a few required objects, then loads `narwhal.js` (usually consists of a shell script at `bin/PLATFORM` and short JavaScript file at `narwhal-PLATFORM.js`)
-
-2. Platform implementations for core modules, such as File (located in `platforms/PLATFORM`)
-
-
-Available Packages
-------------------
-
-* Jack: the web server and web application/framework agnostic interface, similar to Ruby's Rack and Python's WSGI. Narwhal was conceived while building Jack, and was later extracted into it's own project.
-
-[http://github.com/tlrobinson/jack](http://github.com/tlrobinson/jack)
-
-* Chiron: a system of interoperable JavaScript modules, including a type system, base types, general-purpose functions, events, encoding, decoding, hashing, and caching.
-
-[http://github.com/kriskowal/chiron](http://github.com/kriskowal/chiron)
-
-* Nitro: a web application framework built on top of Jack.
-
-[http://github.com/gmosx/nitro](http://github.com/gmosx/nitro)
-
-* getjs: a JavaScript package manager for ServerJS implementations
-
-[http://github.com/dangoor/getjs](http://github.com/dangoor/getjs)
-
-
-Contributors
-------------
-
-* [Tom Robinson](http://tlrobinson.net/)
-* [Kris Kowal](http://askawizard.blogspot.com/)
-* [George Moschovitis](http://blog.gmosx.com/)
-* [Kevin Dangoor](http://www.blueskyonmars.com/)
-* Hannes Wallnöfer
-
-
-License
--------
-
-Copyright (c) 2009 Thomas Robinson <[tlrobinson.net](http://tlrobinson.net/)\>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to
-deal in the Software without restriction, including without limitation the
-rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-sell copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
diff --git a/utils/docs/lib/binary.wiki b/utils/docs/lib/binary.wiki
deleted file mode 100755
index 51560a7..0000000
--- a/utils/docs/lib/binary.wiki
+++ /dev/null
@@ -1,242 +0,0 @@
-All platforms must support two types for interacting with binary data: ByteArray and ByteString. The ByteArray type resembles the interface of Array in that it is mutable, extensible, and indexing will return number values for the byte in the given position, zero by default, or undefined if the index is out of bounds. The ByteString type resembles the interface of String in that it is immutable and indexing returns a ByteString of length 1. These types are exported by the 'binary' top-level module and both types are subtypes of Binary, which is not instantiable but exists only for the convenience of referring to both ByteArray and ByteString. (The idea of using these particular two types and their respective names originated with Jason Orendorff in the [http://groups.google.com/group/serverjs/msg/89808c05d46b92d0 Binary API Brouhaha] discussion.)
-
-= Philosophy =
-
-This proposal is not an object oriented variation on pack and unpack with notions of inherent endianness, read/write head position, or intrinsic codec or charset information. The objects described in this proposal are merely for the storage and direct manipulation of strings and arrays of byte data. Some object oriented conveniences are made, but the exercise of implementing pack, unpack, or an object-oriented analog thereof are left as an exercise for a future proposal of a more abstract type or a 'struct' module (as mentioned by Ionut Gabriel Stan on [http://groups.google.com/group/serverjs/msg/592442ba98c6c70e the list]). This goes against most mentioned [[ServerJS/Binary|prior art]].
-
-This proposal also does not provide named member functions for any particular subset of the possible charsets, codecs, compression algorithms, or consistent hash digests that might operate on a byte string or array. Instead, convenience member functions are provided for interfacing with any named charset, with the IANA charset name space, and with the possibility of eventually employing a system of modular extensions for other codecs or digests, requiring that the given module exports a specified interface. (As supported originally by Robert Schultz, Davey Waterson, Ross Boucher, and tacitly myself, Kris Kowal, on the [http://groups.google.com/group/serverjs/browse_thread/thread/be72ef3d8146731d/06c27162b698eef5?lnk=gst First proposition] thread on the mailing list). This proposal does not address the need for stream objects to support pipelined codecs and hash digests (mentioned by Tom Robinson and Robert Schultz in the same conversation).
-
-This proposal also reflects both group sentiment and a pragmatic point about properties. This isn't a decree that properties like "length" should be consistently used throughout the ServerJS APIs. However, given that all platforms support properties at the native level (to host String and Array objects) and that byte strings and arrays will require support at the native level, pursuing client-side interoperability is beyond the scope of this proposal and therefore properties have been specified. (See comments by Kris Zyp about the implementability of properties in all platforms, comments by Davey Waterson from Aptana about the counter-productivity of attempting to support this API in browsers, and support properties over accessor and mutator functions by Ionut Gabriel Stand and Cameron McCormack on the [http://groups.google.com/group/serverjs/browse_thread/thread/be72ef3d8146731d/06c27162b698eef5?lnk=gst mailing list]).
-
-The byte types provide functions for encoding, decoding, and transcoding, but they are all shallow interfaces that defer to a charset manager module, and may in turn use a system level charset or use a pair of pure JavaScript modules to transcode through an array or stream of canonical Unicode code points. This behavior may be specified further in the future.
-
-= Specification =
-
-The "binary" top-level module must export "Binary", "ByteArray" and "ByteString".
-
-
-== ByteString ==
-
-A ByteString is an immutable, fixed-width representation of a C unsigned char (byte) array. ByteString supports the String API, and indexing returns a byte substring of length 1.
-
-=== Constructor ===
-
-; ByteString()
-: Construct an empty byte string.
-; ByteString(byteString)
-: Copies byteString.
-; ByteString(byteArray)
-: Use the contents of byteArray.
-; ByteString(arrayOfNumbers)
-: Use the numbers in arrayOfNumbers as the bytes.
-: If any element is outside the range 0...255, an exception (''TODO'') is thrown.
-; ByteString(string, charset)
-: Convert a string. The ByteString will contain string encoded with charset.
-
-=== Constructor methods ===
-
-; join(array, delimiter)
-: Like Array.prototype.join, but for Binarys. Returns a ByteString.
-
-=== Instance properties ===
-
-; length
-: The length in bytes. Immutable.
-
-=== Instance methods (in prototype) ===
-
-; toByteArray()
-: Returns a byte for byte copy in a ByteArray.
-; toByteArray(sourceCharset, targetCharset)
-: Returns a transcoded copy in a ByteArray.
-; toByteString()
-: Returns itself, since there's no need to copy an immutable ByteString.
-; toByteString(sourceCharset, targetCharset)
-: Returns a transcoded copy.
-; toArray()
-: Returns an array containing the bytes as numbers.
-; toArray(charset)
-: Returns an array containing the decoded Unicode code points.
-; toString()
-: Returns a debug representation like "[ByteString 10]", where 10 is the length of the Array. Alternative debug representations are valid too, as long as (1) this method will never fail, (2) the length is included.
-; decodeToString(charset)
-: Returns the decoded ByteArray as a string.
-; indexOf(byte)
-; indexOf(byte, start)
-; indexOf(byte, start, stop)
-: Returns the index of the first occurance of byte (a Number or a single element ByteString or ByteArray) or -1 if none was found. If start and/or stop are specified, only elements between the the indexes start and stop are searched.
-; lastIndexOf(byte)
-; lastIndexOf(byte, start)
-; lastIndexOf(byte, start, stop)
-: Returns the index of the last occurance of byte (a Number or a single element ByteString or ByteArray) or -1 if none was found. If start and/or stop are specified, only elements between the the indexes start and stop are searched.
-; charCodeAt(offset)
-; <u>get(offset)</u>
-: Return the byte at offset as a Number.
-; byteAt(offset) ByteString
-; charAt(offset) ByteString
-: Return the byte at offset as a ByteString.
-; split(delimiter, [options])
-: Split at delimiter, which can by a Number, a ByteString, a ByteArray or an Array of the prior (containing multiple delimiters, i.e., "split at any of these delimiters"). Delimiters can have arbitrary size.
-: Options is an optional object parameter with the following optional properties:
-* ''count'' - Maximum number of elements (ignoring delimiters) to return. The last returned element may contain delimiters.
-* ''includeDelimiter'' - Whether the delimiter should be included in the result.
-: Returns an array of ByteStrings.
-; slice()
-; slice(begin)
-; slice(begin, end)
-: See [https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array/slice Array.prototype.slice]
-
-
-; substr(start)
-:
-; substr(start, length)
-:
-; substring(first)
-:
-; substring(first, last)
-
-; [] ByteString
-: the immutable [] operator returning ByteStrings
-; toSource()
-: which would return "ByteString([])" for a null byte string
-
-ByteString does not implement toUpperCase() or toLowerCase() since they are not meaningful without the context of a charset.
-
-== ByteArray ==
-
-A ByteArray is a mutable, flexible representation of a C unsigned char (byte) array.
-
-=== Constructor ===
-
-; ByteArray()
-: New, empty ByteArray.
-; ByteArray(length)
-: New ByteArray filled with length zero bytes.
-; ByteArray(byteArray)
-: Copy byteArray.
-; ByteArray(byteString)
-: Copy contents of byteString.
-; ByteArray(arrayOfBytes)
-: Use numbers in arrayOfBytes as contents.
-: Throws an exception if any element is outside the range 0...255 (''TODO'').
-; ByteArray(string, charset)
-: Create a ByteArray from a Javascript string, the result being encoded with charset.
-
-Unlike the Array, the ByteArray is not variadic so that its initial length constructor is not ambiguous with its copy constructor.
-
-All values within the length of the array are numbers stored as bytes that default to 0 if they have not been explicitly set. Assigning beyond the bounds of a ByteArray implicitly grows the array, just like an Array. Retrieving a value from an index that is out of the bounds of the Array, lower than 0 or at or beyond the length, the returned value is "undefined". Assigning an index with a value that is larger than fits in a byte will be implicitly and silently masked against 0xFF. Negative numbers will be bit extended to a byte in two's complement form and likewise masked.
-
-=== Instance properties ===
-
-; mutable length property
-: extending a byte array fills the new entries with 0.
-
-=== Instance methods (in prototype) ===
-
-; toArray()
-: n array of the byte values
-; toArray(charset)
-: an array of the code points, decoded
-; toString()
-: A string debug representation like "[ByteArray 10]". Alternative debug representations are valid too, as long as (1) this method will never fail, (2) the length is included.
-; decodeToString(charset)
-: returns a String from its decoded bytes in a given charset.
-; toByteArray()
-: just a copy
-; toByteArray(sourceCharset, targetCharset)
-: transcoded
-; toByteString()
-: byte for byte copy
-; toByteString(sourceCharset, targetCharset)
-: transcoded
-; <u>byteAt(offset) ByteString</u>
-: Return the byte at offset as a ByteString.
-; <u>get(offset) Number</u>
-: Return the byte at offset as a Number.
-; concat(other:ByteArray|ByteString|Array)
-; pop() byte:Number
-:
-; push(...variadic Numbers...) -> count(Number)
-:
-; <u>extendRight(...variadic Numbers / Arrays / ByteArrays / ByteStrings ...)</u>
-:
-; shift() byte:Number
-:
-; unshift(...variadic Numbers...) count:Number
-:
-; <u>extendLeft(...variadic Numbers / Arrays / ByteArrays / ByteStrings ...)</u>
-:
-; reverse() in place reversal
-:
-; slice()
-:
-; sort()
-:
-; splice()
-:
-; <u>indexOf()</u>
-:
-; <u>lastIndexOf()</u>
-:
-; <u>split()</u>
-: Returns an array of ByteArrays instead of ByteStrings.
-; <u>filter()</u>
-:
-; <u>forEach()</u>
-:
-; <u>every()</u>
-:
-; <u>some()</u>
-:
-; <u>map()</u>
-:
-; <u>reduce()</u>
-:
-; <u>reduceRight()</u>
-:
-; <u>displace(begin, end, values/ByteStrings/ByteArrays/Arrays...) -> length</u>
-: begin/end are specified like for slice. Can be used like splice but does not return the removed elements.
-; toSource()
-: Returns a string like "ByteArray([])" for a null byte-array.
-; [] Number
-: The mutable [] operator for numbers
-
-== String ==
-
-The String prototype will be extended with the following members:
-
-; toByteArray(charset)
-: Converts a string to a ByteArray encoded in charset.
-; toByteString(charset)
-: Converts a string to a ByteString encoded in charset.
-; charCodes()
-: Returns an array of Unicode code points (as numbers).
-
-== Array ==
-
-The Array prototype will be extended with the following members:
-
-; toByteArray(charset)
-: Converts an array of Unicode code points to a ByteArray encoded in charset.
-; toByteString(charset)
-: Converts an array of Unicode code points to a ByteString encoded in charset.
-
-== General Requirements ==
-
-None of the specified prototypes or augmentations to existing prototypes are enumerable.
-
-<u>Any operation that requires encoding, decoding, or transcoding among charsets may throw an error if that charset is not supported by the implementation. All implementations MUST support "us-ascii" and "utf-8".</u>
-
-Charset strings are as defined by IANA http://www.iana.org/assignments/character-sets.
-
-<u>Charsets are case insensitive.</u>
-
-= Tests =
-
-* [http://github.com/tlrobinson/narwhal/tree/master/tests/serverjs ServerJS tests] compatible with [http://github.com/tlrobinson/narwhal/tree/master/lib/test this test framework].
-
-= Relevant Discussions =
-
-* [http://groups.google.com/group/serverjs/browse_thread/thread/f8ad81201f7b121b ByteArray and ByteString proposal]
-* [http://groups.google.com/group/serverjs/browse_thread/thread/a8d3a91af37fd355 ByteArray: byteAt method]
-* [http://groups.google.com/group/serverjs/browse_thread/thread/45190ac89d7b422a Binary/B Extension Proposals and Implementation Notes]
diff --git a/utils/docs/lib/file.wiki b/utils/docs/lib/file.wiki
deleted file mode 100755
index da344e8..0000000
--- a/utils/docs/lib/file.wiki
+++ /dev/null
@@ -1,325 +0,0 @@
-Proposal A, Draft 5 (in development)
-
-The "file" module supports the File System API, providing an interface for path, directory, file, link, file stat, and file stream manipulation.
-
-For the purpose of this documentation, "fs" is a variable name for any object that implements the File System API, including the exports of the "file" module, and objects returned by "fs.chroot(path)".
-
-
-=== Security ===
-
-Objects implementing the File System API, including the "file" module object, are capability bearing objects that carry and mediate authority to read and write to the underlying storage. As such, the "file" module can return other objects that implement and attenuate the File System API for sandboxing. Furthermore, streams returned by the file system object are implicitly attenuated to only give the receiver authority to manipulate the given file, without knowledge of the path on which it resides or access to references that would permit it to manipulate other parts of the file system.
-
-
-=== Interface ===
-
-The "file" module must export the following:
-
-==== Files ====
-
-; open(path String, mode|options)
-: returns a stream object that supports an appropriate interface for the given options and mode, which include reading, writing, updating, byte, character, unbuffered, buffered, and line buffered streams. More details follow in the [#Stream] section of this document.
-* path
-* mode: "rwa+bxc", or
-* options
-** mode String
-** charset String
-** read Boolean
-** write Boolean
-** append Boolean
-** update Boolean
-** binary Boolean
-** exclusive Boolean
-** canonical Boolean
-; read(path String, [mode|options])
-: opens, reads, and closes a file, returning its content.
-; write(path String, content String|Binary, [mode|options])
-: opens, writes, flushes, and closes a file with the given content. If the content is a ByteArray or ByteString, the binary mode is implied.
-; copy(source String, target String)
-: reads one file and writes another in byte mode.
-; move(from String, to String)
-:
-; remove(path String)
-:
-; rename(path String, name String)
-:
-; touch(path, [mtime Date])
-:
-
-==== Directories ====
-
-('''TODO''' Should the methods in this section use "mkdir" or "makeDir" style names? [http://groups.google.com/group/serverjs/browse_thread/thread/851fea66620bae13 discussion])
-
-; list(path String) Iterator
-: returns an iterator that yields the names of the entries in a directory. Throws an error if the directory is inaccessible or does not exist.
-; mkdir(path String)
-: Create a single directory specified by ''path''. If the directory cannot be created for any reason an exception will be thrown. This includes if the parent directories of "path" are not present.
-:
-; mktree(path String)
-: '''TODO''' Decide upon the name of this function. "mkdirs" or "mktree" or "makeTree"
-: Will create the directory specified by "path" including any missing parent directories.
-:
-; rmdir(path String)
-: Removes a directory if it is empty. If it is not, or cannot be removed for another reason an exception will be thrown.
-:
-; rmtree(path String)
-:
-: This does its best to remove the directory "path", akin to "rm -r" on Unix or "del /s" on Windows. That is it will recursively delete all directories and files under "path".
-
-==== Links ====
-
-==== Paths ====
-
-; [new] Path(path String|Path|Array, [fs FileSystem]) Path
-: returns a Path object that closes on a File System object and a "path" representation. The path object is a chainable shorthand for working with paths in the context of the "file" module. "Path" objects have no more or less authority to manipulate the file system than the FileSystem object that they are attached to, as any path string is reachable by chaining operations on a path instance. The FileSystem object defaults to the "file" module if the argument is omitted or undefined. More details follow in the [#Path Path] section of this document.
-; path(path String|Path, fs FileSystem) Path
-: "fs.path(path)" is a shorthand for "new fs.Path(path, fs)".
-
-===== Working Path =====
-
-The current working directory is used by all routines that resolve relative paths to absolute file system paths, including "open", and "absolute".
-
-; cwd() String
-: returns the current working directory.
-; chdir(path String)
-: changes the current working directory.
-
-===== Traditional =====
-
-; join(...)
-: takes a variadic list of path Strings, joins them on the file system's path separator, and normalizes the result.
-; split(path String) Array
-: returns an array of path components. If the path is absolute, the first component will be an indicator of the root of the file system; for file systems with drives (such as Windows), this is the drive identifier with a colon, like "c:"; on Unix, this is an empty string "". The intent is that calling "join.apply" with the result of "split" as arguments will reconstruct the path.
-; normal(path String)
-: removes '.' path components and simplifies '..' paths, if possible, for a given path.
-; absolute(path String)
-: returns the absolute path, starting with the root of this file system object, for the given path, resolved from the current working directory. If the file system supports home directory aliases, absolute resolves those from the root of the file system. The resulting path is in normal form. On most systems, this is equivalent to expanding any user directory alias, joining the path to the current working directory, and normalizing the result. "absolute" can be implemented in terms of "cwd", "join", and "normal".
-; canonical(path String)
-: returns the canonical path to a given abstract path. Canonical paths are both absolute and intrinsic, such that all paths that refer to a given file (whether it exists or not) have the same corresponding canonical path. This function must not communicate information about the true parent directories of files in chroot environments. This function is equivalent to expanding a user directory alias, joining the given path to the current working directory, joining all symbolic links along the path, and normalizing the result. "canonical" can be implemented in terms of "cwd", "join", "normal" and "readlink".
-; dirname(path String) String
-: returns the path of a file's containing directory, albeit the parent directory if the file is a directory. A terminal directory separator is ignored.
-; basename(path String, [extension String]) String
-: returns the part of the path that is after the last directory separator. If an extension is provided and is equal to the file's extension, the extension is removed from the result.
-; extension(path String) String
-: returns the extension of a file. The extension of a file is the last dot (excluding any number of initial dots) followed by one or more non-dot characters. Returns an empty string if no valid extension exists. [http://github.com/kriskowal/narwhal-test/blob/master/src/test/file/extension.js unit test].
-
-===== URL-like =====
-
-; resolve(...)
-: a function like "join" except that it treats each argument as as either an absolute or relative path and, as is the convention with URL's, treats everything up to the final directory separator as a location, and everything afterward as an entry in that directory, even if the entry refers to a directory in the underlying storage. Resolve starts at the location "" and walks to the locations referenced by each path, and returns the path of the last file. Thus, resolve(file, "") idempotently refers to the location containing a file or directory entry, and resolve(file, neighbor) always gives the path of a file in the same directory. "resolve" is useful for finding paths in the "neighborhood" of a given file, while gracefully accepting both absolute and relative paths at each stage. [http://github.com/kriskowal/narwhal-test/blob/master/src/test/file/resolve.js unit test].
-; relative(from, to)
-: returns the relative path from one path to another using only ".." to traverse up to the two paths' common ancestor.
-
-==== Tests ====
-
-; exists(path)
-:whether a file exists at a given path: receives a path and returns whether that path, joined on the current working directory, corresponds to a file that exists. If the file is a broken symbolic link, returns false.
-; isFile(path)
-:returns whether a path exists and that it corresponds to a file.
-; isDirectory(path)
-:returns whether a path exists and that it corresponds to a directory.
-; isLink(path)
-:returns whether a path exists and that it corresponds to a symbolic link (TODO or shortcut?).
-; isReadable(path)
-:returns whether a path exists, that it corresponds to a file, and that it can be opened for reading by "fs.open".
-; isWritable(path)
-:If a path exists, returns whether a file may be opened for writing, or entries added or removed from an existing directory. If the path does not exist, returns whether entries for files, directories, or links can be created at its location.
-
-==== Metadata ====
-
-; stat(path String)
-:Returns an object that contains the file's metadata, including all of the following that are applicable in the target platform's file system
-;; device Number
-:device number of the file system
-;; inode Number
-:virtual node number
-;; mode Number
-:type and permissions, numeric
-;; linkCount Number
-:number of hard links to the file
-;; uid Number
-:numeric id of the owner user
-;; rdev Number
-:the device identifier for special files
-;; size NUmber
-:total size in bytes
-;; blockSize Number
-:preferred block size for file system IO, in bytes
-;; blockCount Number
-:number of blocks allocated
-;; mtime Date
-:time of last modification (write)
-;; atime Date
-:time of last access (read, write, update)
-;; ctime Date
-:(TODO created vs. stat changed. is /.time/ really the best pattern for expressing these times?)
-;; xattrs
-:extended attributes (reserved)
-;; acls
-:access control lists (reserved)
-
-; size(path String)
-:Number
-; mtime(path String)
-:Date
-; atime(path String)
-:Date
-; ctime(path String)
-:Date
-; same(pathA String, pathB String) Boolean
-:whether the two files are identical, in that they come from the same file system, same device, and have the same node and corresponding storage, such that modifying one would implicitly and atomically modify the other.
-
-==== Security ====
-
-; chroot(path String)
-: returns an object that conforms to the File System API, like the "file" module or the "system.fs" variable, that can be safely passed into a sandbox as the "file" module and "system.fs" objects.
-
-
-== Path ==
-
-; [new] Path(path String|Path|Array, [fs FileSystem]) Path
-:
-
-The prototype for the Path constructor is a String object.
-
-The path constructor accepts as its first argument either a String, Path, or Array. If the path is an Array (as tested by Array.isArray, not merely typeof path == "array"), it must conform to the specification for values returned by "fs.split".
-
-Every path object has the members "normal", "absolute", "canonical", "dirname", "basename", "join", and "resolve". All of these return new Path objects constructed by converting the path to a string, passing it through the likewise named method of "fs", and converting it back to a Path. Thus, all of these methods are chainable. In addition, "join" and "resolve" are variadic, so additional paths can be passed as arguments in either String, Path, or Array form.
-
-Every path object has "chroot", "copy", "exists", "extension", "isDirectory", "isFile", "isLink", "isReadable", "isWritable", "mkdir", "mkdirs", "move", "mtime", "open", "read", "remove", "rename", "rmdir", "rmtree", "same", "size", "split", "stat", "touch", and "write". All of these functions convert themselves to strings and pass the results through the likewise named method of "fs".
-
-In addition, paths implement:
-
-; toString()
-:
-; to(path)
-: uses "fs.relative" to return a Path from this path to another one.
-; from(path)
-: uses "fs.relative" to return a Path to this path from another one.
-; list()
-: returns an iterator of Path objects for the contained directory entries.
-
-(TODO resolve whether it's more proper to make "Path" foundational and eliminate "fs". Wrapping the "Path" object around a central "fs" object will be necessary for "chroot" whether we expose that level of the API or not, and having routines that work with strings on one architectural layer and paths on the next up gives the programmer an oppoertunity to program at the level that makes sense for their task. It also, however, gives the programmer more to learn.)
-
-
-== Streams ==
-
-The "open" function mediates the construction of various kinds of streams. As "open" is the only method with the authority to manipulate files, it constructs these types on behalf of a potentially unpriviledged caller. Stream constructors are not directly callable in a secure sandbox, so where and how these stream types are implemented is beyond the necessary scope of this specification. The "open" function always creates a byte level stream, and by default wraps that in a textual IO wrapper.
-
-* create a "raw" byte stream. If "x" mode (with either "w" or "a" mode), only open if the file does not already exist. Create the file and open the stream atomically.
-** if "r" mode, make "raw" a ByteReader
-** if "w" mode, make "raw" a ByteWriter
-** if "u" mode, make "raw" a ByteUpdater
-* if "+", seek to end.
-* if not "b" mode, return "raw".
-* return a wrapper encoded/decoded string stream around "raw" with specified buffering, line buffering, and charset.
-** if "r" mode, wrap "raw" in a TextReader
-** if "w" mode, wrap "raw" in a TextWriter
-** if "u" mode, wrap "raw" in a TextUpdater
-
-; ByteReader
-: appropriate for reading binary opaque struct records or other binary data or protocols
-; ByteWriter
-: appropriate for writing binary opaque struct records or other binary data or protocols
-; ByteUpdater
-: appropriate for a database
-; ByteReaderWriter
-: appropriate for sockets
-; TextReader
-: appropriate for standard input
-; TextWriter
-: appropriate for standard output
-; TextUpdater
-:
-; TextReaderWriter
-: appropriate for a TTY
-
-(TODO: resolve whether it is necessary for all stream types to have a common prototype, or whether it makes sense for them to be arranged in a class hierarchy.)
-
-=== *Reader, *Updater ===
-
-TextReader, ByteReader, TextUpdater, ByteUpdater, TextReaderWriter, and ByteReaderWriter have the following properties and methods:
-
-; read() *String
-: reads and returns all of the file until EOF is encountered. Return ByteStrings for Byte* types, and Strings for Text* types.
-; read(max Number) *String
-:
-; readInto(buffer *Array, [begin Number], [end Number]) Number
-:
-; canRead() Boolean
-:
-; skip(n Number) Number
-:
-
-=== *Writer, *Updater ===
-
-TextWriter, ByteWriter, TextUpdater, ByteUpdater, TextReaderWriter, and ByteReaderWriter have the following properties and methods:
-
-; canWrite() Boolean
-:
-; flush()
-:
-
-=== ByteUpdater ===
-
-; tell() Number
-:
-; seek(position Number, whence Number)
-:
-; truncate([length Number=0])
-:
-; rewind()
-: a shortcut for seek(0)
-
-=== Text* ===
-
-TextReader, TextWriter, TextUpdater, and TextReaderWriter have the following properties and methods:
-
-; raw Byte*
-: the underlying byte stream, ByteReader for TextReaders, ByteWriter for TextWriters, and so on.
-
-=== TextReader ===
-
-; readLine() String
-: reads a line from the reader. If EOF is encountered before any data is gathered, returns "". Otherwise, returns the line including the "newLine".
-; readLines() Array*String
-: returns an Array of Strings accumulated by calling readLine until an empty string turns up. Does not include the final empty string, and does include "newLine" at the end of every line.
-; next() String or throws StopIteration
-: returns the next line of input without its "newLine". Throws StopIteration if EOF is encountered.
-; iterator() Iterator
-: returns the reader itself
-
-=== TextWriter ===
-
-; writeLine(line String)
-:
-; print(...)
-: writes a "delimiter" delimited array of Strings terminated with a "newLine"
-
-=== TextUpdater ===
-
-; tell() OpaqueCookie
-:
-; seek(position OpaqueCookie)
-:
-; truncate([position OpaqueCookie)
-:
-; rewind()
-: seeks to the beginning of the file.
-
-
-== Notes ==
-
-* Path separators, and other file-system-specific constants are not included in this specification.
-
-= Todo =
-
-* <s>random access IO</s>
-* locks
-* <s>canonical IO (non-blocking)</s>
-* comprehensive stat <s>access</s> and modification
-* temporary files and directories
-* symbolic links
-* more open options: permissions, owner, groupOwner
-* copy with metadata
-* glob
-* other [https://wiki.mozilla.org/ServerJS/API/file/Names proposed names].
diff --git a/utils/docs/lib/os/popen.md b/utils/docs/lib/os/popen.md
deleted file mode 100755
index 4bbc389..0000000
--- a/utils/docs/lib/os/popen.md
+++ /dev/null
@@ -1,70 +0,0 @@
-
-; popen(process):Popen
-: process may be a String or Array of args. If it is a String, popen uses "/bin/sh", "-e" to execute your program.
-
-Popen
------
-
-; stdin
-: a text writer IO object attached to the stdin of subprocess.
-; stdout
-: a text reader IO object attached to the stdout of the supbrocess.
-; stderr
-: a text reader IO object attached to the stderr of the subprocess.
-
-; wait() -> code:Number
-: blocks execution until the subprocess has exited.
-
-; communicate([stdin[, stdout[, stderr]]]):Communicate
-: communicates with the process on stdin, stdout, and stderr concurrently with the attached streams. the given stdin may be a stream, string, or stringio stream. stdout and stderr may be streams or stringio objects, and default to stringio. communicate returns the pipes used to communicate with stdin, stdout, and stderr, by default providing stdout and stderr as stringio objects that have accumulated the entire output and errput of the subprocess.
-
-Communicate
------------
-
-; stdin
-: the text reader object used to communicate with the subprocess. if no stdin was provided as an argument to communicate, stdin will be an empty stringio. if a string was provided, stdin will be a stringio with whatever input was not consumed by the subprocess. if any other stream was provided, stdin will be that stream.
-; stdout
-: the text writer object that the subprocess wrote to on stdout. if no stdout was provided as an argument to communicate, stdout will be a stringio containing all of the accumulated output of the subprocess.
-; stderr
-: the text writer object that the subprocess wrote to on stderr. if no stderr was provided as an argument to communicate, stderr will be a stringio containing all of the accumulated errput of the subprocess.
-; code
-: the exit code of the subprocess
-
-Examples
---------
-
-This is the implementation of "system" in the "os" module:
-
- exports.system = function (command, options) {
- var process = exports.popen(command, options);
- return process.communicate(
- '',
- system.stdout,
- system.stderr
- ).code;
- };
-
-This is the implementation of the "command" function in the "os" module. "command" executes a subprocess and returns all of the output of the subprocess as a String. If the exit status code of the subprocess is non-zero, it throws an error containing all of the accumulated errput of the subprocess.
-
- exports.command = function (command) {
- var process = exports.popen(command);
- var result = process.communicate();
- if (result.code !== 0)
- throw new Error(result.stderr.read());
- return result.stdout.read();
- };
-
-This function uses the "sort" command to sort a list of numbers.
-
- var io = require("io");
- var os = require("os");
-
- var list = io.StringIO();
- list.print("30");
- list.print("4");
- list.print("1000");
- list.print("200");
-
- var process = os.popen(["sort", "-n", "-"]);
- process.communicate(list).stdout.forEach(print);
-
diff --git a/utils/docs/modules.md b/utils/docs/modules.md
deleted file mode 100755
index 6fe786f..0000000
--- a/utils/docs/modules.md
+++ /dev/null
@@ -1,38 +0,0 @@
-
-Narwhal Modules
-===============
-
-Narwhal "scripts" are [ServerJS](https://wiki.mozilla.org/ServerJS) compatible modules, much like Python or Ruby modules. You do not have to use module pattern boilerplate; every module has its own local scope. You can get the exports object of another module by calling `require`.
-
- var file = require("file");
- file.isFile("foo.txt");
-
-Module identifiers for `require` come in three flavors: "top-level", "relative", and "absolute". In the above case, "file" is a "top-level" identifier, so it will load any module called "file.js" in the "lib" directory of whichever package comes first in the load path. Relative identifiers have "." or ".." as their first term, and terms are delimited with "/". So, in the "foo/bar" module, "require('./baz')" will load "foo/baz". Absolute module identifiers should not be used directly, but are produced when you execute a program module outside the module path. The module is identified by its fully-qualified path, starting with "/".
-
-You can export an object by assigning it to `exports`.
-
- exports.foo = function () {
- return "Hello";
- };
-
-In a module, you also get a `module` object that has `module.id` and `module.path` properties so you can inspect your own top-level module identifier, and the path of your own module file. You also get a `require.main` property that tells you the top-level module identifier of the module that started the program.
-
- if (require.id == require.main)
- main();
-
- var settings = require(require.main);
-
- var fs = require("file");
- var path = fs.path(module.path);
- var indexHtml = path.resolve("./template/index.html").read();
-
-Inside a module, you also get a `print` function and a `system` object. The `system` object is equivalent to the `system` module, but always available. It exports `stdin`, `stdout`, `stderr`, `args`, `platform`, `platforms`, `prefix`, and other handy routines.
-
-
-A Brief Tour
-============
-
-The main modules of the standard library are "system", "file", "io", and "os". There are also handy "json", "args", and "util" modules for a JSON codec, command line argument parsers, and utility functions.
-
-I have already introduced `system`. The "file" module implements functions like "open", "read", "write", "copy", "move", "list", and others. "os" exports commands like "system", "command", "exit", "popen", and "enquote" for shell args.
-
diff --git a/utils/docs/narwhal.md b/utils/docs/narwhal.md
deleted file mode 100755
index d2a3f05..0000000
--- a/utils/docs/narwhal.md
+++ /dev/null
@@ -1,478 +0,0 @@
-
-How Narwhal Works
-=================
-
-This document provides information on how to use `bin/narwhal`
-through its command line options, environment variables,
-and configuration files, then descends into the exact
-maddenning details of how it goes about bootstrapping
-and configuraing itself.
-
-
-Glossary
---------
-
-* module: a JavaScript file that gets its own local scope
- and certain free variables so that it may export and import
- APIs.
-
-* library: a directory that contains additional top-level
- modules.
-
-* package: a downloadable and installable component that
- may include a library of additional modules, as well
- as executables, source code, or other resources.
-
-* sandbox: a system of module instances. sandboxes
- are not necessarily secure in our parlance, but are
- the finest security boundary Narwhal can support.
- All modules in a sandbox are mutually vulnerable to
- each other and to their containing sandbox. By
- injecting frozen modules into a sandbox, or through
- dependency injection using the `system` variable,
- it will be eventually possible to construct secure
- sandboxes. In a secure sandbox, monkey patching
- globals will not be possible, and strict mode will
- be enforced. However, all secure sandboxes will
- be able to share the same primordial objects, particularly
- Array, so managed communication among sandboxes will
- be possible.
-
-* sea: a sea for Narwhal is like a virtual environment.
- for simplicity, the directory schema of a package, a sea,
- and Narwhal itself are all the same. They all
- have their own configuration and libraries, but Narwhal
- always starts searching for packages and modules
- in the current sea before searching for packages and
- modules in the main Narwhal installation, or system
- Narwhal installation.
-
-
-Command Line Options
---------------------
-
-* `-e -c --command COMMAND`
-
- evaluate command (final option)
-
-* `-r --require MODULE`
-
- pre-load a module
-
-* `-m --module MAIN`
-
- run a module as a script (final option)
-
-* `-I --include LIB`
-
- add a library path to loader in the position of
- highest precedence
-
-* `-p --package PACKAGEPREFIXES`
-
- add a package prefix directory
-
-* `-d --debug`
-
- set debug mode, system.debug = true
-
-* `-P --no-packages`
-
- do not load packages automatically
-
-* `-v --verbose`
-
- verbose mode: trace 'require' calls.
-
-* `-l --log LEVEL`
-
- set the log level (critical, error, warn, info, debug)
-
-* `-: --path DELIMITER`
-
- prints an augmented PATH with all package bins/
-
-* `-V --version`
-
- print Narwhal version number and exit.
-
-
-Environment Variables
----------------------
-
-* `NARWHAL_DEFAULT_PLATFORM` may be set in `narwhal.conf` to a
- platform name like `rhino`, `v8`, or `xulrunner`. Use
- `tusk platforms` for a complete list and consult the `README` in
- that platform directory for details about its function and
- readiness for use.
-
-* `NARWHAL_PLATFORM` may be set at the command line, but is
- otherwise set to `NARWHAL_DEFAULT_PLATFORM` by `bin/narwhal`
- and exposed in JavaScript as `system.platform`. This
- is the name of the JavaScript engine in use.
-
-* `NARWHAL_HOME` is the path to the `narwhal` directory and
- is available in JavaScript as `system.prefix`.
-
-* `NARWHAL_PLATFORM_HOME` is the path to the narwhal
- platform directory, where `bootstrap.js` may be found,
- and is set by `bin/narwhal`.
-
-* `NARWHAL_PATH` and `JS_PATH` can be used to add
- high priority library directories to the module
- search path. These values are accessible in most
- sandboxes as the `require.loader.paths` variable,
- and may be editable in place with methods like
- `shift`, `unshift`, and `splice`. Replacing
- `require.loader.paths` with a new Array may not
- have any effect. In secure sandboxes, `paths`
- are not available.
-
-* `NARWHAL_DEBUG` is an informational variable that
- can also be set with the `-d` and `--debug` command
- line options, and accessed or changed from within a
- JavaScript module as `system.debug`. `NARWHAL_DEBUG`
- gets coerced to a `Number`, and the options stack,
- so `js -ddd -e 'print(system.debug)'` will print 3.
-
-* `NARWHAL_VERBOSE` instructs the module loader
- to report when modules have started and finished
- loading. This environment variable must be used
- to catalog modules that are loaded in the
- bootstrapping process. Otherwise, you can use
- the `-v` and `--verbose` options for the same
- effect for modules that are loaded after the
- command line arguments have been parsed, which
- happens before packages are loaded.
-
-* `SEA` is an environment variable set by `sea` that
- notifies `narwhal` to search the given virtual
- environment for packages first. This function can
- be approximated by using the `-p` or `--package`
- options to the `narwhal` or `js` command, and is
- inspectable from within a module as the variable
- `system.packagePrefixes[0]`.
-
-* `SEALVL` (sea level) is an informational environment
- variable provided by the `sea` command, analogous to
- `SHLVL` (shell level) that is the number of instances
- of `sea` the present shell is running in.
-
-
-Configuration Files
--------------------
-
-* `narwhal.conf` may be provided to configure site-specific
- or virtual-environment (sea) specific environment
- variables like `NARWHAL_DEFAULT_PLATFORM`. You can
- also opt to specify `NARWHAL_PLATFORM`, but that obviates
- the possibility of allowing the user to override
- the narwhal platform at the command line. `narwhal.conf`
- follows the BSD convention of using shell scripts as
- configuration files, so you may use any `bash` syntax
- in this file. A `narwhal.conf.template` exists for
- illustration.
-
-* `package.json` describes the Narwhal package. Narwhal
- itself is laid out as a package, so it might be used
- as a standard library package for other engines that
- might host module systems independently. `package.json`
- names the package, its metadata, and its dependencies.
- `package.json` should not be edited.
-
-* `local.json` may be created to override the values
- provided in `package.json` for site-specific configurations.
- A `local.json.template` exists to illustrate how this
- might be used to tell Narwhal that the parent directory
- contains packages, as this is a common development
- scenario.
-
-* `sources.json` contains data for Tusk on where to
- find `package.json` files and `package.zip` archives
- so that it can create a catalog of all installable
- packages, their descriptions, and dependencies.
- This file should not be edited unless the intention
- is to update the defaults provided for everyone.
-
-* `.tusk/sources.json` may be created for site-specific
- package sources and overrides the normal `sources.json`.
-
-* `catalog.json` is meant to be maintained as a centrally
- managed catalog that may be downloaded from Github to
- `.tusk/catalog.json` using `tusk update`.
-
-* `.tusk/catalog.json` is where `tusk` looks for information
- about packages that can be downloaded and installed.
- It may be downloaded with `tusk update` or built from
- `sources.json` or `.tusk/sources.json` using
- `tusk create-catalog`.
-
-
-Bootstrapping Narwhal
----------------------
-
-Narwhal launches in stages. On UNIX-like systems, Narwhal starts with a `bash` script, a platform specific `bash` script, a platform specific JavaScript, then the common JavaScript.
-
-* `bin/narwhal`
-
- At this stage, Narwhal uses only environment variables
- for configuration. This script discovers its own
- location on the file system and sources `narwhal.conf`
- as a shell script to load any system-level configuration
- variables like `NARWHAL_DEFAULT_PLATFORM`. From there,
- it discerns and exports the `NARWHAL_PLATFORM` and
- `NARWHAL_PLATFORM_HOME` environment variables.
- It then executes the
- platform-specific script,
- `$NARWHAL_PLATFORM_HOME/bin/narwhal-$NARWHAL_PLATFORM`.
-
-* `platforms/{platform}/bin/narwhal-{platform}`
-
- This `bash` script performs some platform-specific
- configuration, like augmenting the Java `CLASSPATH`
- for the Rhino platform, and executes the
- platform-specific bootstrap JavaScript using the
- JavaScript engine for the platform.
-
- Some platforms, like `k7` require the JavaScript engine
- to be on the `PATH`. The Rhino platform just expects
- Java to be on the `PATH`, and uses the `js.jar` included
- in the repository.
-
-* `platforms/{platform}/bootstrap.js`
-
- This platform-specific JavaScript uses whatever
- minimal mechanisms the JavaScript engine provides
- for reading files and environment variables to
- read and evaluate `narwhal.js`. `narwhal.js` evaluates
- to a function expression that accepts a zygotic
- `system` `Object`, to be replaced later by loading
- the `system` module proper. `bootstrap.js` provides a
- `system` object with `global`, `evalGlobal`, `platform`,
- a `platforms` Array, `print`, `fs.read`, `fs.isFile`,
- `prefix`, `packagePrefixes`, and optionally `evaluate`,
- `debug`, or `verbose`.
-
- * `global` is the `global` `Object`. This is
- passed explicitly in anticipation of times
- when it will be much harder to grab this
- object in platforms where its name varies
- (like `window`, or `this`) and where it will
- be unsafe to assume that `this` defaults
- to `global` for functions called anonymously.
-
- * `evalGlobal` is a function that calls `eval` in
- a scope where no global variables are masked
- by local variables, but `var` declarations
- are localized. This is passed explicitly
- in anticipation of situations down the line where
- it will be harder to call `eval` in a pristine
- scope chain.
-
- * `platform` is a synonym for the `NARWHAL_PLATFORM`
- environment variable, the name of the platform.
- This variable is informational.
-
- * `prefix` is a synonym for the `NARWHAL_HOME`
- environment variable, the path leading to the
- `narwhal` package containing `bin/narwhal`.
-
- * `packagePrefixes` is a prioritized Array of all of
- the package directories to search for packages
- when that time comes. The first package prefix
- should be the `SEA` environment variable, if it
- exists and has a path. This is the first place
- that the `packages` module will look for
- packages to load. The last package prefix is
- simply the `prefix`, `NARWHAL_HOME`. The `SEA`
- prefix appears first so that virtual environments
- can load their own package versions.
-
- * `platforms` is an Array of platform names, used
- to extend the module search path at various stages
- to include platform specific libraries. There will
- usually be more than one platform in this Array.
- For Rhino, it is `['rhino', 'default']`. The
- `default` platform contains many "catch-all" modules
- that, while being platform-specific, are also
- general enough to be shared among almost all
- platforms. Other platforms are likely to share
- dynamically linked C modules in a "c" platform,
- and the "rhino" platform itself is useful for
- the "helma" platform.
-
- * `print` is a temporary shortcut for writing a line to
- a logging console or standard output, favoring
- the latter if it is available.
-
- * `fs` is a pimitive duck-type of the `file` module,
- which will be loaded later. The module loader
- uses `read` and `isFile` to load the initial modules.
-
- * `evaluate` is a module evaluator. If the platform
- does not provide an evaluator, the `sandbox` module
- has a suitable default, but some platforms provide
- their own. For example, the "secure" platform
- injects a safe, hermetic evaluator. `evaluate`
- accepts a module as a String, and optionally
- a file name and line number for debugging purposes.
- `evaluate` returns a module factory `Function`
- that accepts `require`, `exports`, `module`, `system`,
- and `print`, the module-specific free variables for
- getting the exported APIs of other modules, providing
- their own exports, reading their meta data, and
- conveniently accessing the `system` module and `print`
- function respectively.
-
- * `debug` is informational, may be used anywhere, and
- is read from the `NARWHAL_DEBUG` environment variable,
- and may be set later by the `-d` or `--debug` command
- options.
-
- * `verbose` instructs the module loader to log when
- module start and finish loading, and is read
- from the `NARWHAL_VERBOSE` environment variable,
- and may be set later by the `-v` or `--verbose` command
- options. To log the coming and going of modules
- as they occur **before** the packages and program
- modules get loaded, you must use the environment
- variable.
-
-* `narwhal.js`
-
- This is the common script that creates a module loader,
- makes the global scope consistent across platforms,
- finishes the `system` module, parses command line arguments,
- loads packages, executes the desired program, and
- finally calls the unload event for cleanup or running
- a daemon event loop.
-
-When Narwhal is embedded, the recommended practice is to load the `bootstrap.js` platform script directly, skipping the shell script phases.
-
-Some platforms, like Helma or GPSEE, may provide their own module loader implementation. In that case, they may bypass all of this bootstrapping business and simply include Narwhal as if it were a mere package.
-
-No system has been constructed for Windows systems yet.
-
-
-Narwhal Script
---------------
-
-The `narwhal.js` script is the next layer of blubber.
-
-* `sandbox` module (loaded manually from `lib/sandbox.js`),
- provides the means to construct a `require` function
- so all other modules can be loaded.
-* `global` module, monkey patches the transitive globals
- so that every platform receives the same ServerJS
- and EcmaScript 5 global object, or as near to that
- as possible.
-* `system` module, including the `file` and `logger`
- modules, which is provided for convenience as a free
- variable in all modules.
-* `narwhal` module parses arguments.
-* `packages` module loads packages.
- * `packages-platform` loads jars for Java/Rhino.
-* run command
-* `unload` module sends an `unload` signal to any
- observers, usually for cleanup or to kick off event loops.
-
-
-Sandbox Module
---------------
-
-The sandbox module provides a basic module `Loader` for
-module files on disk, a `MultiLoader` for plugable module
-factory loaders (for things like Objective-J modules and
-dynamically linked C modules), a `Sandbox` for creating and
-memoizing module instances from the module factories. The
-sandbox module is useful for creating new sandboxes from
-within the main sandbox, which is useful for creating cheap
-module system reloaders that will instantiate fresh modules but
-only go to disk when the underlying module text has changed.
-
-
-Global Module
--------------
-
-The global module is platform-specific, and there is sharable
-version in the default platform. The purpose of the global
-module is to load modules like "json", "string", "array", and
-"binary", that monkey patch the globals if necessary to
-bring every platform up to speed with EcmaScript 5 and
-the ServerJS standard.
-
-
-System Module
--------------
-
-The system module provides the ServerJS
-[System](https://wiki.mozilla.org/ServerJS/System) module
-standard, for standard IO streams, arguments, and environment
-variables. The system module goes beyond spec by being
-a free variable available in all modules, and by providing
-`print`, `fs`, and `log` variables (at the time of this
-writing). `print` is a late-bound alias for
-`system.stdout.print`, which is to say that replacing
-`system.stdout` will cause `print` to redirect to the new output
-stream. `fs` is an alias for the `file` module, while `log` is a `Logger` instance from the `logger` module that prints time-stamped log messages to `system.stderr`.
-
-
-Narwhal Module
---------------
-
-The Narwhal module contains the command line parser declarations
-for Narwhal, and an Easter egg.
-
-
-Packages Module
----------------
-
-The packages module analyzes and installs packages, such that their libraries are available in the module search path, and also installs some platform-specific package components like Java archives at run-time. The package loader uses a five pass algorithm:
-
-* find and read package.json for every accessible package,
- collating them into a catalog. This involves a breadth
- first topological search of the `packages/` directory of each
- `package` in the `system.packagePrefixes` Array. This
- guarantees that the packages installed in the Sea
- (virtual environment) can override the versions installed
- with the system.
-* verify that the catalog is internally consistent, dropping
- any package that depends on another package that is
- not installed.
-* sort the libraries from packages so that libraries
- that "depend" on other packages get higher precedence
- in the module search path.
-* "analyze" the packages in order. This involves finding
- the library directories in each package, including
- platform-specific libraries for all of the
- `system.platforms`, and performing platform-specific
- analysis like finding the Java archives (`jars`) installed
- in each package.
-* "synthesize" a configuration from the analysis. This
- involves setting the module search path, and performing
- platform-specific synthesis, like installing a Java
- class loader for the Java archives, and creating a new,
- global `Packages` object.
-
-Much of the weight of code in the `packages` module concerns
-using both the conventional locations for libraries and whatnot,
-but also handling overriden configuration values, gracefully
-accepting both single Strings and Arrays of multiple options
-for all directories. For example, `packages` assumes that
-each package has a `lib` directory. However, the package may
-provide a `package.json` that states that `lib` has been put
-somewhere else, like `{"lib": "lib/js"}`, or even multiple
-locations like `{"lib": ["lib/js", "usr/lib/js"]}`. This
-applies to "packages" and "jars" as well.
-
-
-Unload Module
--------------
-
-When the program is finished, Narwhal checks whether the
-"unload" module has been used. If so, it calls the "send"
-function exported by that module, so that any observers attached
-with the "when" method get called in first on first off order.
-This is handy for modules like "reactor" that initiate an event
-loop.
-
diff --git a/utils/docs/packages-howto.md b/utils/docs/packages-howto.md
deleted file mode 100755
index 2429018..0000000
--- a/utils/docs/packages-howto.md
+++ /dev/null
@@ -1,31 +0,0 @@
-
-How to make Packages
-====================
-
-A package consists of a directory of modules conforming to the ServerJS [Securable Modules](https://wiki.mozilla.org/ServerJS/Modules/SecurableModules) specification, and a "package.json" file in the root of the package containing the location of the modules, depedencies, and other metadata.
-
-A package directory might have the following files and directories:
-
-* "package.json" for package metadata like dependencies and overrides for the conventional directory names.
-* "local.json" for overrides on "package.json" provided by the user.
-* "bin" for executables.
-* "lib" for all object code, including JavaScript modules, and C extensions.
-* "src" for all buildable source code, including C and Java source code.
-* "jars" for Java class trees and archives.
-* "packages/{name}" for installed sub-packages.
-* "platforms/{platform}" for platform-specific packages.
-* "parent" for an inherited package tree, like the "narwhal" package installed by the system administrator or OS package management system.
-
-"package.json" and "local.json" may contain the following attributes:
-
-* "name" - the name of the package. The package system will only load one package with a given name. The name defaults to the name of the parent directory.
-* "lib" - a path or array of paths to top-level module directories provided in this package. Defaults to ["lib"].
-* "jars" - for Rhino platforms, a path or array of paths to directories to add to the Java CLASSPATH (uses a Java URLClassLoader, so accepts ".jar" paths and directory paths ending with "/").
-* "packages" - a path or array of paths to directories containing additional packages, defaults to ["packages"].
-* "platforms" - a path or array of paths to directories containing platform-specific packages, defaults to ["platforms"]. These platform packages will be loaded if and in the prioritized order they appear in the "system.platforms" array, and with higher priority that those in this package's generic "js" path so that they can override platform-specific modules.
-* "main" - a path to a main program if the package is run with "bin/narwhal" and its directory instead of a specific script.
-* "author" - may be a comment on the package's author and email in angle brackets.
-* "contributors" - may be an array of additional author names and email addresses in angle brackets.
-* "parent" - a path to a package tree to inherit, like the "narwhal" package installed by the system administorator. Defaults to "parent" if a symlink exists by that name.
-
-
diff --git a/utils/docs/packages.md b/utils/docs/packages.md
deleted file mode 100755
index 8b1e60c..0000000
--- a/utils/docs/packages.md
+++ /dev/null
@@ -1,30 +0,0 @@
-
-Available Packages
-==================
-
-You can download and install packages using the `tusk` application that comes with Narwhal. Check out `tusk help` for details. These are some of the packages:
-
-* `jack`: the webserver and web application/framework agnostic interface, similar to Ruby's Rack and Python's WSGI. Narwhal was conceived while building Jack, and was later extracted into it's own project.
-
-[http://github.com/tlrobinson/jack](http://github.com/tlrobinson/jack)
-
-* `chiron`: a system of interoperable JavaScript modules, including a type system, base types, general-purpose functions, events, encoding, decoding, hashing, and caching.
-
-[http://github.com/kriskowal/chiron](http://github.com/kriskowal/chiron)
-
-* `nitro`: a web application framework built on top of Jack.
-
-[http://github.com/gmosx/nitro](http://github.com/gmosx/nitro)
-
-And others including:
-
-* Narcissus
-* Wiki Creole
-* Browser
-* Inspec
-* Kupo
-* Bespin Server Prototype
-* Bespin PubSub
-* Nitro Templates
-* Google App Engine Utilities
-
diff --git a/utils/docs/platforms.md b/utils/docs/platforms.md
deleted file mode 100755
index 5e25b26..0000000
--- a/utils/docs/platforms.md
+++ /dev/null
@@ -1,32 +0,0 @@
-
-Platforms
-=========
-
-Narwhal is a standard library and tools for multiple JavaScript engines; each engine has its own "platform" library. Use `tusk platform {name}` to select an engine, or edit `narwhal.conf`. The following engines are presently in development:
-
-* `rhino`: is the default and most complete platform, based on Mozilla Rhino for Java, used for out-of-the-box functionality.
-* `k7`: is a `v8` based engine, in development by Sébastien Pierre.
-* `helma`: is based on Rhino with extensions, being developed by Hannes Wallnöefer.
-* `xulrunner`: is in development for Firefox extensions and XULRunner applications on the Spidermonkey platform by Irakli Gozalishvili, Christoph Dorn, and Zach Carter.
-* `jaxer`: is an engine based on Mozilla SpiderMonkey, for deploying web pages with both server and client side scripts, being developed by Nathan L Smith.
-* `v8cgi`: is based on the work of Ondrej Zara, and has not been updated in a long while.
-* `default`: is a catchall platform that implements modules that can be shared among platforms.
-* `browser`: will eventually be available for client side loading of modules with various techniques.
-* `secure`: will eventually be available for dependency injection sandboxed module systems within some other platforms.
-
-
-Creating new Platform Adapters
-------------------------------
-
-We have a template for new platforms at "platforms/template" that you can copy to "platforms/{name}" and fill in the blanks. These consist of:
-
-1. An executable (shell script or binary) at "platforms/{name}/bin/platform-{name}" that executes the interpreter engine of choice and causes it to load a bootstrap script. This script will be loaded by "bin/narwhal" with the environment variable `NARWHAL_HOME` set to the Narwhal project directory and `NARWHAL_PLATFORM_HOME` set to the platform directory. This script will be run if `NARWHAL_PLATFORM` is set to your platform name. You can set `NARWHAL_DEFAULT_PLATFORM` or `NARWHAL_PLATFORM` in a "narwhal.conf" in your Narwhal project directory (template provided).
-
-2. A "thunk", at `platforms/{name}/bootstrap.js` that evaluates `narwhal.js` and passes the returned function a preliminary `system` object with a few required properties (`global`, `evalGlobal`, `platform`, `platforms`, `print`, `evaluate`, `prefix`, `fs.read`, and `fs.isFile`). This should be enough to get to an interactive console.
-
-3. Platform implementations for core modules, such as `file` and `system` located in `platforms/{name}/lib/`. You can implement `file-platform` instead of `file` if you implement the subset of the ServerJS file API used by `lib/file.js` (and similar for `io`, `os`, `binary`, etc). The next steps are:
-
- * system: You must implement `system.args` to be able to pass command line options to Narwhal.
-
- * file: To enable the package system you must implement `list`, `canonical`, `mtime`, `isDirectory`, `isFile`.
-
diff --git a/utils/docs/posts/2009-07-29-hello-0.1.md b/utils/docs/posts/2009-07-29-hello-0.1.md
deleted file mode 100755
index b48c320..0000000
--- a/utils/docs/posts/2009-07-29-hello-0.1.md
+++ /dev/null
@@ -1,19 +0,0 @@
-Hello 0.1
-=========
-
-Today we're announcing [Narwhal](http://narwhaljs.org/) 0.1 and [Jack](http://jackjs.org/) 0.1.
-
-### Download
-
-* Narwhal 0.1: [tar](http://github.com/tlrobinson/narwhal/tarball/0.1), [zip](http://github.com/tlrobinson/narwhal/zipball/0.1)
-* Jack 0.1: [tar](http://github.com/tlrobinson/jack/tarball/0.1), [zip](http://github.com/tlrobinson/jack/zipball/0.1)
-
-Check out the [quick start guide](http://narwhaljs.org/quick-start.html) for instructions on getting up and running with Narwhal and Jack.
-
-### Release Notes
-
-* Complete [securable modules](https://wiki.mozilla.org/ServerJS/Modules/SecurableModules) implementation, in JavaScript, with hooks for native module loading.
-* Various modules, including `file`, `binary`, `os`, `system`, `args`, and many others.
-* The "tusk" package manager, currently using [Github](http://github.com/) as a package repository.
-* Full support for the Rhino interpreter, and partial support for numerous other [platforms](http://narwhaljs.org/platforms.html).
-* Preliminary support for Windows.
diff --git a/utils/docs/quick-start.md b/utils/docs/quick-start.md
deleted file mode 100755
index 3522a11..0000000
--- a/utils/docs/quick-start.md
+++ /dev/null
@@ -1,55 +0,0 @@
-
-Narwhal Quick Start
-===================
-
-Download Narwhal.
-
-* download and extract the [zip](http://github.com/tlrobinson/narwhal/zipball/master) or [tar](http://github.com/tlrobinson/narwhal/tarball/master) archive, or
-* `git clone git://github.com/tlrobinson/narwhal.git`
-
-Put Narwhal on your PATH environment variable.
-
-* `export PATH=$PATH:~/narwhal/bin`, or
-* execute `narwhal/bin/sea` for a quick Narwhal subshell
-
-Run `narwhal` or `js` (they're equivalent).
-
-* `js narwhal/examples/hello`
-
-Look at the options.
-
-* `narwhal --help`
-* `tusk help`
-
-
-My First Web Server
-===================
-
-Create a project "hello-web".
-
- tusk init hello-web
- cd hello-web
-
-Enter your project as a "virtual environment" using `sea` so that its libraries, binaries, and packages get automatically installed when you run Narwhal.
-
- bin/sea
-
-Install some packages you will need, like Jack, the JSGI standard library for interoperable web services.
-
- tusk install jack
-
-Tusk gets downloaded and installed at "hello-web/packages/jack".
-
-Create your "jackconfig.js". This is a trivial JSGI compatible application, wrapped in the `ContentLength` middleware to automatically set the "Content-Length" header.
-
- var jack = require("jack");
-
- exports.app = jack.ContentLength(function (env) {
- return [200, {"Content-type": "text/plain"}, ["Hello, Web!"]];
- });
-
-Run it!
-
- jackup
-
-Next, take a look at the introduction to [modules](modules.html), for a primer on using and making modules in Narwhal.
diff --git a/utils/docs/sea.md b/utils/docs/sea.md
deleted file mode 100755
index 06f2d45..0000000
--- a/utils/docs/sea.md
+++ /dev/null
@@ -1,49 +0,0 @@
-
-Narwhal, Tusk, and Sea
-======================
-
-Narwhal is your JavaScript interpreter. It is executable with "narwhal" or "js". See "narwhal --help" for a list of its options. It is comparable to your shell, Python or Ruby/IRB.
-
-Tusk is your package manager. Tusk by default installs packages whereever "narwhal" is installed. See "tusk help" for a list of options. It is comparable to "apt" or "gem". You can also use "tusk" to create new "packages", application project scaffolds, or "virtual environments", which are all the same thing.
-
-"sea" is a tool for entering a Narwhal "virtual environment". It executes a command or reexecutes your shell inside a "virtual environment". There is a version of "sea" that comes packed with "Narwhal", which you can use to "enter" your system "narwhal" environment, which is handy if "narwhal/bin" is not on your path. You can also source "activate.sh" if your current working directory is the package root you want to use for your Sea.
-
-You can use "narwhal", "tusk", and "sea" to create multiple, independent, reproducable Narwhal project installations. Assuming that "narwhal" and "tusk" are on your path, you can use "tusk init" to create two application projects.
-
- $ tusk init foo
- $ tusk init bar
- $ cd foo
- foo$ bin/sea
- PATH=foo/bin
- SEALVL=1
- foo$ tusk install jack
- foo$ edit jackconfig.js
- foo$ jackup
- Loading configuration module at foo/jackconfig
- Jack is starting up using Simple on port 8080
- ^C
- foo$ echo $SEA
- foo
- foo$ which sea
- foo/bin/sea
- foo$ exit
- SEALVL=0
- foo$ cd ../bar
- bar$ bin/sea
- PATH=bar/bin
- SEALVL=1
- ...
-
-When you are in a Sea, Narwhal loads all of the packages installed in that Sea and Tusk installs packages in your Sea. While you can manipulate the NARWHAL_PATH and JS_PATH environment variables manually, Seas obviate the need.
-
-Each sea can also have a different JavaScript engine. Edit narwhal.conf in your Sea to use a different engine.
-
- $ js -e 'print(system.platform)'
- rhino
- $ cat bar/narwhal.conf
- NARWHAL_DEFAULT_PLATFORM=v8
- $ bar/bin/sea 'js -e "print(system.platform)"'
- v8
- PATH=/bin
- SEALVL=0
-
diff --git a/utils/examples/hello b/utils/examples/hello
deleted file mode 100755
index 49beb13..0000000
--- a/utils/examples/hello
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/usr/bin/env narwhal
-print("Hello, World!");
diff --git a/utils/examples/narwhal b/utils/examples/narwhal
deleted file mode 100755
index 9dfc302..0000000
--- a/utils/examples/narwhal
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env narwhal
-var narwhal = require('narwhal');
-print(narwhal.LEFT);
diff --git a/utils/examples/not-quite-a-quine.js b/utils/examples/not-quite-a-quine.js
deleted file mode 100755
index 3d68c7b..0000000
--- a/utils/examples/not-quite-a-quine.js
+++ /dev/null
@@ -1 +0,0 @@
-system.stdout.write(system.fs.read(module.path)).flush();
diff --git a/utils/getopt.js b/utils/getopt.js
deleted file mode 100755
index 6dd6513..0000000
--- a/utils/getopt.js
+++ /dev/null
@@ -1,273 +0,0 @@
-
-var GetOpt = function() {
- this.options = {};
- this.add("", null, [], false, false, GetOpt.REQUIRED_ARGUMENT); /* main arguments */
-};
-
-/** @constant */ GetOpt.NO_ARGUMENT = 1;
-/** @constant */ GetOpt.REQUIRED_ARGUMENT = 2;
-/** @constant */ GetOpt.OPTIONAL_ARGUMENT = 3;
-
-/**
- * Adds an option
- * @param {string} id Identifier
- * @param {string} description Textual description
- * @param {?} value Default value
- * @param {character} shortOpt Short option character
- * @param {string} longOpt Long option string
- * @param {number} argument Argument type constant
- */
-GetOpt.prototype.add = function(id, description, value, shortOpt, longOpt, argument) {
- this.options[id] = {
- description:description,
- value:value,
- longOpt:longOpt,
- shortOpt:shortOpt,
- argument:argument || GetOpt.NO_ARGUMENT
- };
-}
-
-/**
- * Retrieve option value
- * @param {string} id Identifier
- */
-GetOpt.prototype.get = function(id) {
- var str = id || "";
- if (str in this.options) {
- return this.options[str].value;
- } else {
- throw new Error("Unknown option '"+id+"'");
- }
-}
-
-/**
- * Parses list of options
- * @param {array} array Command-line arguments
- */
-GetOpt.prototype.parse = function(array) {
- this._pending = false;
- for (var i=0;i<array.length;i++) {
- var str = array[i];
- if (str == "--") { /* separator */
- this._finishPending();
- this._parseRemainder(array, i+1);
- break;
- } else if (this._isOption(str)) { /* option string */
- this._finishPending();
- this._parseOption(str);
- } else { /* value */
- if (this._pending) { /* we have pending */
- var item = this.options[this._pending];
- if (item.argument == GetOpt.OPTIONAL_ARGUMENT && this._onlyValues(array, i+1)) { /* there are only value remaining - this is not a pending optional value */
- this._finishPending();
- this._addValue("", str);
- } else { /* safe to finish pending with this value */
- this._addValue(this._pending, str);
- }
- this._pending = false;
- } else { /* add as normal argument */
- this._addValue("", str);
- }
- }
- }
- this._finishPending();
- this._parseRemainder(array, array.length);
-}
-
-/**
- * Formats a help
- * @returns {string}
- */
-GetOpt.prototype.help = function() {
- var names = [];
- var values = [];
-
- for (var id in this.options) {
- if (!id) { continue; } /* do not mention main arguments */
- var item = this.options[id];
- names.push(this._helpName(item));
- values.push(item.description);
- }
-
- var indent = 0;
- for (var i=0;i<names.length;i++) {
- if (names[i].length > indent) { indent = names[i].length; }
- }
- indent++;
-
- var str = "";
- for (var i=0;i<names.length;i++) {
- str += names[i];
- for (var j=names[i].length;j<indent;j++) { str += " "; }
- str += values[i] + "\n";
- }
- return str;
-}
-
-/**
- * Are there only values remaining?
- * @param {int} index First string index to test
- * @returns {bool}
- */
-GetOpt.prototype._onlyValues = function(array, index) {
- for (var i=index; i<array.length; i++) {
- var item = array[i];
- if (this._isOption(item)) { return false; }
- }
- return true;
-}
-
-/**
- * Parse remaining values after '--'
- */
-GetOpt.prototype._parseRemainder = function(array, index) {
- for (var i=index; i<array.length;i++) { this._addValue("", array[i]); } /* consume all normal values */
-}
-
-/**
- * If there is a pending value, either finish it as empty (optional), or throw an error (required)
- */
-GetOpt.prototype._finishPending = function() {
- if (!this._pending) { return; }
- var item = this.options[this._pending];
- if (item.argument == GetOpt.REQUIRED_ARGUMENT) { /* unsatisfied mandatory */
- throw new Error("Missing value for '"+this._pendingString+"'");
- } else { /* unsatisfied optional */
- this._addValue(this._pending, null);
- }
-}
-
-/**
- * Parse an option string
- * @returns {id || false}
- */
-GetOpt.prototype._parseOption = function(str) {
- if (str.charAt(1) == "-") {
- this._parseOptionLong(str);
- } else {
- this._parseOptionShort(str);
- }
-}
-
-GetOpt.prototype._parseOptionLong = function(str) {
- var re = str.match(/^--([a-zA-Z0-9]+)(=(.*))?$/);
- if (!re) { throw new Error("Cannot parse option '"+str+"'"); }
-
- var id = this._findOptionLong(re[1]);
- if (!id) { throw new Error("Unknown option '--"+re[1]+"'"); }
-
- var item = this.options[id];
- if (re[2]) { /* with a value */
- var value = re[3];
- this._addValue(id, value);
- } else { /* without a value */
- if (item.argument == GetOpt.NO_ARGUMENT) {
- this._addValue(id);
- } else {
- this._pending = id;
- this._pendingString = "--"+re[1];
- }
- }
-}
-
-GetOpt.prototype._parseOptionShort = function(str) {
- var re = str.match(/^-([a-zA-Z0-9]+)(=(.*))?$/);
- if (!re) { throw new Error("Cannot parse option '"+str+"'"); }
-
- var list = re[1];
- for (var i=0;i<list.length;i++) {
- var character = list[i];
- var id = this._findOptionShort(character);
- if (!id) { throw new Error("Unknown option '-"+character+"'"); }
-
- var item = this.options[id];
- if (item.argument == GetOpt.NO_ARGUMENT) { /* no argument */
- this._addValue(id);
- } else if (i+1 == list.length) { /* last character */
- if (re[2]) {
- this._addValue(id, re[3]);
- } else {
- this._pending = id;
- this._pendingString = "-"+character;
- }
- } else { /* middle character, argument optional/mandatory */
- if (item.argument == GetOpt.REQUIRED_ARGUMENT) { /* mandatory -> error */
- throw new Error("Missing value for '-"+character+"'");
- } else { /* unsatisfied optional */
- this._addValue(id, null);
- }
- }
- }
-}
-
-GetOpt.prototype._isOption = function(str) {
- return (str.length > 1 && str.charAt(0) == "-");
-}
-
-GetOpt.prototype._findOptionShort = function(str) {
- for (var id in this.options) {
- if (this.options[id].shortOpt == str) { return id; }
- }
- return false;
-}
-
-GetOpt.prototype._findOptionLong = function(str) {
- for (var id in this.options) {
- if (this.options[id].longOpt == str) { return id; }
- }
- return false;
-}
-
-/**
- * Set/add a value to option
- */
-GetOpt.prototype._addValue = function(id, value) {
- var item = this.options[id];
- if (item.argument == GetOpt.NO_ARGUMENT) { /* no argument -> switch to true */
- item.value = true;
- return;
- }
-
- if (item.value instanceof Array) { /* _add_ a new value */
- var val = value;
- if (value === null) { val = true; }
- item.value.push(val);
- } else { /* _set_ a new value */
- if (item.argument == GetOpt.OPTIONAL_ARGUMENT) { /* optional */
- if (typeof(item.value) == "number" && value === null) { /* numeric - increment */
- item.value++;
- } else if (typeof(item.value) == "number") { /* numeric value */
- item.value = parseFloat(value);
- } else { /* other or null value */
- item.value = (value === null ? true : value);
- }
- } else { /* required */
- item.value = value;
- }
- }
-}
-
-GetOpt.prototype._helpName = function(item) {
- var str = "";
- if (item.shortOpt) {
- str += "-"+item.shortOpt;
- if (item.argument != GetOpt.NO_ARGUMENT) { str += " "; }
- if (item.argument == GetOpt.OPTIONAL_ARGUMENT) { str += "["; }
- if (item.argument != GetOpt.NO_ARGUMENT) { str += "value"; }
- if (item.argument == GetOpt.OPTIONAL_ARGUMENT) { str += "]"; }
- }
-
- if (item.shortOpt && item.longOpt) { str += ", "; }
-
- if (item.longOpt) {
- str += "--"+item.longOpt;
- if (item.argument == GetOpt.OPTIONAL_ARGUMENT) { str += "["; }
- if (item.argument != GetOpt.NO_ARGUMENT) { str += "="; }
- if (item.argument != GetOpt.NO_ARGUMENT) { str += "value"; }
- if (item.argument == GetOpt.OPTIONAL_ARGUMENT) { str += "]"; }
- }
-
- return str;
-}
-
-exports.GetOpt = GetOpt;
diff --git a/utils/i18n/#test.pot# b/utils/i18n/#test.pot#
deleted file mode 100755
index a0a6c66..0000000
--- a/utils/i18n/#test.pot#
+++ /dev/null
@@ -1,41 +0,0 @@
-# SOME DESCRIPTIVE TITLE.
-# Copyright (C) YEAR Free Software Foundation, Inc.
-# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
-#
-#, fuzzy
-msgid ""
-msgstr ""
-"Project-Id-Version: PACKAGE VERSION\n"
-"PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n"
-"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
-"Language-Team: LANGUAGE <LL@li.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=CHARSET\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-Project-Id-Version: PACKAGE VERSION
-Report-Msgid-Bugs-To: bryan@olenepal.org
-POT-Creation-Date:
-PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE
-Last-Translator: FULL NAME <EMAIL@ADDRESS>
-Language-Team: LANGUAGE <LL@li.org>
-MIME-Version: 1.0
-Content-Type: text/plain; charset=CHARSET
-Content-Transfer-Encoding: 8bit
-
-msgctxt "HTML Tag: LABEL ID: lblScore"
-msgid "The score is"
-
-msgctxt "HTML Tag: LABEL ID: txtScore"
-msgid "0"
-
-msgctxt "HTML Tag: BUTTON ID: btnYes"
-msgid "Yes"
-
-msgctxt "HTML Tag: BUTTON ID: btnNo"
-msgid "No!"
-
-msgctxt "HTML Tag: BUTTON ID: btnRestart"
-msgid "Restart"
-
-msgctxt "HTML Tag: META ID: "msgid "karma,javascript,html5,sugar,sugarlabs,gsoc,ole,nepal"
diff --git a/utils/i18n/jquery.js b/utils/i18n/jquery.js
deleted file mode 100755
index b1ae21d..0000000
--- a/utils/i18n/jquery.js
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * jQuery JavaScript Library v1.3.2
- * http://jquery.com/
- *
- * Copyright (c) 2009 John Resig
- * Dual licensed under the MIT and GPL licenses.
- * http://docs.jquery.com/License
- *
- * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
- * Revision: 6246
- */
-(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),this.length>1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H<I;H++){if((G=arguments[H])!=null){for(var F in G){var K=J[F],L=G[F];if(J===L){continue}if(E&&L&&typeof L==="object"&&!L.nodeType){J[F]=o.extend(E,K||(L.length!=null?[]:{}),L)}else{if(L!==g){J[F]=L}}}}}return J};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,q=document.defaultView||{},s=Object.prototype.toString;o.extend({noConflict:function(E){l.$=p;if(E){l.jQuery=y}return o},isFunction:function(E){return s.call(E)==="[object Function]"},isArray:function(E){return s.call(E)==="[object Array]"},isXMLDoc:function(E){return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)},globalEval:function(G){if(G&&/\S/.test(G)){var F=document.getElementsByTagName("head")[0]||document.documentElement,E=document.createElement("script");E.type="text/javascript";if(o.support.scriptEval){E.appendChild(document.createTextNode(G))}else{E.text=G}F.insertBefore(E,F.firstChild);F.removeChild(E)}},nodeName:function(F,E){return F.nodeName&&F.nodeName.toUpperCase()==E.toUpperCase()},each:function(G,K,F){var E,H=0,I=G.length;if(F){if(I===g){for(E in G){if(K.apply(G[E],F)===false){break}}}else{for(;H<I;){if(K.apply(G[H++],F)===false){break}}}}else{if(I===g){for(E in G){if(K.call(G[E],E,G[E])===false){break}}}else{for(var J=G[0];H<I&&K.call(J,H,J)!==false;J=G[++H]){}}}return G},prop:function(H,I,G,F,E){if(o.isFunction(I)){I=I.call(H,F)}return typeof I==="number"&&G=="curCSS"&&!b.test(E)?I+"px":I},className:{add:function(E,F){o.each((F||"").split(/\s+/),function(G,H){if(E.nodeType==1&&!o.className.has(E.className,H)){E.className+=(E.className?" ":"")+H}})},remove:function(E,F){if(E.nodeType==1){E.className=F!==g?o.grep(E.className.split(/\s+/),function(G){return !o.className.has(F,G)}).join(" "):""}},has:function(F,E){return F&&o.inArray(E,(F.className||F).toString().split(/\s+/))>-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+"></"+T+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!O.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!O.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!O.indexOf("<td")||!O.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!O.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!o.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/<tbody/i.test(S),N=!O.indexOf("<table")&&!R?L.firstChild&&L.firstChild.childNodes:Q[1]=="<table>"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E<F;E++){if(H[E]===G){return E}}return -1},merge:function(H,E){var F=0,G,I=H.length;if(!o.support.getAll){while((G=E[F++])!=null){if(G.nodeType!=8){H[I++]=G}}}else{while((G=E[F++])!=null){H[I++]=G}}return H},unique:function(K){var F=[],E={};try{for(var G=0,H=K.length;G<H;G++){var J=o.data(K[G]);if(!E[J]){E[J]=true;F.push(K[G])}}}catch(I){F=K}return F},grep:function(F,J,E){var G=[];for(var H=0,I=F.length;H<I;H++){if(!E!=!J(F[H],H)){G.push(F[H])}}return G},map:function(E,J){var F=[];for(var G=0,H=E.length;G<H;G++){var I=J(E[G],G);if(I!=null){F[F.length]=I}}return F.concat.apply([],F)}});var C=navigator.userAgent.toLowerCase();o.browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};o.each({parent:function(E){return E.parentNode},parents:function(E){return o.dir(E,"parentNode")},next:function(E){return o.nth(E,2,"nextSibling")},prev:function(E){return o.nth(E,2,"previousSibling")},nextAll:function(E){return o.dir(E,"nextSibling")},prevAll:function(E){return o.dir(E,"previousSibling")},siblings:function(E){return o.sibling(E.parentNode.firstChild,E)},children:function(E){return o.sibling(E.firstChild)},contents:function(E){return o.nodeName(E,"iframe")?E.contentDocument||E.contentWindow.document:o.makeArray(E.childNodes)}},function(E,F){o.fn[E]=function(G){var H=o.map(this,F);if(G&&typeof G=="string"){H=o.multiFilter(G,H)}return this.pushStack(o.unique(H),E,G)}});o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(E,F){o.fn[E]=function(G){var J=[],L=o(G);for(var K=0,H=L.length;K<H;K++){var I=(K>0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}});
-/*
- * Sizzle CSS Selector Engine - v0.9.3
- * Copyright 2009, The Dojo Foundation
- * Released under the MIT, BSD, and GPL Licenses.
- * More information: http://sizzlejs.com/
- */
-(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!=="undefined"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute("name")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=" "+W[1].replace(/\\/g,"")+" ";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(" "+Y.className+" ").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return U<T[3]-0},gt:function(V,U,T){return U>T[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W<T;W++){if(Y[W]===Z){return false}}return true}}}},CHILD:function(T,W){var Z=W[1],U=T;switch(Z){case"only":case"first":while(U=U.previousSibling){if(U.nodeType===1){return false}}if(Z=="first"){return true}U=T;case"last":while(U=U.nextSibling){if(U.nodeType===1){return false}}return true;case"nth":var V=W[2],ac=W[3];if(V==1&&ac==0){return true}var Y=W[0],ab=T.parentNode;if(ab&&(ab.sizcache!==Y||!T.nodeIndex)){var X=0;for(U=ab.firstChild;U;U=U.nextSibling){if(U.nodeType===1){U.nodeIndex=++X}}ab.sizcache=Y}var aa=T.nodeIndex-ac;if(V==0){return aa==0}else{return(aa%V==0&&aa/V>=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V<T;V++){U.push(X[V])}}else{for(var V=0;X[V];V++){U.push(X[V])}}}return U}}var G;if(document.documentElement.compareDocumentPosition){G=function(U,T){var V=U.compareDocumentPosition(T)&4?-1:U===T?0:1;if(V===0){hasDuplicate=true}return V}}else{if("sourceIndex" in document.documentElement){G=function(U,T){var V=U.sourceIndex-T.sourceIndex;if(V===0){hasDuplicate=true}return V}}else{if(document.createRange){G=function(W,U){var V=W.ownerDocument.createRange(),T=U.ownerDocument.createRange();V.selectNode(W);V.collapse(true);T.selectNode(U);T.collapse(true);var X=V.compareBoundaryPoints(Range.START_TO_END,T);if(X===0){hasDuplicate=true}return X}}}}(function(){var U=document.createElement("form"),V="script"+(new Date).getTime();U.innerHTML="<input name='"+V+"'/>";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="<a href='#'></a>";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="<p class='TEST'></p>";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="<div class='test e'></div><div class='test'></div>";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1&&!ac){T.sizcache=Y;T.sizset=W}if(T.nodeName===Z){X=T;break}T=T[U]}ad[W]=X}}}function S(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1){if(!ac){T.sizcache=Y;T.sizset=W}if(typeof Z!=="string"){if(T===Z){X=true;break}}else{if(F.filter(Z,[T]).length>0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z<U;Z++){F(T,V[Z],W)}return F.filter(X,W)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(T){return T.offsetWidth===0||T.offsetHeight===0};F.selectors.filters.visible=function(T){return T.offsetWidth>0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp("(^|\\.)"+H.type+"(\\.|$)"),G=true,F=[];o.each(o.data(this,"events").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});F.sort(function(J,I){return o.data(J.elem,"closest")-o.data(I.elem,"closest")});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){return(G=false)}});return G}function i(F,E){return["live",F,E.replace(/\./g,"`").replace(/ /g,"|")].join(".")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler("ready")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&l==l.top){(function(){if(o.isReady){return}try{document.documentElement.doScroll("left")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,"load",o.ready)}o.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind("unload",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement("script"),K=document.createElement("div"),J="script"+(new Date).getTime();K.style.display="none";K.innerHTML=' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width=L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display="none"})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},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(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H<F;H++){this[H].style.display=o.data(this[H],"olddisplay")||""}return this}},hide:function(H,I){if(H){return this.animate(t("hide",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],"olddisplay");if(!E&&E!=="none"){o.data(this[G],"olddisplay",o.css(this[G],"display"))}}for(var G=0,F=this.length;G<F;G++){this[G].style.display="none"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G==="boolean";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(":hidden");o(this)[H?"show":"hide"]()}):this.animate(t("toggle",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?"each":"queue"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(":hidden"),J=this;for(M in I){if(I[M]=="hide"&&L||I[M]=="show"&&!L){return K.complete.call(this)}if((M=="height"||M=="width")&&this.style){K.display=o.css(this,"display");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow="hidden"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S=="toggle"?L?"show":"hide":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||"px";if(P!="px"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]=="-="?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,"")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n);n=g}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})(); \ No newline at end of file
diff --git a/utils/i18n/test.html b/utils/i18n/test.html
deleted file mode 100755
index 7f481cf..0000000
--- a/utils/i18n/test.html
+++ /dev/null
@@ -1,38 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" dir="ltr">
-<head>
-<meta name="keywords" content="karma,javascript,html5,sugar,sugarlabs,gsoc,ole,nepal" />
-
-<link rel="shortcut icon" href="http://karma.sugarlabs.org/favicon.ico" />
-
-<style type="text/css">
-
-#scoreboard { border: 1px solid black;
- width: 300px;
- height: 50px;}
-
-</style>
-<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
-<script type="text/javascript" src="js/jquery.jgrowl_minimized.js"></script>
-
-
-</head>
-
-<body>
-<div id="main">
-<div id="scoreboard" class="horizontal_elements translate">
- <label id="lblScore">The score is</label>
- <label id="txtScore">0</label>
-</div>
-<div id="buttons" class="horizontal_elements translate">
-<button id="btnYes">Yes</button>
-<button id="btnNo">No!</button>
-<button id="btnRestart">Restart</button>
-</div>
-</div>
-
-
-
-</body>
-</html>
diff --git a/utils/i18n/test.pot b/utils/i18n/test.pot
deleted file mode 100755
index 5eb8d60..0000000
--- a/utils/i18n/test.pot
+++ /dev/null
@@ -1,26 +0,0 @@
-Project-Id-Version: PACKAGE VERSION
-Report-Msgid-Bugs-To: bryan@olenepal.org
-POT-Creation-Date:
-PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE
-Last-Translator: FULL NAME <EMAIL@ADDRESS>
-Language-Team: LANGUAGE <LL@li.org>
-MIME-Version: 1.0
-Content-Type: text/plain; charset=CHARSET
-Content-Transfer-Encoding: 8bit
-
-msgctxt "HTML Tag: LABEL ID: lblScore"
-msgid "The score is"
-
-msgctxt "HTML Tag: LABEL ID: txtScore"
-msgid "0"
-
-msgctxt "HTML Tag: BUTTON ID: btnYes"
-msgid "Yes"
-
-msgctxt "HTML Tag: BUTTON ID: btnNo"
-msgid "No!"
-
-msgctxt "HTML Tag: BUTTON ID: btnRestart"
-msgid "Restart"
-
-msgctxt "HTML Tag: META ID: "msgid "karma,javascript,html5,sugar,sugarlabs,gsoc,ole,nepal"
diff --git a/utils/i18n/testnw.txt b/utils/i18n/testnw.txt
deleted file mode 100755
index 5eb8d60..0000000
--- a/utils/i18n/testnw.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-Project-Id-Version: PACKAGE VERSION
-Report-Msgid-Bugs-To: bryan@olenepal.org
-POT-Creation-Date:
-PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE
-Last-Translator: FULL NAME <EMAIL@ADDRESS>
-Language-Team: LANGUAGE <LL@li.org>
-MIME-Version: 1.0
-Content-Type: text/plain; charset=CHARSET
-Content-Transfer-Encoding: 8bit
-
-msgctxt "HTML Tag: LABEL ID: lblScore"
-msgid "The score is"
-
-msgctxt "HTML Tag: LABEL ID: txtScore"
-msgid "0"
-
-msgctxt "HTML Tag: BUTTON ID: btnYes"
-msgid "Yes"
-
-msgctxt "HTML Tag: BUTTON ID: btnNo"
-msgid "No!"
-
-msgctxt "HTML Tag: BUTTON ID: btnRestart"
-msgid "Restart"
-
-msgctxt "HTML Tag: META ID: "msgid "karma,javascript,html5,sugar,sugarlabs,gsoc,ole,nepal"
diff --git a/utils/jsdoc-toolkit/README.txt b/utils/jsdoc-toolkit/README.txt
deleted file mode 100755
index 44575d3..0000000
--- a/utils/jsdoc-toolkit/README.txt
+++ /dev/null
@@ -1,186 +0,0 @@
-======================================================================
-
-DESCRIPTION:
-
-This is the source code for JsDoc Toolkit, an automatic documentation
-generation tool for JavaScript. It is written in JavaScript and is run
-from a command line (or terminal) using the Java and Mozilla's Rhino
-JavaScript runtime engine.
-
-Using this tool you can automatically turn JavaDoc-like comments in
-your JavaScript source code into published output files, such as HTML
-or XML.
-
-For more information, to report a bug, or to browse the technical
-documentation for this tool please visit the official JsDoc Toolkit
-project homepage at http://code.google.com/p/jsdoc-toolkit/
-
-For the most up-to-date documentation on JsDoc Toolkit see the
-official wiki at http://code.google.com/p/jsdoc-toolkit/w/list
-
-======================================================================
-
-REQUIREMENTS:
-
-JsDoc Toolkit is known to work with:
-java version "1.6.0_03"
-Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
-on Windows XP,
-and java version "1.5.0_13"
-Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b05-241)
-on Mac OS X 10.4.
-
-Other versions of java may or may not work with JsDoc Toolkit.
-
-======================================================================
-
-USAGE:
-
-Running JsDoc Toolkit requires you to have Java installed on your
-computer. For more information see http://www.java.com/getjava/
-
-Before running the JsDoc Toolkit app you should change your current
-working directory to the jsdoc-toolkit folder. Then follow the
-examples below, or as shown on the project wiki.
-
-On a computer running Windows a valid command line to run JsDoc
-Toolkit might look like this:
-
-> java -jar jsrun.jar app\run.js -a -t=templates\jsdoc mycode.js
-
-On Mac OS X or Linux the same command would look like this:
-
-$ java -jar jsrun.jar app/run.js -a -t=templates/jsdoc mycode.js
-
-The above assumes your current working directory contains jsrun.jar,
-the "app" and "templates" subdirectories from the standard JsDoc
-Toolkit distribution and that the relative path to the code you wish
-to document is "mycode.js".
-
-The output documentation files will be saved to a new directory named
-"out" (by default) in the current directory, or if you specify a
--d=somewhere_else option, to the somewhere_else directory.
-
-For help (usage notes) enter this on the command line:
-
-$ java -jar jsrun.jar app/run.js --help
-
-More information about the various command line options used by JsDoc
-Toolkit are available on the project wiki.
-
-======================================================================
-
-RUNNING VIA SHELL SCRIPT
-
-Avi Deitcher has contributed the file jsrun.sh with the following usage notes:
-
-A script to simplify running jsdoc from the command-line, especially when
-running from within a development or build environment such as ant.
-
-Normally, to run jsdoc, you need a command-line as the following:
-java -Djsdoc.dir=/some/long/dir/path/to/jsdoc -jar
-/some/long/dir/path/to/jsdoc/jsrun.jar /some/long/dir/path/to/jsdoc/app/run.js
--t=template -r=4 /some/long/dir/path/to/my/src/code
-
-This can get tedious to redo time and again, and difficult to use from within a
-build environment.
-
-To simplify the process, jsrun.sh will automatically run this path, as well as
-passing through any arguments.
-
-Usage: jsrun.sh <run.js arguments>
-
-All <run.js arguments> will be passed through.
-Additionally, jsrun.sh will take the following actions:
-1) If the environment variable JSDOCDIR is set, it will add
-"-Djsdoc.dir=$JSDOCDIR" to the command-line
-2) If the environment variable JSDOCTEMPLATEDIR is set, it will add
-"-Djsdoc.template.dir=$JSDOCTEMPLATEDIR" to the command-line
-3) java with the appropriate path to jsrun.jar and run.js will be instantiated
-
-If not variables are set, it is assumed that the path to jsrun.jar and app/ is
-in the current working directory.
-
-Example:
-# jsrun.sh ./src/
-Assuming JSDOCDIR=/some/path/to/my/jsdoc will cause the following command to
-execute:
-java -Djsdoc.dir=/some/path/to/my/jsdoc -jar /some/path/to/my/jsdoc/jsrun.jar
-/some/path/to/my/jsdoc/app/run.js ./src/
-
-======================================================================
-
-TESTING:
-
-To run the suite of unit tests included with JsDoc Toolkit enter this
-on the command line:
-
-$ java -jar jsrun.jar app/run.js -T
-
-To see a dump of the internal data structure that JsDoc Toolkit has
-built from your source files use this command:
-
-$ java -jar jsrun.jar app/run.js mycode.js -Z
-
-======================================================================
-
-LICENSE:
-
-JSDoc.pm
-
-This project is based on the JSDoc.pm tool, created by Michael
-Mathews and Gabriel Reid. More information on JsDoc.pm can
-be found on the JSDoc.pm homepage: http://jsdoc.sourceforge.net/
-
-Complete documentation on JsDoc Toolkit can be found on the project
-wiki at http://code.google.com/p/jsdoc-toolkit/w/list
-
-Rhino
-
-Rhino (JavaScript in Java) is open source and licensed by Mozilla
-under the MPL 1.1 or later/GPL 2.0 or later licenses, the text of
-which is available at http://www.mozilla.org/MPL/
-
-You can obtain the source code for Rhino from the Mozilla web site at
-http://www.mozilla.org/rhino/download.html
-
-JsDoc Toolkit is a larger work that uses the Rhino JavaScript engine
-but is not derived from it in any way. The Rhino library is used
-without modification and without any claims whatsoever.
-
-The Rhino Debugger
-
-You can obtain more information about the Rhino Debugger from the
-Mozilla web site at http://www.mozilla.org/rhino/debugger.html
-
-JsDoc Toolkit is a larger work that uses the Rhino Debugger but
-is not derived from it in any way. The Rhino Debugger is used
-without modification and without any claims whatsoever.
-
-JsDoc Toolkit
-
-All code specific to JsDoc Toolkit are free, open source and licensed
-for use under the X11/MIT License.
-
-JsDoc Toolkit is Copyright (c)2009 Michael Mathews <micmath@gmail.com>
-
-This program is free software; you can redistribute it and/or
-modify it under the terms below.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions: The above copyright notice and this
-permission notice must be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/utils/jsdoc-toolkit/app/frame.js b/utils/jsdoc-toolkit/app/frame.js
deleted file mode 100755
index 1beb405..0000000
--- a/utils/jsdoc-toolkit/app/frame.js
+++ /dev/null
@@ -1,33 +0,0 @@
-IO.include("frame/Opt.js");
-IO.include("frame/Chain.js");
-IO.include("frame/Link.js");
-IO.include("frame/String.js");
-IO.include("frame/Hash.js");
-IO.include("frame/Namespace.js");
-//IO.include("frame/Reflection.js");
-
-/** A few helper functions to make life a little easier. */
-
-function defined(o) {
- return (o !== undefined);
-}
-
-function copy(o) { // todo check for circular refs
- if (o == null || typeof(o) != 'object') return o;
- var c = new o.constructor();
- for(var p in o) c[p] = copy(o[p]);
- return c;
-}
-
-function isUnique(arr) {
- var l = arr.length;
- for(var i = 0; i < l; i++ ) {
- if (arr.lastIndexOf(arr[i]) > i) return false;
- }
- return true;
-}
-
-/** Returns the given string with all regex meta characters backslashed. */
-RegExp.escapeMeta = function(str) {
- return str.replace(/([$^\\\/()|?+*\[\]{}.-])/g, "\\$1");
-}
diff --git a/utils/jsdoc-toolkit/app/frame/Chain.js b/utils/jsdoc-toolkit/app/frame/Chain.js
deleted file mode 100755
index 506469d..0000000
--- a/utils/jsdoc-toolkit/app/frame/Chain.js
+++ /dev/null
@@ -1,102 +0,0 @@
-/**@constructor*/
-function ChainNode(object, link) {
- this.value = object;
- this.link = link; // describes this node's relationship to the previous node
-}
-
-/**@constructor*/
-function Chain(valueLinks) {
- this.nodes = [];
- this.cursor = -1;
-
- if (valueLinks && valueLinks.length > 0) {
- this.push(valueLinks[0], "//");
- for (var i = 1, l = valueLinks.length; i < l; i+=2) {
- this.push(valueLinks[i+1], valueLinks[i]);
- }
- }
-}
-
-Chain.prototype.push = function(o, link) {
- if (this.nodes.length > 0 && link) this.nodes.push(new ChainNode(o, link));
- else this.nodes.push(new ChainNode(o));
-}
-
-Chain.prototype.unshift = function(o, link) {
- if (this.nodes.length > 0 && link) this.nodes[0].link = link;
- this.nodes.unshift(new ChainNode(o));
- this.cursor++;
-}
-
-Chain.prototype.get = function() {
- if (this.cursor < 0 || this.cursor > this.nodes.length-1) return null;
- return this.nodes[this.cursor];
-}
-
-Chain.prototype.first = function() {
- this.cursor = 0;
- return this.get();
-}
-
-Chain.prototype.last = function() {
- this.cursor = this.nodes.length-1;
- return this.get();
-}
-
-Chain.prototype.next = function() {
- this.cursor++;
- return this.get();
-}
-
-Chain.prototype.prev = function() {
- this.cursor--;
- return this.get();
-}
-
-Chain.prototype.toString = function() {
- var string = "";
- for (var i = 0, l = this.nodes.length; i < l; i++) {
- if (this.nodes[i].link) string += " -("+this.nodes[i].link+")-> ";
- string += this.nodes[i].value.toString();
- }
- return string;
-}
-
-Chain.prototype.joinLeft = function() {
- var result = "";
- for (var i = 0, l = this.cursor; i < l; i++) {
- if (result && this.nodes[i].link) result += this.nodes[i].link;
- result += this.nodes[i].value.toString();
- }
- return result;
-}
-
-
-/* USAGE:
-
-var path = "one/two/three.four/five-six";
-var pathChain = new Chain(path.split(/([\/.-])/));
-print(pathChain);
-
-var lineage = new Chain();
-lineage.push("Port");
-lineage.push("Les", "son");
-lineage.push("Dawn", "daughter");
-lineage.unshift("Purdie", "son");
-
-print(lineage);
-
-// walk left
-for (var node = lineage.last(); node !== null; node = lineage.prev()) {
- print("< "+node.value);
-}
-
-// walk right
-var node = lineage.first()
-while (node !== null) {
- print(node.value);
- node = lineage.next();
- if (node && node.link) print("had a "+node.link+" named");
-}
-
-*/ \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/frame/Dumper.js b/utils/jsdoc-toolkit/app/frame/Dumper.js
deleted file mode 100755
index d8b007b..0000000
--- a/utils/jsdoc-toolkit/app/frame/Dumper.js
+++ /dev/null
@@ -1,144 +0,0 @@
-/**
- * @class
-<pre>
-This is a lightly modified version of Kevin Jones' JavaScript
-library Data.Dump. To download the original visit:
- <a href="http://openjsan.org/doc/k/ke/kevinj/Data/Dump/">http://openjsan.org/doc/k/ke/kevinj/Data/Dump/</a>
-
-AUTHORS
-
-The Data.Dump JavaScript module is written by Kevin Jones
-(kevinj@cpan.org), based on Data::Dump by Gisle Aas (gisle@aas.no),
-based on Data::Dumper by Gurusamy Sarathy (gsar@umich.edu).
-
-COPYRIGHT
-
-Copyright 2007 Kevin Jones. Copyright 1998-2000,2003-2004 Gisle Aas.
-Copyright 1996-1998 Gurusamy Sarathy.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the Perl Artistic License
-
-See http://www.perl.com/perl/misc/Artistic.html
-</pre>
- * @static
- */
-Dumper = {
- /** @param [...] The objects to dump. */
- dump: function () {
- if (arguments.length > 1)
- return this._dump(arguments);
- else if (arguments.length == 1)
- return this._dump(arguments[0]);
- else
- return "()";
- },
-
- _dump: function (obj) {
- if (typeof obj == 'undefined') return 'undefined';
- var out;
- if (obj.serialize) { return obj.serialize(); }
- var type = this._typeof(obj);
- if (obj.circularReference) obj.circularReference++;
- switch (type) {
- case 'circular':
- out = "{ //circularReference\n}";
- break;
- case 'object':
- var pairs = new Array;
-
- for (var prop in obj) {
- if (prop != "circularReference" && obj.hasOwnProperty(prop)) { //hide inherited properties
- pairs.push(prop + ': ' + this._dump(obj[prop]));
- }
- }
-
- out = '{' + this._format_list(pairs) + '}';
- break;
-
- case 'string':
- for (var prop in Dumper.ESC) {
- if (Dumper.ESC.hasOwnProperty(prop)) {
- obj = obj.replace(prop, Dumper.ESC[prop]);
- }
- }
-
- // Escape UTF-8 Strings
- if (obj.match(/^[\x00-\x7f]*$/)) {
- out = '"' + obj.replace(/\"/g, "\\\"").replace(/([\n\r]+)/g, "\\$1") + '"';
- }
- else {
- out = "unescape('"+escape(obj)+"')";
- }
- break;
-
- case 'array':
- var elems = new Array;
-
- for (var i=0; i<obj.length; i++) {
- elems.push( this._dump(obj[i]) );
- }
-
- out = '[' + this._format_list(elems) + ']';
- break;
-
- case 'date':
- // firefox returns GMT strings from toUTCString()...
- var utc_string = obj.toUTCString().replace(/GMT/,'UTC');
- out = 'new Date("' + utc_string + '")';
- break;
-
- case 'element':
- // DOM element
- out = this._dump_dom(obj);
- break;
-
- default:
- out = obj;
- }
-
- out = String(out).replace(/\n/g, '\n ');
- out = out.replace(/\n (.*)$/,"\n$1");
-
- return out;
- },
-
- _format_list: function (list) {
- if (!list.length) return '';
- var nl = list.toString().length > 60 ? '\n' : ' ';
- return nl + list.join(',' + nl) + nl;
- },
-
- _typeof: function (obj) {
- if (obj && obj.circularReference && obj.circularReference > 1) return 'circular';
- if (Array.prototype.isPrototypeOf(obj)) return 'array';
- if (Date.prototype.isPrototypeOf(obj)) return 'date';
- if (typeof obj.nodeType != 'undefined') return 'element';
- return typeof(obj);
- },
-
- _dump_dom: function (obj) {
- return '"' + Dumper.nodeTypes[obj.nodeType] + '"';
- }
-};
-
-Dumper.ESC = {
- "\t": "\\t",
- "\n": "\\n",
- "\f": "\\f"
-};
-
-Dumper.nodeTypes = {
- 1: "ELEMENT_NODE",
- 2: "ATTRIBUTE_NODE",
- 3: "TEXT_NODE",
- 4: "CDATA_SECTION_NODE",
- 5: "ENTITY_REFERENCE_NODE",
- 6: "ENTITY_NODE",
- 7: "PROCESSING_INSTRUCTION_NODE",
- 8: "COMMENT_NODE",
- 9: "DOCUMENT_NODE",
- 10: "DOCUMENT_TYPE_NODE",
- 11: "DOCUMENT_FRAGMENT_NODE",
- 12: "NOTATION_NODE"
-}; \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/frame/Hash.js b/utils/jsdoc-toolkit/app/frame/Hash.js
deleted file mode 100755
index 62cfad6..0000000
--- a/utils/jsdoc-toolkit/app/frame/Hash.js
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- @constructor
- @example
- var _index = new Hash();
- _index.set("a", "apple");
- _index.set("b", "blue");
- _index.set("c", "coffee");
-
- for (var p = _index.first(); p; p = _index.next()) {
- print(p.key+" is for "+p.value);
- }
-
- */
-var Hash = function() {
- this._map = {};
- this._keys = [];
- this._vals = [];
- this.reset();
-}
-
-Hash.prototype.set = function(k, v) {
- if (k != "") {
- this._keys.push(k);
- this._map["="+k] = this._vals.length;
- this._vals.push(v);
- }
-}
-
-Hash.prototype.replace = function(k, k2, v) {
- if (k == k2) return;
-
- var offset = this._map["="+k];
- this._keys[offset] = k2;
- if (typeof v != "undefined") this._vals[offset] = v;
- this._map["="+k2] = offset;
- delete(this._map["="+k]);
-}
-
-Hash.prototype.drop = function(k) {
- if (k != "") {
- var offset = this._map["="+k];
- this._keys.splice(offset, 1);
- this._vals.splice(offset, 1);
- delete(this._map["="+k]);
- for (var p in this._map) {
- if (this._map[p] >= offset) this._map[p]--;
- }
- if (this._cursor >= offset && this._cursor > 0) this._cursor--;
- }
-}
-
-Hash.prototype.get = function(k) {
- if (k != "") {
- return this._vals[this._map["="+k]];
- }
-}
-
-Hash.prototype.keys = function() {
- return this._keys;
-}
-
-Hash.prototype.hasKey = function(k) {
- if (k != "") {
- return (typeof this._map["="+k] != "undefined");
- }
-}
-
-Hash.prototype.values = function() {
- return this._vals;
-}
-
-Hash.prototype.reset = function() {
- this._cursor = 0;
-}
-
-Hash.prototype.first = function() {
- this.reset();
- return this.next();
-}
-
-Hash.prototype.next = function() {
- if (this._cursor++ < this._keys.length)
- return {key: this._keys[this._cursor-1], value: this._vals[this._cursor-1]};
-} \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/frame/Link.js b/utils/jsdoc-toolkit/app/frame/Link.js
deleted file mode 100755
index ef5dc0a..0000000
--- a/utils/jsdoc-toolkit/app/frame/Link.js
+++ /dev/null
@@ -1,153 +0,0 @@
-/** Handle the creation of HTML links to documented symbols.
- @constructor
-*/
-function Link() {
- this.alias = "";
- this.src = "";
- this.file = "";
- this.text = "";
- this.innerName = "";
- this.classLink = false;
- this.targetName = "";
-
- this.target = function(targetName) {
- if (defined(targetName)) this.targetName = targetName;
- return this;
- }
- this.inner = function(inner) {
- if (defined(inner)) this.innerName = inner;
- return this;
- }
- this.withText = function(text) {
- if (defined(text)) this.text = text;
- return this;
- }
- this.toSrc = function(filename) {
- if (defined(filename)) this.src = filename;
- return this;
- }
- this.toSymbol = function(alias) {
- if (defined(alias)) this.alias = new String(alias);
- return this;
- }
- this.toClass = function(alias) {
- this.classLink = true;
- return this.toSymbol(alias);
- }
- this.toFile = function(file) {
- if (defined(file)) this.file = file;
- return this;
- }
-
- this.toString = function() {
- var linkString;
- var thisLink = this;
-
- if (this.alias) {
- linkString = this.alias.replace(/(^|[^a-z$0-9_#.:^-])([|a-z$0-9_#.:^-]+)($|[^a-z$0-9_#.:^-])/i,
- function(match, prematch, symbolName, postmatch) {
- var symbolNames = symbolName.split("|");
- var links = [];
- for (var i = 0, l = symbolNames.length; i < l; i++) {
- thisLink.alias = symbolNames[i];
- links.push(thisLink._makeSymbolLink(symbolNames[i]));
- }
- return prematch+links.join("|")+postmatch;
- }
- );
- }
- else if (this.src) {
- linkString = thisLink._makeSrcLink(this.src);
- }
- else if (this.file) {
- linkString = thisLink._makeFileLink(this.file);
- }
-
- return linkString;
- }
-}
-
-/** prefixed for hashes */
-Link.hashPrefix = "";
-
-/** Appended to the front of relative link paths. */
-Link.base = "";
-
-Link.symbolNameToLinkName = function(symbol) {
- var linker = "";
- if (symbol.isStatic) linker = ".";
- else if (symbol.isInner) linker = "-";
-
- return Link.hashPrefix+linker+symbol.name;
-}
-
-/** Create a link to another symbol. */
-Link.prototype._makeSymbolLink = function(alias) {
- var linkBase = Link.base+publish.conf.symbolsDir;
- var linkTo = Link.symbolSet.getSymbol(alias);
- var linkPath;
- var target = (this.targetName)? " target=\""+this.targetName+"\"" : "";
-
- // is it an internal link?
- if (alias.charAt(0) == "#") var linkPath = alias;
-
- // if there is no symbol by that name just return the name unaltered
- else if (!linkTo) return this.text || alias;
-
- // it's a symbol in another file
- else {
- if (!linkTo.is("CONSTRUCTOR") && !linkTo.isNamespace) { // it's a method or property
- if (linkTo.isEvent) {
- linkPath =
- (Link.filemap)? Link.filemap[linkTo.memberOf]
- :
- escape(linkTo.memberOf) || "_global_";
- linkPath += publish.conf.ext + "#event:" + Link.symbolNameToLinkName(linkTo);
- }
- else {
- linkPath =
- (Link.filemap)? Link.filemap[linkTo.memberOf]
- :
- escape(linkTo.memberOf) || "_global_";
- linkPath += publish.conf.ext + "#" + Link.symbolNameToLinkName(linkTo);
- }
- }
- else {
- linkPath = (Link.filemap)? Link.filemap[linkTo.alias] : escape(linkTo.alias);
- linkPath += publish.conf.ext;// + (this.classLink? "":"#" + Link.hashPrefix + "constructor");
- }
- linkPath = linkBase + linkPath
- }
-
- var linkText = this.text || alias;
-
- var link = {linkPath: linkPath, linkText: linkText, linkInner: (this.innerName? "#"+this.innerName : "")};
-
- if (typeof JSDOC.PluginManager != "undefined") {
- JSDOC.PluginManager.run("onSymbolLink", link);
- }
-
- return "<a href=\""+link.linkPath+link.linkInner+"\""+target+">"+link.linkText+"</a>";
-}
-
-/** Create a link to a source file. */
-Link.prototype._makeSrcLink = function(srcFilePath) {
- var target = (this.targetName)? " target=\""+this.targetName+"\"" : "";
-
- // transform filepath into a filename
- var srcFile = srcFilePath.replace(/\.\.?[\\\/]/g, "").replace(/[:\\\/]/g, "_");
- var outFilePath = Link.base + publish.conf.srcDir + srcFile + publish.conf.ext;
-
- if (!this.text) this.text = FilePath.fileName(srcFilePath);
- return "<a href=\""+outFilePath+"\""+target+">"+this.text+"</a>";
-}
-
-/** Create a link to a source file. */
-Link.prototype._makeFileLink = function(filePath) {
- var target = (this.targetName)? " target=\""+this.targetName+"\"" : "";
-
- var outFilePath = Link.base + filePath;
-
- if (!this.text) this.text = filePath;
- return "<a href=\""+outFilePath+"\""+target+">"+this.text+"</a>";
-} \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/frame/Namespace.js b/utils/jsdoc-toolkit/app/frame/Namespace.js
deleted file mode 100755
index fa1e41d..0000000
--- a/utils/jsdoc-toolkit/app/frame/Namespace.js
+++ /dev/null
@@ -1,10 +0,0 @@
-_global_ = this;
-
-function Namespace(name, f) {
- var n = name.split(".");
- for (var o = _global_, i = 0, l = n.length; i < l; i++) {
- o = o[n[i]] = o[n[i]] || {};
- }
-
- if (f) f();
-} \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/frame/Opt.js b/utils/jsdoc-toolkit/app/frame/Opt.js
deleted file mode 100755
index 352f159..0000000
--- a/utils/jsdoc-toolkit/app/frame/Opt.js
+++ /dev/null
@@ -1,134 +0,0 @@
-/** @namespace */
-Opt = {
- /**
- * Get commandline option values.
- * @param {Array} args Commandline arguments. Like ["-a=xml", "-b", "--class=new", "--debug"]
- * @param {object} optNames Map short names to long names. Like {a:"accept", b:"backtrace", c:"class", d:"debug"}.
- * @return {object} Short names and values. Like {a:"xml", b:true, c:"new", d:true}
- */
- get: function(args, optNames) {
- var opt = {"_": []}; // the unnamed option allows multiple values
- for (var i = 0; i < args.length; i++) {
- var arg = new String(args[i]);
- var name;
- var value;
- if (arg.charAt(0) == "-") {
- if (arg.charAt(1) == "-") { // it's a longname like --foo
- arg = arg.substring(2);
- var m = arg.split("=");
- name = m.shift();
- value = m.shift();
- if (typeof value == "undefined") value = true;
-
- for (var n in optNames) { // convert it to a shortname
- if (name == optNames[n]) {
- name = n;
- }
- }
- }
- else { // it's a shortname like -f
- arg = arg.substring(1);
- var m = arg.split("=");
- name = m.shift();
- value = m.shift();
- if (typeof value == "undefined") value = true;
-
- for (var n in optNames) { // find the matching key
- if (name == n || name+'[]' == n) {
- name = n;
- break;
- }
- }
- }
- if (name.match(/(.+)\[\]$/)) { // it's an array type like n[]
- name = RegExp.$1;
- if (!opt[name]) opt[name] = [];
- }
-
- if (opt[name] && opt[name].push) {
- opt[name].push(value);
- }
- else {
- opt[name] = value;
- }
- }
- else { // not associated with any optname
- opt._.push(args[i]);
- }
- }
- return opt;
- }
-}
-
-/*t:
- plan(11, "Testing Opt.");
-
- is(
- typeof Opt,
- "object",
- "Opt is an object."
- );
-
- is(
- typeof Opt.get,
- "function",
- "Opt.get is a function."
- );
-
- var optNames = {a:"accept", b:"backtrace", c:"class", d:"debug", "e[]":"exceptions"};
- var t_options = Opt.get(["-a=xml", "-b", "--class=new", "--debug", "-e=one", "-e=two", "foo", "bar"], optNames);
-
- is(
- t_options.a,
- "xml",
- "an option defined with a short name can be accessed by its short name."
- );
-
- is(
- t_options.b,
- true,
- "an option defined with a short name and no value are true."
- );
-
- is(
- t_options.c,
- "new",
- "an option defined with a long name can be accessed by its short name."
- );
-
- is(
- t_options.d,
- true,
- "an option defined with a long name and no value are true."
- );
-
- is(
- typeof t_options.e,
- "object",
- "an option that can accept multiple values is defined."
- );
-
- is(
- t_options.e.length,
- 2,
- "an option that can accept multiple values can have more than one value."
- );
-
- is(
- t_options.e[1],
- "two",
- "an option that can accept multiple values can be accessed as an array."
- );
-
- is(
- typeof t_options._,
- "object",
- "the property '_' is defined for unnamed options."
- );
-
- is(
- t_options._[0],
- "foo",
- "the property '_' can be accessed as an array."
- );
- */ \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/frame/Reflection.js b/utils/jsdoc-toolkit/app/frame/Reflection.js
deleted file mode 100755
index 0968f1c..0000000
--- a/utils/jsdoc-toolkit/app/frame/Reflection.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/**@constructor*/
-function Reflection(obj) {
- this.obj = obj;
-}
-
-Reflection.prototype.getConstructorName = function() {
- if (this.obj.constructor.name) return this.obj.constructor.name;
- var src = this.obj.constructor.toSource();
- var name = src.substring(name.indexOf("function")+8, src.indexOf('(')).replace(/ /g,'');
- return name;
-}
-
-Reflection.prototype.getMethod = function(name) {
- for (var p in this.obj) {
- if (p == name && typeof(this.obj[p]) == "function") return this.obj[p];
- }
- return null;
-}
-
-Reflection.prototype.getParameterNames = function() {
- var src = this.obj.toSource();
- src = src.substring(
- src.indexOf("(", 8)+1, src.indexOf(")")
- );
- return src.split(/, ?/);
-}
diff --git a/utils/jsdoc-toolkit/app/frame/String.js b/utils/jsdoc-toolkit/app/frame/String.js
deleted file mode 100755
index c183c27..0000000
--- a/utils/jsdoc-toolkit/app/frame/String.js
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- @name String
- @class Additions to the core string object.
-*/
-
-/** @author Steven Levithan, released as public domain. */
-String.prototype.trim = function() {
- var str = this.replace(/^\s+/, '');
- for (var i = str.length - 1; i >= 0; i--) {
- if (/\S/.test(str.charAt(i))) {
- str = str.substring(0, i + 1);
- break;
- }
- }
- return str;
-}
-/*t:
- plan(6, "Testing String.prototype.trim.");
-
- var s = " a bc ".trim();
- is(s, "a bc", "multiple spaces front and back are trimmed.");
-
- s = "a bc\n\n".trim();
- is(s, "a bc", "newlines only in back are trimmed.");
-
- s = "\ta bc".trim();
- is(s, "a bc", "tabs only in front are trimmed.");
-
- s = "\n \t".trim();
- is(s, "", "an all-space string is trimmed to empty.");
-
- s = "a b\nc".trim();
- is(s, "a b\nc", "a string with no spaces in front or back is trimmed to itself.");
-
- s = "".trim();
- is(s, "", "an empty string is trimmed to empty.");
-
-*/
-
-String.prototype.balance = function(open, close) {
- var i = 0;
- while (this.charAt(i) != open) {
- if (i == this.length) return [-1, -1];
- i++;
- }
-
- var j = i+1;
- var balance = 1;
- while (j < this.length) {
- if (this.charAt(j) == open) balance++;
- if (this.charAt(j) == close) balance--;
- if (balance == 0) break;
- j++;
- if (j == this.length) return [-1, -1];
- }
-
- return [i, j];
-}
-/*t:
- plan(16, "Testing String.prototype.balance.");
-
- var s = "{abc}".balance("{","}");
- is(s[0], 0, "opener in first is found.");
- is(s[1], 4, "closer in last is found.");
-
- s = "ab{c}de".balance("{","}");
- is(s[0], 2, "opener in middle is found.");
- is(s[1], 4, "closer in middle is found.");
-
- s = "a{b{c}de}f".balance("{","}");
- is(s[0], 1, "nested opener is found.");
- is(s[1], 8, "nested closer is found.");
-
- s = "{}".balance("{","}");
- is(s[0], 0, "opener with no content is found.");
- is(s[1], 1, "closer with no content is found.");
-
- s = "".balance("{","}");
- is(s[0], -1, "empty string opener is -1.");
- is(s[1], -1, "empty string closer is -1.");
-
- s = "{abc".balance("{","}");
- is(s[0], -1, "opener with no closer returns -1.");
- is(s[1], -1, "no closer returns -1.");
-
- s = "abc".balance("{","}");
- is(s[0], -1, "no opener or closer returns -1 for opener.");
- is(s[1], -1, "no opener or closer returns -1 for closer.");
-
- s = "a<bc}de".balance("<","}");
- is(s[0], 1, "unmatching opener is found.");
- is(s[1], 4, "unmatching closer is found.");
-*/ \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/frame/Testrun.js b/utils/jsdoc-toolkit/app/frame/Testrun.js
deleted file mode 100755
index db7ecc8..0000000
--- a/utils/jsdoc-toolkit/app/frame/Testrun.js
+++ /dev/null
@@ -1,129 +0,0 @@
-/**
- * @fileOverview
- * @name JsTestrun
- * @author Michael Mathews micmath@gmail.com
- * @url $HeadURL: https://jsdoc-toolkit.googlecode.com/svn/trunk/jsdoc-toolkit/app/frame/Testrun.js $
- * @revision $Id: Testrun.js 418 2008-01-15 21:40:33Z micmath $
- * @license <a href="http://en.wikipedia.org/wiki/MIT_License">X11/MIT License</a>
- * (See the accompanying README file for full details.)
- */
-
-/**
- Yet another unit testing tool for JavaScript.
- @author Michael Mathews <a href="mailto:micmath@gmail.com">micmath@gmail.com</a>
- @param {object} testCases Properties are testcase names, values are functions to execute as tests.
-*/
-function testrun(testCases) {
- var ran = 0;
- for (t in testCases) {
- var result = testCases[t]();
- ran++;
- }
-
- return testrun.reportOut+"-------------------------------\n"+((testrun.fails>0)? ":( Failed "+testrun.fails+"/" : ":) Passed all ")+testrun.count+" test"+((testrun.count == 1)? "":"s")+".\n";
-}
-
-
-testrun.count = 0;
-testrun.current = null;
-testrun.passes = 0;
-testrun.fails = 0;
-testrun.reportOut = "";
-
-/** @private */
-testrun.report = function(text) {
- testrun.reportOut += text+"\n";
-}
-
-/**
- Check if test evaluates to true.
- @param {string} test To be evaluated.
- @param {string} message Optional. To be displayed in the report.
- @return {boolean} True if the string test evaluates to true.
-*/
-ok = function(test, message) {
- testrun.count++;
-
- var result;
- try {
- result = eval(test);
-
- if (result) {
- testrun.passes++;
- testrun.report(" OK "+testrun.count+" - "+((message != null)? message : ""));
- }
- else {
- testrun.fails++;
- testrun.report("NOT OK "+testrun.count+" - "+((message != null)? message : ""));
- }
- }
- catch(e) {
- testrun.fails++
- testrun.report("NOT OK "+testrun.count+" - "+((message != null)? message : ""));
-
- }
-}
-
-/**
- Check if test is same as expected.
- @param {string} test To be evaluated.
- @param {string} expected
- @param {string} message Optional. To be displayed in the report.
- @return {boolean} True if (test == expected). Note that the comparison is not a strict equality check.
-*/
-is = function(test, expected, message) {
- testrun.count++;
-
- var result;
- try {
- result = eval(test);
-
- if (result == expected) {
- testrun.passes++
- testrun.report(" OK "+testrun.count+" - "+((message != null)? message : ""));
- }
- else {
- testrun.fails++
- testrun.report("NOT OK "+testrun.count+" - "+((message != null)? message : ""));
- testrun.report("expected: "+expected);
- testrun.report(" got: "+result);
- }
- }
- catch(e) {
- testrun.fails++
- testrun.report("NOT OK "+testrun.count+" - "+((message != null)? message : ""));
- testrun.report("expected: "+expected);
- testrun.report(" got: "+result);}
-}
-
-/**
- Check if test matches pattern.
- @param {string} test To be evaluated.
- @param {string} pattern Used to create a RegExp.
- @param {string} message Optional. To be displayed in the report.
- @return {boolean} True if test matches pattern.
-*/
-like = function(test, pattern, message) {
- testrun.count++;
-
- var result;
- try {
- result = eval(test);
- var rgx = new RegExp(pattern);
-
- if (rgx.test(result)) {
- testrun.passes++
- testrun.report(" OK "+testrun.count+" - "+((message != null)? message : ""));
- }
- else {
- testrun.fails++
- testrun.report("NOT OK "+testrun.count+" - "+((message != null)? message : ""));
- testrun.report(" this: "+result);
- testrun.report("is not like: "+pattern);
- }
- }
- catch(e) {
- testrun.fails++
- testrun.report("NOT OK "+testrun.count+" - "+((message != null)? message : ""));
- }
-} \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/handlers/FOODOC.js b/utils/jsdoc-toolkit/app/handlers/FOODOC.js
deleted file mode 100755
index b208f55..0000000
--- a/utils/jsdoc-toolkit/app/handlers/FOODOC.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- This is the main container for the FOODOC handler.
- @namespace
-*/
-FOODOC = {
-};
-
-/** The current version string of this application. */
-FOODOC.VERSION = "1.0";
-
-FOODOC.handle = function(srcFile, src) {
- LOG.inform("Handling file '" + srcFile + "'");
-
- return [
- new JSDOC.Symbol(
- "foo",
- [],
- "VIRTUAL",
- new JSDOC.DocComment("/** This is a foo. */")
- )
- ];
-};
-
-FOODOC.publish = function(symbolgroup) {
- LOG.inform("Publishing symbolgroup.");
-};
diff --git a/utils/jsdoc-toolkit/app/handlers/XMLDOC.js b/utils/jsdoc-toolkit/app/handlers/XMLDOC.js
deleted file mode 100755
index 40f87b3..0000000
--- a/utils/jsdoc-toolkit/app/handlers/XMLDOC.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * This is the main container for the XMLDOC handler.
- * @namespace
- * @author Brett Fattori (bfattori@fry.com)
- * @version $Revision: 498 $
- */
-XMLDOC = {
-
-};
-
-/** The current version string of this application. */
-XMLDOC.VERSION = "1.0";
-
-/** Include the library necessary to handle XML files */
-IO.includeDir("handlers/XMLDOC/");
-
-/**
- * @type Symbol[]
- */
-XMLDOC.handle = function(srcFile, src) {
-
-};
-
-XMLDOC.publish = function(symbolgroup) {
-
-} \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/handlers/XMLDOC/DomReader.js b/utils/jsdoc-toolkit/app/handlers/XMLDOC/DomReader.js
deleted file mode 100755
index 240563d..0000000
--- a/utils/jsdoc-toolkit/app/handlers/XMLDOC/DomReader.js
+++ /dev/null
@@ -1,159 +0,0 @@
-LOG.inform("XMLDOC.DomReader loaded");
-
-XMLDOC.DomReader = function(root) {
-
- this.dom = root;
-
- /**
- * The current node the reader is on
- */
- this.node = root;
-
- /**
- * Get the current node the reader is on
- * @type XMLDOC.Parser.node
- */
- XMLDOC.DomReader.prototype.getNode = function() {
- return this.node;
- };
-
- /**
- * Set the node the reader should be positioned on.
- * @param node {XMLDOC.Parser.node}
- */
- XMLDOC.DomReader.prototype.setNode = function(node) {
- this.node = node;
- };
-
- /**
- * A helper method to make sure the current node will
- * never return null, unless null is passed as the root.
- * @param step {String} An expression to evaluate - should return a node or null
- */
- XMLDOC.DomReader.prototype.navigate = function(step) {
- var n;
- if ((n = step) != null)
- {
- this.node = n;
- return this.node;
- }
- return null;
- };
-
- /**
- * Get the root node of the current node's document.
- */
- XMLDOC.DomReader.prototype.root = function() {
- this.navigate(this.dom);
- };
-
- /**
- * Get the parent of the current node.
- */
- XMLDOC.DomReader.prototype.parent = function() {
- return this.navigate(this.node.parentNode());
- };
-
- /**
- * Get the first child of the current node.
- */
- XMLDOC.DomReader.prototype.firstChild = function() {
- return this.navigate(this.node.firstChild());
- };
-
- /**
- * Get the last child of the current node.
- */
- XMLDOC.DomReader.prototype.lastChild = function() {
- return this.navigate(this.node.lastChild());
- };
-
- /**
- * Get the next sibling of the current node.
- */
- XMLDOC.DomReader.prototype.nextSibling = function() {
- return this.navigate(this.node.nextSibling());
- };
-
- /**
- * Get the previous sibling of the current node.
- */
- XMLDOC.DomReader.prototype.prevSibling = function() {
- return this.navigate(this.node.prevSibling());
- };
-
- //===============================================================================================
- // Support methods
-
- /**
- * Walk the tree starting with the current node, calling the plug-in for
- * each node visited. Each time the plug-in is called, the DomReader
- * is passed as the only parameter. Use the {@link XMLDOC.DomReader#getNode} method
- * to access the current node. <i>This method uses a depth first traversal pattern.</i>
- *
- * @param srcFile {String} The source file being evaluated
- */
- XMLDOC.DomReader.prototype.getSymbols = function(srcFile)
- {
- XMLDOC.DomReader.symbols = [];
- XMLDOC.DomReader.currentFile = srcFile;
- JSDOC.Symbol.srcFile = (srcFile || "");
-
- if (defined(JSDOC.PluginManager)) {
- JSDOC.PluginManager.run("onDomGetSymbols", this);
- }
-
- return XMLDOC.DomReader.symbols;
- };
-
- /**
- * Find the node with the given name using a depth first traversal.
- * Does not modify the DomReader's current node.
- *
- * @param name {String} The name of the node to find
- * @return the node that was found, or null if not found
- */
- XMLDOC.DomReader.prototype.findNode = function(name)
- {
- var findNode = null;
-
- // Start at the current node and move into the subtree,
- // looking for the node with the given name
- function deeper(node, find)
- {
- var look = null;
-
- if (node) {
- if (node.name == find)
- {
- return node;
- }
-
- if (node.firstChild())
- {
- look = deeper(node.firstChild(), find);
- }
-
- if (!look && node.nextSibling())
- {
- look = deeper(node.nextSibling(), find);
- }
- }
-
- return look;
- }
-
- return deeper(this.getNode().firstChild(), name);
- };
-
- /**
- * Find the next node with the given name using a depth first traversal.
- *
- * @param name {String} The name of the node to find
- */
- XMLDOC.DomReader.prototype.findPreviousNode = function(name)
- {
- };
-
-};
-
diff --git a/utils/jsdoc-toolkit/app/handlers/XMLDOC/XMLDoc.js b/utils/jsdoc-toolkit/app/handlers/XMLDOC/XMLDoc.js
deleted file mode 100755
index e9b3e3c..0000000
--- a/utils/jsdoc-toolkit/app/handlers/XMLDOC/XMLDoc.js
+++ /dev/null
@@ -1,16 +0,0 @@
-LOG.inform("XMLDOC.symbolize loaded");
-
-/**
- * Convert the source file to a set of symbols
- */
-XMLDOC.symbolize = function(srcFile, src) {
-
- LOG.inform("Symbolizing file '" + srcFile + "'");
-
- // XML files already have a defined structure, so we don't need to
- // do anything but parse them. The DOM reader can create a symbol
- // table from the parsed XML.
- var dr = new XMLDOC.DomReader(XMLDOC.Parser.parse(src));
- return dr.getSymbols(srcFile);
-
-};
diff --git a/utils/jsdoc-toolkit/app/handlers/XMLDOC/XMLParse.js b/utils/jsdoc-toolkit/app/handlers/XMLDOC/XMLParse.js
deleted file mode 100755
index 78e8f45..0000000
--- a/utils/jsdoc-toolkit/app/handlers/XMLDOC/XMLParse.js
+++ /dev/null
@@ -1,292 +0,0 @@
-LOG.inform("XMLDOC.Parser loaded");
-
-/**
- * XML Parser object. Returns an {@link #XMLDOC.Parser.node} which is
- * the root element of the parsed document.
- * <p/>
- * By default, this parser will only handle well formed XML. To
- * allow the parser to handle HTML, set the <tt>XMLDOC.Parser.strictMode</tt>
- * variable to <tt>false</tt> before calling <tt>XMLDOC.Parser.parse()</tt>.
- * <p/>
- * <i>Note: If you pass poorly formed XML, it will cause the parser to throw
- * an exception.</i>
- *
- * @author Brett Fattori (bfattori@fry.com)
- * @author $Author: micmath $
- * @version $Revision: 497 $
- */
-XMLDOC.Parser = {};
-
-/**
- * Strict mode setting. Setting this to false allows HTML-style source to
- * be parsed. Normally, well formed XML has defined end tags, or empty tags
- * are properly formed. Default: <tt>true</tt>
- * @type Boolean
- */
-XMLDOC.Parser.strictMode = true;
-
-/**
- * A node in an XML Document. Node types are ROOT, ELEMENT, COMMENT, PI, and TEXT.
- * @param parent {XMLDOC.Parser.node} The parent node
- * @param name {String} The node name
- * @param type {String} One of the types
- */
-XMLDOC.Parser.node = function(parent, name, type)
-{
- this.name = name;
- this.type = type || "ELEMENT";
- this.parent = parent;
- this.charData = "";
- this.attrs = {};
- this.nodes = [];
- this.cPtr = 0;
-
- XMLDOC.Parser.node.prototype.getAttributeNames = function() {
- var a = [];
- for (var o in this.attrs)
- {
- a.push(o);
- }
-
- return a;
- };
-
- XMLDOC.Parser.node.prototype.getAttribute = function(attr) {
- return this.attrs[attr];
- };
-
- XMLDOC.Parser.node.prototype.setAttribute = function(attr, val) {
- this.attrs[attr] = val;
- };
-
- XMLDOC.Parser.node.prototype.getChild = function(idx) {
- return this.nodes[idx];
- };
-
- XMLDOC.Parser.node.prototype.parentNode = function() {
- return this.parent;
- };
-
- XMLDOC.Parser.node.prototype.firstChild = function() {
- return this.nodes[0];
- };
-
- XMLDOC.Parser.node.prototype.lastChild = function() {
- return this.nodes[this.nodes.length - 1];
- };
-
- XMLDOC.Parser.node.prototype.nextSibling = function() {
- var p = this.parent;
- if (p && (p.nodes.indexOf(this) + 1 != p.nodes.length))
- {
- return p.getChild(p.nodes.indexOf(this) + 1);
- }
- return null;
- };
-
- XMLDOC.Parser.node.prototype.prevSibling = function() {
- var p = this.parent;
- if (p && (p.nodes.indexOf(this) - 1 >= 0))
- {
- return p.getChild(p.nodes.indexOf(this) - 1);
- }
- return null;
- };
-};
-
-/**
- * Parse an XML Document from the specified source. The XML should be
- * well formed, unless strict mode is disabled, then the parser will
- * handle HTML-style XML documents.
- * @param src {String} The source to parse
- */
-XMLDOC.Parser.parse = function(src)
-{
- var A = [];
-
- // Normailize whitespace
- A = src.split("\r\n");
- src = A.join("\n");
- A = src.split("\r");
- src = A.join("\n");
-
- // Remove XML and DOCTYPE specifier
- src.replace(/<\?XML .*\?>/i, "");
- src.replace(/<!DOCTYPE .*\>/i, "");
-
- // The document is the root node and cannot be modified or removed
- var doc = new XMLDOC.Parser.node(null, "ROOT", "DOCUMENT");
-
- // Let's break it down
- XMLDOC.Parser.eat(doc, src);
-
- return doc;
-};
-
-/**
- * The XML fragment processing routine. This method is private and should not be called
- * directly.
- * @param parentNode {XMLDOC.Parser.node} The node which is the parent of this fragment
- * @param src {String} The source within the fragment to process
- * @private
- */
-XMLDOC.Parser.eat = function(parentNode, src)
-{
- // A simple tag def
- var reTag = new RegExp("<(!|)(\\?|--|)((.|\\s)*?)\\2>","g");
-
- // Special tag types
- var reCommentTag = /<!--((.|\s)*?)-->/;
- var rePITag = /<\?((.|\s)*?)\?>/;
-
- // A start tag (with potential empty marker)
- var reStartTag = /<(.*?)( +([\w_\-]*)=(\"|')(.*)\4)*(\/)?>/;
-
- // An empty HTML style tag (not proper XML, but we'll accept it so we can process HTML)
- var reHTMLEmptyTag = /<(.*?)( +([\w_\-]*)=(\"|')(.*)\4)*>/;
-
- // Fully enclosing tag with nested tags
- var reEnclosingTag = /<(.*?)( +([\w_\-]*)=(\"|')(.*?)\4)*>((.|\s)*?)<\/\1>/;
-
- // Breaks down attributes
- var reAttributes = new RegExp(" +([\\w_\\-]*)=(\"|')(.*?)\\2","g");
-
- // Find us a tag
- var tag;
- while ((tag = reTag.exec(src)) != null)
- {
- if (tag.index > 0)
- {
- // The next tag has some text before it
- var text = src.substring(0, tag.index).replace(/^[ \t\n]+((.|\n)*?)[ \t\n]+$/, "$1");
-
- if (text.length > 0 && (text != "\n"))
- {
- var txtnode = new XMLDOC.Parser.node(parentNode, "", "TEXT");
- txtnode.charData = text;
-
- // Append the new text node
- parentNode.nodes.push(txtnode);
- }
-
- // Reset the lastIndex of reTag
- reTag.lastIndex -= src.substring(0, tag.index).length;
-
- // Eat the text
- src = src.substring(tag.index);
- }
-
- if (reCommentTag.test(tag[0]))
- {
- // Is this a comment?
- var comment = new XMLDOC.Parser.node(parentNode, "", "COMMENT");
- comment.charData = reCommentTag.exec(tag[0])[1];
-
- // Append the comment
- parentNode.nodes.push(comment);
-
- // Move the lastIndex of reTag
- reTag.lastIndex -= tag[0].length;
-
- // Eat the tag
- src = src.replace(reCommentTag, "");
- }
- else if (rePITag.test(tag[0]))
- {
- // Is this a processing instruction?
- var pi = new XMLDOC.Parser.node(parentNode, "", "PI");
- pi.charData = rePITag.exec(tag[0])[1];
-
- // Append the processing instruction
- parentNode.nodes.push(pi);
-
- // Move the lastIndex of reTag
- reTag.lastIndex -= tag[0].length;
-
- // Eat the tag
- src = src.replace(rePITag, "");
- }
- else if (reStartTag.test(tag[0]))
- {
- // Break it down
- var e = reStartTag.exec(tag[0]);
- var elem = new XMLDOC.Parser.node(parentNode, e[1], "ELEMENT");
-
- // Get attributes from the tag
- var a;
- while ((a = reAttributes.exec(e[2])) != null )
- {
- elem.attrs[a[1]] = a[3];
- }
-
- // Is this an empty XML-style tag?
- if (e[6] == "/")
- {
- // Append the empty element
- parentNode.nodes.push(elem);
-
- // Move the lastIndex of reTag (include the start tag length)
- reTag.lastIndex -= e[0].length;
-
- // Eat the tag
- src = src.replace(reStartTag, "");
- }
- else
- {
- // Check for malformed XML tags
- var htmlParsed = false;
- var htmlStartTag = reHTMLEmptyTag.exec(src);
-
- // See if there isn't an end tag within this block
- var reHTMLEndTag = new RegExp("</" + htmlStartTag[1] + ">");
- var htmlEndTag = reHTMLEndTag.exec(src);
-
- if (XMLDOC.Parser.strictMode && htmlEndTag == null)
- {
- // Poorly formed XML fails in strict mode
- var err = new Error("Malformed XML passed to XMLDOC.Parser... Error contains malformed 'src'");
- err.src = src;
- throw err;
- }
- else if (htmlEndTag == null)
- {
- // This is an HTML-style empty tag, store the element for it in non-strict mode
- parentNode.nodes.push(elem);
-
- // Eat the tag
- src = src.replace(reHTMLEmptyTag, "");
- htmlParsed = true;
- }
-
- // If we didn't parse HTML-style, it must be an enclosing tag
- if (!htmlParsed)
- {
- var enc = reEnclosingTag.exec(src);
-
- // Go deeper into the document
- XMLDOC.Parser.eat(elem, enc[6]);
-
- // Append the new element node
- parentNode.nodes.push(elem);
-
- // Eat the tag
- src = src.replace(reEnclosingTag, "");
- }
- }
-
- // Reset the lastIndex of reTag
- reTag.lastIndex = 0;
- }
- }
-
- // No tag was found... append the text if there is any
- src = src.replace(/^[ \t\n]+((.|\n)*?)[ \t\n]+$/, "$1");
- if (src.length > 0 && (src != "\n"))
- {
- var txtNode = new XMLDOC.Parser.node(parentNode, "", "TEXT");
- txtNode.charData = src;
-
- // Append the new text node
- parentNode.nodes.push(txtNode);
- }
-};
diff --git a/utils/jsdoc-toolkit/app/lib/JSDOC.js b/utils/jsdoc-toolkit/app/lib/JSDOC.js
deleted file mode 100755
index 2dbc0a3..0000000
--- a/utils/jsdoc-toolkit/app/lib/JSDOC.js
+++ /dev/null
@@ -1,104 +0,0 @@
-/**
- @overview
- @date $Date: 2009-06-21 23:36:33 +0100 (Sun, 21 Jun 2009) $
- @version $Revision: 801 $
- @location $HeadURL: https://jsdoc-toolkit.googlecode.com/svn/trunk/jsdoc-toolkit/app/lib/JSDOC.js $
- @name JSDOC.js
- */
-
-/**
- This is the main container for the JSDOC application.
- @namespace
-*/
-JSDOC = {
-};
-
-/**
- @requires Opt
- */
-if (typeof arguments == "undefined") arguments = [];
-JSDOC.opt = Opt.get(
- arguments,
- {
- a: "allfunctions",
- c: "conf",
- d: "directory",
- "D[]": "define",
- e: "encoding",
- "E[]": "exclude",
- h: "help",
- n: "nocode",
- o: "out",
- p: "private",
- q: "quiet",
- r: "recurse",
- S: "securemodules",
- s: "suppress",
- t: "template",
- T: "testmode",
- u: "unique",
- v: "verbose",
- x: "ext"
- }
-);
-
-/** The current version string of this application. */
-JSDOC.VERSION = "2.3.0";
-
-/** Print out usage information and quit. */
-JSDOC.usage = function() {
- print("USAGE: java -jar jsrun.jar app/run.js [OPTIONS] <SRC_DIR> <SRC_FILE> ...");
- print("");
- print("OPTIONS:");
- print(" -a or --allfunctions\n Include all functions, even undocumented ones.\n");
- print(" -c or --conf\n Load a configuration file.\n");
- print(" -d=<PATH> or --directory=<PATH>\n Output to this directory (defaults to \"out\").\n");
- print(" -D=\"myVar:My value\" or --define=\"myVar:My value\"\n Multiple. Define a variable, available in JsDoc as JSDOC.opt.D.myVar.\n");
- print(" -e=<ENCODING> or --encoding=<ENCODING>\n Use this encoding to read and write files.\n");
- print(" -E=\"REGEX\" or --exclude=\"REGEX\"\n Multiple. Exclude files based on the supplied regex.\n");
- print(" -h or --help\n Show this message and exit.\n");
- print(" -n or --nocode\n Ignore all code, only document comments with @name tags.\n");
- print(" -o=<PATH> or --out=<PATH>\n Print log messages to a file (defaults to stdout).\n");
- print(" -p or --private\n Include symbols tagged as private, underscored and inner symbols.\n");
- print(" -q or --quiet\n Do not output any messages, not even warnings.\n");
- print(" -r=<DEPTH> or --recurse=<DEPTH>\n Descend into src directories.\n");
- print(" -s or --suppress\n Suppress source code output.\n");
- print(" -S or --securemodules\n Use Secure Modules mode to parse source code.\n");
- print(" -t=<PATH> or --template=<PATH>\n Required. Use this template to format the output.\n");
- print(" -T or --test\n Run all unit tests and exit.\n");
- print(" -u or --unique\n Force file names to be unique, but not based on symbol names.\n");
- print(" -v or --verbose\n Provide verbose feedback about what is happening.\n");
- print(" -x=<EXT>[,EXT]... or --ext=<EXT>[,EXT]...\n Scan source files with the given extension/s (defaults to js).\n");
-
- quit();
-}
-
-/*t:
- plan(4, "Testing JSDOC namespace.");
-
- is(
- typeof JSDOC,
- "object",
- "JSDOC.usage is a function."
- );
-
- is(
- typeof JSDOC.VERSION,
- "string",
- "JSDOC.VERSION is a string."
- );
-
- is(
- typeof JSDOC.usage,
- "function",
- "JSDOC.usage is a function."
- );
-
- is(
- typeof JSDOC.opt,
- "object",
- "JSDOC.opt is a object."
- );
- */
-
-if (this.IO) IO.includeDir("lib/JSDOC/");
diff --git a/utils/jsdoc-toolkit/app/lib/JSDOC/DocComment.js b/utils/jsdoc-toolkit/app/lib/JSDOC/DocComment.js
deleted file mode 100755
index c6c8d7d..0000000
--- a/utils/jsdoc-toolkit/app/lib/JSDOC/DocComment.js
+++ /dev/null
@@ -1,200 +0,0 @@
-if (typeof JSDOC == "undefined") JSDOC = {};
-
-/**
- Create a new DocComment. This takes a raw documentation comment,
- and wraps it in useful accessors.
- @class Represents a documentation comment object.
- */
-JSDOC.DocComment = function(/**String*/comment) {
- this.init();
- if (typeof comment != "undefined") {
- this.parse(comment);
- }
-}
-
-JSDOC.DocComment.prototype.init = function() {
- this.isUserComment = true;
- this.src = "";
- this.meta = "";
- this.tagTexts = [];
- this.tags = [];
-}
-
-/**
- @requires JSDOC.DocTag
- */
-JSDOC.DocComment.prototype.parse = function(/**String*/comment) {
- if (comment == "") {
- comment = "/** @desc */";
- this.isUserComment = false;
- }
-
- this.src = JSDOC.DocComment.unwrapComment(comment);
-
- this.meta = "";
- if (this.src.indexOf("#") == 0) {
- this.src.match(/#(.+[+-])([\s\S]*)$/);
- if (RegExp.$1) this.meta = RegExp.$1;
- if (RegExp.$2) this.src = RegExp.$2;
- }
-
- if (typeof JSDOC.PluginManager != "undefined") {
- JSDOC.PluginManager.run("onDocCommentSrc", this);
- }
-
- this.fixDesc();
-
- this.src = JSDOC.DocComment.shared+"\n"+this.src;
-
- this.tagTexts =
- this.src
- .split(/(^|[\r\n])\s*@/)
- .filter(function($){return $.match(/\S/)});
-
- /**
- The tags found in the comment.
- @type JSDOC.DocTag[]
- */
- this.tags = this.tagTexts.map(function($){return new JSDOC.DocTag($)});
-
- if (typeof JSDOC.PluginManager != "undefined") {
- JSDOC.PluginManager.run("onDocCommentTags", this);
- }
-}
-
-/*t:
- plan(5, "testing JSDOC.DocComment");
- requires("../frame/String.js");
- requires("../lib/JSDOC/DocTag.js");
-
- var com = new JSDOC.DocComment("/**@foo some\n* comment here*"+"/");
- is(com.tagTexts[0], "foo some\ncomment here", "first tag text is found.");
- is(com.tags[0].title, "foo", "the title is found in a comment with one tag.");
-
- var com = new JSDOC.DocComment("/** @foo first\n* @bar second*"+"/");
- is(com.getTag("bar").length, 1, "getTag() returns one tag by that title.");
-
- JSDOC.DocComment.shared = "@author John Smith";
- var com = new JSDOC.DocComment("/**@foo some\n* comment here*"+"/");
- is(com.tags[0].title, "author", "shared comment is added.");
- is(com.tags[1].title, "foo", "shared comment is added to existing tag.");
-*/
-
-/**
- If no @desc tag is provided, this function will add it.
- */
-JSDOC.DocComment.prototype.fixDesc = function() {
- if (this.meta && this.meta != "@+") return;
- if (/^\s*[^@\s]/.test(this.src)) {
- this.src = "@desc "+this.src;
- }
-}
-
-/*t:
- plan(5, "testing JSDOC.DocComment#fixDesc");
-
- var com = new JSDOC.DocComment();
-
- com.src = "this is a desc\n@author foo";
- com.fixDesc();
- is(com.src, "@desc this is a desc\n@author foo", "if no @desc tag is provided one is added.");
-
- com.src = "x";
- com.fixDesc();
- is(com.src, "@desc x", "if no @desc tag is provided one is added to a single character.");
-
- com.src = "\nx";
- com.fixDesc();
- is(com.src, "@desc \nx", "if no @desc tag is provided one is added to return and character.");
-
- com.src = " ";
- com.fixDesc();
- is(com.src, " ", "if no @desc tag is provided one is not added to just whitespace.");
-
- com.src = "";
- com.fixDesc();
- is(com.src, "", "if no @desc tag is provided one is not added to empty.");
-*/
-
-/**
- Remove slash-star comment wrapper from a raw comment string.
- @type String
- */
-JSDOC.DocComment.unwrapComment = function(/**String*/comment) {
- if (!comment) return "";
- var unwrapped = comment.replace(/(^\/\*\*|\*\/$)/g, "").replace(/^\s*\* ?/gm, "");
- return unwrapped;
-}
-
-/*t:
- plan(5, "testing JSDOC.DocComment.unwrapComment");
-
- var com = "/**x*"+"/";
- var unwrapped = JSDOC.DocComment.unwrapComment(com);
- is(unwrapped, "x", "a single character jsdoc is found.");
-
- com = "/***x*"+"/";
- unwrapped = JSDOC.DocComment.unwrapComment(com);
- is(unwrapped, "x", "three stars are allowed in the opener.");
-
- com = "/****x*"+"/";
- unwrapped = JSDOC.DocComment.unwrapComment(com);
- is(unwrapped, "*x", "fourth star in the opener is kept.");
-
- com = "/**x\n * y\n*"+"/";
- unwrapped = JSDOC.DocComment.unwrapComment(com);
- is(unwrapped, "x\ny\n", "leading stars and spaces are trimmed.");
-
- com = "/**x\n * y\n*"+"/";
- unwrapped = JSDOC.DocComment.unwrapComment(com);
- is(unwrapped, "x\n y\n", "only first space after leading stars are trimmed.");
-*/
-
-/**
- Provides a printable version of the comment.
- @type String
- */
-JSDOC.DocComment.prototype.toString = function() {
- return this.src;
-}
-
-/*t:
- plan(1, "testing JSDOC.DocComment#fixDesc");
- var com = new JSDOC.DocComment();
- com.src = "foo";
- is(""+com, "foo", "stringifying a comment returns the unwrapped src.");
-*/
-
-/**
- Given the title of a tag, returns all tags that have that title.
- @type JSDOC.DocTag[]
- */
-JSDOC.DocComment.prototype.getTag = function(/**String*/tagTitle) {
- return this.tags.filter(function($){return $.title == tagTitle});
-}
-
-/*t:
- plan(1, "testing JSDOC.DocComment#getTag");
- requires("../frame/String.js");
- requires("../lib/JSDOC/DocTag.js");
-
- var com = new JSDOC.DocComment("/**@foo some\n* @bar\n* @bar*"+"/");
- is(com.getTag("bar").length, 2, "getTag returns expected number of tags.");
-*/
-
-/**
- Used to store the currently shared tag text.
-*/
-JSDOC.DocComment.shared = "";
-
-/*t:
- plan(2, "testing JSDOC.DocComment.shared");
- requires("../frame/String.js");
- requires("../lib/JSDOC/DocTag.js");
-
- JSDOC.DocComment.shared = "@author Michael";
-
- var com = new JSDOC.DocComment("/**@foo\n* @foo*"+"/");
- is(com.getTag("author").length, 1, "getTag returns shared tag.");
- is(com.getTag("foo").length, 2, "getTag returns unshared tags too.");
-*/ \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/lib/JSDOC/DocTag.js b/utils/jsdoc-toolkit/app/lib/JSDOC/DocTag.js
deleted file mode 100755
index 77ec07c..0000000
--- a/utils/jsdoc-toolkit/app/lib/JSDOC/DocTag.js
+++ /dev/null
@@ -1,294 +0,0 @@
-if (typeof JSDOC == "undefined") JSDOC = {};
-
-/**
- @constructor
- */
-JSDOC.DocTag = function(src) {
- this.init();
- if (typeof src != "undefined") {
- this.parse(src);
- }
-}
-
-/**
- Create and initialize the properties of this.
- */
-JSDOC.DocTag.prototype.init = function() {
- this.title = "";
- this.type = "";
- this.name = "";
- this.isOptional = false;
- this.defaultValue = "";
- this.desc = "";
-
- return this;
-}
-
-/**
- Populate the properties of this from the given tag src.
- @param {string} src
- */
-JSDOC.DocTag.prototype.parse = function(src) {
- if (typeof src != "string") throw "src must be a string not "+(typeof src);
-
- try {
- src = this.nibbleTitle(src);
- if (JSDOC.PluginManager) {
- JSDOC.PluginManager.run("onDocTagSynonym", this);
- }
-
- src = this.nibbleType(src);
-
- // only some tags are allowed to have names.
- if (this.title == "param" || this.title == "property" || this.title == "config") { // @config is deprecated
- src = this.nibbleName(src);
- }
- }
- catch(e) {
- if (LOG) LOG.warn(e);
- else throw e;
- }
- this.desc = src; // whatever is left
-
- // example tags need to have whitespace preserved
- if (this.title != "example") this.desc = this.desc.trim();
-
- if (JSDOC.PluginManager) {
- JSDOC.PluginManager.run("onDocTag", this);
- }
-}
-
-/**
- Automatically called when this is stringified.
- */
-JSDOC.DocTag.prototype.toString = function() {
- return this.desc;
-}
-
-/*t:
- plan(1, "testing JSDOC.DocTag#toString");
-
- var tag = new JSDOC.DocTag("param {object} date A valid date.");
- is(""+tag, "A valid date.", "stringifying a tag returns the desc.");
- */
-
-/**
- Find and shift off the title of a tag.
- @param {string} src
- @return src
- */
-JSDOC.DocTag.prototype.nibbleTitle = function(src) {
- if (typeof src != "string") throw "src must be a string not "+(typeof src);
-
- var parts = src.match(/^\s*(\S+)(?:\s([\s\S]*))?$/);
-
- if (parts && parts[1]) this.title = parts[1];
- if (parts && parts[2]) src = parts[2];
- else src = "";
-
- return src;
-}
-
-/*t:
- plan(8, "testing JSDOC.DocTag#nibbleTitle");
-
- var tag = new JSDOC.DocTag();
-
- tag.init().nibbleTitle("aTitleGoesHere");
- is(tag.title, "aTitleGoesHere", "a title can be found in a single-word string.");
-
- var src = tag.init().nibbleTitle("aTitleGoesHere and the rest");
- is(tag.title, "aTitleGoesHere", "a title can be found in a multi-word string.");
- is(src, "and the rest", "the rest is returned when the title is nibbled off.");
-
- src = tag.init().nibbleTitle("");
- is(tag.title, "", "given an empty string the title is empty.");
- is(src, "", "the rest is empty when the tag is empty.");
-
- var src = tag.init().nibbleTitle(" aTitleGoesHere\n a description");
- is(tag.title, "aTitleGoesHere", "leading and trailing spaces are not part of the title.");
- is(src, " a description", "leading spaces (less one) are part of the description.");
-
- tag.init().nibbleTitle("a.Title::Goes_Here foo");
- is(tag.title, "a.Title::Goes_Here", "titles with punctuation are allowed.");
- */
-
-/**
- Find and shift off the type of a tag.
- @requires frame/String.js
- @param {string} src
- @return src
- */
-JSDOC.DocTag.prototype.nibbleType = function(src) {
- if (typeof src != "string") throw "src must be a string not "+(typeof src);
-
- if (src.match(/^\s*\{/)) {
- var typeRange = src.balance("{", "}");
- if (typeRange[1] == -1) {
- throw "Malformed comment tag ignored. Tag type requires an opening { and a closing }: "+src;
- }
- this.type = src.substring(typeRange[0]+1, typeRange[1]).trim();
- this.type = this.type.replace(/\s*,\s*/g, "|"); // multiples can be separated by , or |
- src = src.substring(typeRange[1]+1);
- }
-
- return src;
-}
-
-/*t:
- plan(5, "testing JSDOC.DocTag.parser.nibbleType");
- requires("../frame/String.js");
-
- var tag = new JSDOC.DocTag();
-
- tag.init().nibbleType("{String[]} aliases");
- is(tag.type, "String[]", "type can have non-alpha characters.");
-
- tag.init().nibbleType("{ aTypeGoesHere } etc etc");
- is(tag.type, "aTypeGoesHere", "type is trimmed.");
-
- tag.init().nibbleType("{ oneType, twoType ,\n threeType } etc etc");
- is(tag.type, "oneType|twoType|threeType", "multiple types can be separated by commas.");
-
- var error;
- try { tag.init().nibbleType("{widget foo"); }
- catch(e) { error = e; }
- is(typeof error, "string", "malformed tag type throws error.");
- isnt(error.indexOf("Malformed"), -1, "error message tells tag is malformed.");
- */
-
-/**
- Find and shift off the name of a tag.
- @requires frame/String.js
- @param {string} src
- @return src
- */
-JSDOC.DocTag.prototype.nibbleName = function(src) {
- if (typeof src != "string") throw "src must be a string not "+(typeof src);
-
- src = src.trim();
-
- // is optional?
- if (src.charAt(0) == "[") {
- var nameRange = src.balance("[", "]");
- if (nameRange[1] == -1) {
- throw "Malformed comment tag ignored. Tag optional name requires an opening [ and a closing ]: "+src;
- }
- this.name = src.substring(nameRange[0]+1, nameRange[1]).trim();
- this.isOptional = true;
-
- src = src.substring(nameRange[1]+1);
-
- // has default value?
- var nameAndValue = this.name.split("=");
- if (nameAndValue.length) {
- this.name = nameAndValue.shift().trim();
- this.defaultValue = nameAndValue.join("=");
- }
- }
- else {
- var parts = src.match(/^(\S+)(?:\s([\s\S]*))?$/);
- if (parts) {
- if (parts[1]) this.name = parts[1];
- if (parts[2]) src = parts[2].trim();
- else src = "";
- }
- }
-
- return src;
-}
-
-/*t:
- requires("../frame/String.js");
- plan(9, "testing JSDOC.DocTag.parser.nibbleName");
-
- var tag = new JSDOC.DocTag();
-
- tag.init().nibbleName("[foo] This is a description.");
- is(tag.isOptional, true, "isOptional syntax is detected.");
- is(tag.name, "foo", "optional param name is found.");
-
- tag.init().nibbleName("[foo] This is a description.");
- is(tag.isOptional, true, "isOptional syntax is detected when no type.");
- is(tag.name, "foo", "optional param name is found when no type.");
-
- tag.init().nibbleName("[foo=7] This is a description.");
- is(tag.name, "foo", "optional param name is found when default value.");
- is(tag.defaultValue, 7, "optional param default value is found when default value.");
-
- //tag.init().nibbleName("[foo= a value] This is a description.");
- //is(tag.defaultValue, " a value", "optional param default value is found when default value has spaces (issue #112).");
-
- tag.init().nibbleName("[foo=[]] This is a description.");
- is(tag.defaultValue, "[]", "optional param default value is found when default value is [] (issue #95).");
-
- tag.init().nibbleName("[foo=a=b] This is a description.");
- is(tag.name, "foo", "optional param name is found when default value is a=b.");
- is(tag.defaultValue, "a=b", "optional param default value is found when default value is a=b.")
- */
-
-/*t:
- plan(32, "Testing JSDOC.DocTag.parser.");
- requires("../frame/String.js");
-
- var tag = new JSDOC.DocTag();
-
- is(typeof tag, "object", "JSDOC.DocTag.parser with an empty string returns an object.");
- is(typeof tag.title, "string", "returned object has a string property 'title'.");
- is(typeof tag.type, "string", "returned object has a string property 'type'.");
- is(typeof tag.name, "string", "returned object has a string property 'name'.");
- is(typeof tag.defaultValue, "string", "returned object has a string property 'defaultValue'.");
- is(typeof tag.isOptional, "boolean", "returned object has a boolean property 'isOptional'.");
- is(typeof tag.desc, "string", "returned object has a string property 'desc'.");
-
- tag = new JSDOC.DocTag("param {widget} foo");
- is(tag.title, "param", "param title is found.");
- is(tag.name, "foo", "param name is found when desc is missing.");
- is(tag.desc, "", "param desc is empty when missing.");
-
- tag = new JSDOC.DocTag("param {object} date A valid date.");
- is(tag.name, "date", "param name is found with a type.");
- is(tag.type, "object", "param type is found.");
- is(tag.desc, "A valid date.", "param desc is found with a type.");
-
- tag = new JSDOC.DocTag("param aName a description goes\n here.");
- is(tag.name, "aName", "param name is found without a type.");
- is(tag.desc, "a description goes\n here.", "param desc is found without a type.");
-
- tag = new JSDOC.DocTag("param {widget}");
- is(tag.name, "", "param name is empty when it is not given.");
-
- tag = new JSDOC.DocTag("param {widget} [foo] This is a description.");
- is(tag.name, "foo", "optional param name is found.");
-
- tag = new JSDOC.DocTag("return {aType} This is a description.");
- is(tag.type, "aType", "when return tag has no name, type is found.");
- is(tag.desc, "This is a description.", "when return tag has no name, desc is found.");
-
- tag = new JSDOC.DocTag("author Joe Coder <jcoder@example.com>");
- is(tag.title, "author", "author tag has a title.");
- is(tag.type, "", "the author tag has no type.");
- is(tag.name, "", "the author tag has no name.");
- is(tag.desc, "Joe Coder <jcoder@example.com>", "author tag has desc.");
-
- tag = new JSDOC.DocTag("private \t\n ");
- is(tag.title, "private", "private tag has a title.");
- is(tag.type, "", "the private tag has no type.");
- is(tag.name, "", "the private tag has no name.");
- is(tag.desc, "", "private tag has no desc.");
-
- tag = new JSDOC.DocTag("example\n example(code);\n more();");
- is(tag.desc, " example(code);\n more();", "leading whitespace (less one) in examples code is preserved.");
-
- tag = new JSDOC.DocTag("param theName \n");
- is(tag.name, "theName", "name only is found.");
-
- tag = new JSDOC.DocTag("type theDesc \n");
- is(tag.desc, "theDesc", "desc only is found.");
-
- tag = new JSDOC.DocTag("type {theType} \n");
- is(tag.type, "theType", "type only is found.");
-
- tag = new JSDOC.DocTag("");
- is(tag.title, "", "title is empty when tag is empty.");
- */ \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/lib/JSDOC/JsDoc.js b/utils/jsdoc-toolkit/app/lib/JSDOC/JsDoc.js
deleted file mode 100755
index 2c4bfb8..0000000
--- a/utils/jsdoc-toolkit/app/lib/JSDOC/JsDoc.js
+++ /dev/null
@@ -1,126 +0,0 @@
-/**
- @constructor
- @param [opt] Used to override the commandline options. Useful for testing.
- @version $Id: JsDoc.js 773 2009-01-24 09:42:04Z micmath $
-*/
-JSDOC.JsDoc = function(/**object*/ opt) {
- if (opt) {
- JSDOC.opt = opt;
- }
-
- if (JSDOC.opt.h) {
- JSDOC.usage();
- quit();
- }
-
- // defend against options that are not sane
- if (JSDOC.opt._.length == 0) {
- LOG.warn("No source files to work on. Nothing to do.");
- quit();
- }
- if (JSDOC.opt.t === true || JSDOC.opt.d === true) {
- JSDOC.usage();
- }
-
- if (typeof JSDOC.opt.d == "string") {
- if (!JSDOC.opt.d.charAt(JSDOC.opt.d.length-1).match(/[\\\/]/)) {
- JSDOC.opt.d = JSDOC.opt.d+"/";
- }
- LOG.inform("Output directory set to '"+JSDOC.opt.d+"'.");
- IO.mkPath(JSDOC.opt.d);
- }
- if (JSDOC.opt.e) IO.setEncoding(JSDOC.opt.e);
-
- // the -r option: scan source directories recursively
- if (typeof JSDOC.opt.r == "boolean") JSDOC.opt.r = 10;
- else if (!isNaN(parseInt(JSDOC.opt.r))) JSDOC.opt.r = parseInt(JSDOC.opt.r);
- else JSDOC.opt.r = 1;
-
- // the -D option: define user variables
- var D = {};
- if (JSDOC.opt.D) {
- for (var i = 0; i < JSDOC.opt.D.length; i++) {
- var defineParts = JSDOC.opt.D[i].split(":", 2);
- if (defineParts) D[defineParts[0]] = defineParts[1];
- }
- }
- JSDOC.opt.D = D;
- // combine any conf file D options with the commandline D options
- if (defined(JSDOC.conf)) for (var c in JSDOC.conf.D) {
- if (!defined(JSDOC.opt.D[c])) {
- JSDOC.opt.D[c] = JSDOC.conf.D[c];
- }
- }
-
- // Give plugins a chance to initialize
- if (defined(JSDOC.PluginManager)) {
- JSDOC.PluginManager.run("onInit", JSDOC.opt);
- }
-
- JSDOC.opt.srcFiles = JSDOC.JsDoc._getSrcFiles();
- JSDOC.JsDoc._parseSrcFiles();
- JSDOC.JsDoc.symbolSet = JSDOC.Parser.symbols;
-}
-
-/**
- Retrieve source file list.
- @returns {String[]} The pathnames of the files to be parsed.
- */
-JSDOC.JsDoc._getSrcFiles = function() {
- JSDOC.JsDoc.srcFiles = [];
-
- var ext = ["js"];
- if (JSDOC.opt.x) {
- ext = JSDOC.opt.x.split(",").map(function($) {return $.toLowerCase()});
- }
-
- for (var i = 0; i < JSDOC.opt._.length; i++) {
- JSDOC.JsDoc.srcFiles = JSDOC.JsDoc.srcFiles.concat(
- IO.ls(JSDOC.opt._[i], JSDOC.opt.r).filter(
- function($) {
- var thisExt = $.split(".").pop().toLowerCase();
-
- if (JSDOC.opt.E) {
- for(var n = 0; n < JSDOC.opt.E.length; n++) {
- if ($.match(new RegExp(JSDOC.opt.E[n]))) {
- LOG.inform("Excluding " + $);
- return false; // if the file matches the regex then it's excluded.
- }
- }
- }
-
- return (ext.indexOf(thisExt) > -1); // we're only interested in files with certain extensions
- }
- )
- );
- }
-
- return JSDOC.JsDoc.srcFiles;
-}
-
-JSDOC.JsDoc._parseSrcFiles = function() {
- JSDOC.Parser.init();
- for (var i = 0, l = JSDOC.JsDoc.srcFiles.length; i < l; i++) {
- var srcFile = JSDOC.JsDoc.srcFiles[i];
-
- if (JSDOC.opt.v) LOG.inform("Parsing file: " + srcFile);
-
- try {
- var src = IO.readFile(srcFile);
- }
- catch(e) {
- LOG.warn("Can't read source file '"+srcFile+"': "+e.message);
- }
-
- var tr = new JSDOC.TokenReader();
- var ts = new JSDOC.TokenStream(tr.tokenize(new JSDOC.TextStream(src)));
-
- JSDOC.Parser.parse(ts, srcFile);
-
- }
- JSDOC.Parser.finish();
-
- if (JSDOC.PluginManager) {
- JSDOC.PluginManager.run("onFinishedParsing", JSDOC.Parser.symbols);
- }
-}
diff --git a/utils/jsdoc-toolkit/app/lib/JSDOC/JsPlate.js b/utils/jsdoc-toolkit/app/lib/JSDOC/JsPlate.js
deleted file mode 100755
index 79ac61f..0000000
--- a/utils/jsdoc-toolkit/app/lib/JSDOC/JsPlate.js
+++ /dev/null
@@ -1,109 +0,0 @@
-/**
- @constructor
-*/
-JSDOC.JsPlate = function(templateFile) {
- if (templateFile) this.template = IO.readFile(templateFile);
-
- this.templateFile = templateFile;
- this.code = "";
- this.parse();
-}
-
-JSDOC.JsPlate.prototype.parse = function() {
- this.template = this.template.replace(/\{#[\s\S]+?#\}/gi, "");
- this.code = "var output=``"+this.template;
-
- this.code = this.code.replace(
- /<for +each="(.+?)" +in="(.+?)" *>/gi,
- function (match, eachName, inName) {
- return "``;\rvar $"+eachName+"_keys = keys("+inName+");\rfor(var $"+eachName+"_i = 0; $"+eachName+"_i < $"+eachName+"_keys.length; $"+eachName+"_i++) {\rvar $"+eachName+"_last = ($"+eachName+"_i == $"+eachName+"_keys.length-1);\rvar $"+eachName+"_key = $"+eachName+"_keys[$"+eachName+"_i];\rvar "+eachName+" = "+inName+"[$"+eachName+"_key];\routput+=``";
- }
- );
- this.code = this.code.replace(/<if test="(.+?)">/g, "``;\rif ($1) { output+=``");
- this.code = this.code.replace(/<elseif test="(.+?)"\s*\/>/g, "``;}\relse if ($1) { output+=``");
- this.code = this.code.replace(/<else\s*\/>/g, "``;}\relse { output+=``");
- this.code = this.code.replace(/<\/(if|for)>/g, "``;\r};\routput+=``");
- this.code = this.code.replace(
- /\{\+\s*([\s\S]+?)\s*\+\}/gi,
- function (match, code) {
- code = code.replace(/"/g, "``"); // prevent qoute-escaping of inline code
- code = code.replace(/(\r?\n)/g, " ");
- return "``+ ("+code+") +``";
- }
- );
- this.code = this.code.replace(
- /\{!\s*([\s\S]+?)\s*!\}/gi,
- function (match, code) {
- code = code.replace(/"/g, "``"); // prevent qoute-escaping of inline code
- code = code.replace(/(\n)/g, " ");
- return "``; "+code+";\routput+=``";
- }
- );
- this.code = this.code+"``;";
-
- this.code = this.code.replace(/(\r?\n)/g, "\\n");
- this.code = this.code.replace(/"/g, "\\\"");
- this.code = this.code.replace(/``/g, "\"");
-}
-
-JSDOC.JsPlate.prototype.toCode = function() {
- return this.code;
-}
-
-JSDOC.JsPlate.keys = function(obj) {
- var keys = [];
- if (obj.constructor.toString().indexOf("Array") > -1) {
- for (var i = 0; i < obj.length; i++) {
- keys.push(i);
- }
- }
- else {
- for (var i in obj) {
- keys.push(i);
- }
- }
- return keys;
-};
-
-JSDOC.JsPlate.values = function(obj) {
- var values = [];
- if (obj.constructor.toString().indexOf("Array") > -1) {
- for (var i = 0; i < obj.length; i++) {
- values.push(obj[i]);
- }
- }
- else {
- for (var i in obj) {
- values.push(obj[i]);
- }
- }
- return values;
-};
-
-JSDOC.JsPlate.prototype.process = function(data, compact) {
- var keys = JSDOC.JsPlate.keys;
- var values = JSDOC.JsPlate.values;
-
- try {
- eval(this.code);
- }
- catch (e) {
- print(">> There was an error evaluating the compiled code from template: "+this.templateFile);
- print(" The error was on line "+e.lineNumber+" "+e.name+": "+e.message);
- var lines = this.code.split("\r");
- if (e.lineNumber-2 >= 0) print("line "+(e.lineNumber-1)+": "+lines[e.lineNumber-2]);
- print("line "+e.lineNumber+": "+lines[e.lineNumber-1]);
- print("");
- }
-
- if (compact) { // patch by mcbain.asm
- // Remove lines that contain only space-characters, usually left by lines in the template
- // which originally only contained JSPlate tags or code. This makes it easier to write
- // non-tricky templates which still put out nice code (not bloated with extra lines).
- // Lines purposely left blank (just a line ending) are left alone.
- output = output.replace(/\s+?(\r?)\n/g, "$1\n");
- }
-
- /*debug*///print(this.code);
- return output;
-} \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/lib/JSDOC/Lang.js b/utils/jsdoc-toolkit/app/lib/JSDOC/Lang.js
deleted file mode 100755
index 62919d7..0000000
--- a/utils/jsdoc-toolkit/app/lib/JSDOC/Lang.js
+++ /dev/null
@@ -1,144 +0,0 @@
-/**
- @namespace
-*/
-JSDOC.Lang = {
-}
-
-JSDOC.Lang.isBuiltin = function(name) {
- return (JSDOC.Lang.isBuiltin.coreObjects.indexOf(name) > -1);
-}
-JSDOC.Lang.isBuiltin.coreObjects = ['_global_', 'Array', 'Boolean', 'Date', 'Error', 'Function', 'Math', 'Number', 'Object', 'RegExp', 'String'];
-
-JSDOC.Lang.whitespace = function(ch) {
- return JSDOC.Lang.whitespace.names[ch];
-}
-JSDOC.Lang.whitespace.names = {
- " ": "SPACE",
- "\f": "FORMFEED",
- "\t": "TAB",
- "\u0009": "UNICODE_TAB",
- "\u000A": "UNICODE_NBR",
- "\u0008": "VERTICAL_TAB"
-};
-
-JSDOC.Lang.newline = function(ch) {
- return JSDOC.Lang.newline.names[ch];
-}
-JSDOC.Lang.newline.names = {
- "\n": "NEWLINE",
- "\r": "RETURN",
- "\u000A": "UNICODE_LF",
- "\u000D": "UNICODE_CR",
- "\u2029": "UNICODE_PS",
- "\u2028": "UNICODE_LS"
-};
-
-JSDOC.Lang.keyword = function(word) {
- return JSDOC.Lang.keyword.names["="+word];
-}
-JSDOC.Lang.keyword.names = {
- "=break": "BREAK",
- "=case": "CASE",
- "=catch": "CATCH",
- "=const": "VAR",
- "=continue": "CONTINUE",
- "=default": "DEFAULT",
- "=delete": "DELETE",
- "=do": "DO",
- "=else": "ELSE",
- "=false": "FALSE",
- "=finally": "FINALLY",
- "=for": "FOR",
- "=function": "FUNCTION",
- "=if": "IF",
- "=in": "IN",
- "=instanceof": "INSTANCEOF",
- "=new": "NEW",
- "=null": "NULL",
- "=return": "RETURN",
- "=switch": "SWITCH",
- "=this": "THIS",
- "=throw": "THROW",
- "=true": "TRUE",
- "=try": "TRY",
- "=typeof": "TYPEOF",
- "=void": "VOID",
- "=while": "WHILE",
- "=with": "WITH",
- "=var": "VAR"
-};
-
-JSDOC.Lang.punc = function(ch) {
- return JSDOC.Lang.punc.names[ch];
-}
-JSDOC.Lang.punc.names = {
- ";": "SEMICOLON",
- ",": "COMMA",
- "?": "HOOK",
- ":": "COLON",
- "||": "OR",
- "&&": "AND",
- "|": "BITWISE_OR",
- "^": "BITWISE_XOR",
- "&": "BITWISE_AND",
- "===": "STRICT_EQ",
- "==": "EQ",
- "=": "ASSIGN",
- "!==": "STRICT_NE",
- "!=": "NE",
- "<<": "LSH",
- "<=": "LE",
- "<": "LT",
- ">>>": "URSH",
- ">>": "RSH",
- ">=": "GE",
- ">": "GT",
- "++": "INCREMENT",
- "--": "DECREMENT",
- "+": "PLUS",
- "-": "MINUS",
- "*": "MUL",
- "/": "DIV",
- "%": "MOD",
- "!": "NOT",
- "~": "BITWISE_NOT",
- ".": "DOT",
- "[": "LEFT_BRACKET",
- "]": "RIGHT_BRACKET",
- "{": "LEFT_CURLY",
- "}": "RIGHT_CURLY",
- "(": "LEFT_PAREN",
- ")": "RIGHT_PAREN"
-};
-
-JSDOC.Lang.matching = function(name) {
- return JSDOC.Lang.matching.names[name];
-}
-JSDOC.Lang.matching.names = {
- "LEFT_PAREN": "RIGHT_PAREN",
- "RIGHT_PAREN": "LEFT_PAREN",
- "LEFT_CURLY": "RIGHT_CURLY",
- "RIGHT_CURLY": "LEFT_CURLY",
- "LEFT_BRACE": "RIGHT_BRACE",
- "RIGHT_BRACE": "LEFT_BRACE"
-}
-
-JSDOC.Lang.isNumber = function(str) {
- return /^(\.[0-9]|[0-9]+\.|[0-9])[0-9]*([eE][+-][0-9]+)?$/i.test(str);
-}
-
-JSDOC.Lang.isHexDec = function(str) {
- return /^0x[0-9A-F]+$/i.test(str);
-}
-
-JSDOC.Lang.isWordChar = function(str) {
- return /^[a-zA-Z0-9$_.]+$/.test(str);
-}
-
-JSDOC.Lang.isSpace = function(str) {
- return (typeof JSDOC.Lang.whitespace(str) != "undefined");
-}
-
-JSDOC.Lang.isNewline = function(str) {
- return (typeof JSDOC.Lang.newline(str) != "undefined");
-} \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/lib/JSDOC/Parser.js b/utils/jsdoc-toolkit/app/lib/JSDOC/Parser.js
deleted file mode 100755
index f407dd1..0000000
--- a/utils/jsdoc-toolkit/app/lib/JSDOC/Parser.js
+++ /dev/null
@@ -1,145 +0,0 @@
-if (typeof JSDOC == "undefined") JSDOC = {};
-
-/**
- @namespace
- @requires JSDOC.Walker
- @requires JSDOC.Symbol
- @requires JSDOC.DocComment
-*/
-JSDOC.Parser = {
- conf: {
- ignoreCode: JSDOC.opt.n,
- ignoreAnonymous: true, // factory: true
- treatUnderscoredAsPrivate: true, // factory: true
- explain: false // factory: false
- },
-
- addSymbol: function(symbol) {
-
-if (JSDOC.Parser.rename) {
- for (var n in JSDOC.Parser.rename) {
- if (symbol.alias.indexOf(n) == 0) {
- if (symbol.name == symbol.alias) {
- symbol.name = symbol.name.replace(n, JSDOC.Parser.rename[n]);
- }
- symbol.alias = symbol.alias.replace(n, JSDOC.Parser.rename[n]);
- }
- }
-}
-
-if (JSDOC.opt.S) {
- if (typeof JSDOC.Parser.secureModules == "undefined") JSDOC.Parser.secureModules = {};
- if (/^exports\./.test(symbol.alias)) {
- symbol.srcFile.match(/(^|[\\\/])([^\\\/]+)\.js/i);
- var fileNS = RegExp.$2;
- symbol.alias = symbol.alias.replace(/^exports\./, fileNS);
- symbol.name = symbol.name.replace(/^exports\./, "");
- symbol.memberOf = fileNS;
-
- // need to create the namespace associated with this file first
- if (!JSDOC.Parser.secureModules[fileNS]) {
- JSDOC.Parser.secureModules[fileNS] = 1;
- var nsSymbol = new JSDOC.Symbol(fileNS, [], "GLOBAL", new JSDOC.DocComment(""));
- nsSymbol.isNamespace = true;
- nsSymbol.srcFile = "";
- nsSymbol.isPrivate = false;
- nsSymbol.srcFile = symbol.srcFile;
- nsSymbol.desc = (JSDOC.Parser.symbols.getSymbol(symbol.srcFile) || {desc: ""}).desc;
- JSDOC.Parser.addSymbol(nsSymbol);
-
- }
- }
- else { // a method that is not exported?
- if (!symbol.isNamespace) return;
- }
-}
- // if a symbol alias is documented more than once the last one with the user docs wins
- if (JSDOC.Parser.symbols.hasSymbol(symbol.alias)) {
- var oldSymbol = JSDOC.Parser.symbols.getSymbol(symbol.alias);
- if (oldSymbol.comment.isUserComment) {
- if (symbol.comment.isUserComment) { // old and new are both documented
- LOG.warn("The symbol '"+symbol.alias+"' is documented more than once.");
- }
- else { // old is documented but new isn't
- return;
- }
- }
- }
-
- // we don't document anonymous things
- if (JSDOC.Parser.conf.ignoreAnonymous && symbol.name.match(/\$anonymous\b/)) return;
-
- // uderscored things may be treated as if they were marked private, this cascades
- if (JSDOC.Parser.conf.treatUnderscoredAsPrivate && symbol.name.match(/[.#-]_[^.#-]+$/)) {
- if (!symbol.comment.getTag("public").length > 0) symbol.isPrivate = true;
- }
-
- // -p flag is required to document private things
- if (!JSDOC.opt.p && symbol.isPrivate) return; // issue #161 fixed by mcbain.asm
-
- // ignored things are not documented, this doesn't cascade
- if (symbol.isIgnored) return;
- JSDOC.Parser.symbols.addSymbol(symbol);
- },
-
- addBuiltin: function(name) {
- var builtin = new JSDOC.Symbol(name, [], "CONSTRUCTOR", new JSDOC.DocComment(""));
- builtin.isNamespace = true;
- builtin.srcFile = "";
- builtin.isPrivate = false;
- JSDOC.Parser.addSymbol(builtin);
- return builtin;
- },
-
- init: function() {
- JSDOC.Parser.symbols = new JSDOC.SymbolSet();
- JSDOC.Parser.walker = new JSDOC.Walker();
- },
-
- finish: function() {
- JSDOC.Parser.symbols.relate();
-
- // make a litle report about what was found
- if (JSDOC.Parser.conf.explain) {
- var symbols = JSDOC.Parser.symbols.toArray();
- var srcFile = "";
- for (var i = 0, l = symbols.length; i < l; i++) {
- var symbol = symbols[i];
- if (srcFile != symbol.srcFile) {
- srcFile = symbol.srcFile;
- print("\n"+srcFile+"\n-------------------");
- }
- print(i+":\n alias => "+symbol.alias + "\n name => "+symbol.name+ "\n isa => "+symbol.isa + "\n memberOf => " + symbol.memberOf + "\n isStatic => " + symbol.isStatic + ", isInner => " + symbol.isInner+ ", isPrivate => " + symbol.isPrivate);
- }
- print("-------------------\n");
- }
- }
-}
-
-JSDOC.Parser.parse = function(/**JSDOC.TokenStream*/ts, /**String*/srcFile) {
- JSDOC.Symbol.srcFile = (srcFile || "");
- JSDOC.DocComment.shared = ""; // shared comments don't cross file boundaries
-
- if (!JSDOC.Parser.walker) JSDOC.Parser.init();
- JSDOC.Parser.walker.walk(ts); // adds to our symbols
-
- // filter symbols by option
- for (var p = JSDOC.Parser.symbols._index.first(); p; p = JSDOC.Parser.symbols._index.next()) {
- var symbol = p.value;
-
- if (!symbol) continue;
-
- if (symbol.is("FILE") || symbol.is("GLOBAL")) {
- continue;
- }
- else if (!JSDOC.opt.a && !symbol.comment.isUserComment) {
- JSDOC.Parser.symbols.deleteSymbol(symbol.alias);
- }
-
- if (/#$/.test(symbol.alias)) { // we don't document prototypes
- JSDOC.Parser.symbols.deleteSymbol(symbol.alias);
- }
- }
-
- return JSDOC.Parser.symbols.toArray();
-}
diff --git a/utils/jsdoc-toolkit/app/lib/JSDOC/PluginManager.js b/utils/jsdoc-toolkit/app/lib/JSDOC/PluginManager.js
deleted file mode 100755
index 9c91193..0000000
--- a/utils/jsdoc-toolkit/app/lib/JSDOC/PluginManager.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- @namespace Holds functionality related to running plugins.
-*/
-JSDOC.PluginManager = {
-}
-
-/**
- @param name A unique name that identifies that plugin.
- @param handlers A collection of named functions. The names correspond to hooks in the core code.
-*/
-JSDOC.PluginManager.registerPlugin = function(/**String*/name, /**Object*/handlers) {
- if (!defined(JSDOC.PluginManager.plugins))
- /** The collection of all plugins. Requires a unique name for each.
- */
- JSDOC.PluginManager.plugins = {};
-
-
- JSDOC.PluginManager.plugins[name] = handlers;
-}
-
-/**
- @param hook The name of the hook that is being caught.
- @param target Any object. This will be passed as the only argument to the handler whose
- name matches the hook name. Handlers cannot return a value, so must modify the target
- object to have an effect.
-*/
-JSDOC.PluginManager.run = function(/**String*/hook, /**Mixed*/target) {
- for (var name in JSDOC.PluginManager.plugins) {
- if (defined(JSDOC.PluginManager.plugins[name][hook])) {
- JSDOC.PluginManager.plugins[name][hook](target);
- }
- }
-}
diff --git a/utils/jsdoc-toolkit/app/lib/JSDOC/Symbol.js b/utils/jsdoc-toolkit/app/lib/JSDOC/Symbol.js
deleted file mode 100755
index c5b76a8..0000000
--- a/utils/jsdoc-toolkit/app/lib/JSDOC/Symbol.js
+++ /dev/null
@@ -1,645 +0,0 @@
-if (typeof JSDOC == "undefined") JSDOC = {};
-
-/**
- Create a new Symbol.
- @class Represents a symbol in the source code.
- */
-JSDOC.Symbol = function() {
- this.init();
- if (arguments.length) this.populate.apply(this, arguments);
-}
-
-JSDOC.Symbol.count = 0;
-
-JSDOC.Symbol.prototype.init = function() {
- this._name = "";
- this._params = [];
- this.$args = [];
- this.addOn = "";
- this.alias = "";
- this.augments = [];
- this.author = "";
- this.classDesc = "";
- this.comment = {};
- this.defaultValue = undefined;
- this.deprecated = "";
- this.desc = "";
- this.example = [];
- this.exceptions = [];
- this.fires = [];
- this.id = JSDOC.Symbol.count++;
- this.inherits = [];
- this.inheritsFrom = [];
- this.isa = "OBJECT";
- this.isConstant = false;
- this.isEvent = false;
- this.isIgnored = false;
- this.isInner = false;
- this.isNamespace = false;
- this.isPrivate = false;
- this.isStatic = false;
- this.memberOf = "";
- this.methods = [];
- this.properties = [];
- this.requires = [];
- this.returns = [];
- this.see = [];
- this.since = "";
- this.srcFile = {};
- this.type = "";
- this.version = "";
-}
-
-JSDOC.Symbol.prototype.serialize = function() {
- var keys = [];
- for (var p in this) {
- keys.push (p);
- }
- keys = keys.sort();
-
- var out = "";
- for (var i in keys) {
- if (typeof this[keys[i]] == "function") continue;
- out += keys[i]+" => "+Dumper.dump(this[keys[i]])+",\n";
- }
- return "\n{\n" + out + "}\n";
-}
-
-JSDOC.Symbol.prototype.clone = function() {
- var clone = new JSDOC.Symbol();
- clone.populate.apply(clone, this.$args); // repopulate using the original arguments
- clone.srcFile = this.srcFile; // not the current srcFile, the one when the original was made
- return clone;
-}
-
-JSDOC.Symbol.prototype.__defineSetter__("name",
- function(n) { n = n.replace(/^_global_[.#-]/, ""); n = n.replace(/\.prototype\.?/g, '#'); this._name = n; }
-);
-JSDOC.Symbol.prototype.__defineGetter__("name",
- function() { return this._name; }
-);
-JSDOC.Symbol.prototype.__defineSetter__("params",
- function(v) {
- for (var i = 0, l = v.length; i < l; i++) {
- if (v[i].constructor != JSDOC.DocTag) { // may be a generic object parsed from signature, like {type:..., name:...}
- this._params[i] = new JSDOC.DocTag("param"+((v[i].type)?" {"+v[i].type+"}":"")+" "+v[i].name);
- }
- else {
- this._params[i] = v[i];
- }
- }
- }
-);
-JSDOC.Symbol.prototype.__defineGetter__("params",
- function() { return this._params; }
-);
-
-JSDOC.Symbol.prototype.getEvents = function() {
- var events = [];
- for (var i = 0, l = this.methods.length; i < l; i++) {
- if (this.methods[i].isEvent) {
- this.methods[i].name = this.methods[i].name.replace("event:", "");
- events.push(this.methods[i]);
- }
- }
- return events;
-}
-
-JSDOC.Symbol.prototype.getMethods = function() {
- var nonEvents = [];
- for (var i = 0, l = this.methods.length; i < l; i++) {
- if (!this.methods[i].isEvent) {
- nonEvents.push(this.methods[i]);
- }
- }
- return nonEvents;
-}
-
-
-JSDOC.Symbol.prototype.populate = function(
- /** String */ name,
- /** Object[] */ params,
- /** String */ isa,
- /** JSDOC.DocComment */ comment
-) {
- this.$args = arguments;
-
- this.name = name;
- this.alias = this.name;
-
- this.params = params;
- this.isa = (isa == "VIRTUAL")? "OBJECT":isa;
- this.comment = comment || new JSDOC.DocComment("");
- this.srcFile = JSDOC.Symbol.srcFile;
-
- if (this.is("FILE") && !this.alias) this.alias = this.srcFile;
-
- this.setTags();
-
- if (typeof JSDOC.PluginManager != "undefined") {
- JSDOC.PluginManager.run("onSymbol", this);
- }
-}
-
-JSDOC.Symbol.prototype.setTags = function() {
- // @author
- var authors = this.comment.getTag("author");
- if (authors.length) {
- this.author = authors.map(function($){return $.desc;}).join(", ");
- }
-
- /*t:
- plan(34, "testing JSDOC.Symbol");
-
- requires("../lib/JSDOC/DocComment.js");
- requires("../frame/String.js");
- requires("../lib/JSDOC/DocTag.js");
-
- var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@author Joe Smith*"+"/"));
- is(sym.author, "Joe Smith", "@author tag, author is found.");
- */
-
- // @desc
- var descs = this.comment.getTag("desc");
- if (descs.length) {
- this.desc = descs.map(function($){return $.desc;}).join("\n"); // multiple descriptions are concatenated into one
- }
-
- /*t:
- var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@desc This is a description.*"+"/"));
- is(sym.desc, "This is a description.", "@desc tag, description is found.");
- */
-
- // @overview
- if (this.is("FILE")) {
- if (!this.alias) this.alias = this.srcFile;
-
- var overviews = this.comment.getTag("overview");
- if (overviews.length) {
- this.desc = [this.desc].concat(overviews.map(function($){return $.desc;})).join("\n");
- }
- }
-
- /*t:
- var sym = new JSDOC.Symbol("foo", [], "FILE", new JSDOC.DocComment("/**@overview This is an overview.*"+"/"));
- is(sym.desc, "\nThis is an overview.", "@overview tag, description is found.");
- */
-
- // @since
- var sinces = this.comment.getTag("since");
- if (sinces.length) {
- this.since = sinces.map(function($){return $.desc;}).join(", ");
- }
-
- /*t:
- var sym = new JSDOC.Symbol("foo", [], "FILE", new JSDOC.DocComment("/**@since 1.01*"+"/"));
- is(sym.since, "1.01", "@since tag, description is found.");
- */
-
- // @constant
- if (this.comment.getTag("constant").length) {
- this.isConstant = true;
- }
-
- /*t:
- var sym = new JSDOC.Symbol("foo", [], "FILE", new JSDOC.DocComment("/**@constant*"+"/"));
- is(sym.isConstant, true, "@constant tag, isConstant set.");
- */
-
- // @version
- var versions = this.comment.getTag("version");
- if (versions.length) {
- this.version = versions.map(function($){return $.desc;}).join(", ");
- }
-
- /*t:
- var sym = new JSDOC.Symbol("foo", [], "FILE", new JSDOC.DocComment("/**@version 2.0x*"+"/"));
- is(sym.version, "2.0x", "@version tag, version is found.");
- */
-
- // @deprecated
- var deprecateds = this.comment.getTag("deprecated");
- if (deprecateds.length) {
- this.deprecated = deprecateds.map(function($){return $.desc;}).join("\n");
- }
-
- /*t:
- var sym = new JSDOC.Symbol("foo", [], "FILE", new JSDOC.DocComment("/**@deprecated Use other method.*"+"/"));
- is(sym.deprecated, "Use other method.", "@deprecated tag, desc is found.");
- */
-
- // @example
- var examples = this.comment.getTag("example");
- if (examples.length) {
- this.example = examples.map(
- // trim trailing whitespace
- function($) {
- $.desc = $.desc.replace(/\s+$/, "");
- return $;
- }
- );
- }
-
- /*t:
- var sym = new JSDOC.Symbol("foo", [], "FILE", new JSDOC.DocComment("/**@example This\n is an example. \n*"+"/"));
- isnt(typeof sym.example[0], "undefined", "@example tag, creates sym.example array.");
- is(sym.example[0], "This\n is an example.", "@example tag, desc is found.");
- */
-
- // @see
- var sees = this.comment.getTag("see");
- if (sees.length) {
- var thisSee = this.see;
- sees.map(function($){thisSee.push($.desc);});
- }
-
- /*t:
- var sym = new JSDOC.Symbol("foo", [], "FILE", new JSDOC.DocComment("/**@see The other thing.*"+"/"));
- is(sym.see, "The other thing.", "@see tag, desc is found.");
- */
-
- // @class
- var classes = this.comment.getTag("class");
- if (classes.length) {
- this.isa = "CONSTRUCTOR";
- this.classDesc = classes[0].desc; // desc can't apply to the constructor as there is none.
- }
-
- /*t:
- var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@class This describes the class.*"+"/"));
- is(sym.isa, "CONSTRUCTOR", "@class tag, makes symbol a constructor.");
- is(sym.classDesc, "This describes the class.", "@class tag, class description is found.");
- */
-
- // @namespace
- var namespaces = this.comment.getTag("namespace");
- if (namespaces.length) {
- this.classDesc = namespaces[0].desc;
- this.isNamespace = true;
- }
-
- /*t:
- var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@namespace This describes the namespace.*"+"/"));
- is(sym.classDesc, "This describes the namespace.", "@namespace tag, class description is found.");
- */
-
- // @param
- var params = this.comment.getTag("param");
- if (params.length) {
- // user-defined params overwrite those with same name defined by the parser
- var thisParams = this.params;
-
- if (thisParams.length == 0) { // none exist yet, so just bung all these user-defined params straight in
- this.params = params;
- }
- else { // need to overlay these user-defined params on to existing parser-defined params
- for (var i = 0, l = params.length; i < l; i++) {
- if (thisParams[i]) {
- if (params[i].type) thisParams[i].type = params[i].type;
- thisParams[i].name = params[i].name;
- thisParams[i].desc = params[i].desc;
- thisParams[i].isOptional = params[i].isOptional;
- thisParams[i].defaultValue = params[i].defaultValue;
- }
- else thisParams[i] = params[i];
- }
- }
- }
-
- /*t:
- var sym = new JSDOC.Symbol("foo", [{type: "array", name: "pages"}], "FUNCTION", new JSDOC.DocComment("/**Description.*"+"/"));
- is(sym.params.length, 1, "parser defined param is found.");
-
- sym = new JSDOC.Symbol("foo", [], "FUNCTION", new JSDOC.DocComment("/**Description.\n@param {array} pages*"+"/"));
- is(sym.params.length, 1, "user defined param is found.");
- is(sym.params[0].type, "array", "user defined param type is found.");
- is(sym.params[0].name, "pages", "user defined param name is found.");
-
- sym = new JSDOC.Symbol("foo", [{type: "array", name: "pages"}], "FUNCTION", new JSDOC.DocComment("/**Description.\n@param {string} uid*"+"/"));
- is(sym.params.length, 1, "user defined param overwrites parser defined param.");
- is(sym.params[0].type, "string", "user defined param type overwrites parser defined param type.");
- is(sym.params[0].name, "uid", "user defined param name overwrites parser defined param name.");
-
- sym = new JSDOC.Symbol("foo", [{type: "array", name: "pages"}, {type: "number", name: "count"}], "FUNCTION", new JSDOC.DocComment("/**Description.\n@param {string} uid*"+"/"));
- is(sym.params.length, 2, "user defined params overlay parser defined params.");
- is(sym.params[1].type, "number", "user defined param type overlays parser defined param type.");
- is(sym.params[1].name, "count", "user defined param name overlays parser defined param name.");
-
- sym = new JSDOC.Symbol("foo", [], "FUNCTION", new JSDOC.DocComment("/**Description.\n@param {array} pages The pages description.*"+"/"));
- is(sym.params.length, 1, "user defined param with description is found.");
- is(sym.params[0].desc, "The pages description.", "user defined param description is found.");
- */
-
- // @constructor
- if (this.comment.getTag("constructor").length) {
- this.isa = "CONSTRUCTOR";
- }
-
- /*t:
- var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@constructor*"+"/"));
- is(sym.isa, "CONSTRUCTOR", "@constructor tag, makes symbol a constructor.");
- */
-
- // @static
- if (this.comment.getTag("static").length) {
- this.isStatic = true;
- if (this.isa == "CONSTRUCTOR") {
- this.isNamespace = true;
- }
- }
-
- /*t:
- var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@static\n@constructor*"+"/"));
- is(sym.isStatic, true, "@static tag, makes isStatic true.");
- is(sym.isNamespace, true, "@static and @constructor tag, makes isNamespace true.");
- */
-
- // @inner
- if (this.comment.getTag("inner").length) {
- this.isInner = true;
- this.isStatic = false;
- }
-
- /*t:
- var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@inner*"+"/"));
- is(sym.isStatic, false, "@inner tag, makes isStatic false.");
- is(sym.isInner, true, "@inner makes isInner true.");
- */
-
- // @name
- var names = this.comment.getTag("name");
- if (names.length) {
- this.name = names[0].desc;
- }
-
- /*t:
- // todo
- */
-
- // @field
- if (this.comment.getTag("field").length) {
- this.isa = "OBJECT";
- }
-
- /*t:
- var sym = new JSDOC.Symbol("foo", [], "FUNCTION", new JSDOC.DocComment("/**@field*"+"/"));
- is(sym.isa, "OBJECT", "@field tag, makes symbol an object.");
- */
-
- // @function
- if (this.comment.getTag("function").length) {
- this.isa = "FUNCTION";
- if (/event:/.test(this.alias)) this.isEvent = true;
- }
-
- /*t:
- var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@function*"+"/"));
- is(sym.isa, "FUNCTION", "@function tag, makes symbol a function.");
- */
-
- // @event
- var events = this.comment.getTag("event");
- if (events.length) {
- this.isa = "FUNCTION";
- this.isEvent = true;
- if (!/event:/.test(this.alias))
- this.alias = this.alias.replace(/^(.*[.#-])([^.#-]+)$/, "$1event:$2");
- }
-
- /*t:
- var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@event*"+"/"));
- is(sym.isa, "FUNCTION", "@event tag, makes symbol a function.");
- is(sym.isEvent, true, "@event makes isEvent true.");
- */
-
- // @fires
- var fires = this.comment.getTag("fires");
- if (fires.length) {
- for (var i = 0; i < fires.length; i++) {
- this.fires.push(fires[i].desc);
- }
- }
-
- /*t:
- // todo
- */
-
- // @property
- var properties = this.comment.getTag("property");
- if (properties.length) {
- thisProperties = this.properties;
- for (var i = 0; i < properties.length; i++) {
- var property = new JSDOC.Symbol(this.alias+"#"+properties[i].name, [], "OBJECT", new JSDOC.DocComment("/**"+properties[i].desc+"\n@name "+properties[i].name+"\n@memberOf "+this.alias+"#*/"));
- // TODO: shouldn't the following happen in the addProperty method of Symbol?
- property.name = properties[i].name;
- property.memberOf = this.alias;
- if (properties[i].type) property.type = properties[i].type;
- if (properties[i].defaultValue) property.defaultValue = properties[i].defaultValue;
- this.addProperty(property);
- JSDOC.Parser.addSymbol(property);
- }
- }
-
- /*t:
- // todo
- */
-
- // @return
- var returns = this.comment.getTag("return");
- if (returns.length) { // there can be many return tags in a single doclet
- this.returns = returns;
- this.type = returns.map(function($){return $.type}).join(", ");
- }
-
- /*t:
- // todo
- */
-
- // @exception
- this.exceptions = this.comment.getTag("throws");
-
- /*t:
- // todo
- */
-
- // @requires
- var requires = this.comment.getTag("requires");
- if (requires.length) {
- this.requires = requires.map(function($){return $.desc});
- }
-
- /*t:
- // todo
- */
-
- // @type
- var types = this.comment.getTag("type");
- if (types.length) {
- this.type = types[0].desc; //multiple type tags are ignored
- }
-
- /*t:
- // todo
- */
-
- // @private
- if (this.comment.getTag("private").length || this.isInner) {
- this.isPrivate = true;
- }
-
- // @ignore
- if (this.comment.getTag("ignore").length) {
- this.isIgnored = true;
- }
-
- /*t:
- // todo
- */
-
- // @inherits ... as ...
- var inherits = this.comment.getTag("inherits");
- if (inherits.length) {
- for (var i = 0; i < inherits.length; i++) {
- if (/^\s*([a-z$0-9_.#:-]+)(?:\s+as\s+([a-z$0-9_.#:-]+))?/i.test(inherits[i].desc)) {
- var inAlias = RegExp.$1;
- var inAs = RegExp.$2 || inAlias;
-
- if (inAlias) inAlias = inAlias.replace(/\.prototype\.?/g, "#");
-
- if (inAs) {
- inAs = inAs.replace(/\.prototype\.?/g, "#");
- inAs = inAs.replace(/^this\.?/, "#");
- }
-
- if (inAs.indexOf(inAlias) != 0) { //not a full namepath
- var joiner = ".";
- if (this.alias.charAt(this.alias.length-1) == "#" || inAs.charAt(0) == "#") {
- joiner = "";
- }
- inAs = this.alias + joiner + inAs;
- }
- }
- this.inherits.push({alias: inAlias, as: inAs});
- }
- }
-
- /*t:
- // todo
- */
-
- // @augments
- this.augments = this.comment.getTag("augments");
-
- // @default
- var defaults = this.comment.getTag("default");
- if (defaults.length) {
- if (this.is("OBJECT")) {
- this.defaultValue = defaults[0].desc;
- }
- }
-
- /*t:
- // todo
- */
-
- // @memberOf
- var memberOfs = this.comment.getTag("memberOf");
- if (memberOfs.length) {
- this.memberOf = memberOfs[0].desc;
- this.memberOf = this.memberOf.replace(/\.prototype\.?/g, "#");
- }
-
- /*t:
- // todo
- */
-
- // @public
- if (this.comment.getTag("public").length) {
- this.isPrivate = false;
- }
-
- /*t:
- // todo
- */
-
- if (JSDOC.PluginManager) {
- JSDOC.PluginManager.run("onSetTags", this);
- }
-}
-
-JSDOC.Symbol.prototype.is = function(what) {
- return this.isa === what;
-}
-
-JSDOC.Symbol.prototype.isBuiltin = function() {
- return JSDOC.Lang.isBuiltin(this.alias);
-}
-
-JSDOC.Symbol.prototype.setType = function(/**String*/comment, /**Boolean*/overwrite) {
- if (!overwrite && this.type) return;
- var typeComment = JSDOC.DocComment.unwrapComment(comment);
- this.type = typeComment;
-}
-
-JSDOC.Symbol.prototype.inherit = function(symbol) {
- if (!this.hasMember(symbol.name) && !symbol.isInner) {
- if (symbol.is("FUNCTION"))
- this.methods.push(symbol);
- else if (symbol.is("OBJECT"))
- this.properties.push(symbol);
- }
-}
-
-JSDOC.Symbol.prototype.hasMember = function(name) {
- return (this.hasMethod(name) || this.hasProperty(name));
-}
-
-JSDOC.Symbol.prototype.addMember = function(symbol) {
- if (symbol.is("FUNCTION")) { this.addMethod(symbol); }
- else if (symbol.is("OBJECT")) { this.addProperty(symbol); }
-}
-
-JSDOC.Symbol.prototype.hasMethod = function(name) {
- var thisMethods = this.methods;
- for (var i = 0, l = thisMethods.length; i < l; i++) {
- if (thisMethods[i].name == name) return true;
- if (thisMethods[i].alias == name) return true;
- }
- return false;
-}
-
-JSDOC.Symbol.prototype.addMethod = function(symbol) {
- var methodAlias = symbol.alias;
- var thisMethods = this.methods;
- for (var i = 0, l = thisMethods.length; i < l; i++) {
- if (thisMethods[i].alias == methodAlias) {
- thisMethods[i] = symbol; // overwriting previous method
- return;
- }
- }
- thisMethods.push(symbol); // new method with this alias
-}
-
-JSDOC.Symbol.prototype.hasProperty = function(name) {
- var thisProperties = this.properties;
- for (var i = 0, l = thisProperties.length; i < l; i++) {
- if (thisProperties[i].name == name) return true;
- if (thisProperties[i].alias == name) return true;
- }
- return false;
-}
-
-JSDOC.Symbol.prototype.addProperty = function(symbol) {
- var propertyAlias = symbol.alias;
- var thisProperties = this.properties;
- for (var i = 0, l = thisProperties.length; i < l; i++) {
- if (thisProperties[i].alias == propertyAlias) {
- thisProperties[i] = symbol; // overwriting previous property
- return;
- }
- }
-
- thisProperties.push(symbol); // new property with this alias
-}
-
-JSDOC.Symbol.srcFile = ""; //running reference to the current file being parsed
diff --git a/utils/jsdoc-toolkit/app/lib/JSDOC/SymbolSet.js b/utils/jsdoc-toolkit/app/lib/JSDOC/SymbolSet.js
deleted file mode 100755
index 82657e4..0000000
--- a/utils/jsdoc-toolkit/app/lib/JSDOC/SymbolSet.js
+++ /dev/null
@@ -1,241 +0,0 @@
-/** @constructor */
-JSDOC.SymbolSet = function() {
- this.init();
-}
-
-JSDOC.SymbolSet.prototype.init = function() {
- this._index = new Hash();
-}
-
-JSDOC.SymbolSet.prototype.keys = function() {
- return this._index.keys();
-}
-
-JSDOC.SymbolSet.prototype.hasSymbol = function(alias) {
- return this._index.hasKey(alias);
-}
-
-JSDOC.SymbolSet.prototype.addSymbol = function(symbol) {
- if (this.hasSymbol(symbol.alias)) {
- LOG.warn("Overwriting symbol documentation for: "+symbol.alias + ".");
- }
- this._index.set(symbol.alias, symbol);
-}
-
-JSDOC.SymbolSet.prototype.getSymbol = function(alias) {
- if (this.hasSymbol(alias)) return this._index.get(alias);
-}
-
-JSDOC.SymbolSet.prototype.getSymbolByName = function(name) {
- for (var p = this._index.first(); p; p = this._index.next()) {
- var symbol = p.value;
- if (symbol.name == name) return symbol;
- }
-}
-
-JSDOC.SymbolSet.prototype.toArray = function() {
- return this._index.values();
-}
-
-JSDOC.SymbolSet.prototype.deleteSymbol = function(alias) {
- if (!this.hasSymbol(alias)) return;
- this._index.drop(alias);
-}
-
-JSDOC.SymbolSet.prototype.renameSymbol = function(oldName, newName) {
- // todo: should check if oldname or newname already exist
- this._index.replace(oldName, newName);
- this._index.get(newName).alias = newName;
- return newName;
-}
-
-JSDOC.SymbolSet.prototype.relate = function() {
- this.resolveBorrows();
- this.resolveMemberOf();
- this.resolveAugments();
-}
-
-JSDOC.SymbolSet.prototype.resolveBorrows = function() {
- for (var p = this._index.first(); p; p = this._index.next()) {
- var symbol = p.value;
- if (symbol.is("FILE") || symbol.is("GLOBAL")) continue;
-
- var borrows = symbol.inherits;
- for (var i = 0; i < borrows.length; i++) {
-
-if (/#$/.test(borrows[i].alias)) {
- LOG.warn("Attempted to borrow entire instance of "+borrows[i].alias+" but that feature is not yet implemented.");
- return;
-}
- var borrowed = this.getSymbol(borrows[i].alias);
-
- if (!borrowed) {
- LOG.warn("Can't borrow undocumented "+borrows[i].alias+".");
- continue;
- }
-
- if (borrows[i].as == borrowed.alias) {
- var assumedName = borrowed.name.split(/([#.-])/).pop();
- borrows[i].as = symbol.name+RegExp.$1+assumedName;
- LOG.inform("Assuming borrowed as name is "+borrows[i].as+" but that feature is experimental.");
- }
-
- var borrowAsName = borrows[i].as;
- var borrowAsAlias = borrowAsName;
- if (!borrowAsName) {
- LOG.warn("Malformed @borrow, 'as' is required.");
- continue;
- }
-
- if (borrowAsName.length > symbol.alias.length && borrowAsName.indexOf(symbol.alias) == 0) {
- borrowAsName = borrowAsName.replace(borrowed.alias, "")
- }
- else {
- var joiner = "";
- if (borrowAsName.charAt(0) != "#") joiner = ".";
- borrowAsAlias = borrowed.alias + joiner + borrowAsName;
- }
-
- borrowAsName = borrowAsName.replace(/^[#.]/, "");
-
- if (this.hasSymbol(borrowAsAlias)) continue;
-
- var clone = borrowed.clone();
- clone.name = borrowAsName;
- clone.alias = borrowAsAlias;
- this.addSymbol(clone);
- }
- }
-}
-
-JSDOC.SymbolSet.prototype.resolveMemberOf = function() {
- for (var p = this._index.first(); p; p = this._index.next()) {
- var symbol = p.value;
- if (symbol.is("FILE") || symbol.is("GLOBAL")) continue;
-
- // the memberOf value was provided in the @memberOf tag
- else if (symbol.memberOf) {
-
- // like foo.bar is a memberOf foo
- if (symbol.alias.indexOf(symbol.memberOf) == 0) {
- var memberMatch = new RegExp("^("+symbol.memberOf+")[.#-]?(.+)$");
- var aliasParts = symbol.alias.match(memberMatch);
-
- if (aliasParts) {
- symbol.memberOf = aliasParts[1];
- symbol.name = aliasParts[2];
- }
-
- var nameParts = symbol.name.match(memberMatch);
-
- if (nameParts) {
- symbol.name = nameParts[2];
- }
- }
- // like bar is a memberOf foo
- else {
- var joiner = symbol.memberOf.charAt(symbol.memberOf.length-1);
- if (!/[.#-]/.test(joiner)) symbol.memberOf += ".";
- this.renameSymbol(symbol.alias, symbol.memberOf + symbol.name);
- }
- }
- // the memberOf must be calculated
- else {
- var parts = symbol.alias.match(/^(.*[.#-])([^.#-]+)$/);
- if (parts) {
- symbol.memberOf = parts[1];
- symbol.name = parts[2];
- }
- }
-
- // set isStatic, isInner
- if (symbol.memberOf) {
- switch (symbol.memberOf.charAt(symbol.memberOf.length-1)) {
- case '#' :
- symbol.isStatic = false;
- symbol.isInner = false;
- break;
- case '.' :
- symbol.isStatic = true;
- symbol.isInner = false;
- break;
- case '-' :
- symbol.isStatic = false;
- symbol.isInner = true;
- break;
- default: // memberOf ends in none of the above
- symbol.isStatic = true;
- break;
- }
- }
-
- // unowned methods and fields belong to the global object
- if (!symbol.is("CONSTRUCTOR") && !symbol.isNamespace && symbol.memberOf == "") {
- symbol.memberOf = "_global_";
- }
-
- // clean up
- if (symbol.memberOf.match(/[.#-]$/)) {
- symbol.memberOf = symbol.memberOf.substr(0, symbol.memberOf.length-1);
- }
- // add to parent's methods or properties list
- if (symbol.memberOf) {
-
- var container = this.getSymbol(symbol.memberOf);
- if (!container) {
- if (JSDOC.Lang.isBuiltin(symbol.memberOf)) container = JSDOC.Parser.addBuiltin(symbol.memberOf);
- else {
- LOG.warn("Trying to document "+symbol.name +" as a member of undocumented symbol "+symbol.memberOf+".");
- }
- }
-
- if (container) container.addMember(symbol);
- }
- }
-}
-
-JSDOC.SymbolSet.prototype.resolveAugments = function() {
- for (var p = this._index.first(); p; p = this._index.next()) {
- var symbol = p.value;
-
- if (symbol.alias == "_global_" || symbol.is("FILE")) continue;
- JSDOC.SymbolSet.prototype.walk.apply(this, [symbol]);
- }
-}
-
-JSDOC.SymbolSet.prototype.walk = function(symbol) {
- var augments = symbol.augments;
- for(var i = 0; i < augments.length; i++) {
- var contributer = this.getSymbol(augments[i]);
- if (!contributer && JSDOC.Lang.isBuiltin(''+augments[i])) {
- contributer = new JSDOC.Symbol("_global_."+augments[i], [], augments[i], new JSDOC.DocComment("Built in."));
- contributer.isNamespace = true;
- contributer.srcFile = "";
- contributer.isPrivate = false;
- JSDOC.Parser.addSymbol(contributer);
- }
-
- if (contributer) {
- if (contributer.augments.length) {
- JSDOC.SymbolSet.prototype.walk.apply(this, [contributer]);
- }
-
- symbol.inheritsFrom.push(contributer.alias);
- //if (!isUnique(symbol.inheritsFrom)) {
- // LOG.warn("Can't resolve augments: Circular reference: "+symbol.alias+" inherits from "+contributer.alias+" more than once.");
- //}
- //else {
- var cmethods = contributer.methods;
- var cproperties = contributer.properties;
-
- for (var ci = 0, cl = cmethods.length; ci < cl; ci++) {
- if (!cmethods[ci].isStatic) symbol.inherit(cmethods[ci]);
- }
- for (var ci = 0, cl = cproperties.length; ci < cl; ci++) {
- if (!cproperties[ci].isStatic) symbol.inherit(cproperties[ci]);
- }
- //}
- }
- else LOG.warn("Can't augment contributer: "+augments[i]+", not found.");
- }
-}
diff --git a/utils/jsdoc-toolkit/app/lib/JSDOC/TextStream.js b/utils/jsdoc-toolkit/app/lib/JSDOC/TextStream.js
deleted file mode 100755
index ccc48a8..0000000
--- a/utils/jsdoc-toolkit/app/lib/JSDOC/TextStream.js
+++ /dev/null
@@ -1,41 +0,0 @@
-
-/**
- @constructor
-*/
-JSDOC.TextStream = function(text) {
- if (typeof(text) == "undefined") text = "";
- text = ""+text;
- this.text = text;
- this.cursor = 0;
-}
-
-JSDOC.TextStream.prototype.look = function(n) {
- if (typeof n == "undefined") n = 0;
-
- if (this.cursor+n < 0 || this.cursor+n >= this.text.length) {
- var result = new String("");
- result.eof = true;
- return result;
- }
- return this.text.charAt(this.cursor+n);
-}
-
-JSDOC.TextStream.prototype.next = function(n) {
- if (typeof n == "undefined") n = 1;
- if (n < 1) return null;
-
- var pulled = "";
- for (var i = 0; i < n; i++) {
- if (this.cursor+i < this.text.length) {
- pulled += this.text.charAt(this.cursor+i);
- }
- else {
- var result = new String("");
- result.eof = true;
- return result;
- }
- }
-
- this.cursor += n;
- return pulled;
-} \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/lib/JSDOC/Token.js b/utils/jsdoc-toolkit/app/lib/JSDOC/Token.js
deleted file mode 100755
index fb7f9d9..0000000
--- a/utils/jsdoc-toolkit/app/lib/JSDOC/Token.js
+++ /dev/null
@@ -1,18 +0,0 @@
-if (typeof JSDOC == "undefined") JSDOC = {};
-
-/**
- @constructor
-*/
-JSDOC.Token = function(data, type, name) {
- this.data = data;
- this.type = type;
- this.name = name;
-}
-
-JSDOC.Token.prototype.toString = function() {
- return "<"+this.type+" name=\""+this.name+"\">"+this.data+"</"+this.type+">";
-}
-
-JSDOC.Token.prototype.is = function(what) {
- return this.name === what || this.type === what;
-} \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/lib/JSDOC/TokenReader.js b/utils/jsdoc-toolkit/app/lib/JSDOC/TokenReader.js
deleted file mode 100755
index 9f658fb..0000000
--- a/utils/jsdoc-toolkit/app/lib/JSDOC/TokenReader.js
+++ /dev/null
@@ -1,332 +0,0 @@
-if (typeof JSDOC == "undefined") JSDOC = {};
-
-/**
- @class Search a {@link JSDOC.TextStream} for language tokens.
-*/
-JSDOC.TokenReader = function() {
- this.keepDocs = true;
- this.keepWhite = false;
- this.keepComments = false;
-}
-
-/**
- @type {JSDOC.Token[]}
- */
-JSDOC.TokenReader.prototype.tokenize = function(/**JSDOC.TextStream*/stream) {
- var tokens = [];
- /**@ignore*/ tokens.last = function() { return tokens[tokens.length-1]; }
- /**@ignore*/ tokens.lastSym = function() {
- for (var i = tokens.length-1; i >= 0; i--) {
- if (!(tokens[i].is("WHIT") || tokens[i].is("COMM"))) return tokens[i];
- }
- }
-
- while (!stream.look().eof) {
- if (this.read_mlcomment(stream, tokens)) continue;
- if (this.read_slcomment(stream, tokens)) continue;
- if (this.read_dbquote(stream, tokens)) continue;
- if (this.read_snquote(stream, tokens)) continue;
- if (this.read_regx(stream, tokens)) continue;
- if (this.read_numb(stream, tokens)) continue;
- if (this.read_punc(stream, tokens)) continue;
- if (this.read_newline(stream, tokens)) continue;
- if (this.read_space(stream, tokens)) continue;
- if (this.read_word(stream, tokens)) continue;
-
- // if execution reaches here then an error has happened
- tokens.push(new JSDOC.Token(stream.next(), "TOKN", "UNKNOWN_TOKEN"));
- }
- return tokens;
-}
-
-/**
- @returns {Boolean} Was the token found?
- */
-JSDOC.TokenReader.prototype.read_word = function(/**JSDOC.TokenStream*/stream, tokens) {
- var found = "";
- while (!stream.look().eof && JSDOC.Lang.isWordChar(stream.look())) {
- found += stream.next();
- }
-
- if (found === "") {
- return false;
- }
- else {
- var name;
- if ((name = JSDOC.Lang.keyword(found))) tokens.push(new JSDOC.Token(found, "KEYW", name));
- else tokens.push(new JSDOC.Token(found, "NAME", "NAME"));
- return true;
- }
-}
-
-/**
- @returns {Boolean} Was the token found?
- */
-JSDOC.TokenReader.prototype.read_punc = function(/**JSDOC.TokenStream*/stream, tokens) {
- var found = "";
- var name;
- while (!stream.look().eof && JSDOC.Lang.punc(found+stream.look())) {
- found += stream.next();
- }
-
- if (found === "") {
- return false;
- }
- else {
- tokens.push(new JSDOC.Token(found, "PUNC", JSDOC.Lang.punc(found)));
- return true;
- }
-}
-
-/**
- @returns {Boolean} Was the token found?
- */
-JSDOC.TokenReader.prototype.read_space = function(/**JSDOC.TokenStream*/stream, tokens) {
- var found = "";
-
- while (!stream.look().eof && JSDOC.Lang.isSpace(stream.look())) {
- found += stream.next();
- }
-
- if (found === "") {
- return false;
- }
- else {
- if (this.collapseWhite) found = " ";
- if (this.keepWhite) tokens.push(new JSDOC.Token(found, "WHIT", "SPACE"));
- return true;
- }
-}
-
-/**
- @returns {Boolean} Was the token found?
- */
-JSDOC.TokenReader.prototype.read_newline = function(/**JSDOC.TokenStream*/stream, tokens) {
- var found = "";
-
- while (!stream.look().eof && JSDOC.Lang.isNewline(stream.look())) {
- found += stream.next();
- }
-
- if (found === "") {
- return false;
- }
- else {
- if (this.collapseWhite) found = "\n";
- if (this.keepWhite) tokens.push(new JSDOC.Token(found, "WHIT", "NEWLINE"));
- return true;
- }
-}
-
-/**
- @returns {Boolean} Was the token found?
- */
-JSDOC.TokenReader.prototype.read_mlcomment = function(/**JSDOC.TokenStream*/stream, tokens) {
- if (stream.look() == "/" && stream.look(1) == "*") {
- var found = stream.next(2);
-
- while (!stream.look().eof && !(stream.look(-1) == "/" && stream.look(-2) == "*")) {
- found += stream.next();
- }
-
- // to start doclet we allow /** or /*** but not /**/ or /****
- if (/^\/\*\*([^\/]|\*[^*])/.test(found) && this.keepDocs) tokens.push(new JSDOC.Token(found, "COMM", "JSDOC"));
- else if (this.keepComments) tokens.push(new JSDOC.Token(found, "COMM", "MULTI_LINE_COMM"));
- return true;
- }
- return false;
-}
-
-/**
- @returns {Boolean} Was the token found?
- */
-JSDOC.TokenReader.prototype.read_slcomment = function(/**JSDOC.TokenStream*/stream, tokens) {
- var found;
- if (
- (stream.look() == "/" && stream.look(1) == "/" && (found=stream.next(2)))
- ||
- (stream.look() == "<" && stream.look(1) == "!" && stream.look(2) == "-" && stream.look(3) == "-" && (found=stream.next(4)))
- ) {
-
- while (!stream.look().eof && !JSDOC.Lang.isNewline(stream.look())) {
- found += stream.next();
- }
-
- if (this.keepComments) {
- tokens.push(new JSDOC.Token(found, "COMM", "SINGLE_LINE_COMM"));
- }
- return true;
- }
- return false;
-}
-
-/**
- @returns {Boolean} Was the token found?
- */
-JSDOC.TokenReader.prototype.read_dbquote = function(/**JSDOC.TokenStream*/stream, tokens) {
- if (stream.look() == "\"") {
- // find terminator
- var string = stream.next();
-
- while (!stream.look().eof) {
- if (stream.look() == "\\") {
- if (JSDOC.Lang.isNewline(stream.look(1))) {
- do {
- stream.next();
- } while (!stream.look().eof && JSDOC.Lang.isNewline(stream.look()));
- string += "\\\n";
- }
- else {
- string += stream.next(2);
- }
- }
- else if (stream.look() == "\"") {
- string += stream.next();
- tokens.push(new JSDOC.Token(string, "STRN", "DOUBLE_QUOTE"));
- return true;
- }
- else {
- string += stream.next();
- }
- }
- }
- return false; // error! unterminated string
-}
-
-/**
- @returns {Boolean} Was the token found?
- */
-JSDOC.TokenReader.prototype.read_snquote = function(/**JSDOC.TokenStream*/stream, tokens) {
- if (stream.look() == "'") {
- // find terminator
- var string = stream.next();
-
- while (!stream.look().eof) {
- if (stream.look() == "\\") { // escape sequence
- string += stream.next(2);
- }
- else if (stream.look() == "'") {
- string += stream.next();
- tokens.push(new JSDOC.Token(string, "STRN", "SINGLE_QUOTE"));
- return true;
- }
- else {
- string += stream.next();
- }
- }
- }
- return false; // error! unterminated string
-}
-
-/**
- @returns {Boolean} Was the token found?
- */
-JSDOC.TokenReader.prototype.read_numb = function(/**JSDOC.TokenStream*/stream, tokens) {
- if (stream.look() === "0" && stream.look(1) == "x") {
- return this.read_hex(stream, tokens);
- }
-
- var found = "";
-
- while (!stream.look().eof && JSDOC.Lang.isNumber(found+stream.look())){
- found += stream.next();
- }
-
- if (found === "") {
- return false;
- }
- else {
- if (/^0[0-7]/.test(found)) tokens.push(new JSDOC.Token(found, "NUMB", "OCTAL"));
- else tokens.push(new JSDOC.Token(found, "NUMB", "DECIMAL"));
- return true;
- }
-}
-/*t:
- requires("../lib/JSDOC/TextStream.js");
- requires("../lib/JSDOC/Token.js");
- requires("../lib/JSDOC/Lang.js");
-
- plan(3, "testing JSDOC.TokenReader.prototype.read_numb");
-
- //// setup
- var src = "function foo(num){while (num+8.0 >= 0x20 && num < 0777){}}";
- var tr = new JSDOC.TokenReader();
- var tokens = tr.tokenize(new JSDOC.TextStream(src));
-
- var hexToken, octToken, decToken;
- for (var i = 0; i < tokens.length; i++) {
- if (tokens[i].name == "HEX_DEC") hexToken = tokens[i];
- if (tokens[i].name == "OCTAL") octToken = tokens[i];
- if (tokens[i].name == "DECIMAL") decToken = tokens[i];
- }
- ////
-
- is(decToken.data, "8.0", "decimal number is found in source.");
- is(hexToken.data, "0x20", "hexdec number is found in source (issue #99).");
- is(octToken.data, "0777", "octal number is found in source.");
-*/
-
-/**
- @returns {Boolean} Was the token found?
- */
-JSDOC.TokenReader.prototype.read_hex = function(/**JSDOC.TokenStream*/stream, tokens) {
- var found = stream.next(2);
-
- while (!stream.look().eof) {
- if (JSDOC.Lang.isHexDec(found) && !JSDOC.Lang.isHexDec(found+stream.look())) { // done
- tokens.push(new JSDOC.Token(found, "NUMB", "HEX_DEC"));
- return true;
- }
- else {
- found += stream.next();
- }
- }
- return false;
-}
-
-/**
- @returns {Boolean} Was the token found?
- */
-JSDOC.TokenReader.prototype.read_regx = function(/**JSDOC.TokenStream*/stream, tokens) {
- var last;
- if (
- stream.look() == "/"
- &&
- (
-
- (
- !(last = tokens.lastSym()) // there is no last, the regex is the first symbol
- ||
- (
- !last.is("NUMB")
- && !last.is("NAME")
- && !last.is("RIGHT_PAREN")
- && !last.is("RIGHT_BRACKET")
- )
- )
- )
- ) {
- var regex = stream.next();
-
- while (!stream.look().eof) {
- if (stream.look() == "\\") { // escape sequence
- regex += stream.next(2);
- }
- else if (stream.look() == "/") {
- regex += stream.next();
-
- while (/[gmi]/.test(stream.look())) {
- regex += stream.next();
- }
-
- tokens.push(new JSDOC.Token(regex, "REGX", "REGX"));
- return true;
- }
- else {
- regex += stream.next();
- }
- }
- // error: unterminated regex
- }
- return false;
-}
diff --git a/utils/jsdoc-toolkit/app/lib/JSDOC/TokenStream.js b/utils/jsdoc-toolkit/app/lib/JSDOC/TokenStream.js
deleted file mode 100755
index 1eeb44c..0000000
--- a/utils/jsdoc-toolkit/app/lib/JSDOC/TokenStream.js
+++ /dev/null
@@ -1,133 +0,0 @@
-if (typeof JSDOC == "undefined") JSDOC = {};
-
-/**
- @constructor
-*/
-JSDOC.TokenStream = function(tokens) {
- this.tokens = (tokens || []);
- this.rewind();
-}
-
-/**
- @constructor
- @private
-*/
-function VoidToken(/**String*/type) {
- this.toString = function() {return "<VOID type=\""+type+"\">"};
- this.is = function(){return false;}
-}
-
-JSDOC.TokenStream.prototype.rewind = function() {
- this.cursor = -1;
-}
-
-/**
- @type JSDOC.Token
-*/
-JSDOC.TokenStream.prototype.look = function(/**Number*/n, /**Boolean*/considerWhitespace) {
- if (typeof n == "undefined") n = 0;
-
- if (considerWhitespace == true) {
- if (this.cursor+n < 0 || this.cursor+n > this.tokens.length) return {};
- return this.tokens[this.cursor+n];
- }
- else {
- var count = 0;
- var i = this.cursor;
-
- while (true) {
- if (i < 0) return new JSDOC.Token("", "VOID", "START_OF_STREAM");
- else if (i > this.tokens.length) return new JSDOC.Token("", "VOID", "END_OF_STREAM");
-
- if (i != this.cursor && (this.tokens[i] === undefined || this.tokens[i].is("WHIT"))) {
- if (n < 0) i--; else i++;
- continue;
- }
-
- if (count == Math.abs(n)) {
- return this.tokens[i];
- }
- count++;
- (n < 0)? i-- : i++;
- }
-
- return new JSDOC.Token("", "VOID", "STREAM_ERROR"); // because null isn't an object and caller always expects an object
- }
-}
-
-/**
- @type JSDOC.Token|JSDOC.Token[]
-*/
-JSDOC.TokenStream.prototype.next = function(/**Number*/howMany) {
- if (typeof howMany == "undefined") howMany = 1;
- if (howMany < 1) return null;
- var got = [];
-
- for (var i = 1; i <= howMany; i++) {
- if (this.cursor+i >= this.tokens.length) {
- return null;
- }
- got.push(this.tokens[this.cursor+i]);
- }
- this.cursor += howMany;
-
- if (howMany == 1) {
- return got[0];
- }
- else return got;
-}
-
-/**
- @type JSDOC.Token[]
-*/
-JSDOC.TokenStream.prototype.balance = function(/**String*/start, /**String*/stop) {
- if (!stop) stop = JSDOC.Lang.matching(start);
-
- var depth = 0;
- var got = [];
- var started = false;
-
- while ((token = this.look())) {
- if (token.is(start)) {
- depth++;
- started = true;
- }
-
- if (started) {
- got.push(token);
- }
-
- if (token.is(stop)) {
- depth--;
- if (depth == 0) return got;
- }
- if (!this.next()) break;
- }
-}
-
-JSDOC.TokenStream.prototype.getMatchingToken = function(/**String*/start, /**String*/stop) {
- var depth = 0;
- var cursor = this.cursor;
-
- if (!start) {
- start = JSDOC.Lang.matching(stop);
- depth = 1;
- }
- if (!stop) stop = JSDOC.Lang.matching(start);
-
- while ((token = this.tokens[cursor])) {
- if (token.is(start)) {
- depth++;
- }
-
- if (token.is(stop) && cursor) {
- depth--;
- if (depth == 0) return this.tokens[cursor];
- }
- cursor++;
- }
-}
-
-JSDOC.TokenStream.prototype.insertAhead = function(/**JSDOC.Token*/token) {
- this.tokens.splice(this.cursor+1, 0, token);
-} \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/lib/JSDOC/Util.js b/utils/jsdoc-toolkit/app/lib/JSDOC/Util.js
deleted file mode 100755
index 6d7edb3..0000000
--- a/utils/jsdoc-toolkit/app/lib/JSDOC/Util.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * @namespace
- * @deprecated Use {@link FilePath} instead.
- */
-JSDOC.Util = {
-}
-
-/**
- * @deprecated Use {@link FilePath.fileName} instead.
- */
-JSDOC.Util.fileName = function(path) {
- LOG.warn("JSDOC.Util.fileName is deprecated. Use FilePath.fileName instead.");
- var nameStart = Math.max(path.lastIndexOf("/")+1, path.lastIndexOf("\\")+1, 0);
- return path.substring(nameStart);
-}
-
-/**
- * @deprecated Use {@link FilePath.fileExtension} instead.
- */
-JSDOC.Util.fileExtension = function(filename) {
- LOG.warn("JSDOC.Util.fileExtension is deprecated. Use FilePath.fileExtension instead.");
- return filename.split(".").pop().toLowerCase();
-};
-
-/**
- * @deprecated Use {@link FilePath.dir} instead.
- */
-JSDOC.Util.dir = function(path) {
- LOG.warn("JSDOC.Util.dir is deprecated. Use FilePath.dir instead.");
- var nameStart = Math.max(path.lastIndexOf("/")+1, path.lastIndexOf("\\")+1, 0);
- return path.substring(0, nameStart-1);
-}
diff --git a/utils/jsdoc-toolkit/app/lib/JSDOC/Walker.js b/utils/jsdoc-toolkit/app/lib/JSDOC/Walker.js
deleted file mode 100755
index befec4d..0000000
--- a/utils/jsdoc-toolkit/app/lib/JSDOC/Walker.js
+++ /dev/null
@@ -1,474 +0,0 @@
-if (typeof JSDOC == "undefined") JSDOC = {};
-
-/** @constructor */
-JSDOC.Walker = function(/**JSDOC.TokenStream*/ts) {
- this.init();
- if (typeof ts != "undefined") {
- this.walk(ts);
- }
-}
-
-JSDOC.Walker.prototype.init = function() {
- this.ts = null;
-
- var globalSymbol = new JSDOC.Symbol("_global_", [], "GLOBAL", new JSDOC.DocComment(""));
- globalSymbol.isNamespace = true;
- globalSymbol.srcFile = "";
- globalSymbol.isPrivate = false;
- JSDOC.Parser.addSymbol(globalSymbol);
- this.lastDoc = null;
- this.token = null;
-
- /**
- The chain of symbols under which we are currently nested.
- @type Array
- */
- this.namescope = [globalSymbol];
- this.namescope.last = function(n){ if (!n) n = 0; return this[this.length-(1+n)] || "" };
-}
-
-JSDOC.Walker.prototype.walk = function(/**JSDOC.TokenStream*/ts) {
- this.ts = ts;
- while (this.token = this.ts.look()) {
- if (this.token.popNamescope) {
-
- var symbol = this.namescope.pop();
- if (symbol.is("FUNCTION")) {
- if (this.ts.look(1).is("LEFT_PAREN") && symbol.comment.getTag("function").length == 0) {
- symbol.isa = "OBJECT";
- }
- }
- }
- this.step();
- if (!this.ts.next()) break;
- }
-}
-
-JSDOC.Walker.prototype.step = function() {
- if (this.token.is("JSDOC")) { // it's a doc comment
-
- var doc = new JSDOC.DocComment(this.token.data);
-
-
- if (doc.getTag("exports").length > 0) {
- var exports = doc.getTag("exports")[0];
-
- exports.desc.match(/(\S+) as (\S+)/i);
- var n1 = RegExp.$1;
- var n2 = RegExp.$2;
-
- if (!n1 && n2) throw "@exports tag requires a value like: 'name as ns.name'";
-
- JSDOC.Parser.rename = (JSDOC.Parser.rename || {});
- JSDOC.Parser.rename[n1] = n2
- }
-
- if (doc.getTag("lends").length > 0) {
- var lends = doc.getTag("lends")[0];
-
- var name = lends.desc
- if (!name) throw "@lends tag requires a value.";
-
- var symbol = new JSDOC.Symbol(name, [], "OBJECT", doc);
-
- this.namescope.push(symbol);
-
- var matching = this.ts.getMatchingToken("LEFT_CURLY");
- if (matching) matching.popNamescope = name;
- else LOG.warn("Mismatched } character. Can't parse code in file " + symbol.srcFile + ".");
-
- this.lastDoc = null;
- return true;
- }
- else if (doc.getTag("name").length > 0 && doc.getTag("overview").length == 0) { // it's a virtual symbol
- var virtualName = doc.getTag("name")[0].desc;
- if (!virtualName) throw "@name tag requires a value.";
-
- var symbol = new JSDOC.Symbol(virtualName, [], "VIRTUAL", doc);
-
- JSDOC.Parser.addSymbol(symbol);
-
- this.lastDoc = null;
- return true;
- }
- else if (doc.meta) { // it's a meta doclet
- if (doc.meta == "@+") JSDOC.DocComment.shared = doc.src;
- else if (doc.meta == "@-") JSDOC.DocComment.shared = "";
- else if (doc.meta == "nocode+") JSDOC.Parser.conf.ignoreCode = true;
- else if (doc.meta == "nocode-") JSDOC.Parser.conf.ignoreCode = JSDOC.opt.n;
- else throw "Unrecognized meta comment: "+doc.meta;
-
- this.lastDoc = null;
- return true;
- }
- else if (doc.getTag("overview").length > 0) { // it's a file overview
- symbol = new JSDOC.Symbol("", [], "FILE", doc);
-
- JSDOC.Parser.addSymbol(symbol);
-
- this.lastDoc = null;
- return true;
- }
- else {
- this.lastDoc = doc;
- return false;
- }
- }
- else if (!JSDOC.Parser.conf.ignoreCode) { // it's code
- if (this.token.is("NAME")) { // it's the name of something
- var symbol;
- var name = this.token.data;
- var doc = null; if (this.lastDoc) doc = this.lastDoc;
- var params = [];
-
- // it's inside an anonymous object
- if (this.ts.look(1).is("COLON") && this.ts.look(-1).is("LEFT_CURLY") && !(this.ts.look(-2).is("JSDOC") || this.namescope.last().comment.getTag("lends").length || this.ts.look(-2).is("ASSIGN") || this.ts.look(-2).is("COLON"))) {
- name = "$anonymous";
- name = this.namescope.last().alias+"-"+name
-
- params = [];
-
- symbol = new JSDOC.Symbol(name, params, "OBJECT", doc);
-
- JSDOC.Parser.addSymbol(symbol);
-
- this.namescope.push(symbol);
-
- var matching = this.ts.getMatchingToken(null, "RIGHT_CURLY");
- if (matching) matching.popNamescope = name;
- else LOG.warn("Mismatched } character. Can't parse code in file " + symbol.srcFile + ".");
- }
- // function foo() {}
- else if (this.ts.look(-1).is("FUNCTION") && this.ts.look(1).is("LEFT_PAREN")) {
- var isInner;
-
- if (this.lastDoc) doc = this.lastDoc;
- name = this.namescope.last().alias+"-"+name;
- if (!this.namescope.last().is("GLOBAL")) isInner = true;
-
- params = JSDOC.Walker.onParamList(this.ts.balance("LEFT_PAREN"));
-
- symbol = new JSDOC.Symbol(name, params, "FUNCTION", doc);
- if (isInner) symbol.isInner = true;
-
- if (this.ts.look(1).is("JSDOC")) {
- var inlineReturn = ""+this.ts.look(1).data;
- inlineReturn = inlineReturn.replace(/(^\/\*\* *| *\*\/$)/g, "");
- symbol.type = inlineReturn;
- }
-
- JSDOC.Parser.addSymbol(symbol);
-
- this.namescope.push(symbol);
-
- var matching = this.ts.getMatchingToken("LEFT_CURLY");
- if (matching) matching.popNamescope = name;
- else LOG.warn("Mismatched } character. Can't parse code in file " + symbol.srcFile + ".");
- }
- // foo = function() {}
- else if (this.ts.look(1).is("ASSIGN") && this.ts.look(2).is("FUNCTION")) {
- var isInner;
- if (this.ts.look(-1).is("VAR") || this.isInner) {
- name = this.namescope.last().alias+"-"+name
- if (!this.namescope.last().is("GLOBAL")) isInner = true;
- }
- else if (name.indexOf("this.") == 0) {
- name = this.resolveThis(name);
- }
-
- if (this.lastDoc) doc = this.lastDoc;
- params = JSDOC.Walker.onParamList(this.ts.balance("LEFT_PAREN"));
-
- symbol = new JSDOC.Symbol(name, params, "FUNCTION", doc);
- if (isInner) symbol.isInner = true;
-
- if (this.ts.look(1).is("JSDOC")) {
- var inlineReturn = ""+this.ts.look(1).data;
- inlineReturn = inlineReturn.replace(/(^\/\*\* *| *\*\/$)/g, "");
- symbol.type = inlineReturn;
- }
-
- JSDOC.Parser.addSymbol(symbol);
-
- this.namescope.push(symbol);
-
- var matching = this.ts.getMatchingToken("LEFT_CURLY");
- if (matching) matching.popNamescope = name;
- else LOG.warn("Mismatched } character. Can't parse code in file " + symbol.srcFile + ".");
- }
- // foo = new function() {} or foo = (function() {}
- else if (this.ts.look(1).is("ASSIGN") && (this.ts.look(2).is("NEW") || this.ts.look(2).is("LEFT_PAREN")) && this.ts.look(3).is("FUNCTION")) {
- var isInner;
- if (this.ts.look(-1).is("VAR") || this.isInner) {
- name = this.namescope.last().alias+"-"+name
- if (!this.namescope.last().is("GLOBAL")) isInner = true;
- }
- else if (name.indexOf("this.") == 0) {
- name = this.resolveThis(name);
- }
-
- this.ts.next(3); // advance past the "new" or "("
-
- if (this.lastDoc) doc = this.lastDoc;
- params = JSDOC.Walker.onParamList(this.ts.balance("LEFT_PAREN"));
-
- symbol = new JSDOC.Symbol(name, params, "OBJECT", doc);
- if (isInner) symbol.isInner = true;
-
- if (this.ts.look(1).is("JSDOC")) {
- var inlineReturn = ""+this.ts.look(1).data;
- inlineReturn = inlineReturn.replace(/(^\/\*\* *| *\*\/$)/g, "");
- symbol.type = inlineReturn;
- }
-
- JSDOC.Parser.addSymbol(symbol);
-
- symbol.scopeType = "INSTANCE";
- this.namescope.push(symbol);
-
- var matching = this.ts.getMatchingToken("LEFT_CURLY");
- if (matching) matching.popNamescope = name;
- else LOG.warn("Mismatched } character. Can't parse code in file " + symbol.srcFile + ".");
- }
- // foo: function() {}
- else if (this.ts.look(1).is("COLON") && this.ts.look(2).is("FUNCTION")) {
- name = (this.namescope.last().alias+"."+name).replace("#.", "#");
-
- if (this.lastDoc) doc = this.lastDoc;
- params = JSDOC.Walker.onParamList(this.ts.balance("LEFT_PAREN"));
-
- if (doc && doc.getTag("constructs").length) {
- name = name.replace(/\.prototype(\.|$)/, "#");
-
- if (name.indexOf("#") > -1) name = name.match(/(^[^#]+)/)[0];
- else name = this.namescope.last().alias;
-
- symbol = new JSDOC.Symbol(name, params, "CONSTRUCTOR", doc);
- }
- else {
- symbol = new JSDOC.Symbol(name, params, "FUNCTION", doc);
- }
-
- if (this.ts.look(1).is("JSDOC")) {
- var inlineReturn = ""+this.ts.look(1).data;
- inlineReturn = inlineReturn.replace(/(^\/\*\* *| *\*\/$)/g, "");
- symbol.type = inlineReturn;
- }
-
- JSDOC.Parser.addSymbol(symbol);
-
- this.namescope.push(symbol);
-
- var matching = this.ts.getMatchingToken("LEFT_CURLY");
- if (matching) matching.popNamescope = name;
- else LOG.warn("Mismatched } character. Can't parse code in file " + symbol.srcFile + ".");
- }
- // foo = {}
- else if (this.ts.look(1).is("ASSIGN") && this.ts.look(2).is("LEFT_CURLY")) {
- var isInner;
- if (this.ts.look(-1).is("VAR") || this.isInner) {
- name = this.namescope.last().alias+"-"+name
- if (!this.namescope.last().is("GLOBAL")) isInner = true;
- }
- else if (name.indexOf("this.") == 0) {
- name = this.resolveThis(name);
- }
-
- if (this.lastDoc) doc = this.lastDoc;
-
- symbol = new JSDOC.Symbol(name, params, "OBJECT", doc);
- if (isInner) symbol.isInner = true;
-
-
- if (doc) JSDOC.Parser.addSymbol(symbol);
-
- this.namescope.push(symbol);
-
- var matching = this.ts.getMatchingToken("LEFT_CURLY");
- if (matching) matching.popNamescope = name;
- else LOG.warn("Mismatched } character. Can't parse code in file " + symbol.srcFile + ".");
- }
- // var foo;
- else if (this.ts.look(1).is("SEMICOLON")) {
- var isInner;
-
- if (this.ts.look(-1).is("VAR") || this.isInner) {
- name = this.namescope.last().alias+"-"+name
- if (!this.namescope.last().is("GLOBAL")) isInner = true;
-
- if (this.lastDoc) doc = this.lastDoc;
-
- symbol = new JSDOC.Symbol(name, params, "OBJECT", doc);
- if (isInner) symbol.isInner = true;
-
-
- if (doc) JSDOC.Parser.addSymbol(symbol);
- }
- }
- // foo = x
- else if (this.ts.look(1).is("ASSIGN")) {
- var isInner;
- if (this.ts.look(-1).is("VAR") || this.isInner) {
- name = this.namescope.last().alias+"-"+name
- if (!this.namescope.last().is("GLOBAL")) isInner = true;
- }
- else if (name.indexOf("this.") == 0) {
- name = this.resolveThis(name);
- }
-
- if (this.lastDoc) doc = this.lastDoc;
-
- symbol = new JSDOC.Symbol(name, params, "OBJECT", doc);
- if (isInner) symbol.isInner = true;
-
-
- if (doc) JSDOC.Parser.addSymbol(symbol);
- }
- // foo: {}
- else if (this.ts.look(1).is("COLON") && this.ts.look(2).is("LEFT_CURLY")) {
- name = (this.namescope.last().alias+"."+name).replace("#.", "#");
-
- if (this.lastDoc) doc = this.lastDoc;
-
- symbol = new JSDOC.Symbol(name, params, "OBJECT", doc);
-
-
- if (doc) JSDOC.Parser.addSymbol(symbol);
-
- this.namescope.push(symbol);
-
- var matching = this.ts.getMatchingToken("LEFT_CURLY");
- if (matching) matching.popNamescope = name;
- else LOG.warn("Mismatched } character. Can't parse code in file " + symbol.srcFile + ".");
- }
- // foo: x
- else if (this.ts.look(1).is("COLON")) {
- name = (this.namescope.last().alias+"."+name).replace("#.", "#");;
-
- if (this.lastDoc) doc = this.lastDoc;
-
- symbol = new JSDOC.Symbol(name, params, "OBJECT", doc);
-
-
- if (doc) JSDOC.Parser.addSymbol(symbol);
- }
- // foo(...)
- else if (this.ts.look(1).is("LEFT_PAREN")) {
- if (typeof JSDOC.PluginManager != "undefined") {
- var functionCall = {name: name};
-
- var cursor = this.ts.cursor;
- params = JSDOC.Walker.onParamList(this.ts.balance("LEFT_PAREN"));
- this.ts.cursor = cursor;
-
- for (var i = 0; i < params.length; i++)
- functionCall["arg" + (i + 1)] = params[i].name;
-
- JSDOC.PluginManager.run("onFunctionCall", functionCall);
- if (functionCall.doc) {
- this.ts.insertAhead(new JSDOC.Token(functionCall.doc, "COMM", "JSDOC"));
- }
- }
- }
- this.lastDoc = null;
- }
- else if (this.token.is("FUNCTION")) { // it's an anonymous function
- if (
- (!this.ts.look(-1).is("COLON") || !this.ts.look(-1).is("ASSIGN"))
- && !this.ts.look(1).is("NAME")
- ) {
- if (this.lastDoc) doc = this.lastDoc;
-
- name = "$anonymous";
- name = this.namescope.last().alias+"-"+name
-
- params = JSDOC.Walker.onParamList(this.ts.balance("LEFT_PAREN"));
-
- symbol = new JSDOC.Symbol(name, params, "FUNCTION", doc);
-
- JSDOC.Parser.addSymbol(symbol);
-
- this.namescope.push(symbol);
-
- var matching = this.ts.getMatchingToken("LEFT_CURLY");
- if (matching) matching.popNamescope = name;
- else LOG.warn("Mismatched } character. Can't parse code in file " + symbol.srcFile + ".");
- }
- }
- }
- return true;
-}
-
-/**
- Resolves what "this." means when it appears in a name.
- @param name The name that starts with "this.".
- @returns The name with "this." resolved.
- */
-JSDOC.Walker.prototype.resolveThis = function(name) {
- name.match(/^this\.(.+)$/)
- var nameFragment = RegExp.$1;
- if (!nameFragment) return name;
-
- var symbol = this.namescope.last();
- var scopeType = symbol.scopeType || symbol.isa;
-
- // if we are in a constructor function, `this` means the instance
- if (scopeType == "CONSTRUCTOR") {
- name = symbol.alias+"#"+nameFragment;
- }
-
- // if we are in an anonymous constructor function, `this` means the instance
- else if (scopeType == "INSTANCE") {
- name = symbol.alias+"."+nameFragment;
- }
-
- // if we are in a function, `this` means the container (possibly the global)
- else if (scopeType == "FUNCTION") {
- // in a method of a prototype, so `this` means the constructor
- if (symbol.alias.match(/(^.*)[#.-][^#.-]+/)) {
- var parentName = RegExp.$1;
- var parent = JSDOC.Parser.symbols.getSymbol(parentName);
-
- if (!parent) {
- if (JSDOC.Lang.isBuiltin(parentName)) parent = JSDOC.Parser.addBuiltin(parentName);
- else {
- if (symbol.alias.indexOf("$anonymous") < 0) // these will be ignored eventually
- LOG.warn("Trying to document "+symbol.alias+" without first documenting "+parentName+".");
- }
- }
- if (parent) name = parentName+(parent.is("CONSTRUCTOR")?"#":".")+nameFragment;
- }
- else {
- parent = this.namescope.last(1);
- name = parent.alias+(parent.is("CONSTRUCTOR")?"#":".")+nameFragment;
- }
- }
- // otherwise it means the global
- else {
- name = nameFragment;
- }
-
- return name;
-}
-
-JSDOC.Walker.onParamList = function(/**Array*/paramTokens) {
- if (!paramTokens) {
- LOG.warn("Malformed parameter list. Can't parse code.");
- return [];
- }
- var params = [];
- for (var i = 0, l = paramTokens.length; i < l; i++) {
- if (paramTokens[i].is("JSDOC")) {
- var paramType = paramTokens[i].data.replace(/(^\/\*\* *| *\*\/$)/g, "");
-
- if (paramTokens[i+1] && paramTokens[i+1].is("NAME")) {
- i++;
- params.push({type: paramType, name: paramTokens[i].data});
- }
- }
- else if (paramTokens[i].is("NAME")) {
- params.push({name: paramTokens[i].data});
- }
- }
- return params;
-}
diff --git a/utils/jsdoc-toolkit/app/main.js b/utils/jsdoc-toolkit/app/main.js
deleted file mode 100755
index 9b78182..0000000
--- a/utils/jsdoc-toolkit/app/main.js
+++ /dev/null
@@ -1,111 +0,0 @@
-/**
- * @version $Id: main.js 795 2009-06-19 07:03:22Z micmath $
- */
-
-function main() {
- IO.include("lib/JSDOC.js");
- IO.includeDir("plugins/");
-
- // process the options
-
- // the -c option: options are defined in a configuration file
- if (JSDOC.opt.c) {
- eval("JSDOC.conf = " + IO.readFile(JSDOC.opt.c));
-
- LOG.inform("Using configuration file at '"+JSDOC.opt.c+"'.");
-
- for (var c in JSDOC.conf) {
- if (c !== "D" && !defined(JSDOC.opt[c])) { // commandline overrules config file
- JSDOC.opt[c] = JSDOC.conf[c];
- }
- }
-
- if (typeof JSDOC.conf["_"] != "undefined") {
- JSDOC.opt["_"] = JSDOC.opt["_"].concat(JSDOC.conf["_"]);
- }
-
- LOG.inform("With configuration: ");
- for (var o in JSDOC.opt) {
- LOG.inform(" "+o+": "+JSDOC.opt[o]);
- }
- }
-
- // be verbose
- if (JSDOC.opt.v) LOG.verbose = true;
-
- // send log messages to a file
- if (JSDOC.opt.o) LOG.out = IO.open(JSDOC.opt.o);
-
- // run the unit tests
- if (JSDOC.opt.T) {
- LOG.inform("JsDoc Toolkit running in test mode at "+new Date()+".");
- IO.include("frame/Testrun.js");
- IO.include("test.js");
- }
- else {
- // a template must be defined and must be a directory path
- if (!JSDOC.opt.t && System.getProperty("jsdoc.template.dir")) {
- JSDOC.opt.t = System.getProperty("jsdoc.template.dir");
- }
- if (JSDOC.opt.t && !JSDOC.opt.t.charAt(JSDOC.opt.t.length-1).match(/[\\\/]/)) {
- JSDOC.opt.t += SYS.slash;
- }
-
- // verbose messages about the options we were given
- LOG.inform("JsDoc Toolkit main() running at "+new Date()+".");
- LOG.inform("With options: ");
- for (var o in JSDOC.opt) {
- LOG.inform(" "+o+": "+JSDOC.opt[o]);
- }
-
- // initialize and build a symbolSet from your code
- JSDOC.JsDoc();
-
- // debugger's option: dump the entire symbolSet produced from your code
- if (JSDOC.opt.Z) {
- LOG.warn("So you want to see the data structure, eh? This might hang if you have circular refs...");
- IO.include("frame/Dumper.js");
- var symbols = JSDOC.JsDoc.symbolSet.toArray();
- for (var i = 0, l = symbols.length; i < l; i++) {
- var symbol = symbols[i];
- print("// symbol: " + symbol.alias);
- print(symbol.serialize());
- }
- }
- else {
- if (typeof JSDOC.opt.t != "undefined") {
- try {
- // a file named "publish.js" must exist in the template directory
- load(JSDOC.opt.t+"publish.js");
-
- // and must define a function named "publish"
- if (!publish) {
- LOG.warn("No publish() function is defined in that template so nothing to do.");
- }
- else {
- // which will be called with the symbolSet produced from your code
- publish(JSDOC.JsDoc.symbolSet);
- }
- }
- catch(e) {
- LOG.warn("Sorry, that doesn't seem to be a valid template: "+JSDOC.opt.t+"publish.js : "+e);
- }
- }
- else {
- LOG.warn("No template given. Might as well read the usage notes.");
- JSDOC.usage();
- }
- }
- }
-
- // notify of any warnings
- if (!JSDOC.opt.q && LOG.warnings.length) {
- print(LOG.warnings.length+" warning"+(LOG.warnings.length != 1? "s":"")+".");
- }
-
- // stop sending log messages to a file
- if (LOG.out) {
- LOG.out.flush();
- LOG.out.close();
- }
-} \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/plugins/commentSrcJson.js b/utils/jsdoc-toolkit/app/plugins/commentSrcJson.js
deleted file mode 100755
index e826b57..0000000
--- a/utils/jsdoc-toolkit/app/plugins/commentSrcJson.js
+++ /dev/null
@@ -1,20 +0,0 @@
-JSDOC.PluginManager.registerPlugin(
- "JSDOC.commentSrcJson",
- {
- onDocCommentSrc: function(comment) {
- var json;
- if (/^\s*@json\b/.test(comment)) {
- comment.src = new String(comment.src).replace("@json", "");
-
- eval("json = "+comment.src);
- var tagged = "";
- for (var i in json) {
- var tag = json[i];
- // todo handle cases where tag is an object
- tagged += "@"+i+" "+tag+"\n";
- }
- comment.src = tagged;
- }
- }
- }
-); \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/plugins/frameworkPrototype.js b/utils/jsdoc-toolkit/app/plugins/frameworkPrototype.js
deleted file mode 100755
index 9c41751..0000000
--- a/utils/jsdoc-toolkit/app/plugins/frameworkPrototype.js
+++ /dev/null
@@ -1,16 +0,0 @@
-JSDOC.PluginManager.registerPlugin(
- "JSDOC.frameworkPrototype",
- {
- onPrototypeClassCreate: function(classCreator) {
- var desc = "";
- if (classCreator.comment) {
- desc = classCreator.comment;
- }
- var insert = desc+"/** @name "+classCreator.name+"\n@constructor\n@scope "+classCreator.name+".prototype */"
-
- insert = insert.replace(/\*\/\/\*\*/g, "\n");
- /*DEBUG*///print("insert is "+insert);
- classCreator.addComment.data = insert;
- }
- }
-);
diff --git a/utils/jsdoc-toolkit/app/plugins/functionCall.js b/utils/jsdoc-toolkit/app/plugins/functionCall.js
deleted file mode 100755
index 6f87705..0000000
--- a/utils/jsdoc-toolkit/app/plugins/functionCall.js
+++ /dev/null
@@ -1,10 +0,0 @@
-JSDOC.PluginManager.registerPlugin(
- "JSDOC.functionCall",
- {
- onFunctionCall: function(functionCall) {
- if (functionCall.name == "dojo.define" && functionCall.arg1) {
- functionCall.doc = "/** @lends "+eval(functionCall.arg1)+".prototype */";
- }
- }
- }
-); \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/plugins/publishSrcHilite.js b/utils/jsdoc-toolkit/app/plugins/publishSrcHilite.js
deleted file mode 100755
index 65514f2..0000000
--- a/utils/jsdoc-toolkit/app/plugins/publishSrcHilite.js
+++ /dev/null
@@ -1,62 +0,0 @@
-JSDOC.PluginManager.registerPlugin(
- "JSDOC.publishSrcHilite",
- {
- onPublishSrc: function(src) {
- if (src.path in JsHilite.cache) {
- return; // already generated src code
- }
- else JsHilite.cache[src.path] = true;
-
- try {
- var sourceCode = IO.readFile(src.path);
- }
- catch(e) {
- print(e.message);
- quit();
- }
-
- var hiliter = new JsHilite(sourceCode, src.charset);
- src.hilited = hiliter.hilite();
- }
- }
-);
-
-function JsHilite(src, charset) {
-
- var tr = new JSDOC.TokenReader();
-
- tr.keepComments = true;
- tr.keepDocs = true;
- tr.keepWhite = true;
-
- this.tokens = tr.tokenize(new JSDOC.TextStream(src));
-
- // TODO is redefining toString() the best way?
- JSDOC.Token.prototype.toString = function() {
- return "<span class=\""+this.type+"\">"+this.data.replace(/</g, "&lt;")+"</span>";
- }
-
- if (!charset) charset = "utf-8";
-
- this.header = '<html><head><meta http-equiv="content-type" content="text/html; charset='+charset+'"> '+
- "<style>\n\
- .KEYW {color: #933;}\n\
- .COMM {color: #bbb; font-style: italic;}\n\
- .NUMB {color: #393;}\n\
- .STRN {color: #393;}\n\
- .REGX {color: #339;}\n\
- .line {border-right: 1px dotted #666; color: #666; font-style: normal;}\n\
- </style></head><body><pre>";
- this.footer = "</pre></body></html>";
- this.showLinenumbers = true;
-}
-
-JsHilite.cache = {};
-
-JsHilite.prototype.hilite = function() {
- var hilited = this.tokens.join("");
- var line = 1;
- if (this.showLinenumbers) hilited = hilited.replace(/(^|\n)/g, function(m){return m+"<span class='line'>"+((line<10)? " ":"")+((line<100)? " ":"")+(line++)+"</span> "});
-
- return this.header+hilited+this.footer;
-} \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/plugins/symbolLink.js b/utils/jsdoc-toolkit/app/plugins/symbolLink.js
deleted file mode 100755
index c87f1ca..0000000
--- a/utils/jsdoc-toolkit/app/plugins/symbolLink.js
+++ /dev/null
@@ -1,10 +0,0 @@
-JSDOC.PluginManager.registerPlugin(
- "JSDOC.symbolLink",
- {
- onSymbolLink: function(link) {
- // modify link.linkPath (the href part of the link)
- // or link.linkText (the text displayed)
- // or link.linkInner (the #name part of the link)
- }
- }
-); \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/plugins/tagParamConfig.js b/utils/jsdoc-toolkit/app/plugins/tagParamConfig.js
deleted file mode 100755
index 3ea8a1b..0000000
--- a/utils/jsdoc-toolkit/app/plugins/tagParamConfig.js
+++ /dev/null
@@ -1,31 +0,0 @@
-JSDOC.PluginManager.registerPlugin(
- "JSDOC.tagParamConfig",
- {
- onDocCommentTags: function(comment) {
- var currentParam = null;
- var tags = comment.tags;
- for (var i = 0, l = tags.length; i < l; i++) {
-
- if (tags[i].title == "param") {
- if (tags[i].name.indexOf(".") == -1) {
- currentParam = i;
- }
- }
- else if (tags[i].title == "config") {
- tags[i].title = "param";
- if (currentParam == null) {
- tags[i].name = "arguments"+"."+tags[i].name;
- }
- else if (tags[i].name.indexOf(tags[currentParam].name+".") != 0) {
- tags[i].name = tags[currentParam].name+"."+tags[i].name;
- }
- currentParam != null
- //tags[currentParam].properties.push(tags[i]);
- }
- else {
- currentParam = null;
- }
- }
- }
- }
-);
diff --git a/utils/jsdoc-toolkit/app/plugins/tagSynonyms.js b/utils/jsdoc-toolkit/app/plugins/tagSynonyms.js
deleted file mode 100755
index 49a874f..0000000
--- a/utils/jsdoc-toolkit/app/plugins/tagSynonyms.js
+++ /dev/null
@@ -1,43 +0,0 @@
-JSDOC.PluginManager.registerPlugin(
- "JSDOC.tagSynonyms",
- {
- onDocCommentSrc: function(comment) {
- comment.src = comment.src.replace(/@methodOf\b/i, "@function\n@memberOf");
- comment.src = comment.src.replace(/@fieldOf\b/i, "@field\n@memberOf");
- },
-
- onDocCommentTags: function(comment) {
- for (var i = 0, l = comment.tags.length; i < l; i++) {
- var title = comment.tags[i].title.toLowerCase();
- var syn;
- if ((syn = JSDOC.tagSynonyms.synonyms["="+title])) {
- comment.tags[i].title = syn;
- }
- }
- }
- }
-);
-
-new Namespace(
- "JSDOC.tagSynonyms",
- function() {
- JSDOC.tagSynonyms.synonyms = {
- "=member": "memberOf",
- "=memberof": "memberOf",
- "=description": "desc",
- "=exception": "throws",
- "=argument": "param",
- "=returns": "return",
- "=classdescription": "class",
- "=fileoverview": "overview",
- "=extends": "augments",
- "=base": "augments",
- "=projectdescription": "overview",
- "=classdescription": "class",
- "=link": "see",
- "=borrows": "inherits",
- "=scope": "lends",
- "=construct": "constructor"
- }
- }
-); \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/run.js b/utils/jsdoc-toolkit/app/run.js
deleted file mode 100755
index 1f875cd..0000000
--- a/utils/jsdoc-toolkit/app/run.js
+++ /dev/null
@@ -1,348 +0,0 @@
-/**
- * @fileOverview
- * A bootstrap script that creates some basic required objects
- * for loading other scripts.
- * @author Michael Mathews, micmath@gmail.com
- * @version $Id: run.js 756 2009-01-07 21:32:58Z micmath $
- */
-
-/**
- * @namespace Keep track of any messages from the running script.
- */
-LOG = {
- warn: function(msg, e) {
- if (JSDOC.opt.q) return;
- if (e) msg = e.fileName+", line "+e.lineNumber+": "+msg;
-
- msg = ">> WARNING: "+msg;
- LOG.warnings.push(msg);
- if (LOG.out) LOG.out.write(msg+"\n");
- else print(msg);
- },
-
- inform: function(msg) {
- if (JSDOC.opt.q) return;
- msg = " > "+msg;
- if (LOG.out) LOG.out.write(msg+"\n");
- else if (typeof LOG.verbose != "undefined" && LOG.verbose) print(msg);
- }
-};
-LOG.warnings = [];
-LOG.verbose = false
-LOG.out = undefined;
-
-/**
- * @class Manipulate a filepath.
- */
-function FilePath(absPath, separator) {
- this.slash = separator || "/";
- this.root = this.slash;
- this.path = [];
- this.file = "";
-
- var parts = absPath.split(/[\\\/]/);
- if (parts) {
- if (parts.length) this.root = parts.shift() + this.slash;
- if (parts.length) this.file = parts.pop()
- if (parts.length) this.path = parts;
- }
-
- this.path = this.resolvePath();
-}
-
-/** Collapse any dot-dot or dot items in a filepath. */
-FilePath.prototype.resolvePath = function() {
- var resolvedPath = [];
- for (var i = 0; i < this.path.length; i++) {
- if (this.path[i] == "..") resolvedPath.pop();
- else if (this.path[i] != ".") resolvedPath.push(this.path[i]);
- }
- return resolvedPath;
-}
-
-/** Trim off the filename. */
-FilePath.prototype.toDir = function() {
- if (this.file) this.file = "";
- return this;
-}
-
-/** Go up a directory. */
-FilePath.prototype.upDir = function() {
- this.toDir();
- if (this.path.length) this.path.pop();
- return this;
-}
-
-FilePath.prototype.toString = function() {
- return this.root
- + this.path.join(this.slash)
- + ((this.path.length > 0)? this.slash : "")
- + this.file;
-}
-
-/**
- * Turn a path into just the name of the file.
- */
-FilePath.fileName = function(path) {
- var nameStart = Math.max(path.lastIndexOf("/")+1, path.lastIndexOf("\\")+1, 0);
- return path.substring(nameStart);
-}
-
-/**
- * Get the extension of a filename
- */
-FilePath.fileExtension = function(filename) {
- return filename.split(".").pop().toLowerCase();
-};
-
-/**
- * Turn a path into just the directory part.
- */
-FilePath.dir = function(path) {
- var nameStart = Math.max(path.lastIndexOf("/")+1, path.lastIndexOf("\\")+1, 0);
- return path.substring(0, nameStart-1);
-}
-
-
-importClass(java.lang.System);
-
-/**
- * @namespace A collection of information about your system.
- */
-SYS = {
- /**
- * Information about your operating system: arch, name, version.
- * @type string
- */
- os: [
- new String(System.getProperty("os.arch")),
- new String(System.getProperty("os.name")),
- new String(System.getProperty("os.version"))
- ].join(", "),
-
- /**
- * Which way does your slash lean.
- * @type string
- */
- slash: System.getProperty("file.separator")||"/",
-
- /**
- * The path to the working directory where you ran java.
- * @type string
- */
- userDir: new String(System.getProperty("user.dir")),
-
- /**
- * Where is Java's home folder.
- * @type string
- */
- javaHome: new String(System.getProperty("java.home")),
-
- /**
- * The absolute path to the directory containing this script.
- * @type string
- */
- pwd: undefined
-};
-
-// jsrun appends an argument, with the path to here.
-if (arguments[arguments.length-1].match(/^-j=(.+)/)) {
- if (RegExp.$1.charAt(0) == SYS.slash || RegExp.$1.charAt(1) == ":") { // absolute path to here
- SYS.pwd = new FilePath(RegExp.$1).toDir().toString();
- }
- else { // relative path to here
- SYS.pwd = new FilePath(SYS.userDir + SYS.slash + RegExp.$1).toDir().toString();
- }
- arguments.pop();
-}
-else {
- print("The run.js script requires you use jsrun.jar.");
- quit();
-}
-
-// shortcut
-var File = Packages.java.io.File;
-
-/**
- * @namespace A collection of functions that deal with reading a writing to disk.
- */
-IO = {
-
- /**
- * Create a new file in the given directory, with the given name and contents.
- */
- saveFile: function(/**string*/ outDir, /**string*/ fileName, /**string*/ content) {
- var out = new Packages.java.io.PrintWriter(
- new Packages.java.io.OutputStreamWriter(
- new Packages.java.io.FileOutputStream(outDir+SYS.slash+fileName),
- IO.encoding
- )
- );
- out.write(content);
- out.flush();
- out.close();
- },
-
- /**
- * @type string
- */
- readFile: function(/**string*/ path) {
- if (!IO.exists(path)) {
- throw "File doesn't exist there: "+path;
- }
- return readFile(path, IO.encoding);
- },
-
- /**
- * @param inFile
- * @param outDir
- * @param [fileName=The original filename]
- */
- copyFile: function(/**string*/ inFile, /**string*/ outDir, /**string*/ fileName) {
- if (fileName == null) fileName = FilePath.fileName(inFile);
-
- var inFile = new File(inFile);
- var outFile = new File(outDir+SYS.slash+fileName);
-
- var bis = new Packages.java.io.BufferedInputStream(new Packages.java.io.FileInputStream(inFile), 4096);
- var bos = new Packages.java.io.BufferedOutputStream(new Packages.java.io.FileOutputStream(outFile), 4096);
- var theChar;
- while ((theChar = bis.read()) != -1) {
- bos.write(theChar);
- }
- bos.close();
- bis.close();
- },
-
- /**
- * Creates a series of nested directories.
- */
- mkPath: function(/**Array*/ path) {
- if (path.constructor != Array) path = path.split(/[\\\/]/);
- var make = "";
- for (var i = 0, l = path.length; i < l; i++) {
- make += path[i] + SYS.slash;
- if (! IO.exists(make)) {
- IO.makeDir(make);
- }
- }
- },
-
- /**
- * Creates a directory at the given path.
- */
- makeDir: function(/**string*/ path) {
- (new File(path)).mkdir();
- },
-
- /**
- * @type string[]
- * @param dir The starting directory to look in.
- * @param [recurse=1] How many levels deep to scan.
- * @returns An array of all the paths to files in the given dir.
- */
- ls: function(/**string*/ dir, /**number*/ recurse, _allFiles, _path) {
- if (_path === undefined) { // initially
- var _allFiles = [];
- var _path = [dir];
- }
- if (_path.length == 0) return _allFiles;
- if (recurse === undefined) recurse = 1;
-
- dir = new File(dir);
- if (!dir.directory) return [String(dir)];
- var files = dir.list();
-
- for (var f = 0; f < files.length; f++) {
- var file = String(files[f]);
- if (file.match(/^\.[^\.\/\\]/)) continue; // skip dot files
-
- if ((new File(_path.join(SYS.slash)+SYS.slash+file)).list()) { // it's a directory
- _path.push(file);
- if (_path.length-1 < recurse) IO.ls(_path.join(SYS.slash), recurse, _allFiles, _path);
- _path.pop();
- }
- else {
- _allFiles.push((_path.join(SYS.slash)+SYS.slash+file).replace(SYS.slash+SYS.slash, SYS.slash));
- }
- }
-
- return _allFiles;
- },
-
- /**
- * @type boolean
- */
- exists: function(/**string*/ path) {
- file = new File(path);
-
- if (file.isDirectory()){
- return true;
- }
- if (!file.exists()){
- return false;
- }
- if (!file.canRead()){
- return false;
- }
- return true;
- },
-
- /**
- *
- */
- open: function(/**string*/ path, /**string*/ append) {
- var append = true;
- var outFile = new File(path);
- var out = new Packages.java.io.PrintWriter(
- new Packages.java.io.OutputStreamWriter(
- new Packages.java.io.FileOutputStream(outFile, append),
- IO.encoding
- )
- );
- return out;
- },
-
- /**
- * Sets {@link IO.encoding}.
- * Encoding is used when reading and writing text to files,
- * and in the meta tags of HTML output.
- */
- setEncoding: function(/**string*/ encoding) {
- if (/ISO-8859-([0-9]+)/i.test(encoding)) {
- IO.encoding = "ISO8859_"+RegExp.$1;
- }
- else {
- IO.encoding = encoding;
- }
- },
-
- /**
- * @default "utf-8"
- * @private
- */
- encoding: "utf-8",
-
- /**
- * Load the given script.
- */
- include: function(relativePath) {
- load(SYS.pwd+relativePath);
- },
-
- /**
- * Loads all scripts from the given directory path.
- */
- includeDir: function(path) {
- if (!path) return;
-
- for (var lib = IO.ls(SYS.pwd+path), i = 0; i < lib.length; i++)
- if (/\.js$/i.test(lib[i])) load(lib[i]);
- }
-}
-
-// now run the application
-IO.include("frame.js");
-IO.include("main.js");
-
-main();
diff --git a/utils/jsdoc-toolkit/app/t/TestDoc.js b/utils/jsdoc-toolkit/app/t/TestDoc.js
deleted file mode 100755
index c0768b7..0000000
--- a/utils/jsdoc-toolkit/app/t/TestDoc.js
+++ /dev/null
@@ -1,144 +0,0 @@
-var TestDoc = {
- fails: 0,
- plans: 0,
- passes: 0,
- results: []
-};
-
-TestDoc.record = function(result) {
- TestDoc.results.push(result);
- if (typeof result.verdict == "boolean") {
- if (result.verdict === false) TestDoc.fails++;
- if (result.verdict === true) TestDoc.passes++;
- }
-}
-
-TestDoc.prove = function(filePath) {
- if (typeof document != "undefined" && typeof document.write != "undefined") {
- if (TestDoc.console) print = function(s) { TestDoc.console.appendChild(document.createTextNode(s+"\n")); }
- else print = function(s) { document.write(s+"<br />"); }
- }
- TestDoc.run(TestDoc.readFile(filePath));
-}
-
-TestDoc.run = function(src) {
- try { eval(src); } catch(e) { print("# ERROR! "+e); }
-
- var chunks = src.split(/\/\*t:/);
-
- var run = function(chunk) {
- // local shortcuts
- var is = TestDoc.assertEquals;
- var isnt = TestDoc.assertNotEquals;
- var plan = TestDoc.plan;
- var requires = TestDoc.requires;
-
- try { eval(chunk); } catch(e) { print("# ERROR! "+e); }
- }
- for (var start = -1, end = 0; (start = src.indexOf("/*t:", end)) > end; start = end) {
- run(
- src.substring(
- start+4,
- (end = src.indexOf("*/", start))
- )
- );
- }
-}
-
-TestDoc.Result = function(verdict, message) {
- this.verdict = verdict;
- this.message = message;
-}
-
-TestDoc.Result.prototype.toString = function() {
- if (typeof this.verdict == "boolean") {
- return (this.verdict? "ok" : "not ok") + " " + (++TestDoc.report.counter) + " - " + this.message;
- }
-
- return "# " + this.message;
-}
-
-TestDoc.requires = function(file) {
- if (!TestDoc.requires.loaded[file]) {
- load(file);
- TestDoc.requires.loaded[file] = true;
- }
-}
-TestDoc.requires.loaded = {};
-
-TestDoc.report = function() {
- TestDoc.report.counter = 0;
- print("1.."+TestDoc.plans);
- for (var i = 0; i < TestDoc.results.length; i++) {
- print(TestDoc.results[i]);
- }
- print("----------------------------------------");
- if (TestDoc.fails == 0 && TestDoc.passes == TestDoc.plans) {
- print("All tests successful.");
- }
- else {
- print("Failed " + TestDoc.fails + "/" + TestDoc.plans + " tests, "+((TestDoc.plans == 0)? 0 : Math.round(TestDoc.passes/(TestDoc.passes+TestDoc.fails)*10000)/100)+"% okay. Planned to run "+TestDoc.plans+", did run "+(TestDoc.passes+TestDoc.fails)+".")
- }
-}
-
-TestDoc.plan = function(n, message) {
- TestDoc.plans += n;
- TestDoc.record(new TestDoc.Result(null, message+" ("+n+" tests)"));
-}
-
-TestDoc.assertEquals = function(a, b, message) {
- var result = (a == b);
- if (!result) message += "\n#\n# " + a + " does not equal " + b + "\n#";
- TestDoc.record(new TestDoc.Result(result, message));
-}
-
-TestDoc.assertNotEquals = function(a, b, message) {
- var result = (a != b);
- if (!result) message += "\n#\n# " + a + " equals " + b + "\n#";
- TestDoc.record(new TestDoc.Result(result, message));
-}
-
-TestDoc.readFile = (function(){
- // rhino
- if (typeof readFile == "function") {
- return function(url) {
- var text = readFile(url);
- return text || "";
- }
- }
-
- // a web browser
- else {
- return function(url) {
- var httpRequest;
-
- if (window.XMLHttpRequest) { // Mozilla, Safari, etc
- httpRequest = new XMLHttpRequest();
- }
- else if (window.ActiveXObject) { // IE
- try {
- httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
- }
- catch (e) {
- try {
- httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
- }
- catch (e) {
- }
- }
- }
-
- if (!httpRequest) { throw "Cannot create HTTP Request."; }
-
- httpRequest.open('GET', url, false);
- httpRequest.send('');
- if (httpRequest.readyState == 4) {
- if (httpRequest.status >= 400) {
- throw "The HTTP Request returned an error code: "+httpRequest.status;
- }
- }
-
- return httpRequest.responseText || "";
- }
- }
-})();
diff --git a/utils/jsdoc-toolkit/app/t/runner.js b/utils/jsdoc-toolkit/app/t/runner.js
deleted file mode 100755
index 3f9fb4c..0000000
--- a/utils/jsdoc-toolkit/app/t/runner.js
+++ /dev/null
@@ -1,13 +0,0 @@
-// try: java -jar ../../jsrun.jar runner.js
-
-load("TestDoc.js");
-
-TestDoc.prove("../frame/Opt.js");
-TestDoc.prove("../lib/JSDOC.js");
-TestDoc.prove("../frame/String.js");
-TestDoc.prove("../lib/JSDOC/DocTag.js");
-TestDoc.prove("../lib/JSDOC/DocComment.js");
-TestDoc.prove("../lib/JSDOC/TokenReader.js");
-TestDoc.prove("../lib/JSDOC/Symbol.js");
-
-TestDoc.report();
diff --git a/utils/jsdoc-toolkit/app/test.js b/utils/jsdoc-toolkit/app/test.js
deleted file mode 100755
index 787d84f..0000000
--- a/utils/jsdoc-toolkit/app/test.js
+++ /dev/null
@@ -1,325 +0,0 @@
-load("app/frame/Dumper.js");
-function symbolize(opt) {
- symbols = null;
- JSDOC.JsDoc(opt);
- symbols = JSDOC.JsDoc.symbolSet;
-}
-
-var testCases = [
- function() {
- symbolize({a:true, p:true, _: [SYS.pwd+"test/overview.js"]});
- //print(Dumper.dump(symbols));
- is('symbols.getSymbolByName("My Cool Library").name', 'My Cool Library', 'File overview can be found by alias.');
- }
- ,
- function() {
- symbolize({_: [SYS.pwd+"test/name.js"]});
-
- is('symbols.getSymbol("Response").name', "Response", 'Virtual class name is found.');
- is('symbols.getSymbol("Response#text").alias', "Response#text", 'Virtual method name is found.');
- is('symbols.getSymbol("Response#text").memberOf', "Response", 'Virtual method parent name is found.');
- }
- ,
- function() {
- symbolize({a:true, p:true, _: [SYS.pwd+"test/prototype.js"]});
-
- is('symbols.getSymbol("Article").name', "Article", 'Function set to constructor prototype with inner constructor name is found.');
- is('symbols.getSymbol("Article").hasMethod("init")', true, 'The initializer method name of prototype function is correct.');
- is('symbols.getSymbol("Article").hasMember("counter")', true, 'A static property set in the prototype definition is found.');
- is('symbols.getSymbol("Article").hasMember("title")', true, 'An instance property set in the prototype is found.');
- is('symbols.getSymbol("Article#title").isStatic', false, 'An instance property has isStatic set to false.');
- is('symbols.getSymbol("Article.counter").name', "counter", 'A static property set in the initializer has the name set correctly.');
- is('symbols.getSymbol("Article.counter").memberOf', "Article", 'A static property set in the initializer has the memberOf set correctly.');
- is('symbols.getSymbol("Article.counter").isStatic', true, 'A static property set in the initializer has isStatic set to true.');
- }
- ,
- function() {
- symbolize({a:true, _: [SYS.pwd+"test/prototype_oblit.js"]});
-
- is('symbols.getSymbol("Article").name', "Article", 'Oblit set to constructor prototype name is found.');
- is('typeof symbols.getSymbol("Article.prototype")', "undefined", 'The prototype oblit is not a symbol.');
- is('symbols.getSymbol("Article#getTitle").name', "getTitle", 'The nonstatic method name of prototype oblit is correct.');
- is('symbols.getSymbol("Article#getTitle").alias', "Article#getTitle", 'The alias of non-static method of prototype oblit is correct.');
- is('symbols.getSymbol("Article#getTitle").isStatic', false, 'The isStatic of a nonstatic method of prototype oblit is correct.');
- is('symbols.getSymbol("Article.getTitle").name', "getTitle", 'The static method name of prototype oblit is correct.');
- is('symbols.getSymbol("Article.getTitle").isStatic', true, 'The isStatic of a static method of prototype oblit is correct.');
- is('symbols.getSymbol("Article#getTitle").isa', "FUNCTION", 'The isa of non-static method of prototype oblit is correct.');
- is('symbols.getSymbol("Article.getTitle").alias', "Article.getTitle", 'The alias of a static method of prototype oblit is correct.');
- is('symbols.getSymbol("Article.getTitle").isa', "FUNCTION", 'The isa of static method of prototype oblit is correct.');
- }
- ,
- function() {
- symbolize({a:true, p:true, _: [SYS.pwd+"test/prototype_oblit_constructor.js"]});
-
- is('symbols.getSymbol("Article").name', "Article", 'Oblit set to constructor prototype with inner constructor name is found.');
- is('symbols.getSymbol("Article#init").name', "init", 'The initializer method name of prototype oblit is correct.');
- is('symbols.getSymbol("Article").hasMember("pages")', true, 'Property set by initializer method "this" is on the outer constructor.');
- is('symbols.getSymbol("Article#Title").name', "Title", 'Name of the inner constructor name is found.');
- is('symbols.getSymbol("Article#Title").memberOf', "Article", 'The memberOf of the inner constructor name is found.');
- is('symbols.getSymbol("Article#Title").isa', "CONSTRUCTOR", 'The isa of the inner constructor name is constructor.');
- is('symbols.getSymbol("Article#Title").hasMember("title")', true, 'A property set on the inner constructor "this" is on the inner constructor.');
- }
- ,
- function() {
- symbolize({a:true, p:true, _: [SYS.pwd+"test/inner.js"]});
-
- is('symbols.getSymbol("Outer").name', "Outer", 'Outer constructor prototype name is found.');
- is('symbols.getSymbol("Outer").methods.length', 1, 'Inner function doesnt appear as a method of the outer.');
- is('symbols.getSymbol("Outer").hasMethod("open")', true, 'Outer constructors methods arent affected by inner function.');
- is('symbols.getSymbol("Outer-Inner").alias', "Outer-Inner", 'Alias of inner function is found.');
- is('symbols.getSymbol("Outer-Inner").isa', "CONSTRUCTOR", 'isa of inner function constructor is found.');
- is('symbols.getSymbol("Outer-Inner").memberOf', "Outer", 'The memberOf of inner function is found.');
- is('symbols.getSymbol("Outer-Inner").name', "Inner", 'The name of inner function is found.');
- is('symbols.getSymbol("Outer-Inner#name").name', "name", 'A member of the inner function constructor, attached to "this" is found on inner.');
- is('symbols.getSymbol("Outer-Inner#name").memberOf', "Outer-Inner", 'The memberOf of an inner function member is found.');
- }
- ,
- function() {
- symbolize({a:true, _: [SYS.pwd+"test/prototype_nested.js"]});
-
- is('symbols.getSymbol("Word").name', "Word", 'Base constructor name is found.');
- is('symbols.getSymbol("Word").hasMethod("reverse")', true, 'Base constructor method is found.');
- is('symbols.getSymbol("Word").methods.length', 1, 'Base constructor has only one method.');
- is('symbols.getSymbol("Word").memberOf', "", 'Base constructor memberOf is empty.');
- is('symbols.getSymbol("Word#reverse").name', "reverse", 'Member of constructor prototype name is found.');
- is('symbols.getSymbol("Word#reverse").memberOf', "Word", 'Member of constructor prototype memberOf is found.');
- is('symbols.getSymbol("Word#reverse.utf8").name', "utf8", 'Member of constructor prototype method name is found.');
- is('symbols.getSymbol("Word#reverse.utf8").memberOf', "Word#reverse", 'Static nested member memberOf is found.');
- }
- ,
- function() {
- symbolize({a:true, _: [SYS.pwd+"test/namespace_nested.js"]});
-
- is('symbols.getSymbol("ns1").name', "ns1", 'Base namespace name is found.');
- is('symbols.getSymbol("ns1").memberOf', "", 'Base namespace memberOf is empty (its a constructor).');
- is('symbols.getSymbol("ns1.ns2").name', "ns2", 'Nested namespace name is found.');
- is('symbols.getSymbol("ns1.ns2").alias', "ns1.ns2", 'Nested namespace alias is found.');
- is('symbols.getSymbol("ns1.ns2").memberOf', "ns1", 'Nested namespace memberOf is found.');
- is('symbols.getSymbol("ns1.ns2.Function1").name', "Function1", 'Method of nested namespace name is found.');
- is('symbols.getSymbol("ns1.ns2.Function1").memberOf', "ns1.ns2", 'Constructor of nested namespace memberOf is found.');
- }
- ,
- function() {
- symbolize({a:true, p:true, _: [SYS.pwd+"test/functions_nested.js"]});
-
- is('symbols.getSymbol("Zop").name', "Zop", 'Any constructor name is found.');
- is('symbols.getSymbol("Zop").isa', "CONSTRUCTOR", 'It isa constructor.');
- is('symbols.getSymbol("Zop").hasMethod("zap")', true, 'Its method name, set later, is in methods array.');
- is('symbols.getSymbol("Foo").name', "Foo", 'The containing constructor name is found.');
- is('symbols.getSymbol("Foo").hasMethod("methodOne")', true, 'Its method name is found.');
- is('symbols.getSymbol("Foo").hasMethod("methodTwo")', true, 'Its second method name is found.');
- is('symbols.getSymbol("Foo#methodOne").alias', "Foo#methodOne", 'A methods alias is found.');
- is('symbols.getSymbol("Foo#methodOne").isStatic', false, 'A methods is not static.');
- is('symbols.getSymbol("Bar").name', "Bar", 'A global function declared inside another function is found.');
- is('symbols.getSymbol("Bar").isa', "FUNCTION", 'It isa function.');
- is('symbols.getSymbol("Bar").memberOf', "_global_", 'It is global.');
- is('symbols.getSymbol("Foo-inner").name', "inner", 'An inner functions name is found.');
- is('symbols.getSymbol("Foo-inner").memberOf', "Foo", 'It is member of the outer function.');
- is('symbols.getSymbol("Foo-inner").isInner', true, 'It is an inner function.');
- }
- ,
- function() {
- symbolize({a:true, _: [SYS.pwd+"test/memberof_constructor.js"]});
-
- is('symbols.getSymbol("Circle#Tangent").name', "Tangent", 'Constructor set on prototype using @member has correct name.');
- is('symbols.getSymbol("Circle#Tangent").memberOf', "Circle", 'Constructor set on prototype using @member has correct memberOf.');
- is('symbols.getSymbol("Circle#Tangent").alias', "Circle#Tangent", 'Constructor set on prototype using @member has correct alias.');
- is('symbols.getSymbol("Circle#Tangent").isa', "CONSTRUCTOR", 'Constructor set on prototype using @member has correct isa.');
- is('symbols.getSymbol("Circle#Tangent").isStatic', false, 'Constructor set on prototype using @member is not static.');
- is('symbols.getSymbol("Circle#Tangent#getDiameter").name', "getDiameter", 'Method set on prototype using @member has correct name.');
- is('symbols.getSymbol("Circle#Tangent#getDiameter").memberOf', "Circle#Tangent", 'Method set on prototype using @member has correct memberOf.');
- is('symbols.getSymbol("Circle#Tangent#getDiameter").alias', "Circle#Tangent#getDiameter", 'Method set on prototype using @member has correct alias.');
- is('symbols.getSymbol("Circle#Tangent#getDiameter").isa', "FUNCTION", 'Method set on prototype using @member has correct isa.');
- is('symbols.getSymbol("Circle#Tangent#getDiameter").isStatic', false, 'Method set on prototype using @member is not static.');
- }
- ,
- function() {
- symbolize({a:true, p: true, _: [SYS.pwd+"test/memberof.js"]});
-
- is('symbols.getSymbol("pack.install").alias', "pack.install", 'Using @memberOf sets alias, when parent name is in memberOf tag.');
- is('symbols.getSymbol("pack.install.overwrite").name', "install.overwrite", 'Using @memberOf sets name, even if the name is dotted.');
- is('symbols.getSymbol("pack.install.overwrite").memberOf', "pack", 'Using @memberOf sets memberOf.');
- is('symbols.getSymbol("pack.install.overwrite").isStatic', true, 'Using @memberOf with value not ending in octothorp sets isStatic to true.');
- }
- ,
- function() {
- symbolize({a:true, p:true, _: [SYS.pwd+"test/borrows.js"]});
-
- is('symbols.getSymbol("Layout").name', "Layout", 'Constructor can be found.');
- is('symbols.getSymbol("Layout").hasMethod("init")', true, 'Constructor method name can be found.');
- is('symbols.getSymbol("Layout").hasMember("orientation")', true, 'Constructor property name can be found.');
-
- is('symbols.getSymbol("Page").hasMethod("reset")', true, 'Second constructor method name can be found.');
- is('symbols.getSymbol("Page").hasMember("orientation")', true, 'Second constructor borrowed property name can be found in properties.');
- is('symbols.getSymbol("Page#orientation").memberOf', "Page", 'Second constructor borrowed property memberOf can be found.');
- is('symbols.getSymbol("Page-getInnerElements").alias', "Page-getInnerElements", 'Can borrow an inner function and it is still inner.');
- is('symbols.getSymbol("Page.units").alias', "Page.units", 'Can borrow a static function and it is still static.');
-
- is('symbols.getSymbol("ThreeColumnPage#init").alias', "ThreeColumnPage#init", 'Third constructor method can be found even though method with same name is borrowed.');
- is('symbols.getSymbol("ThreeColumnPage#reset").alias', "ThreeColumnPage#reset", 'Borrowed method can be found.');
- is('symbols.getSymbol("ThreeColumnPage#orientation").alias', "ThreeColumnPage#orientation", 'Twice borrowed method can be found.');
-
- }
- ,
- function() {
- symbolize({a:true, p:true, _: [SYS.pwd+"test/borrows2.js"]});
-
- is('symbols.getSymbol("Foo").hasMethod("my_zop")', true, 'Borrowed method can be found.');
- is('symbols.getSymbol("Bar").hasMethod("my_zip")', true, 'Second borrowed method can be found.');
- }
- ,
- function() {
- symbolize({a:true, p:true, _: [SYS.pwd+"test/constructs.js"]});
-
- is('symbols.getSymbol("Person").hasMethod("say")', true, 'The constructs tag creates a class that lends can add a method to.');
- }
- ,
- function() {
- symbolize({a: true, _: [SYS.pwd+"test/augments.js", SYS.pwd+"test/augments2.js"]});
-
- is('symbols.getSymbol("Page").augments[0]', "Layout", 'An augmented class can be found.');
- is('symbols.getSymbol("Page#reset").alias', "Page#reset", 'Method of augmenter can be found.');
- is('symbols.getSymbol("Page").hasMethod("Layout#init")', true, 'Method from augmented can be found.');
- is('symbols.getSymbol("Page").hasMember("Layout#orientation")', true, 'Property from augmented can be found.');
- is('symbols.getSymbol("Page").methods.length', 3, 'Methods of augmented class are included in methods array.');
-
- is('symbols.getSymbol("ThreeColumnPage").augments[0]', "Page", 'The extends tag is a synonym for augments.');
- is('symbols.getSymbol("ThreeColumnPage").hasMethod("ThreeColumnPage#init")', true, 'Local method overrides augmented method of same name.');
- is('symbols.getSymbol("ThreeColumnPage").methods.length', 3, 'Local method count is right.');
-
- is('symbols.getSymbol("NewsletterPage").augments[0]', "ThreeColumnPage", 'Can augment across file boundaries.');
- is('symbols.getSymbol("NewsletterPage").augments.length', 2, 'Multiple augments are supported.');
- is('symbols.getSymbol("NewsletterPage").inherits[0].alias', "Junkmail#annoy", 'Inherited method with augments.');
- is('symbols.getSymbol("NewsletterPage").methods.length', 6, 'Methods of augmented class are included in methods array across files.');
- is('symbols.getSymbol("NewsletterPage").properties.length', 1, 'Properties of augmented class are included in properties array across files.');
- }
- ,
- function() {
- symbolize({a:true, _: [SYS.pwd+"test/static_this.js"]});
-
- is('symbols.getSymbol("box.holder").name', "holder", 'Static namespace name can be found.');
- is('symbols.getSymbol("box.holder.foo").name', "foo", 'Static namespace method name can be found.');
- is('symbols.getSymbol("box.holder").isStatic', true, 'Static namespace method is static.');
-
- is('symbols.getSymbol("box.holder.counter").name', "counter", 'Instance namespace property name set on "this" can be found.');
- is('symbols.getSymbol("box.holder.counter").alias', "box.holder.counter", 'Instance namespace property alias set on "this" can be found.');
- is('symbols.getSymbol("box.holder.counter").memberOf', "box.holder", 'Static namespace property memberOf set on "this" can be found.');
- }
- ,
- function() {
- symbolize({a:true, p: true, _: [SYS.pwd+"test/lend.js"]});
-
- is('symbols.getSymbol("Person").name', "Person", 'Class defined in lend comment is found.');
- is('symbols.getSymbol("Person").hasMethod("initialize")', true, 'Lent instance method name can be found.');
- is('symbols.getSymbol("Person").hasMethod("say")', true, 'Second instance method can be found.');
- is('symbols.getSymbol("Person#sing").isStatic', false, 'Instance method is known to be not static.');
-
- is('symbols.getSymbol("Person.getCount").name', "getCount", 'Static method name from second lend comment can be found.');
- is('symbols.getSymbol("Person.getCount").isStatic', true, 'Static method from second lend comment is known to be static.');
-
- is('LOG.warnings.filter(function($){if($.indexOf("notok") > -1) return $}).length', 1, 'A warning is emitted when lending to an undocumented parent.');
- }
- ,
- function() {
- symbolize({a:true, _: [SYS.pwd+"test/param_inline.js"]});
-
- is('symbols.getSymbol("Layout").params[0].type', "int", 'Inline param name is set.');
- is('symbols.getSymbol("Layout").params[0].desc', "The number of columns.", 'Inline param desc is set from comment.');
- is('symbols.getSymbol("Layout#getElement").params[0].name', "id", 'User defined param documentation takes precedence over parser defined.');
- is('symbols.getSymbol("Layout#getElement").params[0].isOptional', true, 'Default for param is to not be optional.');
- is('symbols.getSymbol("Layout#getElement").params[1].isOptional', false, 'Can mark a param as being optional.');
- is('symbols.getSymbol("Layout#getElement").params[1].type', "number|string", 'Type of inline param doc can have multiple values.');
- is('symbols.getSymbol("Layout#Canvas").params[0].type', "", 'Type can be not defined for some params.');
- is('symbols.getSymbol("Layout#Canvas").params[2].type', "int", 'Type can be defined inline for only some params.');
- is('symbols.getSymbol("Layout#rotate").params.length', 0, 'Docomments inside function sig is ignored without a param.');
- is('symbols.getSymbol("Layout#init").params[2].type', "zoppler", 'Doc comment type overrides inline type for param with same name.');
- }
- ,
- function() {
- symbolize({a: true, _: [SYS.pwd+"test/shared.js", SYS.pwd+"test/shared2.js"]});
-
- is('symbols.getSymbol("Array#some").name', 'some', 'The name of a symbol in a shared section is found.');
- is('symbols.getSymbol("Array#some").alias', 'Array#some', 'The alias of a symbol in a shared section is found.');
- is('symbols.getSymbol("Array#some").desc', "Extension to builtin array.", 'A description can be shared.');
- is('symbols.getSymbol("Array#filter").desc', "Extension to builtin array.\nChange every element of an array.", 'A shared description is appended.');
- is('symbols.getSymbol("Queue").desc', "A first in, first out data structure.", 'A description is not shared when outside a shared section.');
- is('symbols.getSymbol("Queue.rewind").alias', "Queue.rewind", 'Second shared tag can be started.');
- is('symbols.getSymbol("startOver").alias', "startOver", 'Shared tag doesnt cross over files.');
- }
- ,
- function() {
- symbolize({a: true, _: [SYS.pwd+"test/config.js"]});
- is('symbols.getSymbol("Contact").params[0].name', 'person', 'The name of a param is found.');
- is('symbols.getSymbol("Contact").params[1].name', 'person.name', 'The name of a param set with a dot name is found.');
- is('symbols.getSymbol("Contact").params[2].name', 'person.age', 'The name of a second param set with a dot name is found.');
- is('symbols.getSymbol("Contact").params[4].name', 'connection', 'The name of a param after config is found.');
-
- is('symbols.getSymbol("Family").params[0].name', 'persons', 'Another name of a param is found.');
- is('symbols.getSymbol("Family").params[1].name', 'persons.Father', 'The name of a param+config is found.');
- is('symbols.getSymbol("Family").params[2].name', 'persons.Mother', 'The name of a second param+config is found.');
- is('symbols.getSymbol("Family").params[3].name', 'persons.Children', 'The name of a third param+config is found.');
- }
- ,
- function() {
- symbolize({a:true, p:true, _: [SYS.pwd+"test/ignore.js"]});
- is('LOG.warnings.filter(function($){if($.indexOf("undocumented symbol Ignored") > -1) return $}).length', 1, 'A warning is emitted when documenting members of an ignored parent.');
- }
- ,
- function() {
- symbolize({a:true, p:true, _: [SYS.pwd+"test/functions_anon.js"]});
- is('symbols.getSymbol("a.b").alias', 'a.b', 'In anonymous constructor this is found to be the container object.');
- is('symbols.getSymbol("a.f").alias', 'a.f', 'In anonymous constructor this can have a method.');
- is('symbols.getSymbol("a.c").alias', 'a.c', 'In anonymous constructor method this is found to be the container object.');
- is('symbols.getSymbol("g").alias', 'g', 'In anonymous function executed inline this is the global.');
- is('symbols.getSymbol("bar2.p").alias', 'bar2.p', 'In named constructor executed inline this is the container object.');
- is('symbols.getSymbol("module.pub").alias', 'module.pub', 'In parenthesized anonymous function executed inline function scoped variables arent documented.');
- }
- ,
- function() {
- symbolize({a:true, p:true, _: [SYS.pwd+"test/oblit_anon.js"]});
- is('symbols.getSymbol("opt").name', 'opt', 'Anonymous object properties are created.');
- is('symbols.getSymbol("opt.conf.keep").alias', 'opt.conf.keep', 'Anonymous object first property is assigned to $anonymous.');
- is('symbols.getSymbol("opt.conf.base").alias', 'opt.conf.base', 'Anonymous object second property is assigned to $anonymous.');
- }
- ,
- function() {
- symbolize({a:true, p:true, _: [SYS.pwd+"test/params_optional.js"]});
- is('symbols.getSymbol("Document").params.length', 3, 'Correct number of params are found when optional param syntax is used.');
- is('symbols.getSymbol("Document").params[1].name', "id", 'Name of optional param is found.');
- is('symbols.getSymbol("Document").params[1].isOptional', true, 'Optional param is marked isOptional.');
- is('symbols.getSymbol("Document").params[2].name', "title", 'Name of optional param with default value is found.');
- is('symbols.getSymbol("Document").params[2].isOptional', true, 'Optional param with default value is marked isOptional.');
- is('symbols.getSymbol("Document").params[2].defaultValue', " This is untitled.", 'Optional param default value is found.');
- }
- ,
- function() {
- symbolize({a:true, p:true, _: [SYS.pwd+"test/synonyms.js"]});
- is('symbols.getSymbol("myObject.myFunc").type', 'function', 'Type can be set to function.');
- }
- ,
- function() {
- symbolize({a:true, p:true, _: [SYS.pwd+"test/event.js"]});
- is('symbols.getSymbol("Kitchen#event:cakeEaten").isEvent', true, 'Function with event prefix is an event.');
- is('symbols.getSymbol("Kitchen#cakeEaten").isa', "FUNCTION", 'Function with same name as event isa function.');
- }
- ,
- function() {
- symbolize({x:"js", a:true, _: [SYS.pwd+"test/scripts/"]});
- is('JSDOC.JsDoc.srcFiles.length', 1, 'Only js files are scanned when -x=js.');
- }
- ,
- function() {
- symbolize({x:"js", a:true, _: [SYS.pwd+"test/exports.js"]});
- is('symbols.getSymbol("mxn.Map#doThings").name', 'doThings', 'Exports creates a documentation alias that can have methods.');
- }
- ,
- function() {
- symbolize({p:true, a:true, _: [SYS.pwd+"test/module.js"]});
- is('symbols.getSymbol("myProject.myModule.myPublicMethod").name', 'myPublicMethod', 'A function wrapped in parens can be recognized.');
- is('symbols.getSymbol("myProject.myModule-myPrivateMethod").name', 'myPrivateMethod', 'A private method in the scope of a function wrapped in parens can be recognized.');
- is('symbols.getSymbol("myProject.myModule-myPrivateVar").name', 'myPrivateVar', 'A private member in the scope of a function wrapped in parens can be recognized.');
- }
-];
-
-//// run and print results
-print(testrun(testCases));
diff --git a/utils/jsdoc-toolkit/app/test/addon.js b/utils/jsdoc-toolkit/app/test/addon.js
deleted file mode 100755
index 8886205..0000000
--- a/utils/jsdoc-toolkit/app/test/addon.js
+++ /dev/null
@@ -1,24 +0,0 @@
-String.prototype.reverse = function() {
-}
-
-String.prototype.reverse.utf8 = function() {
-}
-
-Function.count = function() {
-}
-
-/** @memberOf Function */
-Function.count.reset = function() {
-}
-
-/** @memberOf Function */
-count.getValue = function() {
-}
-
-/** @memberOf Function.prototype */
-getSig = function() {
-}
-
-/** @memberOf Function.prototype */
-Function.prototype.getProps = function() {
-}
diff --git a/utils/jsdoc-toolkit/app/test/anon_inner.js b/utils/jsdoc-toolkit/app/test/anon_inner.js
deleted file mode 100755
index 227eeee..0000000
--- a/utils/jsdoc-toolkit/app/test/anon_inner.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * @name bar
- * @namespace
- */
-
-new function() {
- /**
- * @name bar-foo
- * @function
- * @param {number} x
- */
- function foo(x) {
- }
-} \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/test/augments.js b/utils/jsdoc-toolkit/app/test/augments.js
deleted file mode 100755
index 12e706e..0000000
--- a/utils/jsdoc-toolkit/app/test/augments.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
-@constructor
-*/
-function Layout(p) {
- this.init = function(p) {
- }
-
- this.getId = function() {
- }
-
- /** @type Page */
- this.orientation = "landscape";
-}
-
-/**
-@constructor
-@augments Layout
-*/
-function Page() {
- this.reset = function(b) {
- }
-}
-
-/**
-@extends Page
-@constructor
-*/
-function ThreeColumnPage() {
- this.init = function(resetCode) {
- }
-}
diff --git a/utils/jsdoc-toolkit/app/test/augments2.js b/utils/jsdoc-toolkit/app/test/augments2.js
deleted file mode 100755
index e8388f0..0000000
--- a/utils/jsdoc-toolkit/app/test/augments2.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
-@constructor
-*/
-function LibraryItem() {
- this.reserve = function() {
- }
-}
-
-/**
-@constructor
-*/
-function Junkmail() {
- this.annoy = function() {
- }
-}
-
-/**
-@inherits Junkmail.prototype.annoy as pester
-@augments ThreeColumnPage
-@augments LibraryItem
-@constructor
-*/
-function NewsletterPage() {
- this.getHeadline = function() {
- }
-}
diff --git a/utils/jsdoc-toolkit/app/test/borrows.js b/utils/jsdoc-toolkit/app/test/borrows.js
deleted file mode 100755
index a5d8ea4..0000000
--- a/utils/jsdoc-toolkit/app/test/borrows.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
-@constructor
-*/
-function Layout(p) {
- /** initilize 1 */
- this.init = function(p) {
- }
-
- /** get the id */
- this.getId = function() {
- }
-
- /** @type string */
- this.orientation = "landscape";
-
- function getInnerElements(elementSecretId){
- }
-}
-
-/** A static method. */
-Layout.units = function() {
-}
-
-/**
-@constructor
-@borrows Layout#orientation
-@borrows Layout-getInnerElements
-@borrows Layout.units
-*/
-function Page() {
- /** reset the page */
- this.reset = function(b) {
- }
-}
-
-/**
-@constructor
-@borrows Layout.prototype.orientation as this.orientation
-@borrows Layout.prototype.init as #init
-@inherits Page.prototype.reset as #reset
-*/
-function ThreeColumnPage() {
- /** initilize 2 */
- this.init = function(p) {
- }
-}
diff --git a/utils/jsdoc-toolkit/app/test/borrows2.js b/utils/jsdoc-toolkit/app/test/borrows2.js
deleted file mode 100755
index c0d5ea2..0000000
--- a/utils/jsdoc-toolkit/app/test/borrows2.js
+++ /dev/null
@@ -1,23 +0,0 @@
-// testing circular borrows
-
-/**
- @class
- @borrows Bar#zop as this.my_zop
-*/
-function Foo() {
- /** this is a zip. */
- this.zip = function() {}
-
- this.my_zop = new Bar().zop;
-}
-
-/**
- @class
- @borrows Foo#zip as this.my_zip
-*/
-function Bar() {
- /** this is a zop. */
- this.zop = function() {}
-
- this.my_zip = new Foo().zip;
-} \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/test/config.js b/utils/jsdoc-toolkit/app/test/config.js
deleted file mode 100755
index 0748a21..0000000
--- a/utils/jsdoc-toolkit/app/test/config.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * @constructor
- * @param person The person.
- * @param {string} person.name The person's name.
- * @config {integer} age The person's age.
- * @config [id=1] Optional id number to use.
- * @param connection
- */
-function Contact(person, connection) {
-
-}
-
-/**
- * @constructor
- * @param persons
- * @config {string} Father The paternal person.
- * @config {string} Mother The maternal person.
- * @config {string[]} Children And the rest.
- */
-function Family(/**Object*/persons) {
-
-}
diff --git a/utils/jsdoc-toolkit/app/test/constructs.js b/utils/jsdoc-toolkit/app/test/constructs.js
deleted file mode 100755
index cca5dbd..0000000
--- a/utils/jsdoc-toolkit/app/test/constructs.js
+++ /dev/null
@@ -1,18 +0,0 @@
-var Person = makeClass(
- /**
- @scope Person
- */
- {
- /**
- This is just another way to define a constructor.
- @constructs
- @param {string} name The name of the person.
- */
- initialize: function(name) {
- this.name = name;
- },
- say: function(message) {
- return this.name + " says: " + message;
- }
- }
-); \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/test/encoding.js b/utils/jsdoc-toolkit/app/test/encoding.js
deleted file mode 100755
index ba64219..0000000
--- a/utils/jsdoc-toolkit/app/test/encoding.js
+++ /dev/null
@@ -1,10 +0,0 @@
-
-/**
- * @Constructor
- * @desc 配置文件
- * @class 什么也不返回
- */
-function Test(conf) {
- // do something;
-}
-
diff --git a/utils/jsdoc-toolkit/app/test/encoding_other.js b/utils/jsdoc-toolkit/app/test/encoding_other.js
deleted file mode 100755
index b144da4..0000000
--- a/utils/jsdoc-toolkit/app/test/encoding_other.js
+++ /dev/null
@@ -1,12 +0,0 @@
-
-/**
- * @Constructor
- * @desc
- * @class
- */
-function Test(conf) {
- // do something;
-}
-
-// run with commanline option -e=iso-8859-5
-
diff --git a/utils/jsdoc-toolkit/app/test/event.js b/utils/jsdoc-toolkit/app/test/event.js
deleted file mode 100755
index 7e41d6f..0000000
--- a/utils/jsdoc-toolkit/app/test/event.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * @name Kitchen
- * @constructor
- * @fires Bakery#event:donutOrdered
- */
-
-/**
- * Fired when some cake is eaten.
- * @name Kitchen#event:cakeEaten
- * @function
- * @param {Number} pieces The number of pieces eaten.
- */
-
-/**
- * Find out if cake was eaten.
- * @name Kitchen#cakeEaten
- * @function
- * @param {Boolean} wasEaten
- */
-
-/**
- * @name getDesert
- * @function
- * @fires Kitchen#event:cakeEaten
- */
-
-/**
- * @name Bakery
- * @constructor
- * @extends Kitchen
- */
-
-/**
- * Fired when a donut order is made.
- * @name Bakery#event:donutOrdered
- * @event
- * @param {Event} e The event object.
- * @param {String} [e.topping] Optional sprinkles.
- */
-
-/**
- * @constructor
- * @borrows Bakery#event:donutOrdered as this.event:cakeOrdered
- */
-function CakeShop() {
-}
-
-/** @event */
-CakeShop.prototype.icingReady = function(isPink) {
-}
-
-/** @event */
-function amHungry(/**Boolean*/enoughToEatAHorse) {
-} \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/test/exports.js b/utils/jsdoc-toolkit/app/test/exports.js
deleted file mode 100755
index 63a87cb..0000000
--- a/utils/jsdoc-toolkit/app/test/exports.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/** @namespace */
-var mxn = {};
-
-(function(){
- /** @exports Map as mxn.Map */
- var Map =
- /** @constructor */
- mxn.Map = function() {
- };
-
- /** A method. */
- Map.prototype.doThings = function() {
- };
-})(); \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/test/functions_anon.js b/utils/jsdoc-toolkit/app/test/functions_anon.js
deleted file mode 100755
index e9dd6c1..0000000
--- a/utils/jsdoc-toolkit/app/test/functions_anon.js
+++ /dev/null
@@ -1,39 +0,0 @@
-/** an anonymous constructor executed inline */
-a = new function() {
- /** a.b*/
- this.b = 1;
- /** a.f */
- this.f = function() {
- /** a.c */
- this.c = 2;
- }
-}
-
-
-/**
- named function executed inline
-*/
-bar1 = function Zoola1() {
- /** property of global */
- this.g = 1;
-}();
-
-/**
- named constructor executed inline
-*/
-bar2 = new function Zoola2() {
- /** property of bar */
- this.p = 1;
-};
-
-/** module pattern */
-module = (function () {
- /** won't appear in documentation */
- var priv = 1;
-
- /** @scope module */
- return {
- /** will appear as a property of module */
- pub: 1
- }
-})();
diff --git a/utils/jsdoc-toolkit/app/test/functions_nested.js b/utils/jsdoc-toolkit/app/test/functions_nested.js
deleted file mode 100755
index f044faf..0000000
--- a/utils/jsdoc-toolkit/app/test/functions_nested.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/** @constructor */
-function Zop() {
-}
-
-/**
- @class
-*/
-Foo = function(id) {
- // this is a bit twisted, but if you call Foo() you will then
- // modify Foo(). This is kinda, sorta non-insane, because you
- // would have to call Foo() 100% of the time to use Foo's methods
- Foo.prototype.methodOne = function(bar) {
- alert(bar);
- };
-
- // same again
- Foo.prototype.methodTwo = function(bar2) {
- alert(bar2);
- };
-
- // and these are only executed if the enclosing function is actually called
- // and who knows if that will ever happen?
- Bar = function(pez) {
- alert(pez);
- };
- Zop.prototype.zap = function(p){
- alert(p);
- };
-
- // but this is only visible inside Foo
- function inner() {
- }
-};
diff --git a/utils/jsdoc-toolkit/app/test/global.js b/utils/jsdoc-toolkit/app/test/global.js
deleted file mode 100755
index 5ea4894..0000000
--- a/utils/jsdoc-toolkit/app/test/global.js
+++ /dev/null
@@ -1,13 +0,0 @@
-/** ecks */
-var x = [1, 2, 4];
-
-var y = {
- foo: function(){
- }
-}
-
-bar = function() {
-}
-
-function zop() {
-}
diff --git a/utils/jsdoc-toolkit/app/test/globals.js b/utils/jsdoc-toolkit/app/test/globals.js
deleted file mode 100755
index 3f83fb1..0000000
--- a/utils/jsdoc-toolkit/app/test/globals.js
+++ /dev/null
@@ -1,25 +0,0 @@
-function example(/**Circle*/a, b) {
- /** a global defined in function */
- var number = a;
-
- var hideNumber = function(){
- }
-
- setNumber = function(){
- }
- alert('You have chosen: ' + b);
-}
-
-function initPage() {
- var supported = document.createElement && document.getElementsByTagName;
- if (!supported) return;
- // start of DOM script
- var x = document.getElementById('writeroot');
- // etc.
-}
-
-/** an example var */
-var document = new Document(x, y);
-
-var getNumber = function(){
-} \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/test/ignore.js b/utils/jsdoc-toolkit/app/test/ignore.js
deleted file mode 100755
index d3fac9e..0000000
--- a/utils/jsdoc-toolkit/app/test/ignore.js
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * A test constructor.
- * @constructor
- * @ignore
- */
-function Ignored() {
- /** a method */
- this.bar = function() {
- }
-} \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/test/inner.js b/utils/jsdoc-toolkit/app/test/inner.js
deleted file mode 100755
index 37cfa9d..0000000
--- a/utils/jsdoc-toolkit/app/test/inner.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- * @constructor
- */
-function Outer() {
- /**
- * @constructor
- */
- function Inner(name) {
- /** The name of this. */
- this.name = name;
- }
-
- this.open = function(name) {
- return (new Inner(name));
- }
-} \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/test/jsdoc_test.js b/utils/jsdoc-toolkit/app/test/jsdoc_test.js
deleted file mode 100755
index 0817712..0000000
--- a/utils/jsdoc-toolkit/app/test/jsdoc_test.js
+++ /dev/null
@@ -1,477 +0,0 @@
-/**
- * @fileoverview This file is to be used for testing the JSDoc parser
- * It is not intended to be an example of good JavaScript OO-programming,
- * nor is it intended to fulfill any specific purpose apart from
- * demonstrating the functionality of the
- * <a href='http://sourceforge.net/projects/jsdoc'>JSDoc</a> parser
- *
- * @author Gabriel Reid gab_reid@users.sourceforge.net
- * @version 0.1
- */
-
-
-/**
- * Construct a new Shape object.
- * @class This is the basic Shape class.
- * It can be considered an abstract class, even though no such thing
- * really existing in JavaScript
- * @constructor
- * @throws MemoryException if there is no more memory
- * @throws GeneralShapeException rarely (if ever)
- * @return {Shape|Coordinate} A new shape.
- */
-function Shape(){
-
- /**
- * This is an example of a function that is not given as a property
- * of a prototype, but instead it is assigned within a constructor.
- * For inner functions like this to be picked up by the parser, the
- * function that acts as a constructor <b>must</b> be denoted with
- * the <b>&#64;constructor</b> tag in its comment.
- * @type String
- */
- this.getClassName = function(){
- return "Shape";
- }
-
- /**
- * This is an inner method, just used here as an example
- * @since version 0.5
- * @author Sue Smart
- */
- function addReference(){
- // Do nothing...
- }
-
-}
-
-/**
- * Create a new Hexagon instance.
- * @extends Shape
- * @class Hexagon is a class that is a <i>logical</i> sublcass of
- * {@link Shape} (thanks to the <code>&#64;extends</code> tag), but in
- * reality it is completely unrelated to Shape.
- * @param {int} sideLength The length of one side for the new Hexagon
- * @example
- * var h = new Hexagon(2);
- * @example
- * if (hasHex) {
- * hex = new Hexagon(5);
- * color = hex.getColor();
- * }
- */
-function Hexagon(sideLength) {
-}
-
-
-/**
- * This is an unattached (static) function that adds two integers together.
- * @param {int} One The first number to add
- * @param {int} Two The second number to add
- * @author Gabriel Reid
- * @deprecated So you shouldn't use it anymore! Use {@link Shape#getClassName} instead.
- */
-function Add(One, Two){
- return One + Two;
-}
-
-
-/**
- * The color of this shape
- * @type Color
- */
-Shape.prototype.color = null;
-
-/**
- * The border of this shape.
- * @field
- * @type int
- */
-Shape.prototype.border = function(){return border;};
-
-/*
- * These are all the instance method implementations for Shape
- */
-
-/**
- * Get the coordinates of this shape. It is assumed that we're always talking
- * about shapes in a 2D location here.
- * @requires The {@link Shape} class
- * @returns A Coordinate object representing the location of this Shape
- * @type Coordinate[]
- */
-Shape.prototype.getCoords = function(){
- return this.coords;
-}
-
-/**
- * Get the color of this shape.
- * @see #setColor
- * @see The <a href="http://example.com">Color</a> library.
- * @link Shape
- * @type Color
- */
-Shape.prototype.getColor = function(){
- return this.color;
-}
-
-/**
- * Set the coordinates for this Shape
- * @param {Coordinate} coordinates The coordinates to set for this Shape
- */
-Shape.prototype.setCoords = function(coordinates){
- this.coords = coordinates;
-}
-
-/**
- * Set the color for this Shape
- * @param {Color} color The color to set for this Shape
- * @param other There is no other param, but it can still be documented if
- * optional parameters are used
- * @throws NonExistantColorException (no, not really!)
- * @see #getColor
- */
-Shape.prototype.setColor = function(color){
- this.color = color;
-}
-
-/**
- * Clone this shape
- * @returns A copy of this shape
- * @type Shape
- * @author Gabriel Reid
- */
-Shape.prototype.clone = function(){
- return new Shape();
-}
-
-/**
- * Create a new Rectangle instance.
- * @class A basic rectangle class, inherits from Shape.
- * This class could be considered a concrete implementation class
- * @constructor
- * @param {int} width The optional width for this Rectangle
- * @param {int} height Thie optional height for this Rectangle
- * @author Gabriel Reid
- * @see Shape is the base class for this
- * @augments Shape
- * @hilited
- */
-function Rectangle(width, // This is the width
- height // This is the height
- ){
- if (width){
- this.width = width;
- if (height){
- this.height = height;
- }
- }
-}
-
-
-/* Inherit from Shape */
-Rectangle.prototype = new Shape();
-
-/**
- * Value to represent the width of the Rectangle.
- * <br>Text in <b>bold</b> and <i>italic</i> and a
- * link to <a href="http://sf.net">SourceForge</a>
- * @private
- * @type int
- */
-Rectangle.prototype.width = 0;
-
-/**
- * Value to represent the height of the Rectangle
- * @private
- * @type int
- */
-Rectangle.prototype.height = 0;
-
-/**
- * Get the type of this object.
- * @type String
- */
-Rectangle.prototype.getClassName= function(){
- return "Rectangle";
-}
-
-/**
- * Get the value of the width for the Rectangle
- * @type int
- * @see Rectangle#setWidth
- */
-Rectangle.prototype.getWidth = function(){
- return this.width;
-}
-
-/**
- * Get the value of the height for the Rectangle.
- * Another getter is the {@link Shape#getColor} method in the
- * {@link Shape} base class.
- * @return The height of this Rectangle
- * @type int
- * @see Rectangle#setHeight
- */
-Rectangle.prototype.getHeight = function(){
- return this.height;
-}
-
-/**
- * Set the width value for this Rectangle.
- * @param {int} width The width value to be set
- * @see #setWidth
- */
-Rectangle.prototype.setWidth = function(width){
- this.width = width;
-}
-
-/**
- * Set the height value for this Rectangle.
- * @param {int} height The height value to be set
- * @see #getHeight
- */
-Rectangle.prototype.setHeight = function(height){
- this.height = height;
-}
-
-/**
- * Get the value for the total area of this Rectangle
- * @return total area of this Rectangle
- * @type int
- */
-Rectangle.prototype.getArea = function(){
- return width * height;
-}
-
-
-/**
- * Create a new Square instance.
- * @class A Square is a subclass of {@link Rectangle}
- * @param {int} width The optional width for this Rectangle
- * @param {int} height The optional height for this Rectangle
- * @augments Rectangle
- */
-function Square(width, height){
- if (width){
- this.width = width;
- if (height){
- this.height = height;
- }
- }
-
-}
-
-/* Square is a subclass of Rectangle */
-Square.prototype = new Rectangle();
-
-/**
- * Set the width value for this Shape.
- * @param {int} width The width value to be set
- * @see #getWidth
- */
-Square.prototype.setWidth = function(width){
- this.width = this.height = width;
-}
-
-/**
- * Set the height value for this Shape
- * Sets the {@link Rectangle#height} attribute in the Rectangle.
- * @param {int} height The height value to be set
- */
-Square.prototype.setHeight = function(height){
- this.height = this.width = height;
-}
-
-
-/**
- * Create a new Circle instance based on a radius.
- * @class Circle class is another subclass of Shape
- * @extends Shape
- * @param {int} radius The optional radius of this {@link Circle }
- * @mixin Square.prototype.setWidth as this.setDiameter
- */
-function Circle(radius){
- if (radius) {
- /** The radius of the this Circle. */
- this.radius = radius;
- }
-}
-
-/* Circle inherits from {@link Shape} */
-Circle.prototype = new Shape();
-
-/**
- * The radius value for this Circle
- * @private
- * @type int
- */
-Circle.prototype.radius = 0;
-
-/**
- * A very simple class (static) field that is also a constant
- * @final
- * @type float
- */
-Circle.PI = 3.14;
-
-/**
- * Get the radius value for this Circle
- * @type int
- * @see #setRadius
- */
-Circle.prototype.getRadius = function(){
- return this.radius;
-}
-
-/**
- * Set the radius value for this Circle
- * @param {int} radius The {@link Circle#radius} value to set
- * @see #getRadius
- */
-Circle.prototype.setRadius = function(radius){
- this.radius = radius;
-}
-
-/**
- * An example of a class (static) method that acts as a factory for Circle
- * objects. Given a radius value, this method creates a new Circle.
- * @param {int} radius The radius value to use for the new Circle.
- * @type Circle
- */
-Circle.createCircle = function(radius){
- return new Circle(radius);
-}
-
-
-/**
- * Create a new Coordinate instance based on x and y grid data.
- * @class Coordinate is a class that can encapsulate location information.
- * @param {int} [x=0] The optional x portion of the Coordinate
- * @param {int} [y=0] The optinal y portion of the Coordinate
- */
-function Coordinate(x, y){
- if (x){
- this.x = x;
- if (y){
- this.y = y;
- }
- }
-}
-
-/**
- * The x portion of the Coordinate
- * @type int
- * @see #getX
- * @see #setX
- */
-Coordinate.prototype.x = 0;
-
-/**
- * The y portion of the Coordinate
- * @type int
- * @see #getY
- * @see #setY
- */
-Coordinate.prototype.y = 0;
-
-/**
- * Gets the x portion of the Coordinate.
- * @type int
- * @see #setX
- */
-Coordinate.prototype.getX = function(){
- return this.x;
-}
-
-/**
- * Get the y portion of the Coordinate.
- * @type int
- * @see #setY
- */
-Coordinate.prototype.getY = function(){
- return this.y;
-}
-
-/**
- * Sets the x portion of the Coordinate.
- * @param {int} x The x value to set
- * @see #getX
- */
-Coordinate.prototype.setX = function(x){
- this.x = x;
-}
-
-/**
- * Sets the y portion of the Coordinate.
- * @param {int} y The y value to set
- * @see #getY
- */
-Coordinate.prototype.setY = function(y){
- this.y = y;
-}
-
-/**
- * @class This class exists to demonstrate the assignment of a class prototype
- * as an anonymous block.
- */
-function ShapeFactory(){
-}
-
-ShapeFactory.prototype = {
- /**
- * Creates a new {@link Shape} instance.
- * @return A new {@link Shape}
- * @type Shape
- */
- createShape: function(){
- return new Shape();
- }
-}
-
-/**
- * An example of a singleton class
- * @param ... Arguments represent {@link coordinate}s in the shape.
- * @constructor
- */
-MySingletonShapeFactory = function(){
-
- /**
- * Get the next {@link Shape}
- * @type Shape
- * @return A new {@link Shape}
- */
- this.getShape = function(){
- return null;
- }
-
-}
-
-
-/**
- * Create a new Foo instance.
- * @class This is the Foo class. It exists to demonstrate 'nested' classes.
- * @constructor
- * @see Foo.Bar
- */
-function Foo(){}
-
-/**
- * Creates a new instance of Bar.
- * @class This class exists to demonstrate 'nested' classes.
- * @constructor
- * @see Foo.Bar
- */
-function Bar(){}
-
-/**
- * Nested class
- * @constructor
- */
-Foo.Bar = function(){
- /** The x. */ this.x = 2;
-}
-
-Foo.Bar.prototype = new Bar();
-/** The y. */
-Foo.Bar.prototype.y = '3';
diff --git a/utils/jsdoc-toolkit/app/test/lend.js b/utils/jsdoc-toolkit/app/test/lend.js
deleted file mode 100755
index 92b15d5..0000000
--- a/utils/jsdoc-toolkit/app/test/lend.js
+++ /dev/null
@@ -1,33 +0,0 @@
- /** @class */
-var Person = Class.create(
- /**
- @lends Person.prototype
- */
- {
- initialize: function(name) {
- this.name = name;
- },
- say: function(message) {
- return this.name + ': ' + message;
- }
- }
- );
-
-/** @lends Person.prototype */
-{
- /** like say but more musical */
- sing: function(song) {
- }
-}
-
-/** @lends Person */
-{
- getCount: function() {
- }
-}
-
-/** @lends Unknown.prototype */
-{
- notok: function() {
- }
-} \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/test/memberof.js b/utils/jsdoc-toolkit/app/test/memberof.js
deleted file mode 100755
index 883bbde..0000000
--- a/utils/jsdoc-toolkit/app/test/memberof.js
+++ /dev/null
@@ -1,19 +0,0 @@
-/** @constructor */
-pack = function() {
- this.init = function(){}
- function config(){}
-}
-
- pack.build = function(task) {};
-
-/** @memberOf pack */
-pack.install = function() {}
-
-/** @memberOf pack */
-pack.install.overwrite = function() {}
-
-/** @memberOf pack */
-clean = function() {}
-
-/** @memberOf pack-config */
-install = function() {};
diff --git a/utils/jsdoc-toolkit/app/test/memberof_constructor.js b/utils/jsdoc-toolkit/app/test/memberof_constructor.js
deleted file mode 100755
index 80fde73..0000000
--- a/utils/jsdoc-toolkit/app/test/memberof_constructor.js
+++ /dev/null
@@ -1,17 +0,0 @@
-/** @constructor */
-function Circle(){}
-
-/**
- @constructor
- @memberOf Circle#
- */
-Circle.prototype.Tangent = function(){};
-
-// renaming Circle#Tangent to Circle#Circle#Tangent
-
-/**
- @memberOf Circle#Tangent#
- */
-Circle.prototype.Tangent.prototype.getDiameter = function(){};
-
-
diff --git a/utils/jsdoc-toolkit/app/test/module.js b/utils/jsdoc-toolkit/app/test/module.js
deleted file mode 100755
index 5b3fe42..0000000
--- a/utils/jsdoc-toolkit/app/test/module.js
+++ /dev/null
@@ -1,17 +0,0 @@
-/** @namespace */
-myProject = myProject || {};
-
-/** @namespace */
-myProject.myModule = (function () {
- /** describe myPrivateVar here */
- var myPrivateVar = "";
-
- var myPrivateMethod = function () {
- }
-
- /** @scope myProject.myModule */
- return {
- myPublicMethod: function () {
- }
- };
-})(); \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/test/name.js b/utils/jsdoc-toolkit/app/test/name.js
deleted file mode 100755
index e88a51a..0000000
--- a/utils/jsdoc-toolkit/app/test/name.js
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- @name Response
- @class
-*/
-
-Response.prototype = {
- /**
- @name Response#text
- @function
- @description
- Gets the body of the response as plain text
- @returns {String}
- Response as text
- */
-
- text: function() {
- return this.nativeResponse.responseText;
- }
-} \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/test/namespace_nested.js b/utils/jsdoc-toolkit/app/test/namespace_nested.js
deleted file mode 100755
index 46cafa2..0000000
--- a/utils/jsdoc-toolkit/app/test/namespace_nested.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- @namespace This is the first namespace.
-*/
-ns1 = {};
-
-/**
- This is the second namespace.
- @namespace
-*/
-ns1.ns2 = {};
-
-/**
- This part of ns1.ns2
- @constructor
-*/
-ns1.ns2.Function1 = function() {
-};
-
-ns1.staticFunction = function() {
-};
-
-/** A static field in a namespace. */
-ns1.ns2.staticField = 1;
diff --git a/utils/jsdoc-toolkit/app/test/nocode.js b/utils/jsdoc-toolkit/app/test/nocode.js
deleted file mode 100755
index 1cf99bc..0000000
--- a/utils/jsdoc-toolkit/app/test/nocode.js
+++ /dev/null
@@ -1,13 +0,0 @@
-/**#nocode+*/
- /**
- @name star
- @function
- */
- function blahblah() {
-
- }
-/**#nocode-*/
-
-function yaddayadda() {
-
-} \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/test/oblit_anon.js b/utils/jsdoc-toolkit/app/test/oblit_anon.js
deleted file mode 100755
index 8d9e941..0000000
--- a/utils/jsdoc-toolkit/app/test/oblit_anon.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/** the options */
-opt = Opt.get(
- arguments,
- {
- d: "directory",
- c: "conf",
- "D[]": "define"
- }
-);
-
-/** configuration */
-opt.conf = {
- /** keep */
- keep: true,
- /** base */
- base: getBase(this, {p: properties})
-}
-
-
-
diff --git a/utils/jsdoc-toolkit/app/test/overview.js b/utils/jsdoc-toolkit/app/test/overview.js
deleted file mode 100755
index 1dfc09b..0000000
--- a/utils/jsdoc-toolkit/app/test/overview.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * @overview This "library" contains a
- * lot of classes and functions.
- * @example
- <pre>
- var x (x < 1);
- alert("This 'is' \"code\"");
- </pre>
- * @name My Cool Library
- * @author Joe Smith jsmith@company.com
- * @version 0.1
- */
-
-/**
- * Gets the current foo
- * @param {String} fooId The unique identifier for the foo.
- * @return {Object} Returns the current foo.
- */
-function getFoo(fooID){
-} \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/test/param_inline.js b/utils/jsdoc-toolkit/app/test/param_inline.js
deleted file mode 100755
index 09845b2..0000000
--- a/utils/jsdoc-toolkit/app/test/param_inline.js
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- @constructor
- @param columns The number of columns.
-*/
-function Layout(/**int*/columns){
- /**
- @param [id] The id of the element.
- @param elName The name of the element.
- */
- this.getElement = function(
- /** string */ elName,
- /** number|string */ id
- ) {
- };
-
- /**
- @constructor
- */
- this.Canvas = function(top, left, /**int*/width, height) {
- /** Is it initiated yet? */
- this.initiated = true;
- }
-
- this.rotate = function(/**nothing*/) {
- }
-
- /**
- @param x
- @param y
- @param {zoppler} z*/
- this.init = function(x, y, /**abbler*/z) {
- /** The xyz. */
- this.xyz = x+y+z;
- this.getXyz = function() {
- }
- }
-}
diff --git a/utils/jsdoc-toolkit/app/test/params_optional.js b/utils/jsdoc-toolkit/app/test/params_optional.js
deleted file mode 100755
index 18bf598..0000000
--- a/utils/jsdoc-toolkit/app/test/params_optional.js
+++ /dev/null
@@ -1,8 +0,0 @@
-
-/**
- * @param {Page[]} pages
- * @param {number} [id] Specifies the id, if applicable.
- * @param {String} [title = This is untitled.] Specifies the title.
- */
-function Document(pages, id, title){
-} \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/test/prototype.js b/utils/jsdoc-toolkit/app/test/prototype.js
deleted file mode 100755
index 1147008..0000000
--- a/utils/jsdoc-toolkit/app/test/prototype.js
+++ /dev/null
@@ -1,17 +0,0 @@
-/** @constructor */
-function Article() {
-}
-
-Article.prototype.init = function(title) {
- /** the instance title */
- this.title = title;
-
- /** the static counter */
- Article.counter = 1;
-}
-
-a = new Article();
-a.Init("my title");
-
-print(a.title);
-print(Article.counter); \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/test/prototype_nested.js b/utils/jsdoc-toolkit/app/test/prototype_nested.js
deleted file mode 100755
index e8ca1ce..0000000
--- a/utils/jsdoc-toolkit/app/test/prototype_nested.js
+++ /dev/null
@@ -1,9 +0,0 @@
-/** @constructor */
-function Word() {
-}
-
-Word.prototype.reverse = function() {
-}
-
-Word.prototype.reverse.utf8 = function() {
-} \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/test/prototype_oblit.js b/utils/jsdoc-toolkit/app/test/prototype_oblit.js
deleted file mode 100755
index 6cfc39c..0000000
--- a/utils/jsdoc-toolkit/app/test/prototype_oblit.js
+++ /dev/null
@@ -1,13 +0,0 @@
-/** @constructor */
-function Article() {
-}
-
-Article.prototype = {
- /** instance get title */
- getTitle: function(){
- }
-}
-
-/** static get title */
-Article.getTitle = function(){
-} \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/test/prototype_oblit_constructor.js b/utils/jsdoc-toolkit/app/test/prototype_oblit_constructor.js
deleted file mode 100755
index 9248248..0000000
--- a/utils/jsdoc-toolkit/app/test/prototype_oblit_constructor.js
+++ /dev/null
@@ -1,24 +0,0 @@
-/** @constructor */
-function Article() {
-}
-
-Article.prototype = {
- /** @constructor */
- Title: function(title) {
- /** the value of the Title instance */
- this.title = title;
- },
-
- init: function(pages) {
- /** the value of the pages of the Article instance */
- this.pages = pages;
- }
-}
-
-f = new Article();
-f.init("one two three");
-
-t = new f.Title("my title");
-
-print(f.pages);
-print(t.title); \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/test/public.js b/utils/jsdoc-toolkit/app/test/public.js
deleted file mode 100755
index 35d34f6..0000000
--- a/utils/jsdoc-toolkit/app/test/public.js
+++ /dev/null
@@ -1,10 +0,0 @@
-/**@constructor*/
-function Foo() {
- /**
- @public
- @static
- @field
- */
- var bar = function(x) {
- }
-} \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/test/scripts/code.js b/utils/jsdoc-toolkit/app/test/scripts/code.js
deleted file mode 100755
index e9d7ed2..0000000
--- a/utils/jsdoc-toolkit/app/test/scripts/code.js
+++ /dev/null
@@ -1,5 +0,0 @@
-/**
- @class
- */
-function thisiscode() {
-} \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/test/scripts/notcode.txt b/utils/jsdoc-toolkit/app/test/scripts/notcode.txt
deleted file mode 100755
index fcd737e..0000000
--- a/utils/jsdoc-toolkit/app/test/scripts/notcode.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-(This is not code)
-function foo(){{{{
-(
-!
-@ \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/test/shared.js b/utils/jsdoc-toolkit/app/test/shared.js
deleted file mode 100755
index e1c277a..0000000
--- a/utils/jsdoc-toolkit/app/test/shared.js
+++ /dev/null
@@ -1,42 +0,0 @@
-
-/**
- * Builtin object.
- * @class
- * @name Array
- */
-
-/**#@+
- * Extension to builtin array.
- * @memberOf Array
- * @method
- */
-
-/**
- * @returns Boolen if some array members...
- */
-Array.prototype.some = function(){};
-
-/**
- * Change every element of an array.
- * @returns Filtered array copy.
- */
-Array.prototype.filter = function(){};
-
-/**#@-*/
-
-
-/**
- * A first in, first out data structure.
- * @constructor
- */
-Queue = function(){};
-
-/**#@+
- * Extension to Queue.
- * @memberOf Queue
- */
-
-rewind = function(){
-}
-
-// should close automatically here. \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/test/shared2.js b/utils/jsdoc-toolkit/app/test/shared2.js
deleted file mode 100755
index 3f7736a..0000000
--- a/utils/jsdoc-toolkit/app/test/shared2.js
+++ /dev/null
@@ -1,2 +0,0 @@
-startOver = function(){
-} \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/test/shortcuts.js b/utils/jsdoc-toolkit/app/test/shortcuts.js
deleted file mode 100755
index f738f1e..0000000
--- a/utils/jsdoc-toolkit/app/test/shortcuts.js
+++ /dev/null
@@ -1,22 +0,0 @@
-// /**#=+
-// * {
-// * 'D': 'Date.prototype',
-// * '$N': 'Number'
-// * }
-// */
-// var D = Date.prototype,
-// $N = Number;
-//
-// D.locale = function(){
-// };
-//
-// /**
-// @return {string} The cardinal number string.
-// */
-// $N.nth = function(n){
-// };
-//
-// LOAD.file = function(){
-// }
-//
-// /**#=-*/ \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/test/static_this.js b/utils/jsdoc-toolkit/app/test/static_this.js
deleted file mode 100755
index 9407b20..0000000
--- a/utils/jsdoc-toolkit/app/test/static_this.js
+++ /dev/null
@@ -1,13 +0,0 @@
-/** the parent */
-var box = {};
-
-/** @namespace */
-box.holder = {}
-
-box.holder.foo = function() {
- /** the counter */
- this.counter = 1;
-}
-
-box.holder.foo();
-print(box.holder.counter);
diff --git a/utils/jsdoc-toolkit/app/test/synonyms.js b/utils/jsdoc-toolkit/app/test/synonyms.js
deleted file mode 100755
index 09066b9..0000000
--- a/utils/jsdoc-toolkit/app/test/synonyms.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- @class
- @inherits Bar#zop as #my_zop
-*/
-function Foo() {
- /** this is a zip. */
- this.zip = function() {}
-
- /** from Bar */
- this.my_zop = new Bar().zop;
-}
-
-/**
- @class
- @borrows Foo#zip as this.my_zip
-*/
-function Bar() {
- /** this is a zop. */
- this.zop = function() {}
-
- /** from Foo */
- this.my_zip = new Foo().zip;
-}
-
-/** @namespace */
-var myObject = {
- /**
- @type function
- */
- myFunc: getFunction()
-} \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/test/tosource.js b/utils/jsdoc-toolkit/app/test/tosource.js
deleted file mode 100755
index 706d476..0000000
--- a/utils/jsdoc-toolkit/app/test/tosource.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * @param {Object} object
- * @return {string}
- */
-function valueOf(object) {}
-
-/**
- * @param {Object} object
- * @return {string}
- */
-function toString(object) {}
-
-/**
- * @param {Object} object
- * @return {string}
- */
-function toSource(object) {}
-
-/**
- * @param {Object} object
- * @return {string}
- */
-function constructor(object) {} \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/app/test/variable_redefine.js b/utils/jsdoc-toolkit/app/test/variable_redefine.js
deleted file mode 100755
index 2c07da0..0000000
--- a/utils/jsdoc-toolkit/app/test/variable_redefine.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/** @constructor */
-function Foo() {
- var bar = 1;
- bar = 2; // redefining a private
-
- this.baz = 1;
- baz = 2; // global
-
- /** a private */
- var blap = {
- /** in here */
- tada: 1
- }
-} \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/changes.txt b/utils/jsdoc-toolkit/changes.txt
deleted file mode 100755
index 35ee299..0000000
--- a/utils/jsdoc-toolkit/changes.txt
+++ /dev/null
@@ -1,96 +0,0 @@
-== 2.3.0 ==
-
- * Added option -u, --unique to avoid bug that causes multiple symbols with names that differ only by case to overwrite each others output on case-insensitive filesystems. ( issue #162 )
- * Fixed bug where {@links} in @deprecated tags did not resolve. ( issue #220 )
- * Fixed bug that caused parens around a function to make it to be unrecognized. ( issue #213 )
- * Fixed bug prevented explicit links to named anchors from working (thanks katgao.pku). ( issue #215 )
- * Fixed bug that prevented full description from appearing in file overview. ( issue #224 )
-
-== 2.2.1 ==
-
- * Fixed bug with class template, where sorting of methods was accidentally removed (thanks dezfowler).
- * Added missing test files for the @exports unit tests.
-
-== 2.2.0 ==
-
- * Fixed bug that caused exception when given a folder containing non-js files, even with the x commandline option set to "js". ( issue #193 )
- * Fixed typo in index template [patch submitted by olle]. ( issue #198 )
- * Modified @borrows tag experimentally to allow for missing "as ..." clause.
- * Added support for the @exports tag, to allow one symbol to be documented as another.
- * Added support for the -S option to document code following the Secure Modules pattern.
-
-== 2.1.0 ==
-
- * Added support for the @event tag.
- * Fixed bug that prevented the : character from appearing in symbol names.
- * Fixed bug that prevented underscored symbols marked with @public being tagged as private. (issue #184 )
- * Fixed bug that randomly affected the @memberOf tag when the name of the symbol did not include the parent name.
- * Fixed bug that prevented templates that were not in the jsdoc-toolkit folder from being found. ( issue #176 )
- * Added ability to check for trailing slash on template path. ( issue #177 )
- * Modified classDesc so that it no longer is appended with the constructor desc.
- * Fixed call to plugin onDocCommentSrc.
- * Added missing support for inline doc comments for function return types. ( issue #189 )
- * Added command line option -q, --quiet.
- * Added command line option -E, --exclude. ( issue #143 )
- * Added 2 more hooks for plugins. ( issue #163 )
- * Added support for extending built-ins. ( issue #160 )
- * Added "compact" option to JSDOC.JsPlate.prototype.process. ( issue #159 )
- * @augments no longer documents static members as inherited. ( issue #138 )
- * @link to a class now goes to the page for that class, not the constructor. ( issue #178 )
- * Warnings of mismatched curly brace now include filename. ( issue #166 )
- * Fixed bug affecting template paths loaded via a configuration file when the trailing slash is missing. ( issue #191 )
- * Minor optimizations.
-
-== 2.0.2 ==
-
- * Fixed bug that sometimes caused an example of division in the source code to be interpretted as a regex by the JsDoc Toolkit analyzer. ( issue #158 )
- * Fixed a bug that prevented private variables marked as @public from appearing in the documentation. ( issue #161 )
- * Fixed bug that prevented variable names with underscored properties from appearing in summaries. ( issue #173 )
-
-== 2.0.1 ==
-
- * Fixed bug that prevented @fileOverview tag from being recognized.
- * Added support for @fieldOf as a synonym for @field plus @memberOf.
- * Added support for @name tag in a @fileOverview comment to control the displayed name of the file.
- * Added support for multiple @example tags. ( issue #152 )
- * Modified style sheet of jsdoc template to make more readable. ( issue #151 )
- * Fixed bug that prevented @since documentation from displaying correctly when it appeared in a class. ( issue #150 )
- * Fixed bug that caused inhertited properties to sometimes not resolve correctly. ( issue #144 )
- * Modified so that trailing whitespace in @example is always trimmed. ( issue #153 )
- * Added support for elseif to JsPlate. (hat tip to fredck)
- * Added support for @location urls in the @overview comment to the jsdoc template.
-
-== Changes From Versions 1.4.0 to 2.0.0 ==
-
- * Upgraded included version of Rhino from 1.6 to 1.7R1.
- * Removed circular references in parsed documentation objects.
- * Improved inheritance handling, now properties and events can be inherited same as methods.
- * Improved handling of cross-file relationships, now having two related objects in separate files is not a problem.
- * Improved ability to recognize membership of previously defined objects.
- * Added ability to redefine parsing behavior with plugins.
- * @methodOf is a synonym for @function and @memberOf.
- * Added @default to document default values of members that are objects.
- * Added ability to parse and refer to inner functions.
- * Fixed bug that appeared when calling a method to set properties of the instance referred to by "this".
- * Added ability to automatically create links to other symbols.
- * New "jsdoc" template now produces fully W3C valid XHTML.
- * Inline parameter type hint comments are now documented.
- * Fixed error: Locally scoped variables (declared with var) no longer appear as global.
- * It is now possible to run JsDoc Toolkit from any directory.
- * Added support for inline {@link ...} tags.
- * Added support for the -H command-line option to allow for custom content handlers.
- * Tag names @inherits and @scope changed to @borrows and @lends.
- ? Combining @constructor in a doclet with @lends now supported.
- * Multiple @lend tags now supported.
- * Added support for the @constructs tag, used inside a @lends block.
- * Added support for the @constant tag.
- * Fixed bug that prevented the use of [] as a default value.
- * Added support for the @field tag.
- * Added support for the @public tag (applied to inner functions).
- * @namespace tag can now be applied to functions, not just object literals.
- * Added support for the -s command line option to suppress source code output.
- * Added new unit test framework.
- * Underscored symbols are now treated as if they have a @private tag by default.
- * Improved support for anonymous constructors.
- * Added support for the nocode meta tag.
- \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/conf/sample.conf b/utils/jsdoc-toolkit/conf/sample.conf
deleted file mode 100755
index ad0f08e..0000000
--- a/utils/jsdoc-toolkit/conf/sample.conf
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- This is an example of one way you could set up a configuration file to more
- conveniently define some commandline options. You might like to do this if
- you frequently reuse the same options. Note that you don't need to define
- every option in this file, you can combine a configuration file with
- additional options on the commandline if your wish.
-
- You would include this configuration file by running JsDoc Toolkit like so:
- java -jar jsrun.jar app/run.js -c=conf/sample.conf
-
-*/
-
-{
- // source files to use
- _: ['app/test/jsdoc_test.js'],
-
- // document all functions, even uncommented ones
- a: true,
-
- // including those marked @private
- p: true,
-
- // some extra variables I want to include
- D: {generatedBy: "Michael Mathews", copyright: "2008"},
-
- // use this directory as the output directory
- d: "docs",
-
- // use this template
- t: "templates/jsdoc"
-} \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/java/build.xml b/utils/jsdoc-toolkit/java/build.xml
deleted file mode 100755
index bb845ce..0000000
--- a/utils/jsdoc-toolkit/java/build.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<project>
- <target name="clean">
- <delete dir="build"/>
- </target>
-
- <target name="compile">
- <mkdir dir="build/classes"/>
- <javac
- srcdir="src" destdir="build/classes"
- classpath="./classes/js.jar"
- />
- </target>
-
- <target name="jar">
- <mkdir dir="build/jar"/>
- <jar destfile="build/jar/jsrun.jar" basedir="build/classes">
- <manifest>
- <attribute name="Main-Class" value="JsRun"/>
- <attribute name="Class-Path" value="./java/classes/js.jar"/>
- </manifest>
- </jar>
- </target>
-
- <target name="debugjar">
- <mkdir dir="build/jar"/>
- <jar destfile="build/jar/jsdebug.jar" basedir="build/classes">
- <manifest>
- <attribute name="Main-Class" value="JsDebugRun"/>
- <attribute name="Class-Path" value="./java/classes/js.jar"/>
- </manifest>
- </jar>
- </target>
-
- <target name="clean-build" depends="clean,compile,jar"/>
- <target name="clean-debug" depends="clean,compile,debugjar"/>
-</project> \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/java/build_1.4.xml b/utils/jsdoc-toolkit/java/build_1.4.xml
deleted file mode 100755
index ab408a4..0000000
--- a/utils/jsdoc-toolkit/java/build_1.4.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<project default="clean-build"><!-- use this build script if you are stuck with ant version 1.4 -->
- <target name="clean">
- <delete dir="build"/>
- </target>
-
- <target name="compile">
- <mkdir dir="build/classes"/>
- <javac
- srcdir="src" destdir="build/classes"
- classpath="./classes/js.jar"
- />
- </target>
-
- <target name="jar">
- <mkdir dir="build/jar"/>
- <jar jarfile="build/jar/jsrun.jar" basedir="build/classes">
- <manifest>
- <attribute name="Main-Class" value="JsRun"/>
- <attribute name="Class-Path" value="./java/classes/js.jar"/>
- </manifest>
- </jar>
- </target>
-
- <target name="debugjar">
- <mkdir dir="build/jar"/>
- <jar jarfile="build/jar/jsdebug.jar" basedir="build/classes">
- <manifest>
- <attribute name="Main-Class" value="JsDebugRun"/>
- <attribute name="Class-Path" value="./java/classes/js.jar"/>
- </manifest>
- </jar>
- </target>
-
- <target name="clean-build" depends="clean,compile,jar"/>
- <target name="clean-debug" depends="clean,compile,debugjar"/>
-</project>
diff --git a/utils/jsdoc-toolkit/java/classes/js.jar b/utils/jsdoc-toolkit/java/classes/js.jar
deleted file mode 100755
index 0352cb1..0000000
--- a/utils/jsdoc-toolkit/java/classes/js.jar
+++ /dev/null
Binary files differ
diff --git a/utils/jsdoc-toolkit/java/src/JsDebugRun.java b/utils/jsdoc-toolkit/java/src/JsDebugRun.java
deleted file mode 100755
index 319a5c6..0000000
--- a/utils/jsdoc-toolkit/java/src/JsDebugRun.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * A trivial bootstrap class that simply adds the path to the
- * .js file as an argument to the Rhino call. This little hack
- * allows the code in the .js file to have access to it's own
- * path via the Rhino arguments object. This is necessary to
- * allow the .js code to find resource files in a location
- * relative to itself.
- *
- * USAGE: java -jar jsdebug.jar path/to/file.js
- */
-public class JsDebugRun {
- public static void main(String[] args) {
- String[] jsargs = {"-j="+args[0]};
-
- String[] allArgs = new String[jsargs.length + args.length];
- System.arraycopy(args, 0, allArgs, 0, args.length);
- System.arraycopy(jsargs, 0, allArgs, args.length ,jsargs.length);
-
- org.mozilla.javascript.tools.debugger.Main.main(allArgs);
- }
-}
diff --git a/utils/jsdoc-toolkit/java/src/JsRun.java b/utils/jsdoc-toolkit/java/src/JsRun.java
deleted file mode 100755
index 25f519a..0000000
--- a/utils/jsdoc-toolkit/java/src/JsRun.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * A trivial bootstrap class that simply adds the path to the
- * .js file as an argument to the Rhino call. This little hack
- * allows the code in the .js file to have access to it's own
- * path via the Rhino arguments object. This is necessary to
- * allow the .js code to find resource files in a location
- * relative to itself.
- *
- * USAGE: java -jar jsrun.jar path/to/file.js
- */
-public class JsRun {
- public static void main(String[] args) {
- String[] jsargs = {"-j="+args[0]};
-
- String[] allArgs = new String[jsargs.length + args.length];
- System.arraycopy(args, 0, allArgs, 0, args.length);
- System.arraycopy(jsargs, 0, allArgs, args.length ,jsargs.length);
-
- org.mozilla.javascript.tools.shell.Main.main(allArgs);
- }
-}
diff --git a/utils/jsdoc-toolkit/jsdebug.jar b/utils/jsdoc-toolkit/jsdebug.jar
deleted file mode 100755
index a0ac7da..0000000
--- a/utils/jsdoc-toolkit/jsdebug.jar
+++ /dev/null
Binary files differ
diff --git a/utils/jsdoc-toolkit/jsrun.jar b/utils/jsdoc-toolkit/jsrun.jar
deleted file mode 100755
index 49c03f4..0000000
--- a/utils/jsdoc-toolkit/jsrun.jar
+++ /dev/null
Binary files differ
diff --git a/utils/jsdoc-toolkit/jsrun.sh b/utils/jsdoc-toolkit/jsrun.sh
deleted file mode 100755
index 74ca79c..0000000
--- a/utils/jsdoc-toolkit/jsrun.sh
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/bin/ksh
-
-# launcher script for jsdoc
-# Author: Avi Deitcher
-#
-# This program is released under the MIT License as follows:
-
-# Copyright (c) 2008-2009 Atomic Inc <avi@jsorm.com>
-#
-#Permission is hereby granted, free of charge, to any person
-#obtaining a copy of this software and associated documentation
-#files (the "Software"), to deal in the Software without
-#restriction, including without limitation the rights to use,
-#copy, modify, merge, publish, distribute, sublicense, and/or sell
-#copies of the Software, and to permit persons to whom the
-#Software is furnished to do so, subject to the following
-#conditions:
-##
-#The above copyright notice and this permission notice shall be
-#included in all copies or substantial portions of the Software.
-#
-#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-#EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-#OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-#NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-#HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-#WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-#FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-#OTHER DEALINGS IN THE SOFTWARE.
-#
-
-
-if [[ -n "$JSDOCDIR" ]]; then
- _DOCDIR="-Djsdoc.dir=$JSDOCDIR"
- _APPDIR="$JSDOCDIR/app"
- _BASEDIR="$JSDOCDIR"
-else
- _DOCDIR=""
- _APPDIR="./app"
- _BASEDIR="."
-fi
-
-if [[ -n "$JSDOCTEMPLATEDIR" ]]; then
- _TDIR="-Djsdoc.template.dir=$JSDOCTEMPLATEDIR"
-else
- _TDIR=""
-fi
-
-CMD="java $_DOCDIR $_TDIR -jar $_BASEDIR/jsrun.jar $_APPDIR/run.js $@"
-echo $CMD
-$CMD
-
diff --git a/utils/jsdoc-toolkit/templates/jsdoc/allclasses.tmpl b/utils/jsdoc-toolkit/templates/jsdoc/allclasses.tmpl
deleted file mode 100755
index 32f4358..0000000
--- a/utils/jsdoc-toolkit/templates/jsdoc/allclasses.tmpl
+++ /dev/null
@@ -1,17 +0,0 @@
-<div align="center">{+new Link().toFile("index.html").withText("Class Index")+}
-| {+new Link().toFile("files.html").withText("File Index")+}</div>
-<hr />
-<h2>Classes</h2>
-<ul class="classList">
- <for each="thisClass" in="data">
- <li>{!
- if (thisClass.alias == "_global_") {
- output += "<i>"+new Link().toClass(thisClass.alias)+"</i>";
- }
- else {
- output += new Link().toClass(thisClass.alias);
- }
- !}</li>
- </for>
-</ul>
-<hr /> \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/templates/jsdoc/allfiles.tmpl b/utils/jsdoc-toolkit/templates/jsdoc/allfiles.tmpl
deleted file mode 100755
index 86c7590..0000000
--- a/utils/jsdoc-toolkit/templates/jsdoc/allfiles.tmpl
+++ /dev/null
@@ -1,56 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
- <head>
- <meta http-equiv="content-type" content="text/html; charset={+IO.encoding+}"" />
- {! Link.base = ""; /* all generated links will be relative to this */ !}
- <title>JsDoc Reference - File Index</title>
- <meta name="generator" content="JsDoc Toolkit" />
-
- <style type="text/css">
- {+include("static/default.css")+}
- </style>
- </head>
-
- <body>
- {+include("static/header.html")+}
-
- <div id="index">
- {+publish.classesIndex+}
- </div>
-
- <div id="content">
- <h1 class="classTitle">File Index</h1>
-
- <for each="item" in="data">
- <div>
- <h2>{+new Link().toSrc(item.alias).withText(item.name)+}</h2>
- <if test="item.desc">{+resolveLinks(item.desc)+}</if>
- <dl>
- <if test="item.author">
- <dt class="heading">Author:</dt>
- <dd>{+item.author+}</dd>
- </if>
- <if test="item.version">
- <dt class="heading">Version:</dt>
- <dd>{+item.version+}</dd>
- </if>
- {! var locations = item.comment.getTag('location').map(function($){return $.toString().replace(/(^\$ ?| ?\$$)/g, '').replace(/^HeadURL: https:/g, 'http:');}) !}
- <if test="locations.length">
- <dt class="heading">Location:</dt>
- <for each="location" in="locations">
- <dd><a href="{+location+}">{+location+}</a></dd>
- </for>
- </if>
- </dl>
- </div>
- <hr />
- </for>
-
- </div>
- <div class="fineprint" style="clear:both">
- <if test="JSDOC.opt.D.copyright">&copy;{+JSDOC.opt.D.copyright+}<br /></if>
- Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> {+JSDOC.VERSION+} on {+new Date()+}
- </div>
- </body>
-</html> \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/templates/jsdoc/class.tmpl b/utils/jsdoc-toolkit/templates/jsdoc/class.tmpl
deleted file mode 100755
index e51f1d3..0000000
--- a/utils/jsdoc-toolkit/templates/jsdoc/class.tmpl
+++ /dev/null
@@ -1,646 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
- <head>
- <meta http-equiv="content-type" content="text/html; charset={+IO.encoding+}" />
- <meta name="generator" content="JsDoc Toolkit" />
- {! Link.base = "../"; /* all generated links will be relative to this */ !}
- <title>JsDoc Reference - {+data.alias+}</title>
-
- <style type="text/css">
- {+include("static/default.css")+}
- </style>
- </head>
-
- <body>
-<!-- ============================== header ================================= -->
- <!-- begin static/header.html -->
- {+include("static/header.html")+}
- <!-- end static/header.html -->
-
-<!-- ============================== classes index ============================ -->
- <div id="index">
- <!-- begin publish.classesIndex -->
- {+publish.classesIndex+}
- <!-- end publish.classesIndex -->
- </div>
-
- <div id="content">
-<!-- ============================== class title ============================ -->
- <h1 class="classTitle">
- {!
- var classType = "";
-
- if (data.isBuiltin()) {
- classType += "Built-In ";
- }
-
- if (data.isNamespace) {
- if (data.is('FUNCTION')) {
- classType += "Function ";
- }
- classType += "Namespace ";
- }
- else {
- classType += "Class ";
- }
- !}
- {+classType+}{+data.alias+}
- </h1>
-
-<!-- ============================== class summary ========================== -->
- <p class="description">
- <if test="data.augments.length"><br />Extends
- {+
- data.augments
- .sort()
- .map(
- function($) { return new Link().toSymbol($); }
- )
- .join(", ")
- +}.<br />
- </if>
-
- {+resolveLinks(data.classDesc)+}
-
- <if test="!data.isBuiltin()">{# isn't defined in any file #}
- <br /><i>Defined in: </i> {+new Link().toSrc(data.srcFile)+}.
- </if>
- </p>
-
-<!-- ============================== constructor summary ==================== -->
- <if test="!data.isBuiltin() && (data.isNamespace || data.is('CONSTRUCTOR'))">
- <table class="summaryTable" cellspacing="0" summary="A summary of the constructor documented in the class {+data.alias+}.">
- <caption>{+classType+}Summary</caption>
- <thead>
- <tr>
- <th scope="col">Constructor Attributes</th>
- <th scope="col">Constructor Name and Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td class="attributes">{!
- if (data.isPrivate) output += "&lt;private&gt; ";
- if (data.isInner) output += "&lt;inner&gt; ";
- !}&nbsp;</td>
- <td class="nameDescription" {!if (data.comment.getTag("hilited").length){output += 'style="color: red"'}!}>
- <div class="fixedFont">
- <b>{+ new Link().toSymbol(data.alias).inner('constructor')+}</b><if test="classType != 'Namespace '">{+ makeSignature(data.params) +}</if>
- </div>
- <div class="description">{+resolveLinks(summarize(data.desc))+}</div>
- </td>
- </tr>
- </tbody>
- </table>
- </if>
-
-<!-- ============================== properties summary ===================== -->
- <if test="data.properties.length">
- {! var ownProperties = data.properties.filter(function($){return $.memberOf == data.alias && !$.isNamespace}).sort(makeSortby("name")); !}
- <if test="ownProperties.length">
- <table class="summaryTable" cellspacing="0" summary="A summary of the fields documented in the class {+data.alias+}.">
- <caption>Field Summary</caption>
- <thead>
- <tr>
- <th scope="col">Field Attributes</th>
- <th scope="col">Field Name and Description</th>
- </tr>
- </thead>
- <tbody>
- <for each="member" in="ownProperties">
- <tr>
- <td class="attributes">{!
- if (member.isPrivate) output += "&lt;private&gt; ";
- if (member.isInner) output += "&lt;inner&gt; ";
- if (member.isStatic) output += "&lt;static&gt; ";
- if (member.isConstant) output += "&lt;constant&gt; ";
- !}&nbsp;</td>
- <td class="nameDescription">
- <div class="fixedFont">
- <if test="member.isStatic && member.memberOf != '_global_'">{+member.memberOf+}.</if><b>{+new Link().toSymbol(member.alias).withText(member.name)+}</b>
- </div>
- <div class="description">{+resolveLinks(summarize(member.desc))+}</div>
- </td>
- </tr>
- </for>
- </tbody>
- </table>
- </if>
-
- <if test="data.inheritsFrom.length">
- <dl class="inheritsList">
- {!
- var borrowedMembers = data.properties.filter(function($) {return $.memberOf != data.alias});
-
- var contributers = [];
- borrowedMembers.map(function($) {if (contributers.indexOf($.memberOf) < 0) contributers.push($.memberOf)});
- for (var i = 0, l = contributers.length; i < l; i++) {
- output +=
- "<dt>Fields borrowed from class "+new Link().toSymbol(contributers[i])+": </dt>"
- +
- "<dd>" +
- borrowedMembers
- .filter(
- function($) { return $.memberOf == contributers[i] }
- )
- .sort(makeSortby("name"))
- .map(
- function($) { return new Link().toSymbol($.alias).withText($.name) }
- )
- .join(", ")
- +
- "</dd>";
- }
- !}
- </dl>
- </if>
- </if>
-
-<!-- ============================== methods summary ======================== -->
- <if test="data.methods.length">
- {! var ownMethods = data.methods.filter(function($){return $.memberOf == data.alias && !$.isNamespace}).sort(makeSortby("name")); !}
- <if test="ownMethods.length">
- <table class="summaryTable" cellspacing="0" summary="A summary of the methods documented in the class {+data.alias+}.">
- <caption>Method Summary</caption>
- <thead>
- <tr>
- <th scope="col">Method Attributes</th>
- <th scope="col">Method Name and Description</th>
- </tr>
- </thead>
- <tbody>
- <for each="member" in="ownMethods">
- <tr>
- <td class="attributes">{!
- if (member.isPrivate) output += "&lt;private&gt; ";
- if (member.isInner) output += "&lt;inner&gt; ";
- if (member.isStatic) output += "&lt;static&gt; ";
- !}&nbsp;</td>
- <td class="nameDescription">
- <div class="fixedFont"><if test="member.isStatic && member.memberOf != '_global_'">{+member.memberOf+}.</if><b>{+new Link().toSymbol(member.alias).withText(member.name)+}</b>{+makeSignature(member.params)+}
- </div>
- <div class="description">{+resolveLinks(summarize(member.desc))+}</div>
- </td>
- </tr>
- </for>
- </tbody>
- </table>
- </if>
-
- <if test="data.inheritsFrom.length">
- <dl class="inheritsList">
- {!
- var borrowedMembers = data.methods.filter(function($) {return $.memberOf != data.alias});
- var contributers = [];
- borrowedMembers.map(function($) {if (contributers.indexOf($.memberOf) < 0) contributers.push($.memberOf)});
- for (var i = 0, l = contributers.length; i < l; i++) {
- output +=
- "<dt>Methods borrowed from class "+new Link().toSymbol(contributers[i])+": </dt>"
- +
- "<dd>" +
- borrowedMembers
- .filter(
- function($) { return $.memberOf == contributers[i] }
- )
- .sort(makeSortby("name"))
- .map(
- function($) { return new Link().toSymbol($.alias).withText($.name) }
- )
- .join(", ")
- +
- "</dd>";
- }
-
- !}
- </dl>
- </if>
- </if>
-<!-- ============================== events summary ======================== -->
- <if test="data.events.length">
- {! var ownEvents = data.events.filter(function($){return $.memberOf == data.alias && !$.isNamespace}).sort(makeSortby("name")); !}
- <if test="ownEvents.length">
- <table class="summaryTable" cellspacing="0" summary="A summary of the events documented in the class {+data.alias+}.">
- <caption>Event Summary</caption>
- <thead>
- <tr>
- <th scope="col">Event Attributes</th>
- <th scope="col">Event Name and Description</th>
- </tr>
- </thead>
- <tbody>
- <for each="member" in="ownEvents">
- <tr>
- <td class="attributes">{!
- if (member.isPrivate) output += "&lt;private&gt; ";
- if (member.isInner) output += "&lt;inner&gt; ";
- if (member.isStatic) output += "&lt;static&gt; ";
- !}&nbsp;</td>
- <td class="nameDescription">
- <div class="fixedFont"><if test="member.isStatic && member.memberOf != '_global_'">{+member.memberOf+}.</if><b>{+new Link().toSymbol(member.alias).withText(member.name)+}</b>{+makeSignature(member.params)+}
- </div>
- <div class="description">{+resolveLinks(summarize(member.desc))+}</div>
- </td>
- </tr>
- </for>
- </tbody>
- </table>
- </if>
-
- <if test="data.inheritsFrom.length">
- <dl class="inheritsList">
- {!
- var borrowedMembers = data.events.filter(function($) {return $.memberOf != data.alias});
- var contributers = [];
- borrowedMembers.map(function($) {if (contributers.indexOf($.memberOf) < 0) contributers.push($.memberOf)});
- for (var i = 0, l = contributers.length; i < l; i++) {
- output +=
- "<dt>Events borrowed from class "+new Link().toSymbol(contributers[i])+": </dt>"
- +
- "<dd>" +
- borrowedMembers
- .filter(
- function($) { return $.memberOf == contributers[i] }
- )
- .sort(makeSortby("name"))
- .map(
- function($) { return new Link().toSymbol($.alias).withText($.name) }
- )
- .join(", ")
- +
- "</dd>";
- }
-
- !}
- </dl>
- </if>
- </if>
-
-<!-- ============================== constructor details ==================== -->
- <if test="!data.isBuiltin() && (data.isNamespace || data.is('CONSTRUCTOR'))">
- <div class="details"><a name="constructor"> </a>
- <div class="sectionTitle">
- {+classType+}Detail
- </div>
-
- <div class="fixedFont">{!
- if (data.isPrivate) output += "&lt;private&gt; ";
- if (data.isInner) output += "&lt;inner&gt; ";
- !}
- <b>{+ data.alias +}</b><if test="classType != 'Namespace '">{+ makeSignature(data.params) +}</if>
- </div>
-
- <div class="description">
- {+resolveLinks(data.desc)+}
- <if test="data.author"><br /><i>Author: </i>{+data.author+}.</if>
- </div>
-
- <if test="data.example.length">
- <for each="example" in="data.example">
- <pre class="code">{+example+}</pre>
- </for>
- </if>
-
-
- <if test="data.params.length">
- <dl class="detailList">
- <dt class="heading">Parameters:</dt>
- <for each="item" in="data.params">
- <dt>
- {+((item.type)?""+("<span class=\"light fixedFont\">{"+(new Link().toSymbol(item.type)+"}</span> ")) : "")+} <b>{+item.name+}</b>
- <if test="item.isOptional"><i>Optional<if test="item.defaultValue">, Default: {+item.defaultValue+}</if></i></if>
- </dt>
- <dd>{+resolveLinks(item.desc)+}</dd>
- </for>
- </dl>
- </if>
- <if test="data.deprecated">
- <dl class="detailList">
- <dt class="heading">Deprecated:</dt>
- <dt>
- {+resolveLinks(data.deprecated)+}
- </dt>
- </dl>
- </if>
- <if test="data.since">
- <dl class="detailList">
- <dt class="heading">Since:</dt>
- <dd>{+ data.since +}</dd>
- </dl>
- </if>
- <if test="data.exceptions.length">
- <dl class="detailList">
- <dt class="heading">Throws:</dt>
- <for each="item" in="data.exceptions">
- <dt>
- {+((item.type)?"<span class=\"light fixedFont\">{"+(new Link().toSymbol(item.type))+"}</span> " : "")+} <b>{+item.name+}</b>
- </dt>
- <dd>{+resolveLinks(item.desc)+}</dd>
- </for>
- </dl>
- </if>
- <if test="data.returns.length">
- <dl class="detailList">
- <dt class="heading">Returns:</dt>
- <for each="item" in="data.returns">
- <dd>{+((item.type)?"<span class=\"light fixedFont\">{"+(new Link().toSymbol(item.type))+"}</span> " : "")+}{+resolveLinks(item.desc)+}</dd>
- </for>
- </dl>
- </if>
- <if test="data.requires.length">
- <dl class="detailList">
- <dt class="heading">Requires:</dt>
- <for each="item" in="data.requires">
- <dd>{+ resolveLinks(item) +}</dd>
- </for>
- </dl>
- </if>
- <if test="data.see.length">
- <dl class="detailList">
- <dt class="heading">See:</dt>
- <for each="item" in="data.see">
- <dd>{+ new Link().toSymbol(item) +}</dd>
- </for>
- </dl>
- </if>
-
- </div>
- </if>
-
-<!-- ============================== field details ========================== -->
- <if test="defined(ownProperties) && ownProperties.length">
- <div class="sectionTitle">
- Field Detail
- </div>
- <for each="member" in="ownProperties">
- <a name="{+Link.symbolNameToLinkName(member)+}"> </a>
- <div class="fixedFont">{!
- if (member.isPrivate) output += "&lt;private&gt; ";
- if (member.isInner) output += "&lt;inner&gt; ";
- if (member.isStatic) output += "&lt;static&gt; ";
- if (member.isConstant) output += "&lt;constant&gt; ";
- !}
-
- <if test="member.type"><span class="light">{{+new Link().toSymbol(member.type)+}}</span></if>
- <if test="member.isStatic && member.memberOf != '_global_'"><span class="light">{+member.memberOf+}.</span></if><b>{+member.name+}</b>
-
- </div>
- <div class="description">
- {+resolveLinks(member.desc)+}
- <if test="member.srcFile != data.srcFile">
- <br />
- <i>Defined in: </i> {+new Link().toSrc(member.srcFile)+}.
- </if>
- <if test="member.author"><br /><i>Author: </i>{+member.author+}.</if>
- </div>
-
- <if test="member.example.length">
- <for each="example" in="member.example">
- <pre class="code">{+example+}</pre>
- </for>
- </if>
-
- <if test="member.deprecated">
- <dl class="detailList">
- <dt class="heading">Deprecated:</dt>
- <dt>
- {+ resolveLinks(member.deprecated) +}
- </dt>
- </dl>
- </if>
- <if test="member.since">
- <dl class="detailList">
- <dt class="heading">Since:</dt>
- <dd>{+ member.since +}</dd>
- </dl>
- </if>
- <if test="member.see.length">
- <dl class="detailList">
- <dt class="heading">See:</dt>
- <for each="item" in="member.see">
- <dd>{+ new Link().toSymbol(item) +}</dd>
- </for>
- </dl>
- </if>
- <if test="member.defaultValue">
- <dl class="detailList">
- <dt class="heading">Default Value:</dt>
- <dd>
- {+resolveLinks(member.defaultValue)+}
- </dd>
- </dl>
- </if>
-
- <if test="!$member_last"><hr /></if>
- </for>
- </if>
-
-<!-- ============================== method details ========================= -->
- <if test="defined(ownMethods) && ownMethods.length">
- <div class="sectionTitle">
- Method Detail
- </div>
- <for each="member" in="ownMethods">
- <a name="{+Link.symbolNameToLinkName(member)+}"> </a>
- <div class="fixedFont">{!
- if (member.isPrivate) output += "&lt;private&gt; ";
- if (member.isInner) output += "&lt;inner&gt; ";
- if (member.isStatic) output += "&lt;static&gt; ";
- !}
-
- <if test="member.type"><span class="light">{{+new Link().toSymbol(member.type)+}}</span></if>
- <if test="member.isStatic && member.memberOf != '_global_'"><span class="light">{+member.memberOf+}.</span></if><b>{+member.name+}</b>{+makeSignature(member.params)+}
-
- </div>
- <div class="description">
- {+resolveLinks(member.desc)+}
- <if test="member.srcFile != data.srcFile">
- <br />
- <i>Defined in: </i> {+new Link().toSrc(member.srcFile)+}.
- </if>
- <if test="member.author"><br /><i>Author: </i>{+member.author+}.</if>
- </div>
-
- <if test="member.example.length">
- <for each="example" in="member.example">
- <pre class="code">{+example+}</pre>
- </for>
- </if>
-
- <if test="member.params.length">
- <dl class="detailList">
- <dt class="heading">Parameters:</dt>
- <for each="item" in="member.params">
- <dt>
- {+((item.type)?"<span class=\"light fixedFont\">{"+(new Link().toSymbol(item.type))+"}</span> " : "")+}<b>{+item.name+}</b>
- <if test="item.isOptional"><i>Optional<if test="item.defaultValue">, Default: {+item.defaultValue+}</if></i></if>
- </dt>
- <dd>{+resolveLinks(item.desc)+}</dd>
- </for>
- </dl>
- </if>
- <if test="member.deprecated">
- <dl class="detailList">
- <dt class="heading">Deprecated:</dt>
- <dt>
- {+ resolveLinks(member.deprecated) +}
- </dt>
- </dl>
- </if>
- <if test="member.since">
- <dl class="detailList">
- <dt class="heading">Since:</dt>
- <dd>{+ member.since +}</dd>
- </dl>
- </dl>
- </if>
- <if test="member.exceptions.length">
- <dl class="detailList">
- <dt class="heading">Throws:</dt>
- <for each="item" in="member.exceptions">
- <dt>
- {+((item.type)?"<span class=\"light fixedFont\">{"+(new Link().toSymbol(item.type))+"}</span> " : "")+} <b>{+item.name+}</b>
- </dt>
- <dd>{+resolveLinks(item.desc)+}</dd>
- </for>
- </dl>
- </if>
- <if test="member.returns.length">
- <dl class="detailList">
- <dt class="heading">Returns:</dt>
- <for each="item" in="member.returns">
- <dd>{+((item.type)?"<span class=\"light fixedFont\">{"+(new Link().toSymbol(item.type))+"}</span> " : "")+}{+resolveLinks(item.desc)+}</dd>
- </for>
- </dl>
- </if>
- <if test="member.requires.length">
- <dl class="detailList">
- <dt class="heading">Requires:</dt>
- <for each="item" in="member.requires">
- <dd>{+ resolveLinks(item) +}</dd>
- </for>
- </dl>
- </if>
- <if test="member.see.length">
- <dl class="detailList">
- <dt class="heading">See:</dt>
- <for each="item" in="member.see">
- <dd>{+ new Link().toSymbol(item) +}</dd>
- </for>
- </dl>
- </if>
-
- <if test="!$member_last"><hr /></if>
- </for>
- </if>
-
-<!-- ============================== event details ========================= -->
- <if test="defined(ownEvents) && ownEvents.length">
- <div class="sectionTitle">
- Event Detail
- </div>
- <for each="member" in="ownEvents">
- <a name="event:{+Link.symbolNameToLinkName(member)+}"> </a>
- <div class="fixedFont">{!
- if (member.isPrivate) output += "&lt;private&gt; ";
- if (member.isInner) output += "&lt;inner&gt; ";
- if (member.isStatic) output += "&lt;static&gt; ";
- !}
-
- <if test="member.type"><span class="light">{{+new Link().toSymbol(member.type)+}}</span></if>
- <if test="member.isStatic && member.memberOf != '_global_'"><span class="light">{+member.memberOf+}.</span></if><b>{+member.name+}</b>{+makeSignature(member.params)+}
-
- </div>
- <div class="description">
- {+resolveLinks(member.desc)+}
- <if test="member.srcFile != data.srcFile">
- <br />
- <i>Defined in: </i> {+new Link().toSrc(member.srcFile)+}.
- </if>
- <if test="member.author"><br /><i>Author: </i>{+member.author+}.</if>
- </div>
-
- <if test="member.example.length">
- <for each="example" in="member.example">
- <pre class="code">{+example+}</pre>
- </for>
- </if>
-
- <if test="member.params.length">
- <dl class="detailList">
- <dt class="heading">Parameters:</dt>
- <for each="item" in="member.params">
- <dt>
- {+((item.type)?"<span class=\"light fixedFont\">{"+(new Link().toSymbol(item.type))+"}</span> " : "")+}<b>{+item.name+}</b>
- <if test="item.isOptional"><i>Optional<if test="item.defaultValue">, Default: {+item.defaultValue+}</if></i></if>
- </dt>
- <dd>{+ resolveLinks(item.desc) +}</dd>
- </for>
- </dl>
- </if>
- <if test="member.deprecated">
- <dl class="detailList">
- <dt class="heading">Deprecated:</dt>
- <dt>
- {+ resolveLinks(member.deprecated) +}
- </dt>
- </dl>
- </if>
- <if test="member.since">
- <dl class="detailList">
- <dt class="heading">Since:</dt>
- <dd>{+ member.since +}</dd>
- </dl>
- </dl>
- </if>
- <if test="member.exceptions.length">
- <dl class="detailList">
- <dt class="heading">Throws:</dt>
- <for each="item" in="member.exceptions">
- <dt>
- {+((item.type)?"<span class=\"light fixedFont\">{"+(new Link().toSymbol(item.type))+"}</span> " : "")+} <b>{+item.name+}</b>
- </dt>
- <dd>{+ resolveLinks(item.desc) +}</dd>
- </for>
- </dl>
- </if>
- <if test="member.returns.length">
- <dl class="detailList">
- <dt class="heading">Returns:</dt>
- <for each="item" in="member.returns">
- <dd>{+((item.type)?"<span class=\"light fixedFont\">{"+(new Link().toSymbol(item.type))+"}</span> " : "")+}{+resolveLinks(item.desc)+}</dd>
- </for>
- </dl>
- </if>
- <if test="member.requires.length">
- <dl class="detailList">
- <dt class="heading">Requires:</dt>
- <for each="item" in="member.requires">
- <dd>{+ resolveLinks(item) +}</dd>
- </for>
- </dl>
- </if>
- <if test="member.see.length">
- <dl class="detailList">
- <dt class="heading">See:</dt>
- <for each="item" in="member.see">
- <dd>{+ new Link().toSymbol(item) +}</dd>
- </for>
- </dl>
- </if>
-
- <if test="!$member_last"><hr /></if>
- </for>
- </if>
-
- <hr />
- </div>
-
-
-<!-- ============================== footer ================================= -->
- <div class="fineprint" style="clear:both">
- <if test="JSDOC.opt.D.copyright">&copy;{+JSDOC.opt.D.copyright+}<br /></if>
- Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> {+JSDOC.VERSION+} on {+new Date()+}
- </div>
- </body>
-</html>
diff --git a/utils/jsdoc-toolkit/templates/jsdoc/index.tmpl b/utils/jsdoc-toolkit/templates/jsdoc/index.tmpl
deleted file mode 100755
index a5dc115..0000000
--- a/utils/jsdoc-toolkit/templates/jsdoc/index.tmpl
+++ /dev/null
@@ -1,39 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
- <head>
- <meta http-equiv="content-type" content="text/html; charset={+IO.encoding+}" />
-
- <title>JsDoc Reference - Index</title>
- <meta name="generator" content="JsDoc Toolkit" />
-
- <style type="text/css">
- {+include("static/default.css")+}
- </style>
- </head>
-
- <body>
- {+include("static/header.html")+}
-
- <div id="index">
- {+publish.classesIndex+}
- </div>
-
- <div id="content">
- <h1 class="classTitle">Class Index</h1>
-
- <for each="thisClass" in="data">
- <div>
- <h2>{+(new Link().toSymbol(thisClass.alias))+}</h2>
- {+resolveLinks(summarize(thisClass.classDesc))+}
- </div>
- <hr />
- </for>
-
- </div>
- <div class="fineprint" style="clear:both">
- <if test="JSDOC.opt.D.copyright">&copy;{+JSDOC.opt.D.copyright+}<br /></if>
- Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> {+JSDOC.VERSION+} on {+new Date()+}
- </div>
- </body>
-</html> \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/templates/jsdoc/publish.js b/utils/jsdoc-toolkit/templates/jsdoc/publish.js
deleted file mode 100755
index 446c92b..0000000
--- a/utils/jsdoc-toolkit/templates/jsdoc/publish.js
+++ /dev/null
@@ -1,200 +0,0 @@
-/** Called automatically by JsDoc Toolkit. */
-function publish(symbolSet) {
- publish.conf = { // trailing slash expected for dirs
- ext: ".html",
- outDir: JSDOC.opt.d || SYS.pwd+"../out/jsdoc/",
- templatesDir: JSDOC.opt.t || SYS.pwd+"../templates/jsdoc/",
- symbolsDir: "symbols/",
- srcDir: "symbols/src/"
- };
-
- // is source output is suppressed, just display the links to the source file
- if (JSDOC.opt.s && defined(Link) && Link.prototype._makeSrcLink) {
- Link.prototype._makeSrcLink = function(srcFilePath) {
- return "&lt;"+srcFilePath+"&gt;";
- }
- }
-
- // create the folders and subfolders to hold the output
- IO.mkPath((publish.conf.outDir+"symbols/src").split("/"));
-
- // used to allow Link to check the details of things being linked to
- Link.symbolSet = symbolSet;
-
- // create the required templates
- try {
- var classTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"class.tmpl");
- var classesTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"allclasses.tmpl");
- }
- catch(e) {
- print("Couldn't create the required templates: "+e);
- quit();
- }
-
- // some ustility filters
- function hasNoParent($) {return ($.memberOf == "")}
- function isaFile($) {return ($.is("FILE"))}
- function isaClass($) {return ($.is("CONSTRUCTOR") || $.isNamespace)}
-
- // get an array version of the symbolset, useful for filtering
- var symbols = symbolSet.toArray();
-
- // create the hilited source code files
- var files = JSDOC.opt.srcFiles;
- for (var i = 0, l = files.length; i < l; i++) {
- var file = files[i];
- var srcDir = publish.conf.outDir + "symbols/src/";
- makeSrcFile(file, srcDir);
- }
-
- // get a list of all the classes in the symbolset
- var classes = symbols.filter(isaClass).sort(makeSortby("alias"));
-
- // create a filemap in which outfiles must be to be named uniquely, ignoring case
- if (JSDOC.opt.u) {
- var filemapCounts = {};
- Link.filemap = {};
- for (var i = 0, l = classes.length; i < l; i++) {
- var lcAlias = classes[i].alias.toLowerCase();
-
- if (!filemapCounts[lcAlias]) filemapCounts[lcAlias] = 1;
- else filemapCounts[lcAlias]++;
-
- Link.filemap[classes[i].alias] =
- (filemapCounts[lcAlias] > 1)?
- lcAlias+"_"+filemapCounts[lcAlias] : lcAlias;
- }
- }
-
- // create a class index, displayed in the left-hand column of every class page
- Link.base = "../";
- publish.classesIndex = classesTemplate.process(classes); // kept in memory
-
- // create each of the class pages
- for (var i = 0, l = classes.length; i < l; i++) {
- var symbol = classes[i];
-
- symbol.events = symbol.getEvents(); // 1 order matters
- symbol.methods = symbol.getMethods(); // 2
-
- var output = "";
- output = classTemplate.process(symbol);
-
- IO.saveFile(publish.conf.outDir+"symbols/", ((JSDOC.opt.u)? Link.filemap[symbol.alias] : symbol.alias) + publish.conf.ext, output);
- }
-
- // regenerate the index with different relative links, used in the index pages
- Link.base = "";
- publish.classesIndex = classesTemplate.process(classes);
-
- // create the class index page
- try {
- var classesindexTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"index.tmpl");
- }
- catch(e) { print(e.message); quit(); }
-
- var classesIndex = classesindexTemplate.process(classes);
- IO.saveFile(publish.conf.outDir, "index"+publish.conf.ext, classesIndex);
- classesindexTemplate = classesIndex = classes = null;
-
- // create the file index page
- try {
- var fileindexTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"allfiles.tmpl");
- }
- catch(e) { print(e.message); quit(); }
-
- var documentedFiles = symbols.filter(isaFile); // files that have file-level docs
- var allFiles = []; // not all files have file-level docs, but we need to list every one
-
- for (var i = 0; i < files.length; i++) {
- allFiles.push(new JSDOC.Symbol(files[i], [], "FILE", new JSDOC.DocComment("/** */")));
- }
-
- for (var i = 0; i < documentedFiles.length; i++) {
- var offset = files.indexOf(documentedFiles[i].alias);
- allFiles[offset] = documentedFiles[i];
- }
-
- allFiles = allFiles.sort(makeSortby("name"));
-
- // output the file index page
- var filesIndex = fileindexTemplate.process(allFiles);
- IO.saveFile(publish.conf.outDir, "files"+publish.conf.ext, filesIndex);
- fileindexTemplate = filesIndex = files = null;
-}
-
-
-/** Just the first sentence (up to a full stop). Should not break on dotted variable names. */
-function summarize(desc) {
- if (typeof desc != "undefined")
- return desc.match(/([\w\W]+?\.)[^a-z0-9_$]/i)? RegExp.$1 : desc;
-}
-
-/** Make a symbol sorter by some attribute. */
-function makeSortby(attribute) {
- return function(a, b) {
- if (a[attribute] != undefined && b[attribute] != undefined) {
- a = a[attribute].toLowerCase();
- b = b[attribute].toLowerCase();
- if (a < b) return -1;
- if (a > b) return 1;
- return 0;
- }
- }
-}
-
-/** Pull in the contents of an external file at the given path. */
-function include(path) {
- var path = publish.conf.templatesDir+path;
- return IO.readFile(path);
-}
-
-/** Turn a raw source file into a code-hilited page in the docs. */
-function makeSrcFile(path, srcDir, name) {
- if (JSDOC.opt.s) return;
-
- if (!name) {
- name = path.replace(/\.\.?[\\\/]/g, "").replace(/[\\\/]/g, "_");
- name = name.replace(/\:/g, "_");
- }
-
- var src = {path: path, name:name, charset: IO.encoding, hilited: ""};
-
- if (defined(JSDOC.PluginManager)) {
- JSDOC.PluginManager.run("onPublishSrc", src);
- }
-
- if (src.hilited) {
- IO.saveFile(srcDir, name+publish.conf.ext, src.hilited);
- }
-}
-
-/** Build output for displaying function parameters. */
-function makeSignature(params) {
- if (!params) return "()";
- var signature = "("
- +
- params.filter(
- function($) {
- return $.name.indexOf(".") == -1; // don't show config params in signature
- }
- ).map(
- function($) {
- return $.name;
- }
- ).join(", ")
- +
- ")";
- return signature;
-}
-
-/** Find symbol {@link ...} strings in text and turn into html links */
-function resolveLinks(str, from) {
- str = str.replace(/\{@link ([^} ]+) ?\}/gi,
- function(match, symbolName) {
- return new Link().toSymbol(symbolName);
- }
- );
-
- return str;
-}
diff --git a/utils/jsdoc-toolkit/templates/jsdoc/static/default.css b/utils/jsdoc-toolkit/templates/jsdoc/static/default.css
deleted file mode 100755
index 97e021e..0000000
--- a/utils/jsdoc-toolkit/templates/jsdoc/static/default.css
+++ /dev/null
@@ -1,162 +0,0 @@
-/* default.css */
-body
-{
- font: 12px "Lucida Grande", Tahoma, Arial, Helvetica, sans-serif;
- width: 800px;
-}
-
-.header
-{
- clear: both;
- background-color: #ccc;
- padding: 8px;
-}
-
-h1
-{
- font-size: 150%;
- font-weight: bold;
- padding: 0;
- margin: 1em 0 0 .3em;
-}
-
-hr
-{
- border: none 0;
- border-top: 1px solid #7F8FB1;
- height: 1px;
-}
-
-pre.code
-{
- display: block;
- padding: 8px;
- border: 1px dashed #ccc;
-}
-
-#index
-{
- margin-top: 24px;
- float: left;
- width: 160px;
- position: absolute;
- left: 8px;
- background-color: #F3F3F3;
- padding: 8px;
-}
-
-#content
-{
- margin-left: 190px;
- width: 600px;
-}
-
-.classList
-{
- list-style-type: none;
- padding: 0;
- margin: 0 0 0 8px;
- font-family: arial, sans-serif;
- font-size: 1em;
- overflow: auto;
-}
-
-.classList li
-{
- padding: 0;
- margin: 0 0 8px 0;
-}
-
-.summaryTable { width: 100%; }
-
-h1.classTitle
-{
- font-size:170%;
- line-height:130%;
-}
-
-h2 { font-size: 110%; }
-caption, div.sectionTitle
-{
- background-color: #7F8FB1;
- color: #fff;
- font-size:130%;
- text-align: left;
- padding: 2px 6px 2px 6px;
- border: 1px #7F8FB1 solid;
-}
-
-div.sectionTitle { margin-bottom: 8px; }
-.summaryTable thead { display: none; }
-
-.summaryTable td
-{
- vertical-align: top;
- padding: 4px;
- border-bottom: 1px #7F8FB1 solid;
- border-right: 1px #7F8FB1 solid;
-}
-
-/*col#summaryAttributes {}*/
-.summaryTable td.attributes
-{
- border-left: 1px #7F8FB1 solid;
- width: 140px;
- text-align: right;
-}
-
-td.attributes, .fixedFont
-{
- line-height: 15px;
- color: #002EBE;
- font-family: "Courier New",Courier,monospace;
- font-size: 13px;
-}
-
-.summaryTable td.nameDescription
-{
- text-align: left;
- font-size: 13px;
- line-height: 15px;
-}
-
-.summaryTable td.nameDescription, .description
-{
- line-height: 15px;
- padding: 4px;
- padding-left: 4px;
-}
-
-.summaryTable { margin-bottom: 8px; }
-
-ul.inheritsList
-{
- list-style: square;
- margin-left: 20px;
- padding-left: 0;
-}
-
-.detailList {
- margin-left: 20px;
- line-height: 15px;
-}
-.detailList dt { margin-left: 20px; }
-
-.detailList .heading
-{
- font-weight: bold;
- padding-bottom: 6px;
- margin-left: 0;
-}
-
-.light, td.attributes, .light a:link, .light a:visited
-{
- color: #777;
- font-style: italic;
-}
-
-.fineprint
-{
- text-align: right;
- font-size: 10px;
-} \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/templates/jsdoc/static/header.html b/utils/jsdoc-toolkit/templates/jsdoc/static/header.html
deleted file mode 100755
index 353b735..0000000
--- a/utils/jsdoc-toolkit/templates/jsdoc/static/header.html
+++ /dev/null
@@ -1,2 +0,0 @@
-<div id="header">
-</div> \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/templates/jsdoc/static/index.html b/utils/jsdoc-toolkit/templates/jsdoc/static/index.html
deleted file mode 100755
index 661f6f6..0000000
--- a/utils/jsdoc-toolkit/templates/jsdoc/static/index.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta http-equiv="content-type" content="text/html; charset=utf-8" />
- <title>Generated Javascript Documentation</title>
-</head>
-<frameset cols="20%,80%">
- <frame src="allclasses-frame.html" name="packageFrame" />
- <frame src="splash.html" name="classFrame" />
- <noframes>
- <body>
- <p>
- This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client.
- </p>
- </body>
- </noframes>
-</frameset>
-</html> \ No newline at end of file
diff --git a/utils/jsdoc-toolkit/templates/jsdoc/symbol.tmpl b/utils/jsdoc-toolkit/templates/jsdoc/symbol.tmpl
deleted file mode 100755
index f8f4bd1..0000000
--- a/utils/jsdoc-toolkit/templates/jsdoc/symbol.tmpl
+++ /dev/null
@@ -1,35 +0,0 @@
-<symbol alias="{+data.alias+}">
- <name>{+data.name+}</name>
- <memberOf>{+data.memberOf+}</memberOf>
- <isStatic>{+data.isStatic+}</isStatic>
- <isa>{+data.isa+}</isa>
- <desc>{+data.desc+}</desc>
- <classDesc>{+data.classDesc+}</classDesc>
-
- <methods><for each="method" in="data.methods">
- <method>
- <name>{+method.name+}</name>
- <memberOf>{+method.memberOf+}</memberOf>
- <isStatic>{+method.isStatic+}</isStatic>
- <desc>{+method.desc+}</desc>
- <params><for each="param" in="method.params">
- <param>
- <type>{+param.type+}</type>
- <name>{+param.name+}</name>
- <desc>{+param.desc+}</desc>
- <defaultValue>{+param.defaultValue+}</defaultValue>
- </param></for>
- </params>
- </method></for>
- </methods>
-
- <properties><for each="property" in="data.properties">
- <property>
- <name>{+property.name+}</name>
- <memberOf>{+property.memberOf+}</memberOf>
- <isStatic>{+property.isStatic+}</isStatic>
- <desc>{+property.desc+}</desc>
- <type>{+property.type+}</type>
- </property></for>
- </properties>
-</symbol>
diff --git a/utils/lib/.args.js.swp b/utils/lib/.args.js.swp
deleted file mode 100755
index 9c2cec9..0000000
--- a/utils/lib/.args.js.swp
+++ /dev/null
Binary files differ
diff --git a/utils/lib/args.js b/utils/lib/args.js
deleted file mode 100755
index 4c7f450..0000000
--- a/utils/lib/args.js
+++ /dev/null
@@ -1,702 +0,0 @@
-
-var os = require('os');
-var util = require('util');
-var stream = require('term').stream;
-
-exports.Parser = function () {
- this._options = [];
- this._def = {};
- this._long = {};
- this._short = {};
- this._commands = {};
- this._args = [];
- this._vargs = undefined;
-};
-
-exports.Parser.prototype.option = function () {
- var self = this;
- var option = new this.Option(this, arguments);
- this._options.push(option);
- return option;
-};
-
-exports.Parser.prototype.def = function (name, value) {
- this._def[name] = value;
- return this;
-};
-
-exports.Parser.prototype.command = function (name, handler) {
- var parent = this;
- if (!handler) {
- var parser = new exports.Parser();
- this._commands[name] = function () {
- return parser;
- };
- return parser;
- } else if (typeof handler == "string") {
- this._commands[name] = function () {
- return require(handler).parser;
- };
- return;
- } else {
- var parser = new this.Parser();
- parser.action(handler);
- this._commands[name] = function () {
- return parser;
- };
- return parser;
- }
-};
-
-exports.Parser.prototype.arg = function (name) {
- var argument = new exports.Argument(this).name(name);
- this._args.push(argument);
- return argument;
-};
-
-exports.Parser.prototype.args = function (name) {
- var argument = new exports.Argument(this).name(name);
- this._vargs = argument;
- return argument;
-};
-
-exports.Parser.prototype.act = function (args, options) {
- if (!this._action) {
- this.error(options, "Not yet implemented.");
- this.exit(-1);
- }
- options.acted = true;
- this._action.call(this, this.parse(args), options);
-};
-
-exports.Parser.prototype.action = function (action) {
- this._action = action;
- return this;
-};
-
-// should be called last
-exports.Parser.prototype.helpful = function () {
- var self = this;
- this.option('-h', '--help')
- .help('displays usage information')
- .action(function (options) {
- return self.printHelp(options);
- })
- .halt();
- if (util.len(this._commands))
- this.command('help', function (options) {
- self.printHelp(options);
- }).help('displays usage information');
- return this;
-};
-
-exports.Parser.prototype.usage = function (usage) {
- this._usage = usage;
- return this;
-};
-
-exports.Parser.prototype.help = function (help) {
- this._help = help;
- return this;
-};
-
-exports.Parser.prototype.printHelp = function (options) {
- if (options.args.length) {
- util.put(options.args, 1, '--help');
- this._commands[options.args[0]]().act(options.args, options);
- } else {
- this.printUsage(options);
- // todo, parse args for deep help
- if (this._help)
- this.print('\0cyan(\0bold(' + this._help + '\0)\0)');
- this.printCommands(options);
- this.printOptions(options);
- this.exit();
- }
-};
-
-exports.Parser.prototype.printUsage = function (options) {
- this.print(
- 'Usage: \0bold(\0blue(' + system.fs.basename(options.command || '<unknown>') + ' [OPTIONS]' +
- (util.len(this._commands) ?
- ' COMMAND' :
- ''
- ) +
- (util.len(this._args) ?
- ' ' + this._args.map(function (arg) {
- if (arg._optional) {
- return '[' + arg._name.toUpperCase() + ']';
- } else {
- return arg._name.toUpperCase();
- }
- }).join(' ') :
- ''
- ) +
- (this._vargs ?
- ' [' + this._vargs._name.toUpperCase() + ' ...]':
- ''
- ) +
- (this._usage ?
- ' ' + this._usage :
- ''
- ) + "\0)\0)"
- );
-};
-
-exports.Parser.prototype.printCommands = function (options) {
- var self = this;
- util.forEachApply(
- util.items(this._commands),
- function (name, command) {
- var parser = command();
- self.print(' \0bold(\0green(' + name + '\0)\0)' + (
- parser._help ?
- (
- ': ' +
- (
- parser._action?
- '': '\0red(NYI\0): '
- ) +
- parser._help
- ) : ''
- ));
- }
- );
-};
-
-exports.Parser.prototype.printOptions = function (options) {
- var self = this;
- this._options.forEach(function (option) {
- if (option._hidden)
- return;
- var message = [];
- if (option._short.length)
- message.push(option._short.map(function (_short) {
- return ' \0bold(\0green(-' + _short + '\0)\0)';
- }).join(''));
- if (option._long.length)
- message.push(option._long.map(function (_long) {
- return ' \0bold(\0green(--' + _long + '\0)\0)';
- }).join(''));
- if (option._action.length > 2)
- message.push(
- ' ' +
- util.range(option._action.length - 2)
- .map(function () {
- return '\0bold(\0green(' + util.upper(
- option.getName()
- ) + '\0)\0)';
- }).join(' ')
- );
- if (option._help)
- message.push(': ' + option._help + '');
- if (option._choices) {
- var choices = option._choices;
- if (!util.isArrayLike(choices))
- choices = util.keys(choices);
- message.push(' \0bold(\0blue((' + choices.join(', ') + ')\0)\0)');
- }
- if (option._halt)
- message.push(' \0bold(\0blue((final option)\0)\0)');
- self.print(message.join(''));
- });
-};
-
-exports.Parser.prototype.error = function (options, message) {
- if (this._parser) {
- this._parser.error.apply(
- this._parser,
- arguments
- );
- } else {
- this.print('\0red(' + message + '\0)');
- this.exit();
- }
-};
-
-exports.Parser.prototype.exit = function (status) {
- if (this._parser)
- this._parser.exit.apply(
- this._parser,
- arguments
- );
- else {
- os.exit(status);
- throw new Error("exit failed");
- }
-};
-
-exports.Parser.prototype.print = function () {
- if (this._parser)
- this._parser.print.apply(
- this._parser,
- arguments
- );
- else
- stream.print.apply(null, arguments);
-};
-
-exports.Parser.prototype.parse = function (args, options, noCommand) {
- var self = this;
-
- if (!args)
- args = system.args;
- if (!options)
- options = {};
-
- options.args = args;
- if (!noCommand && args.length && !/^-/.test(args[0]))
- options.command = args.shift();
-
- function mandatoryShift(n, name) {
- if (n > args.length) {
- this.error(
- options,
- 'ERROR: The ' + util.enquote(name) +
- ' option requires ' + n + ' arguments.'
- );
- }
- return args.shift(n);
- };
-
- function validate (option, value) {
- try {
- return option._validate.call(self, value);
- } catch (exception) {
- self.error(options, exception);
- }
- };
-
- // initial values
- for (var name in this._def) {
- if (util.has(this._def, name) && !util.has(options, name))
- options[name] = util.copy(this._def[name]);
- }
- this._options.forEach(function (option) {
- if (!util.has(options, option._name))
- options[option._name] = option._def;
- });
-
- // walk args
- ARGS: while (args.length) {
- var arg = args.shift();
- if (arg == "--") {
- break;
-
- } else if (/^--/.test(arg)) {
-
- var pattern = arg.match(/^--([^=]+)(?:=(.*))?/).slice(1);
- var word = pattern[0];
- var value = pattern[1];
-
- if (!!value) {
- args.unshift(value);
- }
-
- if (util.has(this._long, word)) {
-
- var option = this._long[word];
- if (!option._action) {
- self.error(
- options,
- "Programmer error: The " + word +
- " option does not have an associated action."
- );
- }
- if (option._action.length <= 2) {
- option._action.call(
- self,
- options,
- option._name
- );
- } else if (option._action.length <= 3) {
- option._action.apply(
- self,
- [
- options,
- option.getName(),
- validate(option, mandatoryShift.call(
- this,
- Math.max(0, option._action.length - 2),
- word
- ))
- ]
- );
- } else {
- option._action.apply(
- self,
- [
- options,
- option.getName()
- ].concat(
- validate(option, mandatoryShift.call(
- this,
- Math.max(0, option._action.length - 2),
- word
- ))
- )
- );
- }
-
- if (option._halt)
- break ARGS;
-
- } else {
- this.error(options, 'ERROR: Unrecognized option: ' + util.enquote(word));
- }
-
- } else if (/^-/.test(arg)) {
-
- var letters = arg.match(/^-(.*)/)[1].split('');
- while (letters.length) {
- var letter = letters.shift();
- if (util.has(this._short, letter)) {
- var option = this._short[letter];
- if (option._action.length > 2) {
- if (letters.length) {
- option._action.call(
- self,
- options,
- option._name,
- validate(option, letters.join(''))
- );
- letters = '';
- } else {
- option._action.apply(
- self,
- [
- options,
- option._name,
- ].concat(
- validate(option, args.shift(option._action.length - 2))
- )
- );
- }
- } else {
- option._action.call(self, options, option._name);
- }
-
- if (option._halt)
- break ARGS;
-
- } else {
- this.error(options, 'ERROR: unrecognized option: ' + util.enquote(letter));
- }
- }
-
- } else {
- args.unshift(arg);
- break;
- }
-
- }
-
- if (util.len(this._commands)) {
- if (args.length) {
- if (util.has(this._commands, args[0])) {
- var command = this._commands[args[0]];
- command().act(args, options);
- } else {
- this.error(options, 'ERROR: unrecognized command');
- }
- } else {
- this.printHelp(options);
- this.exit(0);
- }
- }
-
- return options;
-};
-
-exports.Argument = function (parser) {
- this._parser = parser;
- return this;
-};
-
-exports.Argument.prototype.name = function (name) {
- this._name = name;
- return this;
-};
-
-exports.Argument.prototype.optional = function () {
- this._optional = true;
- return this;
-};
-
-exports.Option = function (parser, args) {
- var self = this;
- this._parser = parser;
- this._validate = function (value) {
- return value;
- };
- this._long = [];
- this._short = [];
- util.forEach(args, function (arg) {
- if (typeof arg == "function") {
- self.action(arg);
- } else if (typeof arg !== "string") {
- for (var name in arg) {
- var value = arg[name];
- self[name](value);
- }
- } else if (/ /.test(arg)) {
- self.help(arg);
- } else if (/^--/.test(arg)) {
- arg = arg.match(/^--(.*)/)[1];
- self.__(arg);
- } else if (/^-.$/.test(arg)) {
- arg = arg.match(/^-(.)/)[1];
- self._(arg);
- } else if (/^-/.test(arg)) {
- throw new Error("option names with one dash can only have one letter.");
- } else {
- self.name(arg);
- }
- });
- return this;
-};
-
-exports.Option.prototype._ = function (letter) {
- this._short.push(letter);
- this._parser._short[letter] = this;
- return this;
-};
-
-exports.Option.prototype.__ = function (word) {
- this._long.push(word);
- this._parser._long[word] = this;
- return this;
-};
-
-exports.Option.prototype.name = function (name) {
- this._name = name;
- return this;
-};
-
-exports.Option.prototype.getName = function () {
- if (this._name)
- return this._name;
- if (this._long.length);
- return this._long[0]
- if (this._short.length)
- return this._short[0]
- throw new Error("Programmer error: unnamed option");
-};
-
-exports.Option.prototype.action = function (action) {
- var self = this;
- if (typeof action == "string") {
- this._action = self._parser[action];
- } else {
- this._action = action;
- }
- return this;
-};
-
-exports.Option.prototype.set = function (value) {
- var option = this;
- if (arguments.length == 0)
- return this.action(function (options, name, value) {
- options[name] = value;
- });
- else if (arguments.length == 1)
- return this.action(function (options, name) {
- options[name] = value;
- });
- else
- throw new Error("Option().set takes 0 or 1 arguments");
-};
-
-exports.Option.prototype.push = function () {
- var option = this;
- return this.def([]).action(function (options, name, value) {
- options[option._name].push(option._validate.call(
- this,
- value
- ));
- });
-};
-
-exports.Option.prototype.inc = function () {
- return this.def(0).action(function (options, name) {
- options[name]++;
- });
-};
-
-exports.Option.prototype.dec = function () {
- return this.def(0).action(function (options, name) {
- options[name]--;
- });
-};
-
-exports.Option.prototype.choices = function (choices) {
- this.set();
- this._choices = choices;
- var self = this;
- if (util.isArrayLike(choices)) {
- return this.validate(function (value) {
- if (choices.indexOf(value) < 0)
- throw new Error(
- "choice for " + util.upper(self.getName()) +
- " is invalid: " + util.enquote(value) + "\n" +
- "Use one of: " + choices.map(function (choice) {
- return util.enquote(choice);
- }).join(', ')
- );
- return value;
- })
- } else {
- return this.validate(function (value) {
- if (!util.has(choices, value))
- throw new Error(
- "choice for " + util.upper(self.getName()) +
- " is invalid: " + util.enquote(value) + "\n" +
- "Use one of: " + util.keys(choices).map(function (choice) {
- return util.enquote(choice);
- }).join(', ')
- );
- return choices[value];
- });
- }
-};
-
-exports.Option.prototype.def = function (value) {
- if (this._def === undefined)
- this._def = value;
- return this;
-};
-
-exports.Option.prototype.validate = function (validate) {
- this._validate = validate;
- return this;
-};
-
-exports.Option.prototype.input = function () {
- this.set().validate(function (value) {
- if (value == "-")
- return system.stdin;
- else
- return system.fs.open(value, 'r');
- });
-};
-
-exports.Option.prototype.output = function () {
- this.set().validate(function (value) {
- if (value == "-")
- return system.stdout;
- else
- return system.fs.open(value, 'w');
- });
-};
-
-exports.Option.prototype.number = function () {
- return this.set().validate(function (value) {
- var result = +value;
- if (result == NaN)
- throw new Error("not a number");
- return result;
- });
-};
-
-exports.Option.prototype.oct = function () {
- return this.set().validate(function (value) {
- var result = parseInt(value, 8);
- if (result == 0 && +value !== 0)
- throw new Error("not an octal value");
- return result;
- });
-};
-
-exports.Option.prototype.hex = function () {
- return this.set().validate(function (value) {
- var result = parseInt(value, 16);
- if (result == 0 && +value !== 0)
- throw new Error("not an hex value");
- return result;
- });
-};
-
-exports.Option.prototype.integer = function () {
- return this.set().validate(function (value) {
- var result = value >>> 0;
- if (result !== value)
- throw new Error("not an integer");
- return result;
- });
-};
-
-exports.Option.prototype.natural = function () {
- return this.set().validate(function (value) {
- var result = value >>> 0;
- if (result !== +value || result < 0)
- throw new Error("not a natural number");
- return result;
- });
-};
-
-exports.Option.prototype.whole = function () {
- return this.set().validate(function (value) {
- var result = value >>> 0;
- if (result !== +value || result < 1)
- throw new Error("not a whole number");
- return result;
- });
-};
-
-exports.Option.prototype.bool = function (def) {
- if (def === undefined)
- def = true;
- return this.def(!def).set(!!def);
-};
-
-exports.Option.prototype.inverse = function () {
- var args = arguments;
- if (!args.length) {
- args = [];
- this._short.forEach(function (_) {
- args.push('-' + _.toUpperCase());
- });
- this._long.forEach(function (__) {
- args.push('--no-' + __);
- });
- if (this._name)
- args.push(this._name);
- }
- var parser = this._parser;
- var inverse = this._inverse = parser.option.apply(
- parser,
- args
- ).set(!this._def).help('^ inverse');
- return this;
-};
-
-exports.Option.prototype.help = function (text) {
- this._help = text;
- return this;
-};
-
-exports.Option.prototype.halt = function () {
- this._halt = true;
- return this;
-};
-
-exports.Option.prototype.hidden = function () {
- this._hidden = true;
- return this;
-};
-
-exports.Option.prototype.end = function () {
- return this._parser;
-};
-
-exports.Option.prototype.option = function () {
- return this.end().option.apply(this, arguments);
-};
-
-exports.Parser.prototype.end = function () {
- return this._parser;
-};
-
-exports.Parser.prototype.Option = exports.Option;
-exports.Parser.prototype.Parser = exports.Parser;
-
diff --git a/utils/lib/base16.js b/utils/lib/base16.js
deleted file mode 100755
index b8e54c7..0000000
--- a/utils/lib/base16.js
+++ /dev/null
@@ -1,16 +0,0 @@
-
-var util = require('util');
-var binary = require('binary');
-var struct = require('struct');
-
-exports.encode = function (n) {
- var length = n.length;
- var result = [];
- var alphabet = struct.alphabet16Lower;
- for (var i = 0; i < length; i++) {
- n[i] = n[i] & 0xFF;
- result.push(alphabet[(n.charCodeAt(i) >>> 4) & 0xF], alphabet[n.charCodeAt(i) & 0xF]);
- }
- return result.join('');
-};
-
diff --git a/utils/lib/base64.js b/utils/lib/base64.js
deleted file mode 100755
index 0579e80..0000000
--- a/utils/lib/base64.js
+++ /dev/null
@@ -1,120 +0,0 @@
-/* Copyright (C) 1999 Masanao Izumo <iz@onicos.co.jp>
- * Version: 1.0
- * LastModified: Dec 25 1999
- * This library is free. You can redistribute it and/or modify it.
- */
-
-/* modified by Kris Kowal to add support for Binary for Narwhal */
-
-var encodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-var decodeChars = [
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
- -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
- -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1
-];
-
-var binary = require('binary');
-
-exports.encode = function (str) {
- var out, i, length;
- var c1, c2, c3;
-
- length = len(str);
- i = 0;
- out = [];
- while(i < length) {
- c1 = str.charCodeAt(i++) & 0xff;
- if(i == length)
- {
- out.push(encodeChars.charCodeAt(c1 >> 2));
- out.push(encodeChars.charCodeAt((c1 & 0x3) << 4));
- out.push("=".charCodeAt(0));
- out.push("=".charCodeAt(0));
- break;
- }
- c2 = str.charCodeAt(i++);
- if(i == length)
- {
- out.push(encodeChars.charCodeAt(c1 >> 2));
- out.push(encodeChars.charCodeAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4)));
- out.push(encodeChars.charCodeAt((c2 & 0xF) << 2));
- out.push("=".charCodeAt(0));
- break;
- }
- c3 = str.charCodeAt(i++);
- out.push(encodeChars.charCodeAt(c1 >> 2));
- out.push(encodeChars.charCodeAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4)));
- out.push(encodeChars.charCodeAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >>6)));
- out.push(encodeChars.charCodeAt(c3 & 0x3F));
- }
- return binary.ByteString(out).toString('ascii');
-};
-
-exports.decode = function (str) {
- var c1, c2, c3, c4;
- var i, length, out;
-
- length = len(str);
- i = 0;
- out = [];
- while(i < length) {
- /* c1 */
- do {
- c1 = decodeChars[str.charCodeAt(i++) & 0xff];
- } while(i < length && c1 == -1);
- if(c1 == -1)
- break;
-
- /* c2 */
- do {
- c2 = decodeChars[str.charCodeAt(i++) & 0xff];
- } while(i < length && c2 == -1);
- if(c2 == -1)
- break;
-
- out.push(String.fromCharCode((c1 << 2) | ((c2 & 0x30) >> 4)));
-
- /* c3 */
- do {
- c3 = str.charCodeAt(i++) & 0xff;
- if(c3 == 61)
- return out.join('');
- c3 = decodeChars[c3];
- } while(i < length && c3 == -1);
- if(c3 == -1)
- break;
-
- out.push(String.fromCharCode(((c2 & 0xF) << 4) | ((c3 & 0x3C) >> 2)));
-
- /* c4 */
- do {
- c4 = str.charCodeAt(i++) & 0xff;
- if(c4 == 61)
- return out.join('');
- c4 = decodeChars[c4];
- } while(i < length && c4 == -1);
-
- if(c4 == -1)
- break;
-
- out.push(String.fromCharCode(((c3 & 0x03) << 6) | c4));
- }
-
- return out.join('');
-};
-
-var len = function (object) {
- if (object.length !== undefined) {
- return object.length;
- } else if (object.getLength !== undefined) {
- return object.getLength();
- } else {
- return undefined;
- }
-};
-
diff --git a/utils/lib/codec/base64.js b/utils/lib/codec/base64.js
deleted file mode 100755
index 6913d84..0000000
--- a/utils/lib/codec/base64.js
+++ /dev/null
@@ -1,7 +0,0 @@
-system.log.warn("codec/base64 is deprecated. use base64 directly.");
-var base64 = require("base64");
-for (var name in base64) {
- if (Object.prototype.hasOwnProperty.call(base64, name)) {
- exports[name] = base64[name];
- }
-}
diff --git a/utils/lib/crc32.js b/utils/lib/crc32.js
deleted file mode 100755
index 71a9443..0000000
--- a/utils/lib/crc32.js
+++ /dev/null
@@ -1,60 +0,0 @@
-
-var util = require('./util');
-
-/*** polynomials
-*/
-exports.polynomials = {
- 'ieee802_3': 0xEDB88320,
- 'castagnoli': 0x82F63B78,
- 'kooperman': 0xEB31D82E
-};
-
-/*** Table
-*/
-exports.Table = function (polynomial) {
- var term, table = [];
- for (var i = 0; i < 256; i++) {
- term = i;
- for (var j = 0; j < 8; j++) {
- if (term & 1)
- term = (term >>> 1) ^ polynomial;
- else
- term = term >>> 1;
- }
- table[i] = term;
- }
- return table;
-};
-
-/*** table
-*/
-exports.table = exports.Table(exports.polynomials.ieee802_3);
-
-/*** hash
- returns the crc32 hash for a string as an integer.
-*/
-exports.hash = function (bin, table) {
- if (util.no(table))
- table = exports.table;
- var crc = 0xFFFFFFFF;
- for (var i = 0; i < bin.length; i ++) {
- var x = bin.charCodeAt(i);
- if (x & ~0xFF)
- throw new Error(
- "crc32 can only encode strings of bytes. " +
- "Consider using utf8.js#encode."
- );
- crc = (crc >>> 8) ^ table[x ^ (crc & 0xFF)];
- }
- return ~crc;
-};
-
-/*
-
- References
- ==========
-
- http://www.webtoolkit.info/
- Javascript crc32
-
-*/
diff --git a/utils/lib/env.rhino.js b/utils/lib/env.rhino.js
deleted file mode 100755
index eb086c7..0000000
--- a/utils/lib/env.rhino.js
+++ /dev/null
@@ -1,9041 +0,0 @@
-/**
- * @author thatcher
- */
-var Envjs = function(){
- if(arguments.length === 2){
- for ( var i in arguments[1] ) {
- var g = arguments[1].__lookupGetter__(i),
- s = arguments[1].__lookupSetter__(i);
- if ( g || s ) {
- if ( g ) Envjs.__defineGetter__(i, g);
- if ( s ) Envjs.__defineSetter__(i, s);
- } else
- Envjs[i] = arguments[1][i];
- }
- }
- window.location = arguments[0];
-};
-
-/*
-* env.rhino.js
-*/
-(function($env){
-
- //You can emulate different user agents by overriding these after loading env
- $env.appCodeName = "Envjs";//eg "Mozilla"
- $env.appName = "Resig/20070309 BirdDog/0.0.0.1";//eg "Gecko/20070309 Firefox/2.0.0.3"
-
- //set this to true and see profile/profile.js to select which methods
- //to profile
- $env.profile = false;
-
- $env.log = function(msg, level){};
- $env.debug = function(){};
- $env.info = function(){};
- $env.warn = function(){};
- $env.error = function(){};
-
- //uncomment these if you want to get some internal log statementes
- /*$env.debug = function(msg){
- $env.log(msg,"DEBUG");
- };*/
- $env.info = function(msg){
- $env.log(msg,"INFO");
- };
- $env.warn = function(msg){
- $env.log(msg,"WARNIING");
- };
- $env.error = function(msg, e){
- $env.log(msg+ " Line: "+ $env.lineSource(e),'ERROR');
- $env.log(e||"",'ERROR');
- };
-
- $env.info("Initializing Core Platform Env");
-
- $env.lineSource = function(e){};
-
- $env.hashCode = function(obj){};
-
- //resolves location relative to base or window location
- $env.location = function(path, base){};
-
- //For Java the window.timer is created using the java.lang.Thread in combination
- //with the java.lang.Runnable
- $env.timer = function(fn, time){};
-
- $env.javaEnabled = false;
-
- //Used in the XMLHttpRquest implementation to run a
- // request in a seperate thread
- $env.runAsync = function(fn){};
-
- //Used to write to a local file
- $env.writeToFile = function(text, url){};
-
- //Used to write to a local file
- $env.writeToTempFile = function(text, suffix){};
-
- //Used to delete a local file
- $env.deleteFile = function(url){};
-
- $env.connection = function(xhr, responseHandler, data){};
-
- $env.parseHTML = function(htmlstring){};
- $env.parseXML = function(xmlstring){};
- $env.xpath = function(expression, doc){};
-
- $env.tmpdir = '';
- $env.os_name = '';
- $env.os_arch = '';
- $env.os_version = '';
- $env.lang = '';
- $env.platform = "Rhino ";//how do we get the version
-
- $env.safeScript = function(){
- //do nothing
- };
-
- $env.scriptTypes = {
- "text/javascript" :false,
- "text/envjs" :true
- };
-
- $env.loadLocalScript = function(script, parser){
- $env.debug("loading script ");
- var types, type, src, i, base,
- docWrites = [],
- write = document.write,
- writeln = document.writeln;
- //temporarily replace document write becuase the function
- //has a different meaning during parsing
- document.write = function(text){
- docWrites.push(text);
- };
- try{
- if(script.type){
- types = script.type?script.type.split(";"):[];
- for(i=0;i<types.length;i++){
- if($env.scriptTypes[types[i]]){
- if(script.src){
- $env.info("loading allowed external script :" + script.src);
- if($env.beforeload&&$env.beforeload[script.src]){
- //lets you register a function to execute
- //before the script is loaded
- $env.beforeload[script.src]();
- }
- base = "" + window.location;
- load($env.location(script.src.match(/([^\?#]*)/)[1], base ));
- if($env.afterload&&$env.afterload[script.src]){
- //lets you register a function to execute
- //after the script is loaded
- $env.afterload[script.src]();
- }
- }else{
- $env.loadInlineScript(script);
- }
- }else{
- if(!script.src && script.type == "text/javascript"){
- $env.loadInlineScript(script);
- }
- }
- }
- }else{
- //anonymous type and anonymous src means inline
- if(!script.src){
- $env.loadInlineScript(script);
- }
- }
- }catch(e){
- $env.error("Error loading script.", e);
- }finally{
- if(parser){
- parser.appendFragment(docWrites.join(''));
- }
- //return document.write to it's non-script loading form
- document.write = write;
- document.writeln = writeln;
- }
- };
-
- $env.loadInlineScript = function(script){};
-
-})(Envjs);/*
-* env.rhino.js
-*/
-(function($env){
-
- $env.log = function(msg, level){
- print(' '+ (level?level:'LOG') + ':\t['+ new Date()+"] {ENVJS} "+msg);
- };
-
- $env.lineSource = function(e){
- return e&&e.rhinoException?e.rhinoException.lineSource():"(line ?)";
- };
-
- $env.hashCode = function(obj){
- return obj?obj.hashCode().toString()+'':null;
- };
-
- //For Java the window.location object is a java.net.URL
- $env.location = function(path, base){
- var protocol = new RegExp('(^file\:|^http\:|^https\:)');
- var m = protocol.exec(path);
- if(m&&m.length>1){
- return new java.net.URL(path).toString()+'';
- }else if(base){
- return new java.net.URL(new java.net.URL(base), path).toString()+'';
- }else{
- //return an absolute url from a url relative to the window location
- if(window.location.href.length > 0){
- base = window.location.href.substring(0, window.location.href.lastIndexOf('/'));
- return base + '/' + path;
- }else{
- return new java.io.File( path ).toURL().toString()+'';
- }
- }
- };
-
- //For Java the window.timer is created using the java.lang.Thread in combination
- //with the java.lang.Runnable
- $env.timer = function(fn, time){
- var running = true;
- var thread = new java.lang.Thread(new java.lang.Runnable({
- run: function(){
- while (running){
- java.lang.Thread.currentThread().sleep(time);
- //$env.debug("calling in timer "+time);
- fn();
- }
- }
- }));
- this.start = function(){
- thread.start();
- };
- this.stop = function(){
- running = false;
- }
- };
-
- //Since we're running in rhino I guess we can safely assume
- //java is 'enabled'. I'm sure this requires more thought
- //than I've given it here
- $env.javaEnabled = true;
-
-
- //Used in the XMLHttpRquest implementation to run a
- // request in a seperate thread
- $env.runAsync = function(fn){
- $env.debug("running async");
- (new java.lang.Thread(new java.lang.Runnable({
- run: fn
- }))).start();
- };
-
- //Used to write to a local file
- $env.writeToFile = function(text, url){
- $env.debug("writing text to url : " + url);
- var out = new java.io.FileWriter(
- new java.io.File(
- new java.net.URI(url.toString())));
- out.write( text, 0, text.length );
- out.flush();
- out.close();
- };
-
- //Used to write to a local file
- $env.writeToTempFile = function(text, suffix){
- $env.debug("writing text to temp url : " + suffix);
- // Create temp file.
- var temp = java.io.File.createTempFile("envjs-tmp", suffix);
-
- // Delete temp file when program exits.
- temp.deleteOnExit();
-
- // Write to temp file
- var out = new java.io.FileWriter(temp);
- out.write(text, 0, text.length);
- out.close();
- return temp.getAbsolutePath().toString()+'';
- };
-
- //Used to delete a local file
- $env.deleteFile = function(url){
- var file = new java.io.File( new java.net.URI( url ) );
- file["delete"]();
- };
-
- $env.connection = function(xhr, responseHandler, data){
- var url = java.net.URL(xhr.url);//, $w.location);
- var connection;
- if ( /^file\:/.test(url) ) {
- if ( xhr.method == "PUT" ) {
- var text = data || "" ;
- $env.writeToFile(text, url);
- } else if ( xhr.method == "DELETE" ) {
- $env.deleteFile(url);
- } else {
- connection = url.openConnection();
- connection.connect();
- }
- } else {
- connection = url.openConnection();
- connection.setRequestMethod( xhr.method );
-
- // Add headers to Java connection
- for (var header in xhr.headers){
- connection.addRequestProperty(header+'', xhr.headers[header]+'');
- }
-
- //write data to output stream if required
- if(data&&data.length&&data.length>0){
- if ( xhr.method == "PUT" ) {
- connection.setDoOutput(true);
- var outstream = connection.getOutputStream(),
- outbuffer = new java.lang.String(data).getBytes('UTF-8');
-
- outstream.write(outbuffer, 0, outbuffer.length);
- outstream.close();
- }
- }else{
- connection.connect();
- }
-
-
- var respheadlength = connection.getHeaderFields().size();
- // Stick the response headers into responseHeaders
- for (var i = 0; i < respheadlength; i++) {
- var headerName = connection.getHeaderFieldKey(i);
- var headerValue = connection.getHeaderField(i);
- if (headerName)
- xhr.responseHeaders[headerName+''] = headerValue+'';
- }
- }
- if(connection){
- xhr.readyState = 4;
- xhr.status = parseInt(connection.responseCode,10) || undefined;
- xhr.statusText = connection.responseMessage || "";
-
- var contentEncoding = connection.getContentEncoding() || "utf-8",
- stream = (contentEncoding.equalsIgnoreCase("gzip") || contentEncoding.equalsIgnoreCase("decompress") )?
- new java.util.zip.GZIPInputStream(connection.getInputStream()) :
- connection.getInputStream(),
- baos = new java.io.ByteArrayOutputStream(),
- buffer = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 1024),
- length,
- responseXML = null;
-
- while ((length = stream.read(buffer)) != -1) {
- baos.write(buffer, 0, length);
- }
-
- baos.close();
- stream.close();
-
- xhr.responseText = java.nio.charset.Charset.forName("UTF-8").
- decode(java.nio.ByteBuffer.wrap(baos.toByteArray())).toString()+"";
-
- }
- if(responseHandler){
- responseHandler();
- }
- };
-
- var htmlDocBuilder = Packages.javax.xml.parsers.DocumentBuilderFactory.newInstance();
- htmlDocBuilder.setNamespaceAware(false);
- htmlDocBuilder.setValidating(false);
-
- $env.parseHTML = function(htmlstring){
- return htmlDocBuilder.newDocumentBuilder().parse(
- new java.io.ByteArrayInputStream(
- (new java.lang.String(htmlstring)).getBytes("UTF8")))+"";
- };
-
- var xmlDocBuilder = Packages.javax.xml.parsers.DocumentBuilderFactory.newInstance();
- xmlDocBuilder.setNamespaceAware(true);
- xmlDocBuilder.setValidating(true);
-
- $env.parseXML = function(xmlstring){
- return xmlDocBuilder.newDocumentBuilder().parse(
- new java.io.ByteArrayInputStream(
- (new java.lang.String(xmlstring)).getBytes("UTF8")))+"";
- };
-
-
- $env.xpath = function(expression, doc){
- return Packages.javax.xml.xpath.
- XPathFactory.newInstance().newXPath().
- evaluate(expression, doc, javax.xml.xpath.XPathConstants.NODESET);
- };
-
- $env.tmpdir = java.lang.System.getProperty("java.io.tmpdir");
- $env.os_name = java.lang.System.getProperty("os.name");
- $env.os_arch = java.lang.System.getProperty("os.arch");
- $env.os_version = java.lang.System.getProperty("os.version");
- $env.lang = java.lang.System.getProperty("user.lang");
- $env.platform = "Rhino ";//how do we get the version
-
- $env.safeScript = function(){
- //do nothing
- };
-
- $env.scriptTypes = {
- "text/javascript" :false,
- "text/envjs" :true
- };
-
-
- $env.loadInlineScript = function(script){
- $env.debug("loading inline script :" + script.text);
- var tmpFile = $env.writeToTempFile(script.text, 'js') ;
- $env.debug("loading " + tmpFile);
- load(tmpFile);
- };
-
-})(Envjs);/*
- * Pure JavaScript Browser Environment
- * By John Resig <http://ejohn.org/>
- * Copyright 2008 John Resig, under the MIT License
- */
-
-
-// The Window Object
-var __this__ = this;
-this.__defineGetter__('window', function(){
- return __this__;
-});
-
-try{
-(function($w, $env){
- /*
-* window.js
-* - this file will be wrapped in a closure providing the window object as $w
-*/
-// a logger or empty function available to all modules.
-var $log = $env.log,
- $debug = $env.debug,
- $info = $env.info,
- $warn = $env.warn,
- $error = $env.error;
-
-//The version of this application
-var $version = "0.1";
-//This should be hooked to git or svn or whatever
-var $revision = "0.0.0.0";
-
-//These descriptions of window properties are taken loosely David Flanagan's
-//'JavaScript - The Definitive Guide' (O'Reilly)
-
-/**> $cookies - see cookie.js <*/
-// read only boolean specifies whether the window has been closed
-var $closed = false;
-
-// a read/write string that specifies the default message that appears in the status line
-var $defaultStatus = "Done";
-
-// a read-only reference to the Document object belonging to this window
-/**> $document - See document.js <*/
-
-//IE only, refers to the most recent event object - this maybe be removed after review
-var $event = null;
-
-//A read-only array of window objects
-var $frames = [];
-
-// a read-only reference to the History object
-/**> $history - see location.js <**/
-
-// read-only properties that specify the height and width, in pixels
-var $innerHeight = 600, $innerWidth = 800;
-
-// a read-only reference to the Location object. the location object does expose read/write properties
-/**> $location - see location.js <**/
-
-// a read only property specifying the name of the window. Can be set when using open()
-// and may be used when specifying the target attribute of links
-var $name = 'Resig Env Browser';
-
-// a read-only reference to the Navigator object
-/**> $navigator - see navigator.js <**/
-
-// a read/write reference to the Window object that contained the script that called open() to
-//open this browser window. This property is valid only for top-level window objects.
-var $opener;
-
-// Read-only properties that specify the total height and width, in pixels, of the browser window.
-// These dimensions include the height and width of the menu bar, toolbars, scrollbars, window
-// borders and so on. These properties are not supported by IE and IE offers no alternative
-// properties;
-var $outerHeight = $innerHeight, $outerWidth = $innerWidth;
-
-// Read-only properties that specify the number of pixels that the current document has been scrolled
-//to the right and down. These are not supported by IE.
-var $pageXOffset = 0, $pageYOffset = 0;
-
-//A read-only reference to the Window object that contains this window or frame. If the window is
-// a top-level window, parent refers to the window itself. If this window is a frame, this property
-// refers to the window or frame that conatins it.
-var $parent;
-
-// a read-only refernce to the Screen object that specifies information about the screen:
-// the number of available pixels and the number of available colors.
-/**> $screen - see screen.js <**/
-
-// read only properties that specify the coordinates of the upper-left corner of the screen.
-var $screenX = 0, $screenY = 0;
-var $screenLeft = $screenX, $screenTop = $screenY;
-
-// a read-only refernce to this window itself.
-var $self;
-
-// a read/write string that specifies the current contents of the status line.
-var $status = '';
-
-// a read-only reference to the top-level window that contains this window. If this
-// window is a top-level window it is simply a refernce to itself. If this window
-// is a frame, the top property refers to the top-level window that contains the frame.
-var $top;
-
-// the window property is identical to the self property.
-var $window = $w;
-
-$debug("Initializing Window.");
-__extend__($w,{
- get closed(){return $closed;},
- get defaultStatus(){return $defaultStatus;},
- set defaultStatus(_defaultStatus){$defaultStatus = _defaultStatus;},
- //get document(){return $document;}, - see document.js
- get event(){return $event;},
- get frames(){return $frames;},
- //get history(){return $history;}, - see location.js
- get innerHeight(){return $innerHeight;},
- get innerWidth(){return $innerWidth;},
- get clientHeight(){return $innerHeight;},
- get clientWidth(){return $innerWidth;},
- //get location(){return $location;}, see location.js
- get name(){return $name;},
- //get navigator(){return $navigator;}, see navigator.js
- get opener(){return $opener;},
- get outerHeight(){return $outerHeight;},
- get outerWidth(){return $outerWidth;},
- get pageXOffest(){return $pageXOffset;},
- get pageYOffset(){return $pageYOffset;},
- get parent(){return $parent;},
- //get screen(){return $screen;}, see screen.js
- get screenLeft(){return $screenLeft;},
- get screenTop(){return $screenTop;},
- get screenX(){return $screenX;},
- get screenY(){return $screenY;},
- get self(){return $self;},
- get status(){return $status;},
- set status(_status){$status = _status;},
- get top(){return $top || $window;},
- get window(){return $window;}
-});
-
-$w.open = function(url, name, features, replace){
- //TODO
-};
-
-$w.close = function(){
- //TODO
-};
-
-/* Time related functions - see timer.js
-* - clearTimeout
-* - clearInterval
-* - setTimeout
-* - setInterval
-*/
-
-/*
-* Events related functions - see event.js
-* - addEventListener
-* - attachEvent
-* - detachEvent
-* - removeEventListener
-*
-* These functions are identical to the Element equivalents.
-*/
-
-/*
-* UIEvents related functions - see uievent.js
-* - blur
-* - focus
-*
-* These functions are identical to the Element equivalents.
-*/
-
-/* Dialog related functions - see dialog.js
-* - alert
-* - confirm
-* - prompt
-*/
-
-/* Screen related functions - see screen.js
-* - moveBy
-* - moveTo
-* - print
-* - resizeBy
-* - resizeTo
-* - scrollBy
-* - scrollTo
-*/
-
-/* CSS related functions - see css.js
-* - getComputedStyle
-*/
-
-/*
-* Shared utility methods
-*/
-// Helper method for extending one object with another.
-function __extend__(a,b) {
- for ( var i in b ) {
- var g = b.__lookupGetter__(i), s = b.__lookupSetter__(i);
- if ( g || s ) {
- if ( g ) a.__defineGetter__(i, g);
- if ( s ) a.__defineSetter__(i, s);
- } else
- a[i] = b[i];
- } return a;
-};
-
-
-// from ariel flesler http://flesler.blogspot.com/2008/11/fast-trim-function-for-javascript.html
-// this might be a good utility function to provide in the env.core
-// as in might be useful to the parser and other areas as well
-function trim( str ){
- return (str || "").replace( /^\s+|\s+$/g, "" );
-
-};
-/*function trim( str ){
- var start = -1,
- end = str.length;
- /*jsl:ignore*
- while( str.charCodeAt(--end) < 33 );
- while( str.charCodeAt(++start) < 33 );
- /*jsl:end*
- return str.slice( start, end + 1 );
-};*/
-
-//from jQuery
-function __setArray__( target, array ) {
- // Resetting the length to 0, then using the native Array push
- // is a super-fast way to populate an object with array-like properties
- target.length = 0;
- Array.prototype.push.apply( target, array );
-};
-
-
-$debug("Defining NodeList");
-/*
-* NodeList - DOM Level 2
-*/
-/**
- * @class DOMNodeList - provides the abstraction of an ordered collection of nodes
- *
- * @author Jon van Noort (jon@webarcana.com.au)
- *
- * @param ownerDocument : DOMDocument - the ownerDocument
- * @param parentNode : DOMNode - the node that the DOMNodeList is attached to (or null)
- */
-var DOMNodeList = function(ownerDocument, parentNode) {
- this.length = 0;
- this.parentNode = parentNode;
- this.ownerDocument = ownerDocument;
-
- this._readonly = false;
-
- __setArray__(this, []);
-};
-__extend__(DOMNodeList.prototype, {
- item : function(index) {
- var ret = null;
- //$log("NodeList item("+index+") = " + this[index]);
- if ((index >= 0) && (index < this.length)) { // bounds check
- ret = this[index]; // return selected Node
- }
-
- return ret; // if the index is out of bounds, default value null is returned
- },
- get xml() {
- var ret = "";
-
- // create string containing the concatenation of the string values of each child
- for (var i=0; i < this.length; i++) {
- if(this[i]){
- if(this[i].nodeType == DOMNode.TEXT_NODE && i>0 && this[i-1].nodeType == DOMNode.TEXT_NODE){
- //add a single space between adjacent text nodes
- ret += " "+this[i].xml;
- }else{
- ret += this[i].xml;
- }
- }
- }
-
- return ret;
- },
- toArray: function () {
- var children = [];
- for ( var i=0; i < this.length; i++) {
- children.push (this[i]);
- }
- return children;
- },
- toString: function(){
- return "[ "+(this.length > 0?Array.prototype.join.apply(this, [", "]):"Empty NodeList")+" ]";
- }
-});
-
-
-/**
- * @method DOMNodeList._findItemIndex - find the item index of the node with the specified internal id
- * @author Jon van Noort (jon@webarcana.com.au)
- * @param id : int - unique internal id
- * @return : int
- */
-var __findItemIndex__ = function (nodelist, id) {
- var ret = -1;
-
- // test that id is valid
- if (id > -1) {
- for (var i=0; i<nodelist.length; i++) {
- // compare id to each node's _id
- if (nodelist[i]._id == id) { // found it!
- ret = i;
- break;
- }
- }
- }
-
- return ret; // if node is not found, default value -1 is returned
-};
-
-/**
- * @method DOMNodeList._insertBefore - insert the specified Node into the NodeList before the specified index
- * Used by DOMNode.insertBefore(). Note: DOMNode.insertBefore() is responsible for Node Pointer surgery
- * DOMNodeList._insertBefore() simply modifies the internal data structure (Array).
- *
- * @author Jon van Noort (jon@webarcana.com.au)
- * @param newChild : DOMNode - the Node to be inserted
- * @param refChildIndex : int - the array index to insert the Node before
- */
-var __insertBefore__ = function(nodelist, newChild, refChildIndex) {
- if ((refChildIndex >= 0) && (refChildIndex < nodelist.length)) { // bounds check
-
- if (newChild.nodeType == DOMNode.DOCUMENT_FRAGMENT_NODE) { // node is a DocumentFragment
- // append the children of DocumentFragment
- Array.prototype.splice.apply(nodelist,[refChildIndex, 0].concat(newChild.childNodes.toArray()));
- }
- else {
- // append the newChild
- Array.prototype.splice.apply(nodelist,[refChildIndex, 0, newChild]);
- }
- }
-};
-
-/**
- * @method DOMNodeList._replaceChild - replace the specified Node in the NodeList at the specified index
- * Used by DOMNode.replaceChild(). Note: DOMNode.replaceChild() is responsible for Node Pointer surgery
- * DOMNodeList._replaceChild() simply modifies the internal data structure (Array).
- *
- * @author Jon van Noort (jon@webarcana.com.au)
- * @param newChild : DOMNode - the Node to be inserted
- * @param refChildIndex : int - the array index to hold the Node
- */
-var __replaceChild__ = function(nodelist, newChild, refChildIndex) {
- var ret = null;
-
- if ((refChildIndex >= 0) && (refChildIndex < nodelist.length)) { // bounds check
- ret = nodelist[refChildIndex]; // preserve old child for return
-
- if (newChild.nodeType == DOMNode.DOCUMENT_FRAGMENT_NODE) { // node is a DocumentFragment
- // get array containing children prior to refChild
- Array.prototype.splice.apply(nodelist,[refChildIndex, 1].concat(newChild.childNodes.toArray()));
- }
- else {
- // simply replace node in array (links between Nodes are made at higher level)
- nodelist[refChildIndex] = newChild;
- }
- }
-
- return ret; // return replaced node
-};
-
-/**
- * @method DOMNodeList._removeChild - remove the specified Node in the NodeList at the specified index
- * Used by DOMNode.removeChild(). Note: DOMNode.removeChild() is responsible for Node Pointer surgery
- * DOMNodeList._replaceChild() simply modifies the internal data structure (Array).
- *
- * @author Jon van Noort (jon@webarcana.com.au)
- * @param refChildIndex : int - the array index holding the Node to be removed
- */
-var __removeChild__ = function(nodelist, refChildIndex) {
- var ret = null;
-
- if (refChildIndex > -1) { // found it!
- ret = nodelist[refChildIndex]; // return removed node
-
- // rebuild array without removed child
- Array.prototype.splice.apply(nodelist,[refChildIndex, 1]);
- }
-
- return ret; // return removed node
-};
-
-/**
- * @method DOMNodeList._appendChild - append the specified Node to the NodeList
- * Used by DOMNode.appendChild(). Note: DOMNode.appendChild() is responsible for Node Pointer surgery
- * DOMNodeList._appendChild() simply modifies the internal data structure (Array).
- *
- * @author Jon van Noort (jon@webarcana.com.au)
- * @param newChild : DOMNode - the Node to be inserted
- */
-var __appendChild__ = function(nodelist, newChild) {
- if (newChild.nodeType == DOMNode.DOCUMENT_FRAGMENT_NODE) { // node is a DocumentFragment
- // append the children of DocumentFragment
- Array.prototype.push.apply(nodelist, newChild.childNodes.toArray() );
- } else {
- // simply add node to array (links between Nodes are made at higher level)
- Array.prototype.push.apply(nodelist, [newChild]);
- }
-
-};
-
-/**
- * @method DOMNodeList._cloneNodes - Returns a NodeList containing clones of the Nodes in this NodeList
- *
- * @author Jon van Noort (jon@webarcana.com.au)
- * @param deep : boolean - If true, recursively clone the subtree under each of the nodes;
- * if false, clone only the nodes themselves (and their attributes, if it is an Element).
- * @param parentNode : DOMNode - the new parent of the cloned NodeList
- * @return : DOMNodeList - NodeList containing clones of the Nodes in this NodeList
- */
-var __cloneNodes__ = function(nodelist, deep, parentNode) {
- var cloneNodeList = new DOMNodeList(nodelist.ownerDocument, parentNode);
-
- // create list containing clones of each child
- for (var i=0; i < nodelist.length; i++) {
- __appendChild__(cloneNodeList, nodelist[i].cloneNode(deep));
- }
-
- return cloneNodeList;
-};
-
-$w.NodeList = DOMNodeList;
-
-/**
- * @class DOMNamedNodeMap - used to represent collections of nodes that can be accessed by name
- * typically a set of Element attributes
- *
- * @extends DOMNodeList - note W3C spec says that this is not the case,
- * but we need an item() method identicle to DOMNodeList's, so why not?
- * @author Jon van Noort (jon@webarcana.com.au)
- * @param ownerDocument : DOMDocument - the ownerDocument
- * @param parentNode : DOMNode - the node that the DOMNamedNodeMap is attached to (or null)
- */
-var DOMNamedNodeMap = function(ownerDocument, parentNode) {
- //$log("\t\tcreating dom namednodemap");
- this.DOMNodeList = DOMNodeList;
- this.DOMNodeList(ownerDocument, parentNode);
- __setArray__(this, []);
-};
-DOMNamedNodeMap.prototype = new DOMNodeList;
-__extend__(DOMNamedNodeMap.prototype, {
- getNamedItem : function(name) {
- var ret = null;
-
- // test that Named Node exists
- var itemIndex = __findNamedItemIndex__(this, name);
-
- if (itemIndex > -1) { // found it!
- ret = this[itemIndex]; // return NamedNode
- }
-
- return ret; // if node is not found, default value null is returned
- },
- setNamedItem : function(arg) {
- // test for exceptions
- if (__ownerDocument__(this).implementation.errorChecking) {
- // throw Exception if arg was not created by this Document
- if (this.ownerDocument != arg.ownerDocument) {
- throw(new DOMException(DOMException.WRONG_DOCUMENT_ERR));
- }
-
- // throw Exception if DOMNamedNodeMap is readonly
- if (this._readonly || (this.parentNode && this.parentNode._readonly)) {
- throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
-
- // throw Exception if arg is already an attribute of another Element object
- if (arg.ownerElement && (arg.ownerElement != this.parentNode)) {
- throw(new DOMException(DOMException.INUSE_ATTRIBUTE_ERR));
- }
- }
-
- // get item index
- var itemIndex = __findNamedItemIndex__(this, arg.name);
- var ret = null;
-
- if (itemIndex > -1) { // found it!
- ret = this[itemIndex]; // use existing Attribute
-
- // throw Exception if DOMAttr is readonly
- if (__ownerDocument__(this).implementation.errorChecking && ret._readonly) {
- throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- } else {
- this[itemIndex] = arg; // over-write existing NamedNode
- this[arg.name] = arg;
- }
- } else {
- // add new NamedNode
- Array.prototype.push.apply(this, [arg]);
- this[arg.name] = arg;
- }
-
- arg.ownerElement = this.parentNode; // update ownerElement
-
- return ret; // return old node or null
- },
- removeNamedItem : function(name) {
- var ret = null;
- // test for exceptions
- // throw Exception if DOMNamedNodeMap is readonly
- if (__ownerDocument__(this).implementation.errorChecking &&
- (this._readonly || (this.parentNode && this.parentNode._readonly))) {
- throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
-
- // get item index
- var itemIndex = __findNamedItemIndex__(this, name);
-
- // throw Exception if there is no node named name in this map
- if (__ownerDocument__(this).implementation.errorChecking && (itemIndex < 0)) {
- throw(new DOMException(DOMException.NOT_FOUND_ERR));
- }
-
- // get Node
- var oldNode = this[itemIndex];
- //this[oldNode.name] = undefined;
-
- // throw Exception if Node is readonly
- if (__ownerDocument__(this).implementation.errorChecking && oldNode._readonly) {
- throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
-
- // return removed node
- return __removeChild__(this, itemIndex);
- },
- getNamedItemNS : function(namespaceURI, localName) {
- var ret = null;
-
- // test that Named Node exists
- var itemIndex = __findNamedItemNSIndex__(this, namespaceURI, localName);
-
- if (itemIndex > -1) { // found it!
- ret = this[itemIndex]; // return NamedNode
- }
-
- return ret; // if node is not found, default value null is returned
- },
- setNamedItemNS : function(arg) {
- // test for exceptions
- if (__ownerDocument__(this).implementation.errorChecking) {
- // throw Exception if DOMNamedNodeMap is readonly
- if (this._readonly || (this.parentNode && this.parentNode._readonly)) {
- throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
-
- // throw Exception if arg was not created by this Document
- if (__ownerDocument__(this) != __ownerDocument__(arg)) {
- throw(new DOMException(DOMException.WRONG_DOCUMENT_ERR));
- }
-
- // throw Exception if arg is already an attribute of another Element object
- if (arg.ownerElement && (arg.ownerElement != this.parentNode)) {
- throw(new DOMException(DOMException.INUSE_ATTRIBUTE_ERR));
- }
- }
-
- // get item index
- var itemIndex = __findNamedItemNSIndex__(this, arg.namespaceURI, arg.localName);
- var ret = null;
-
- if (itemIndex > -1) { // found it!
- ret = this[itemIndex]; // use existing Attribute
- // throw Exception if DOMAttr is readonly
- if (__ownerDocument__(this).implementation.errorChecking && ret._readonly) {
- throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- } else {
- this[itemIndex] = arg; // over-write existing NamedNode
- }
- }else {
- // add new NamedNode
- Array.prototype.push.apply(this, [arg]);
- }
- arg.ownerElement = this.parentNode;
-
-
- return ret; // return old node or null
- },
- removeNamedItemNS : function(namespaceURI, localName) {
- var ret = null;
-
- // test for exceptions
- // throw Exception if DOMNamedNodeMap is readonly
- if (__ownerDocument__(this).implementation.errorChecking && (this._readonly || (this.parentNode && this.parentNode._readonly))) {
- throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
-
- // get item index
- var itemIndex = __findNamedItemNSIndex__(this, namespaceURI, localName);
-
- // throw Exception if there is no matching node in this map
- if (__ownerDocument__(this).implementation.errorChecking && (itemIndex < 0)) {
- throw(new DOMException(DOMException.NOT_FOUND_ERR));
- }
-
- // get Node
- var oldNode = this[itemIndex];
-
- // throw Exception if Node is readonly
- if (__ownerDocument__(this).implementation.errorChecking && oldNode._readonly) {
- throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
-
- return __removeChild__(this, itemIndex); // return removed node
- },
- get xml() {
- var ret = "";
-
- // create string containing concatenation of all (but last) Attribute string values (separated by spaces)
- for (var i=0; i < this.length -1; i++) {
- ret += this[i].xml +" ";
- }
-
- // add last Attribute to string (without trailing space)
- if (this.length > 0) {
- ret += this[this.length -1].xml;
- }
-
- return ret;
- }
-
-});
-
-/**
- * @method DOMNamedNodeMap._findNamedItemIndex - find the item index of the node with the specified name
- *
- * @author Jon van Noort (jon@webarcana.com.au)
- * @param name : string - the name of the required node
- * @param isnsmap : if its a DOMNamespaceNodeMap
- * @return : int
- */
-var __findNamedItemIndex__ = function(namednodemap, name, isnsmap) {
- var ret = -1;
-
- // loop through all nodes
- for (var i=0; i<namednodemap.length; i++) {
- // compare name to each node's nodeName
- if(isnsmap){
- if (namednodemap[i].localName == localName) { // found it!
- ret = i;
- break;
- }
- }else{
- if (namednodemap[i].name == name) { // found it!
- ret = i;
- break;
- }
- }
- }
-
- return ret; // if node is not found, default value -1 is returned
-};
-
-/**
- * @method DOMNamedNodeMap._findNamedItemNSIndex - find the item index of the node with the specified namespaceURI and localName
- *
- * @author Jon van Noort (jon@webarcana.com.au)
- * @param namespaceURI : string - the namespace URI of the required node
- * @param localName : string - the local name of the required node
- * @return : int
- */
-var __findNamedItemNSIndex__ = function(namednodemap, namespaceURI, localName) {
- var ret = -1;
-
- // test that localName is not null
- if (localName) {
- // loop through all nodes
- for (var i=0; i<namednodemap.length; i++) {
- // compare name to each node's namespaceURI and localName
- if ((namednodemap[i].namespaceURI == namespaceURI) && (namednodemap[i].localName == localName)) {
- ret = i; // found it!
- break;
- }
- }
- }
-
- return ret; // if node is not found, default value -1 is returned
-};
-
-/**
- * @method DOMNamedNodeMap._hasAttribute - Returns true if specified node exists
- *
- * @author Jon van Noort (jon@webarcana.com.au)
- * @param name : string - the name of the required node
- * @return : boolean
- */
-var __hasAttribute__ = function(namednodemap, name) {
- var ret = false;
-
- // test that Named Node exists
- var itemIndex = __findNamedItemIndex__(namednodemap, name);
-
- if (itemIndex > -1) { // found it!
- ret = true; // return true
- }
-
- return ret; // if node is not found, default value false is returned
-}
-
-/**
- * @method DOMNamedNodeMap._hasAttributeNS - Returns true if specified node exists
- *
- * @author Jon van Noort (jon@webarcana.com.au)
- * @param namespaceURI : string - the namespace URI of the required node
- * @param localName : string - the local name of the required node
- * @return : boolean
- */
-var __hasAttributeNS__ = function(namednodemap, namespaceURI, localName) {
- var ret = false;
-
- // test that Named Node exists
- var itemIndex = __findNamedItemNSIndex__(namednodemap, namespaceURI, localName);
-
- if (itemIndex > -1) { // found it!
- ret = true; // return true
- }
-
- return ret; // if node is not found, default value false is returned
-}
-
-/**
- * @method DOMNamedNodeMap._cloneNodes - Returns a NamedNodeMap containing clones of the Nodes in this NamedNodeMap
- *
- * @author Jon van Noort (jon@webarcana.com.au)
- * @param parentNode : DOMNode - the new parent of the cloned NodeList
- * @param isnsmap : bool - is this a DOMNamespaceNodeMap
- * @return : DOMNamedNodeMap - NamedNodeMap containing clones of the Nodes in this DOMNamedNodeMap
- */
-var __cloneNamedNodes__ = function(namednodemap, parentNode, isnsmap) {
- var cloneNamedNodeMap = isnsmap?
- new DOMNamespaceNodeMap(namednodemap.ownerDocument, parentNode):
- new DOMNamedNodeMap(namednodemap.ownerDocument, parentNode);
-
- // create list containing clones of all children
- for (var i=0; i < namednodemap.length; i++) {
- $debug("cloning node in named node map :" + namednodemap[i]);
- __appendChild__(cloneNamedNodeMap, namednodemap[i].cloneNode(false));
- }
-
- return cloneNamedNodeMap;
-};
-
-
-/**
- * @class DOMNamespaceNodeMap - used to represent collections of namespace nodes that can be accessed by name
- * typically a set of Element attributes
- *
- * @extends DOMNamedNodeMap
- *
- * @author Jon van Noort (jon@webarcana.com.au)
- *
- * @param ownerDocument : DOMDocument - the ownerDocument
- * @param parentNode : DOMNode - the node that the DOMNamespaceNodeMap is attached to (or null)
- */
-var DOMNamespaceNodeMap = function(ownerDocument, parentNode) {
- //$log("\t\t\tcreating dom namespacednodemap");
- this.DOMNamedNodeMap = DOMNamedNodeMap;
- this.DOMNamedNodeMap(ownerDocument, parentNode);
- __setArray__(this, []);
-};
-DOMNamespaceNodeMap.prototype = new DOMNamedNodeMap;
-__extend__(DOMNamespaceNodeMap.prototype, {
- get xml() {
- var ret = "";
-
- // identify namespaces declared local to this Element (ie, not inherited)
- for (var ind = 0; ind < this.length; ind++) {
- // if namespace declaration does not exist in the containing node's, parentNode's namespaces
- var ns = null;
- try {
- var ns = this.parentNode.parentNode._namespaces.
- getNamedItem(this[ind].localName);
- }
- catch (e) {
- //breaking to prevent default namespace being inserted into return value
- break;
- }
- if (!(ns && (""+ ns.nodeValue == ""+ this[ind].nodeValue))) {
- // display the namespace declaration
- ret += this[ind].xml +" ";
- }
- }
-
- return ret;
- }
-});
-$debug("Defining Node");
-/*
-* Node - DOM Level 2
-*/
-/**
- * @class DOMNode - The Node interface is the primary datatype for the entire Document Object Model.
- * It represents a single node in the document tree.
- * @author Jon van Noort (jon@webarcana.com.au), David Joham (djoham@yahoo.com) and Scott Severtson
- * @param ownerDocument : DOMDocument - The Document object associated with this node.
- */
-var DOMNode = function(ownerDocument) {
- if (ownerDocument) {
- this._id = ownerDocument._genId(); // generate unique internal id
- }
-
- this.namespaceURI = ""; // The namespace URI of this node (Level 2)
- this.prefix = ""; // The namespace prefix of this node (Level 2)
- this.localName = ""; // The localName of this node (Level 2)
-
- this.nodeName = ""; // The name of this node
- this.nodeValue = null; // The value of this node
- this.className = ""; // The CSS class name of this node.
-
- // The parent of this node. All nodes, except Document, DocumentFragment, and Attr may have a parent.
- // However, if a node has just been created and not yet added to the tree, or if it has been removed from the tree, this is null
- this.parentNode = null;
-
- // A NodeList that contains all children of this node. If there are no children, this is a NodeList containing no nodes.
- // The content of the returned NodeList is "live" in the sense that, for instance, changes to the children of the node object
- // that it was created from are immediately reflected in the nodes returned by the NodeList accessors;
- // it is not a static snapshot of the content of the node. This is true for every NodeList, including the ones returned by the getElementsByTagName method.
- this.childNodes = new DOMNodeList(ownerDocument, this);
-
- this.firstChild = null; // The first child of this node. If there is no such node, this is null
- this.lastChild = null; // The last child of this node. If there is no such node, this is null.
- this.previousSibling = null; // The node immediately preceding this node. If there is no such node, this is null.
- this.nextSibling = null; // The node immediately following this node. If there is no such node, this is null.
-
- this.ownerDocument = ownerDocument; // The Document object associated with this node
- this.attributes = new DOMNamedNodeMap(this.ownerDocument, this);
- this._namespaces = new DOMNamespaceNodeMap(ownerDocument, this); // The namespaces in scope for this node
- this._readonly = false;
-};
-
-// nodeType constants
-DOMNode.ELEMENT_NODE = 1;
-DOMNode.ATTRIBUTE_NODE = 2;
-DOMNode.TEXT_NODE = 3;
-DOMNode.CDATA_SECTION_NODE = 4;
-DOMNode.ENTITY_REFERENCE_NODE = 5;
-DOMNode.ENTITY_NODE = 6;
-DOMNode.PROCESSING_INSTRUCTION_NODE = 7;
-DOMNode.COMMENT_NODE = 8;
-DOMNode.DOCUMENT_NODE = 9;
-DOMNode.DOCUMENT_TYPE_NODE = 10;
-DOMNode.DOCUMENT_FRAGMENT_NODE = 11;
-DOMNode.NOTATION_NODE = 12;
-DOMNode.NAMESPACE_NODE = 13;
-
-__extend__(DOMNode.prototype, {
- hasAttributes : function() {
- if (this.attributes.length == 0) {
- return false;
- }else{
- return true;
- }
- },
- insertBefore : function(newChild, refChild) {
- var prevNode;
-
- if(newChild==null || refChild==null){
- return newChild;
- }
-
- // test for exceptions
- if (__ownerDocument__(this).implementation.errorChecking) {
- // throw Exception if DOMNode is readonly
- if (this._readonly) {
- throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
-
- // throw Exception if newChild was not created by this Document
- if (__ownerDocument__(this) != __ownerDocument__(newChild)) {
- throw(new DOMException(DOMException.WRONG_DOCUMENT_ERR));
- }
-
- // throw Exception if the node is an ancestor
- if (__isAncestor__(this, newChild)) {
- throw(new DOMException(DOMException.HIERARCHY_REQUEST_ERR));
- }
- }
-
- if (refChild) { // if refChild is specified, insert before it
- // find index of refChild
- var itemIndex = __findItemIndex__(this.childNodes, refChild._id);
-
- // throw Exception if there is no child node with this id
- if (__ownerDocument__(this).implementation.errorChecking && (itemIndex < 0)) {
- throw(new DOMException(DOMException.NOT_FOUND_ERR));
- }
-
- // if the newChild is already in the tree,
- var newChildParent = newChild.parentNode;
- if (newChildParent) {
- // remove it
- newChildParent.removeChild(newChild);
- }
-
- // insert newChild into childNodes
- __insertBefore__(this.childNodes, newChild,
- __findItemIndex__(this.childNodes, refChild._id));
-
- // do node pointer surgery
- prevNode = refChild.previousSibling;
-
- // handle DocumentFragment
- if (newChild.nodeType == DOMNode.DOCUMENT_FRAGMENT_NODE) {
- if (newChild.childNodes.length > 0) {
- // set the parentNode of DocumentFragment's children
- for (var ind = 0; ind < newChild.childNodes.length; ind++) {
- newChild.childNodes[ind].parentNode = this;
- }
-
- // link refChild to last child of DocumentFragment
- refChild.previousSibling = newChild.childNodes[newChild.childNodes.length-1];
- }
- }else {
- newChild.parentNode = this; // set the parentNode of the newChild
- refChild.previousSibling = newChild; // link refChild to newChild
- }
- }else { // otherwise, append to end
- prevNode = this.lastChild;
- this.appendChild(newChild);
- }
-
- if (newChild.nodeType == DOMNode.DOCUMENT_FRAGMENT_NODE) {
- // do node pointer surgery for DocumentFragment
- if (newChild.childNodes.length > 0) {
- if (prevNode) {
- prevNode.nextSibling = newChild.childNodes[0];
- }else { // this is the first child in the list
- this.firstChild = newChild.childNodes[0];
- }
-
- newChild.childNodes[0].previousSibling = prevNode;
- newChild.childNodes[newChild.childNodes.length-1].nextSibling = refChild;
- }
- }else {
- // do node pointer surgery for newChild
- if (prevNode) {
- prevNode.nextSibling = newChild;
- }else { // this is the first child in the list
- this.firstChild = newChild;
- }
-
- newChild.previousSibling = prevNode;
- newChild.nextSibling = refChild;
- }
-
- return newChild;
- },
- replaceChild : function(newChild, oldChild) {
- var ret = null;
-
- if(newChild==null || oldChild==null){
- return oldChild;
- }
-
- // test for exceptions
- if (__ownerDocument__(this).implementation.errorChecking) {
- // throw Exception if DOMNode is readonly
- if (this._readonly) {
- throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
-
- // throw Exception if newChild was not created by this Document
- if (__ownerDocument__(this) != __ownerDocument__(newChild)) {
- throw(new DOMException(DOMException.WRONG_DOCUMENT_ERR));
- }
-
- // throw Exception if the node is an ancestor
- if (__isAncestor__(this, newChild)) {
- throw(new DOMException(DOMException.HIERARCHY_REQUEST_ERR));
- }
- }
-
- // get index of oldChild
- var index = __findItemIndex__(this.childNodes, oldChild._id);
-
- // throw Exception if there is no child node with this id
- if (__ownerDocument__(this).implementation.errorChecking && (index < 0)) {
- throw(new DOMException(DOMException.NOT_FOUND_ERR));
- }
-
- // if the newChild is already in the tree,
- var newChildParent = newChild.parentNode;
- if (newChildParent) {
- // remove it
- newChildParent.removeChild(newChild);
- }
-
- // add newChild to childNodes
- ret = __replaceChild__(this.childNodes,newChild, index);
-
-
- if (newChild.nodeType == DOMNode.DOCUMENT_FRAGMENT_NODE) {
- // do node pointer surgery for Document Fragment
- if (newChild.childNodes.length > 0) {
- for (var ind = 0; ind < newChild.childNodes.length; ind++) {
- newChild.childNodes[ind].parentNode = this;
- }
-
- if (oldChild.previousSibling) {
- oldChild.previousSibling.nextSibling = newChild.childNodes[0];
- } else {
- this.firstChild = newChild.childNodes[0];
- }
-
- if (oldChild.nextSibling) {
- oldChild.nextSibling.previousSibling = newChild;
- } else {
- this.lastChild = newChild.childNodes[newChild.childNodes.length-1];
- }
-
- newChild.childNodes[0].previousSibling = oldChild.previousSibling;
- newChild.childNodes[newChild.childNodes.length-1].nextSibling = oldChild.nextSibling;
- }
- } else {
- // do node pointer surgery for newChild
- newChild.parentNode = this;
-
- if (oldChild.previousSibling) {
- oldChild.previousSibling.nextSibling = newChild;
- }else{
- this.firstChild = newChild;
- }
- if (oldChild.nextSibling) {
- oldChild.nextSibling.previousSibling = newChild;
- }else{
- this.lastChild = newChild;
- }
- newChild.previousSibling = oldChild.previousSibling;
- newChild.nextSibling = oldChild.nextSibling;
- }
- return ret;
- },
- removeChild : function(oldChild) {
- if(!oldChild){
- return null;
- }
- // throw Exception if DOMNamedNodeMap is readonly
- if (__ownerDocument__(this).implementation.errorChecking && (this._readonly || oldChild._readonly)) {
- throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
-
- // get index of oldChild
- var itemIndex = __findItemIndex__(this.childNodes, oldChild._id);
-
- // throw Exception if there is no child node with this id
- if (__ownerDocument__(this).implementation.errorChecking && (itemIndex < 0)) {
- throw(new DOMException(DOMException.NOT_FOUND_ERR));
- }
-
- // remove oldChild from childNodes
- __removeChild__(this.childNodes, itemIndex);
-
- // do node pointer surgery
- oldChild.parentNode = null;
-
- if (oldChild.previousSibling) {
- oldChild.previousSibling.nextSibling = oldChild.nextSibling;
- }else {
- this.firstChild = oldChild.nextSibling;
- }
- if (oldChild.nextSibling) {
- oldChild.nextSibling.previousSibling = oldChild.previousSibling;
- }else {
- this.lastChild = oldChild.previousSibling;
- }
-
- oldChild.previousSibling = null;
- oldChild.nextSibling = null;
-
- return oldChild;
- },
- appendChild : function(newChild) {
- if(!newChild){
- return null;
- }
- // test for exceptions
- if (__ownerDocument__(this).implementation.errorChecking) {
- // throw Exception if Node is readonly
- if (this._readonly) {
- throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
-
- // throw Exception if arg was not created by this Document
- if (__ownerDocument__(this) != __ownerDocument__(this)) {
- throw(new DOMException(DOMException.WRONG_DOCUMENT_ERR));
- }
-
- // throw Exception if the node is an ancestor
- if (__isAncestor__(this, newChild)) {
- throw(new DOMException(DOMException.HIERARCHY_REQUEST_ERR));
- }
- }
-
- // if the newChild is already in the tree,
- var newChildParent = newChild.parentNode;
- if (newChildParent) {
- // remove it
- newChildParent.removeChild(newChild);
- }
-
- // add newChild to childNodes
- __appendChild__(this.childNodes, newChild);
-
- if (newChild.nodeType == DOMNode.DOCUMENT_FRAGMENT_NODE) {
- // do node pointer surgery for DocumentFragment
- if (newChild.childNodes.length > 0) {
- for (var ind = 0; ind < newChild.childNodes.length; ind++) {
- newChild.childNodes[ind].parentNode = this;
- }
-
- if (this.lastChild) {
- this.lastChild.nextSibling = newChild.childNodes[0];
- newChild.childNodes[0].previousSibling = this.lastChild;
- this.lastChild = newChild.childNodes[newChild.childNodes.length-1];
- }
- else {
- this.lastChild = newChild.childNodes[newChild.childNodes.length-1];
- this.firstChild = newChild.childNodes[0];
- }
- }
- }
- else {
- // do node pointer surgery for newChild
- newChild.parentNode = this;
- if (this.lastChild) {
- this.lastChild.nextSibling = newChild;
- newChild.previousSibling = this.lastChild;
- this.lastChild = newChild;
- }
- else {
- this.lastChild = newChild;
- this.firstChild = newChild;
- }
- }
-
- return newChild;
- },
- hasChildNodes : function() {
- return (this.childNodes.length > 0);
- },
- cloneNode: function(deep) {
- // use importNode to clone this Node
- //do not throw any exceptions
- try {
- return __ownerDocument__(this).importNode(this, deep);
- } catch (e) {
- //there shouldn't be any exceptions, but if there are, return null
- return null;
- }
- },
- normalize : function() {
- var inode;
- var nodesToRemove = new DOMNodeList();
-
- if (this.nodeType == DOMNode.ELEMENT_NODE || this.nodeType == DOMNode.DOCUMENT_NODE) {
- var adjacentTextNode = null;
-
- // loop through all childNodes
- for(var i = 0; i < this.childNodes.length; i++) {
- inode = this.childNodes.item(i);
-
- if (inode.nodeType == DOMNode.TEXT_NODE) { // this node is a text node
- if (inode.length < 1) { // this text node is empty
- __appendChild__(nodesToRemove, inode); // add this node to the list of nodes to be remove
- }else {
- if (adjacentTextNode) { // if previous node was also text
- adjacentTextNode.appendData(inode.data); // merge the data in adjacent text nodes
- __appendChild__(nodesToRemove, inode); // add this node to the list of nodes to be removed
- }else {
- adjacentTextNode = inode; // remember this node for next cycle
- }
- }
- } else {
- adjacentTextNode = null; // (soon to be) previous node is not a text node
- inode.normalize(); // normalise non Text childNodes
- }
- }
-
- // remove redundant Text Nodes
- for(var i = 0; i < nodesToRemove.length; i++) {
- inode = nodesToRemove.item(i);
- inode.parentNode.removeChild(inode);
- }
- }
- },
- isSupported : function(feature, version) {
- // use Implementation.hasFeature to determin if this feature is supported
- return __ownerDocument__(this).implementation.hasFeature(feature, version);
- },
- getElementsByTagName : function(tagname) {
- // delegate to _getElementsByTagNameRecursive
- // recurse childNodes
- var nodelist = new DOMNodeList(__ownerDocument__(this));
- for(var i = 0; i < this.childNodes.length; i++) {
- nodeList = __getElementsByTagNameRecursive__(this.childNodes.item(i), tagname, nodelist);
- }
- return nodelist;
- },
- getElementsByTagNameNS : function(namespaceURI, localName) {
- // delegate to _getElementsByTagNameNSRecursive
- return __getElementsByTagNameNSRecursive__(this, namespaceURI, localName,
- new DOMNodeList(__ownerDocument__(this)));
- },
- importNode : function(importedNode, deep) {
-
- var importNode;
- //$debug("importing node " + importedNode.nodeName + "(?deep = "+deep+")");
- //there is no need to perform namespace checks since everything has already gone through them
- //in order to have gotten into the DOM in the first place. The following line
- //turns namespace checking off in ._isValidNamespace
- __ownerDocument__(this)._performingImportNodeOperation = true;
-
- if (importedNode.nodeType == DOMNode.ELEMENT_NODE) {
- if (!__ownerDocument__(this).implementation.namespaceAware) {
- // create a local Element (with the name of the importedNode)
- importNode = __ownerDocument__(this).createElement(importedNode.tagName);
-
- // create attributes matching those of the importedNode
- for(var i = 0; i < importedNode.attributes.length; i++) {
- importNode.setAttribute(importedNode.attributes.item(i).name, importedNode.attributes.item(i).value);
- }
- }else {
- // create a local Element (with the name & namespaceURI of the importedNode)
- importNode = __ownerDocument__(this).createElementNS(importedNode.namespaceURI, importedNode.nodeName);
-
- // create attributes matching those of the importedNode
- for(var i = 0; i < importedNode.attributes.length; i++) {
- importNode.setAttributeNS(importedNode.attributes.item(i).namespaceURI,
- importedNode.attributes.item(i).name, importedNode.attributes.item(i).value);
- }
-
- // create namespace definitions matching those of the importedNode
- for(var i = 0; i < importedNode._namespaces.length; i++) {
- importNode._namespaces[i] = __ownerDocument__(this).createNamespace(importedNode._namespaces.item(i).localName);
- importNode._namespaces[i].value = importedNode._namespaces.item(i).value;
- }
- }
- } else if (importedNode.nodeType == DOMNode.ATTRIBUTE_NODE) {
- if (!__ownerDocument__(this).implementation.namespaceAware) {
- // create a local Attribute (with the name of the importedAttribute)
- importNode = __ownerDocument__(this).createAttribute(importedNode.name);
- } else {
- // create a local Attribute (with the name & namespaceURI of the importedAttribute)
- importNode = __ownerDocument__(this).createAttributeNS(importedNode.namespaceURI, importedNode.nodeName);
-
- // create namespace definitions matching those of the importedAttribute
- for(var i = 0; i < importedNode._namespaces.length; i++) {
- importNode._namespaces[i] = __ownerDocument__(this).createNamespace(importedNode._namespaces.item(i).localName);
- importNode._namespaces[i].value = importedNode._namespaces.item(i).value;
- }
- }
-
- // set the value of the local Attribute to match that of the importedAttribute
- importNode.value = importedNode.value;
-
- } else if (importedNode.nodeType == DOMNode.DOCUMENT_FRAGMENT) {
- // create a local DocumentFragment
- importNode = __ownerDocument__(this).createDocumentFragment();
- } else if (importedNode.nodeType == DOMNode.NAMESPACE_NODE) {
- // create a local NamespaceNode (with the same name & value as the importedNode)
- importNode = __ownerDocument__(this).createNamespace(importedNode.nodeName);
- importNode.value = importedNode.value;
- } else if (importedNode.nodeType == DOMNode.TEXT_NODE) {
- // create a local TextNode (with the same data as the importedNode)
- importNode = __ownerDocument__(this).createTextNode(importedNode.data);
- } else if (importedNode.nodeType == DOMNode.CDATA_SECTION_NODE) {
- // create a local CDATANode (with the same data as the importedNode)
- importNode = __ownerDocument__(this).createCDATASection(importedNode.data);
- } else if (importedNode.nodeType == DOMNode.PROCESSING_INSTRUCTION_NODE) {
- // create a local ProcessingInstruction (with the same target & data as the importedNode)
- importNode = __ownerDocument__(this).createProcessingInstruction(importedNode.target, importedNode.data);
- } else if (importedNode.nodeType == DOMNode.COMMENT_NODE) {
- // create a local Comment (with the same data as the importedNode)
- importNode = __ownerDocument__(this).createComment(importedNode.data);
- } else { // throw Exception if nodeType is not supported
- throw(new DOMException(DOMException.NOT_SUPPORTED_ERR));
- }
-
- if (deep) { // recurse childNodes
- for(var i = 0; i < importedNode.childNodes.length; i++) {
- importNode.appendChild(__ownerDocument__(this).importNode(importedNode.childNodes.item(i), true));
- }
- }
-
- //reset _performingImportNodeOperation
- __ownerDocument__(this)._performingImportNodeOperation = false;
- return importNode;
-
- },
- contains : function(node){
- while(node && node != this ){
- node = node.parentNode;
- }
- return !!node;
- },
- compareDocumentPosition : function(b){
- var a = this;
- var number = (a != b && a.contains(b) && 16) + (a != b && b.contains(a) && 8);
- //find position of both
- var all = document.getElementsByTagName("*");
- var my_location = 0, node_location = 0;
- for(var i=0; i < all.length; i++){
- if(all[i] == a) my_location = i;
- if(all[i] == b) node_location = i;
- if(my_location && node_location) break;
- }
- number += (my_location < node_location && 4)
- number += (my_location > node_location && 2)
- return number;
- }
-
-});
-
-/**
- * @method DOMNode._getElementsByTagNameRecursive - implements getElementsByTagName()
- * @param elem : DOMElement - The element which are checking and then recursing into
- * @param tagname : string - The name of the tag to match on. The special value "*" matches all tags
- * @param nodeList : DOMNodeList - The accumulating list of matching nodes
- *
- * @return : DOMNodeList
- */
-var __getElementsByTagNameRecursive__ = function (elem, tagname, nodeList) {
-
- if (elem.nodeType == DOMNode.ELEMENT_NODE || elem.nodeType == DOMNode.DOCUMENT_NODE) {
-
- if(elem.nodeType !== DOMNode.DOCUMENT_NODE &&
- ((elem.nodeName.toUpperCase() == tagname.toUpperCase()) ||
- (tagname == "*")) ){
- __appendChild__(nodeList, elem); // add matching node to nodeList
- }
-
- // recurse childNodes
- for(var i = 0; i < elem.childNodes.length; i++) {
- nodeList = __getElementsByTagNameRecursive__(elem.childNodes.item(i), tagname, nodeList);
- }
- }
-
- return nodeList;
-};
-
-/**
- * @method DOMNode._getElementsByTagNameNSRecursive - implements getElementsByTagName()
- *
- * @param elem : DOMElement - The element which are checking and then recursing into
- * @param namespaceURI : string - the namespace URI of the required node
- * @param localName : string - the local name of the required node
- * @param nodeList : DOMNodeList - The accumulating list of matching nodes
- *
- * @return : DOMNodeList
- */
-var __getElementsByTagNameNSRecursive__ = function(elem, namespaceURI, localName, nodeList) {
- if (elem.nodeType == DOMNode.ELEMENT_NODE || elem.nodeType == DOMNode.DOCUMENT_NODE) {
-
- if (((elem.namespaceURI == namespaceURI) || (namespaceURI == "*")) && ((elem.localName == localName) || (localName == "*"))) {
- __appendChild__(nodeList, elem); // add matching node to nodeList
- }
-
- // recurse childNodes
- for(var i = 0; i < elem.childNodes.length; i++) {
- nodeList = __getElementsByTagNameNSRecursive__(elem.childNodes.item(i), namespaceURI, localName, nodeList);
- }
- }
-
- return nodeList;
-};
-
-/**
- * @method DOMNode._isAncestor - returns true if node is ancestor of target
- * @param target : DOMNode - The node we are using as context
- * @param node : DOMNode - The candidate ancestor node
- * @return : boolean
- */
-var __isAncestor__ = function(target, node) {
- // if this node matches, return true,
- // otherwise recurse up (if there is a parentNode)
- return ((target == node) || ((target.parentNode) && (__isAncestor__(target.parentNode, node))));
-};
-
-var __ownerDocument__ = function(node){
- return (node.nodeType == DOMNode.DOCUMENT_NODE)?node:node.ownerDocument;
-};
-
-$w.Node = DOMNode;
-
-/**
- * @class DOMNamespace - The Namespace interface represents an namespace in an Element object
- *
- * @extends DOMNode
- * @author Jon van Noort (jon@webarcana.com.au)
- * @param ownerDocument : DOMDocument - The Document object associated with this node.
- */
-var DOMNamespace = function(ownerDocument) {
- this.DOMNode = DOMNode;
- this.DOMNode(ownerDocument);
-
- this.name = ""; // the name of this attribute
-
- // If this attribute was explicitly given a value in the original document, this is true; otherwise, it is false.
- // Note that the implementation is in charge of this attribute, not the user.
- // If the user changes the value of the attribute (even if it ends up having the same value as the default value)
- // then the specified flag is automatically flipped to true
- this.specified = false;
-};
-DOMNamespace.prototype = new DOMNode;
-__extend__(DOMNamespace.prototype, {
- get value(){
- // the value of the attribute is returned as a string
- return this.nodeValue;
- },
- set value(value){
- this.nodeValue = value+'';
- },
- get nodeType(){
- return DOMNode.NAMESPACE_NODE;
- },
- get xml(){
- var ret = "";
-
- // serialize Namespace Declaration
- if (this.nodeName != "") {
- ret += this.nodeName +"=\""+ __escapeXML__(this.nodeValue) +"\"";
- }
- else { // handle default namespace
- ret += "xmlns=\""+ __escapeXML__(this.nodeValue) +"\"";
- }
-
- return ret;
- },
- toString: function(){
- return "Namespace #" + this.id;
- }
-});
-
-$debug("Defining CharacterData");
-/*
-* CharacterData - DOM Level 2
-*/
-/**
- * @class DOMCharacterData - parent abstract class for DOMText and DOMComment
- * @extends DOMNode
- * @author Jon van Noort (jon@webarcana.com.au)
- * @param ownerDocument : DOMDocument - The Document object associated with this node.
- */
-var DOMCharacterData = function(ownerDocument) {
- this.DOMNode = DOMNode;
- this.DOMNode(ownerDocument);
-};
-DOMCharacterData.prototype = new DOMNode;
-__extend__(DOMCharacterData.prototype,{
- get data(){
- return this.nodeValue;
- },
- set data(data){
- this.nodeValue = data;
- },
- get length(){return this.nodeValue.length;},
- appendData: function(arg){
- // throw Exception if DOMCharacterData is readonly
- if (__ownerDocument__(this).implementation.errorChecking && this._readonly) {
- throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
- // append data
- this.data = "" + this.data + arg;
- },
- deleteData: function(offset, count){
- // throw Exception if DOMCharacterData is readonly
- if (__ownerDocument__(this).implementation.errorChecking && this._readonly) {
- throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
- if (this.data) {
- // throw Exception if offset is negative or greater than the data length,
- if (__ownerDocument__(this).implementation.errorChecking &&
- ((offset < 0) || (offset > this.data.length) || (count < 0))) {
- throw(new DOMException(DOMException.INDEX_SIZE_ERR));
- }
-
- // delete data
- if(!count || (offset + count) > this.data.length) {
- this.data = this.data.substring(0, offset);
- }else {
- this.data = this.data.substring(0, offset).
- concat(this.data.substring(offset + count));
- }
- }
- },
- insertData: function(offset, arg){
- // throw Exception if DOMCharacterData is readonly
- if(__ownerDocument__(this).implementation.errorChecking && this._readonly){
- throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
-
- if(this.data){
- // throw Exception if offset is negative or greater than the data length,
- if (__ownerDocument__(this).implementation.errorChecking &&
- ((offset < 0) || (offset > this.data.length))) {
- throw(new DOMException(DOMException.INDEX_SIZE_ERR));
- }
-
- // insert data
- this.data = this.data.substring(0, offset).concat(arg, this.data.substring(offset));
- }else {
- // throw Exception if offset is negative or greater than the data length,
- if (__ownerDocument__(this).implementation.errorChecking && (offset != 0)) {
- throw(new DOMException(DOMException.INDEX_SIZE_ERR));
- }
-
- // set data
- this.data = arg;
- }
- },
- replaceData: function(offset, count, arg){
- // throw Exception if DOMCharacterData is readonly
- if (__ownerDocument__(this).implementation.errorChecking && this._readonly) {
- throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
-
- if (this.data) {
- // throw Exception if offset is negative or greater than the data length,
- if (__ownerDocument__(this).implementation.errorChecking &&
- ((offset < 0) || (offset > this.data.length) || (count < 0))) {
- throw(new DOMException(DOMException.INDEX_SIZE_ERR));
- }
-
- // replace data
- this.data = this.data.substring(0, offset).
- concat(arg, this.data.substring(offset + count));
- }else {
- // set data
- this.data = arg;
- }
- },
- substringData: function(offset, count){
- var ret = null;
- if (this.data) {
- // throw Exception if offset is negative or greater than the data length,
- // or the count is negative
- if (__ownerDocument__(this).implementation.errorChecking &&
- ((offset < 0) || (offset > this.data.length) || (count < 0))) {
- throw(new DOMException(DOMException.INDEX_SIZE_ERR));
- }
- // if count is not specified
- if (!count) {
- ret = this.data.substring(offset); // default to 'end of string'
- }else{
- ret = this.data.substring(offset, offset + count);
- }
- }
- return ret;
- }
-});
-
-$w.CharacterData = DOMCharacterData;$debug("Defining Text");
-/*
-* Text - DOM Level 2
-*/
-/**
- * @class DOMText - The Text interface represents the textual content (termed character data in XML) of an Element or Attr.
- * If there is no markup inside an element's content, the text is contained in a single object implementing the Text interface
- * that is the only child of the element. If there is markup, it is parsed into a list of elements and Text nodes that form the
- * list of children of the element.
- * @extends DOMCharacterData
- * @author Jon van Noort (jon@webarcana.com.au) and David Joham (djoham@yahoo.com)
- * @param ownerDocument : DOMDocument - The Document object associated with this node.
- */
-var DOMText = function(ownerDocument) {
- this.DOMCharacterData = DOMCharacterData;
- this.DOMCharacterData(ownerDocument);
-
- this.nodeName = "#text";
-};
-DOMText.prototype = new DOMCharacterData;
-__extend__(DOMText.prototype,{
- //Breaks this Text node into two Text nodes at the specified offset,
- // keeping both in the tree as siblings. This node then only contains all the content up to the offset point.
- // And a new Text node, which is inserted as the next sibling of this node, contains all the content at and after the offset point.
- splitText : function(offset) {
- var data, inode;
-
- // test for exceptions
- if (__ownerDocument__(this).implementation.errorChecking) {
- // throw Exception if Node is readonly
- if (this._readonly) {
- throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
-
- // throw Exception if offset is negative or greater than the data length,
- if ((offset < 0) || (offset > this.data.length)) {
- throw(new DOMException(DOMException.INDEX_SIZE_ERR));
- }
- }
-
- if (this.parentNode) {
- // get remaining string (after offset)
- data = this.substringData(offset);
-
- // create new TextNode with remaining string
- inode = __ownerDocument__(this).createTextNode(data);
-
- // attach new TextNode
- if (this.nextSibling) {
- this.parentNode.insertBefore(inode, this.nextSibling);
- }
- else {
- this.parentNode.appendChild(inode);
- }
-
- // remove remaining string from original TextNode
- this.deleteData(offset);
- }
-
- return inode;
- },
- get nodeType(){
- return DOMNode.TEXT_NODE;
- },
- get xml(){
- return __escapeXML__(""+ this.nodeValue);
- },
- toString: function(){
- return "Text #" + this._id;
- }
-});
-
-$w.Text = DOMText;$debug("Defining CDATASection");
-/*
-* CDATASection - DOM Level 2
-*/
-/**
- * @class DOMCDATASection - CDATA sections are used to escape blocks of text containing characters that would otherwise be regarded as markup.
- * The only delimiter that is recognized in a CDATA section is the "\]\]\>" string that ends the CDATA section
- * @extends DOMCharacterData
- * @author Jon van Noort (jon@webarcana.com.au) and David Joham (djoham@yahoo.com)
- * @param ownerDocument : DOMDocument - The Document object associated with this node.
- */
-var DOMCDATASection = function(ownerDocument) {
- this.DOMText = DOMText;
- this.DOMText(ownerDocument);
-
- this.nodeName = "#cdata-section";
-};
-DOMCDATASection.prototype = new DOMText;
-__extend__(DOMCDATASection.prototype,{
- get nodeType(){
- return DOMNode.CDATA_SECTION_NODE;
- },
- get xml(){
- return "<![CDATA[" + this.nodeValue + "]]>";
- },
- toString : function(){
- return "CDATA #"+this._id;
- }
-});
-
-$w.CDATASection = DOMCDATASection;$debug("Defining Comment");
-/*
-* Comment - DOM Level 2
-*/
-/**
- * @class DOMComment - This represents the content of a comment, i.e., all the characters between the starting '<!--' and ending '-->'
- * @extends DOMCharacterData
- * @author Jon van Noort (jon@webarcana.com.au)
- * @param ownerDocument : DOMDocument - The Document object associated with this node.
- */
-var DOMComment = function(ownerDocument) {
- this.DOMCharacterData = DOMCharacterData;
- this.DOMCharacterData(ownerDocument);
-
- this.nodeName = "#comment";
-};
-DOMComment.prototype = new DOMCharacterData;
-__extend__(DOMComment.prototype, {
- get nodeType(){
- return DOMNode.COMMENT_NODE;
- },
- get xml(){
- return "<!--" + this.nodeValue + "-->";
- },
- toString : function(){
- return "Comment #"+this._id;
- }
-});
-
-$w.Comment = DOMComment;
-$debug("Defining DocumentType");
-;/*
-* DocumentType - DOM Level 2
-*/
-var DOMDocumentType = function() {
- $error("DOMDocumentType.constructor(): Not Implemented" );
-};
-
-$w.DocumentType = DOMDocumentType;
-$debug("Defining Attr");
-/*
-* Attr - DOM Level 2
-*/
-/**
- * @class DOMAttr - The Attr interface represents an attribute in an Element object
- * @extends DOMNode
- * @author Jon van Noort (jon@webarcana.com.au)
- * @param ownerDocument : DOMDocument - The Document object associated with this node.
- */
-var DOMAttr = function(ownerDocument) {
- this.DOMNode = DOMNode;
- this.DOMNode(ownerDocument);
-
- this.ownerElement = null; // set when Attr is added to NamedNodeMap
-};
-DOMAttr.prototype = new DOMNode;
-__extend__(DOMAttr.prototype, {
- // the name of this attribute
- get name(){
- return this.nodeName;
- },
- set name(name){
- this.nodeName = name;
- },
- // the value of the attribute is returned as a string
- get value(){
- return this.nodeValue;
- },
- set value(value){
- // throw Exception if Attribute is readonly
- if (__ownerDocument__(this).implementation.errorChecking && this._readonly) {
- throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
- // delegate to node
- this.nodeValue = value;
- },
- get specified(){
- return (this.value.length > 0);
- },
- get nodeType(){
- return DOMNode.ATTRIBUTE_NODE;
- },
- get xml(){
- return this.nodeName + '="' + __escapeXML__(this.nodeValue) + '" ';
- },
- toString : function(){
- return "Attr #" + this._id + " " + this.name;
- }
-});
-
-$w.Attr = DOMAttr;
-$debug("Defining Element");
-/**
- * @class DOMElement - By far the vast majority of objects (apart from text) that authors encounter
- * when traversing a document are Element nodes.
- * @extends DOMNode
- * @author Jon van Noort (jon@webarcana.com.au) and David Joham (djoham@yahoo.com)
- * @param ownerDocument : DOMDocument - The Document object associated with this node.
- */
-var DOMElement = function(ownerDocument) {
- this.DOMNode = DOMNode;
- this.DOMNode(ownerDocument);
- this.id = ""; // the ID of the element
-};
-DOMElement.prototype = new DOMNode;
-__extend__(DOMElement.prototype, {
- // The name of the element.
- get tagName(){
- return this.nodeName;
- },
- set tagName(name){
- this.nodeName = name;
- },
- addEventListener : function(){ window.addEventListener.apply(this, arguments) },
- removeEventListener : function(){ window.removeEventListener.apply(this, arguments) },
- dispatchEvent : function(){ window.dispatchEvent.apply(this, arguments) },
- getAttribute: function(name) {
- var ret = null;
- // if attribute exists, use it
- var attr = this.attributes.getNamedItem(name);
- if (attr) {
- ret = attr.value;
- }
- return ret; // if Attribute exists, return its value, otherwise, return ""
- },
- setAttribute : function (name, value) {
- // if attribute exists, use it
- var attr = this.attributes.getNamedItem(name);
- var value = value+'';
- //I had to add this check becuase as the script initializes
- //the id may be set in the constructor, and the html element
- //overrides the id property with a getter/setter.
- if(__ownerDocument__(this)){
- if (!attr) {
- attr = __ownerDocument__(this).createAttribute(name); // otherwise create it
- }
-
-
- // test for exceptions
- if (__ownerDocument__(this).implementation.errorChecking) {
- // throw Exception if Attribute is readonly
- if (attr._readonly) {
- throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
-
- // throw Exception if the value string contains an illegal character
- if (!__isValidString__(value)) {
- throw(new DOMException(DOMException.INVALID_CHARACTER_ERR));
- }
- }
-
- if (__isIdDeclaration__(name)) {
- // this.id = value; // cache ID for getElementById()
- }
-
- // assign values to properties (and aliases)
- attr.value = value;
-
- // add/replace Attribute in NamedNodeMap
- this.attributes.setNamedItem(attr);
- }
- },
- removeAttribute : function removeAttribute(name) {
- // delegate to DOMNamedNodeMap.removeNamedItem
- return this.attributes.removeNamedItem(name);
- },
- getAttributeNode : function getAttributeNode(name) {
- // delegate to DOMNamedNodeMap.getNamedItem
- return this.attributes.getNamedItem(name);
- },
- setAttributeNode: function(newAttr) {
- // if this Attribute is an ID
- if (__isIdDeclaration__(newAttr.name)) {
- this.id = newAttr.value; // cache ID for getElementById()
- }
- // delegate to DOMNamedNodeMap.setNamedItem
- return this.attributes.setNamedItem(newAttr);
- },
- removeAttributeNode: function(oldAttr) {
- // throw Exception if Attribute is readonly
- if (__ownerDocument__(this).implementation.errorChecking && oldAttr._readonly) {
- throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
-
- // get item index
- var itemIndex = this.attributes._findItemIndex(oldAttr._id);
-
- // throw Exception if node does not exist in this map
- if (__ownerDocument__(this).implementation.errorChecking && (itemIndex < 0)) {
- throw(new DOMException(DOMException.NOT_FOUND_ERR));
- }
-
- return this.attributes._removeChild(itemIndex);
- },
- getAttributeNS : function(namespaceURI, localName) {
- var ret = "";
- // delegate to DOMNAmedNodeMap.getNamedItemNS
- var attr = this.attributes.getNamedItemNS(namespaceURI, localName);
- if (attr) {
- ret = attr.value;
- }
- return ret; // if Attribute exists, return its value, otherwise return ""
- },
- setAttributeNS : function(namespaceURI, qualifiedName, value) {
- // call DOMNamedNodeMap.getNamedItem
- var attr = this.attributes.getNamedItem(namespaceURI, qualifiedName);
-
- if (!attr) { // if Attribute exists, use it
- // otherwise create it
- attr = __ownerDocument__(this).createAttributeNS(namespaceURI, qualifiedName);
- }
-
- var value = value+'';
-
- // test for exceptions
- if (__ownerDocument__(this).implementation.errorChecking) {
- // throw Exception if Attribute is readonly
- if (attr._readonly) {
- throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
-
- // throw Exception if the Namespace is invalid
- if (!__isValidNamespace__(namespaceURI, qualifiedName)) {
- throw(new DOMException(DOMException.NAMESPACE_ERR));
- }
-
- // throw Exception if the value string contains an illegal character
- if (!__isValidString__(value)) {
- throw(new DOMException(DOMException.INVALID_CHARACTER_ERR));
- }
- }
-
- // if this Attribute is an ID
- if (__isIdDeclaration__(name)) {
- this.id = value; // cache ID for getElementById()
- }
-
- // assign values to properties (and aliases)
- attr.value = value;
- attr.nodeValue = value;
-
- // delegate to DOMNamedNodeMap.setNamedItem
- this.attributes.setNamedItemNS(attr);
- },
- removeAttributeNS : function(namespaceURI, localName) {
- // delegate to DOMNamedNodeMap.removeNamedItemNS
- return this.attributes.removeNamedItemNS(namespaceURI, localName);
- },
- getAttributeNodeNS : function(namespaceURI, localName) {
- // delegate to DOMNamedNodeMap.getNamedItemNS
- return this.attributes.getNamedItemNS(namespaceURI, localName);
- },
- setAttributeNodeNS : function(newAttr) {
- // if this Attribute is an ID
- if ((newAttr.prefix == "") && __isIdDeclaration__(newAttr.name)) {
- this.id = newAttr.value+''; // cache ID for getElementById()
- }
-
- // delegate to DOMNamedNodeMap.setNamedItemNS
- return this.attributes.setNamedItemNS(newAttr);
- },
- hasAttribute : function(name) {
- // delegate to DOMNamedNodeMap._hasAttribute
- return __hasAttribute__(this.attributes,name);
- },
- hasAttributeNS : function(namespaceURI, localName) {
- // delegate to DOMNamedNodeMap._hasAttributeNS
- return __hasAttributeNS__(this.attributes, namespaceURI, localName);
- },
- get nodeType(){
- return DOMNode.ELEMENT_NODE;
- },
- get xml() {
- var ret = "";
-
- // serialize namespace declarations
- var ns = this._namespaces.xml;
- if (ns.length > 0) ns = " "+ ns;
-
- // serialize Attribute declarations
- var attrs = this.attributes.xml;
- if (attrs.length > 0) attrs = " "+ attrs;
-
- // serialize this Element
- ret += "<" + this.nodeName.toLowerCase() + ns + attrs +">";
- ret += this.childNodes.xml;
- ret += "</" + this.nodeName.toLowerCase()+">";
-
- return ret;
- },
- toString : function(){
- return "Element #"+this._id + " "+ this.tagName + (this.id?" => "+this.id:'');
- }
-});
-
-$w.Element = DOMElement;
-/**
- * @class DOMException - raised when an operation is impossible to perform
- * @author Jon van Noort (jon@webarcana.com.au)
- * @param code : int - the exception code (one of the DOMException constants)
- */
-var DOMException = function(code) {
- this.code = code;
-};
-
-// DOMException constants
-// Introduced in DOM Level 1:
-DOMException.INDEX_SIZE_ERR = 1;
-DOMException.DOMSTRING_SIZE_ERR = 2;
-DOMException.HIERARCHY_REQUEST_ERR = 3;
-DOMException.WRONG_DOCUMENT_ERR = 4;
-DOMException.INVALID_CHARACTER_ERR = 5;
-DOMException.NO_DATA_ALLOWED_ERR = 6;
-DOMException.NO_MODIFICATION_ALLOWED_ERR = 7;
-DOMException.NOT_FOUND_ERR = 8;
-DOMException.NOT_SUPPORTED_ERR = 9;
-DOMException.INUSE_ATTRIBUTE_ERR = 10;
-
-// Introduced in DOM Level 2:
-DOMException.INVALID_STATE_ERR = 11;
-DOMException.SYNTAX_ERR = 12;
-DOMException.INVALID_MODIFICATION_ERR = 13;
-DOMException.NAMESPACE_ERR = 14;
-DOMException.INVALID_ACCESS_ERR = 15;
-$debug("Defining DocumentFragment");
-/*
-* DocumentFragment - DOM Level 2
-*/
-/**
- * @class DOMDocumentFragment - DocumentFragment is a "lightweight" or "minimal" Document object.
- * @extends DOMNode
- * @author Jon van Noort (jon@webarcana.com.au) and David Joham (djoham@yahoo.com)
- * @param ownerDocument : DOMDocument - The Document object associated with this node.
- */
-var DOMDocumentFragment = function(ownerDocument) {
- this.DOMNode = DOMNode;
- this.DOMNode(ownerDocument);
- this.nodeName = "#document-fragment";
-};
-DOMDocumentFragment.prototype = new DOMNode;
-__extend__(DOMDocumentFragment.prototype,{
- get nodeType(){
- return DOMNode.DOCUMENT_FRAGMENT_NODE;
- },
- get xml(){
- var xml = "",
- count = this.childNodes.length;
-
- // create string concatenating the serialized ChildNodes
- for (var i = 0; i < count; i++) {
- xml += this.childNodes.item(i).xml;
- }
-
- return xml;
- },
- toString : function(){
- return "DocumentFragment #"+this._id;
- }
-});
-
-$w.DocumentFragment = DOMDocumentFragment;
-$debug("Defining ProcessingInstruction");
-/*
-* ProcessingInstruction - DOM Level 2
-*/
-/**
- * @class DOMProcessingInstruction - The ProcessingInstruction interface represents a "processing instruction",
- * used in XML as a way to keep processor-specific information in the text of the document
- * @extends DOMNode
- * @author Jon van Noort (jon@webarcana.com.au)
- * @param ownerDocument : DOMDocument - The Document object associated with this node.
- */
-var DOMProcessingInstruction = function(ownerDocument) {
- this.DOMNode = DOMNode;
- this.DOMNode(ownerDocument);
-};
-DOMProcessingInstruction.prototype = new DOMNode;
-__extend__(DOMProcessingInstruction.prototype, {
- get data(){
- return this.nodeValue;
- },
- set data(data){
- // throw Exception if DOMNode is readonly
- if (__ownerDocument__(this).errorChecking && this._readonly) {
- throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
- }
- this.nodeValue = data;
- },
- get target(){
- // The target of this processing instruction.
- // XML defines this as being the first token following the markup that begins the processing instruction.
- // The content of this processing instruction.
- return this.nodeName;
- },
- get nodeType(){
- return DOMNode.PROCESSING_INSTRUCTION_NODE;
- },
- get xml(){
- return "<?" + this.nodeName +" "+ this.nodeValue + " ?>";
- },
- toString : function(){
- return "ProcessingInstruction #"+this._id;
- }
-});
-
-$w.ProcessesingInstruction = DOMProcessingInstruction;
-$debug("Defining DOMParser");
-/*
-* DOMParser
-*/
-
-var DOMParser = function(){};
-__extend__(DOMParser.prototype,{
- parseFromString: function(xmlString){
- //$log("Parsing XML String: " +xmlString);
- return document.implementation.createDocument().loadXML(xmlString);
- }
-});
-
-$debug("Initializing Internal DOMParser.");
-//keep one around for internal use
-$domparser = new DOMParser();
-
-$w.DOMParser = DOMParser;
-// =========================================================================
-//
-// xmlsax.js - an XML SAX parser in JavaScript.
-//
-// version 3.1
-//
-// =========================================================================
-//
-// Copyright (C) 2001 - 2002 David Joham (djoham@yahoo.com) and Scott Severtson
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-//
-// Visit the XML for <SCRIPT> home page at http://xmljs.sourceforge.net
-//
-
-// CONSTANTS
-var whitespace = "\n\r\t ";
-
-
-/**
-* function: this is the constructor to the XMLP Object
-* Author: Scott Severtson
-* Description:XMLP is a pull-based parser. The calling application passes in a XML string
-* to the constructor, then repeatedly calls .next() to parse the next segment.
-* .next() returns a flag indicating what type of segment was found, and stores
-* data temporarily in couple member variables (name, content, array of
-* attributes), which can be accessed by several .get____() methods.
-*
-* Basically, XMLP is the lowest common denominator parser - an very simple
-* API which other wrappers can be built against.
-**/
-
-
-var XMLP = function(strXML) {
- // Normalize line breaks
- strXML = SAXStrings.replace(strXML, null, null, "\r\n", "\n");
- strXML = SAXStrings.replace(strXML, null, null, "\r", "\n");
-
- this.m_xml = strXML;
- this.m_iP = 0;
- this.m_iState = XMLP._STATE_PROLOG;
- this.m_stack = new Stack();
- this._clearAttributes();
- this.replaceEntities = true;
-};
-
-
-// CONSTANTS (these must be below the constructor)
-
-
-XMLP._NONE = 0;
-XMLP._ELM_B = 1;
-XMLP._ELM_E = 2;
-XMLP._ELM_EMP = 3;
-XMLP._ATT = 4;
-XMLP._TEXT = 5;
-XMLP._ENTITY = 6;
-XMLP._PI = 7;
-XMLP._CDATA = 8;
-XMLP._COMMENT = 9;
-XMLP._DTD = 10;
-XMLP._ERROR = 11;
-
-XMLP._CONT_XML = 0;
-XMLP._CONT_ALT = 1;
-
-XMLP._ATT_NAME = 0;
-XMLP._ATT_VAL = 1;
-
-XMLP._STATE_PROLOG = 1;
-XMLP._STATE_DOCUMENT = 2;
-XMLP._STATE_MISC = 3;
-
-XMLP._errs = new Array();
-XMLP._errs[XMLP.ERR_CLOSE_PI = 0 ] = "PI: missing closing sequence";
-XMLP._errs[XMLP.ERR_CLOSE_DTD = 1 ] = "DTD: missing closing sequence";
-XMLP._errs[XMLP.ERR_CLOSE_COMMENT = 2 ] = "Comment: missing closing sequence";
-XMLP._errs[XMLP.ERR_CLOSE_CDATA = 3 ] = "CDATA: missing closing sequence";
-XMLP._errs[XMLP.ERR_CLOSE_ELM = 4 ] = "Element: missing closing sequence";
-XMLP._errs[XMLP.ERR_CLOSE_ENTITY = 5 ] = "Entity: missing closing sequence";
-XMLP._errs[XMLP.ERR_PI_TARGET = 6 ] = "PI: target is required";
-XMLP._errs[XMLP.ERR_ELM_EMPTY = 7 ] = "Element: cannot be both empty and closing";
-XMLP._errs[XMLP.ERR_ELM_NAME = 8 ] = "Element: name must immediatly follow \"<\"";
-XMLP._errs[XMLP.ERR_ELM_LT_NAME = 9 ] = "Element: \"<\" not allowed in element names";
-XMLP._errs[XMLP.ERR_ATT_VALUES = 10] = "Attribute: values are required and must be in quotes";
-XMLP._errs[XMLP.ERR_ATT_LT_NAME = 11] = "Element: \"<\" not allowed in attribute names";
-XMLP._errs[XMLP.ERR_ATT_LT_VALUE = 12] = "Attribute: \"<\" not allowed in attribute values";
-XMLP._errs[XMLP.ERR_ATT_DUP = 13] = "Attribute: duplicate attributes not allowed";
-XMLP._errs[XMLP.ERR_ENTITY_UNKNOWN = 14] = "Entity: unknown entity";
-XMLP._errs[XMLP.ERR_INFINITELOOP = 15] = "Infininte loop";
-XMLP._errs[XMLP.ERR_DOC_STRUCTURE = 16] = "Document: only comments, processing instructions, or whitespace allowed outside of document element";
-XMLP._errs[XMLP.ERR_ELM_NESTING = 17] = "Element: must be nested correctly";
-
-
-
-XMLP.prototype._addAttribute = function(name, value) {
- this.m_atts[this.m_atts.length] = new Array(name, value);
-}
-
-
-XMLP.prototype._checkStructure = function(iEvent) {
-
- if(XMLP._STATE_PROLOG == this.m_iState) {
- if((XMLP._TEXT == iEvent) || (XMLP._ENTITY == iEvent)) {
- if(SAXStrings.indexOfNonWhitespace(this.getContent(), this.getContentBegin(), this.getContentEnd()) != -1) {
- return this._setErr(XMLP.ERR_DOC_STRUCTURE);
- }
- }
-
- if((XMLP._ELM_B == iEvent) || (XMLP._ELM_EMP == iEvent)) {
- this.m_iState = XMLP._STATE_DOCUMENT;
- // Don't return - fall through to next state
- }
- }
- if(XMLP._STATE_DOCUMENT == this.m_iState) {
- if((XMLP._ELM_B == iEvent) || (XMLP._ELM_EMP == iEvent)) {
- this.m_stack.push(this.getName());
- }
-
- if((XMLP._ELM_E == iEvent) || (XMLP._ELM_EMP == iEvent)) {
- var strTop = this.m_stack.pop();
- if((strTop == null) || (strTop != this.getName())) {
- return this._setErr(XMLP.ERR_ELM_NESTING);
- }
- }
-
- if(this.m_stack.count() == 0) {
- this.m_iState = XMLP._STATE_MISC;
- return iEvent;
- }
- }
- if(XMLP._STATE_MISC == this.m_iState) {
- if((XMLP._ELM_B == iEvent) || (XMLP._ELM_E == iEvent) || (XMLP._ELM_EMP == iEvent) || (XMLP.EVT_DTD == iEvent)) {
- return this._setErr(XMLP.ERR_DOC_STRUCTURE);
- }
-
- if((XMLP._TEXT == iEvent) || (XMLP._ENTITY == iEvent)) {
- if(SAXStrings.indexOfNonWhitespace(this.getContent(), this.getContentBegin(), this.getContentEnd()) != -1) {
- return this._setErr(XMLP.ERR_DOC_STRUCTURE);
- }
- }
- }
-
- return iEvent;
-
-}
-
-
-XMLP.prototype._clearAttributes = function() {
- this.m_atts = new Array();
-}
-
-
-XMLP.prototype._findAttributeIndex = function(name) {
- for(var i = 0; i < this.m_atts.length; i++) {
- if(this.m_atts[i][XMLP._ATT_NAME] == name) {
- return i;
- }
- }
- return -1;
-
-}
-
-
-XMLP.prototype.getAttributeCount = function() {
-
- return this.m_atts ? this.m_atts.length : 0;
-
-}
-
-
-XMLP.prototype.getAttributeName = function(index) {
-
- return ((index < 0) || (index >= this.m_atts.length)) ? null : this.m_atts[index][XMLP._ATT_NAME];
-
-}
-
-
-XMLP.prototype.getAttributeValue = function(index) {
-
- return ((index < 0) || (index >= this.m_atts.length)) ? null : __unescapeXML__(this.m_atts[index][XMLP._ATT_VAL]);
-
-}
-
-
-XMLP.prototype.getAttributeValueByName = function(name) {
-
- return this.getAttributeValue(this._findAttributeIndex(name));
-
-}
-
-
-XMLP.prototype.getColumnNumber = function() {
-
- return SAXStrings.getColumnNumber(this.m_xml, this.m_iP);
-
-}
-
-
-XMLP.prototype.getContent = function() {
-
- return (this.m_cSrc == XMLP._CONT_XML) ? this.m_xml : this.m_cAlt;
-
-}
-
-
-XMLP.prototype.getContentBegin = function() {
-
- return this.m_cB;
-
-}
-
-
-XMLP.prototype.getContentEnd = function() {
-
- return this.m_cE;
-
-}
-
-
-XMLP.prototype.getLineNumber = function() {
-
- return SAXStrings.getLineNumber(this.m_xml, this.m_iP);
-
-}
-
-
-XMLP.prototype.getName = function() {
-
- return this.m_name;
-
-}
-
-
-XMLP.prototype.next = function() {
-
- return this._checkStructure(this._parse());
-
-}
-
-XMLP.prototype.appendFragment = function(xmlfragment) {
-
- var start = this.m_xml.slice(0,this.m_iP);
- var end = this.m_xml.slice(this.m_iP);
- this.m_xml = start+xmlfragment+end;
-
-}
-
-
-XMLP.prototype._parse = function() {
-
- if(this.m_iP == this.m_xml.length) {
- return XMLP._NONE;
- }
-
- if(this.m_iP == this.m_xml.indexOf("<", this.m_iP)){
- if(this.m_xml.charAt(this.m_iP+1) == "?") {
- return this._parsePI(this.m_iP + 2);
- }
- else if(this.m_xml.charAt(this.m_iP+1) == "!") {
- if(this.m_xml.charAt(this.m_iP+2) == "D") {
- return this._parseDTD(this.m_iP + 9);
- }
- else if(this.m_xml.charAt(this.m_iP+2) == "-") {
- return this._parseComment(this.m_iP + 4);
- }
- else if(this.m_xml.charAt(this.m_iP+2) == "[") {
- return this._parseCDATA(this.m_iP + 9);
- }
- }
- else{
- return this._parseElement(this.m_iP + 1);
- }
- }
- else if(this.m_iP == this.m_xml.indexOf("&", this.m_iP)) {
- return this._parseEntity(this.m_iP + 1);
- }
- else{
- return this._parseText(this.m_iP);
- }
-
-
-}
-
-
-XMLP.prototype._parseAttribute = function(iB, iE) {
- var iNB, iNE, iEq, iVB, iVE;
- var cQuote, strN, strV;
-
- this.m_cAlt = ""; //resets the value so we don't use an old one by accident (see testAttribute7 in the test suite)
-
- iNB = SAXStrings.indexOfNonWhitespace(this.m_xml, iB, iE);
- if((iNB == -1) ||(iNB >= iE)) {
- return iNB;
- }
-
- iEq = this.m_xml.indexOf("=", iNB);
- if((iEq == -1) || (iEq > iE)) {
- return this._setErr(XMLP.ERR_ATT_VALUES);
- }
-
- iNE = SAXStrings.lastIndexOfNonWhitespace(this.m_xml, iNB, iEq);
-
- iVB = SAXStrings.indexOfNonWhitespace(this.m_xml, iEq + 1, iE);
- if((iVB == -1) ||(iVB > iE)) {
- return this._setErr(XMLP.ERR_ATT_VALUES);
- }
-
- cQuote = this.m_xml.charAt(iVB);
- if(_SAXStrings.QUOTES.indexOf(cQuote) == -1) {
- return this._setErr(XMLP.ERR_ATT_VALUES);
- }
-
- iVE = this.m_xml.indexOf(cQuote, iVB + 1);
- if((iVE == -1) ||(iVE > iE)) {
- return this._setErr(XMLP.ERR_ATT_VALUES);
- }
-
- strN = this.m_xml.substring(iNB, iNE + 1);
- strV = this.m_xml.substring(iVB + 1, iVE);
-
- if(strN.indexOf("<") != -1) {
- return this._setErr(XMLP.ERR_ATT_LT_NAME);
- }
-
- if(strV.indexOf("<") != -1) {
- return this._setErr(XMLP.ERR_ATT_LT_VALUE);
- }
-
- strV = SAXStrings.replace(strV, null, null, "\n", " ");
- strV = SAXStrings.replace(strV, null, null, "\t", " ");
- iRet = this._replaceEntities(strV);
- if(iRet == XMLP._ERROR) {
- return iRet;
- }
-
- strV = this.m_cAlt;
-
- if(this._findAttributeIndex(strN) == -1) {
- this._addAttribute(strN, strV);
- }else {
- return this._setErr(XMLP.ERR_ATT_DUP);
- }
-
- this.m_iP = iVE + 2;
-
- return XMLP._ATT;
-
-}
-
-
-XMLP.prototype._parseCDATA = function(iB) {
- var iE = this.m_xml.indexOf("]]>", iB);
- if (iE == -1) {
- return this._setErr(XMLP.ERR_CLOSE_CDATA);
- }
-
- this._setContent(XMLP._CONT_XML, iB, iE);
-
- this.m_iP = iE + 3;
-
- return XMLP._CDATA;
-
-}
-
-
-XMLP.prototype._parseComment = function(iB) {
- var iE = this.m_xml.indexOf("-" + "->", iB);
- if (iE == -1) {
- return this._setErr(XMLP.ERR_CLOSE_COMMENT);
- }
-
- this._setContent(XMLP._CONT_XML, iB, iE);
-
- this.m_iP = iE + 3;
-
- return XMLP._COMMENT;
-
-}
-
-
-XMLP.prototype._parseDTD = function(iB) {
-
- // Eat DTD
-
- var iE, strClose, iInt, iLast;
-
- iE = this.m_xml.indexOf(">", iB);
- if(iE == -1) {
- return this._setErr(XMLP.ERR_CLOSE_DTD);
- }
-
- iInt = this.m_xml.indexOf("[", iB);
- strClose = ((iInt != -1) && (iInt < iE)) ? "]>" : ">";
-
- while(true) {
- // DEBUG: Remove
- /*if(iE == iLast) {
- return this._setErr(XMLP.ERR_INFINITELOOP);
- }
-
- iLast = iE;*/
- // DEBUG: Remove End
-
- iE = this.m_xml.indexOf(strClose, iB);
- if(iE == -1) {
- return this._setErr(XMLP.ERR_CLOSE_DTD);
- }
-
- // Make sure it is not the end of a CDATA section
- if (this.m_xml.substring(iE - 1, iE + 2) != "]]>") {
- break;
- }
- }
-
- this.m_iP = iE + strClose.length;
-
- return XMLP._DTD;
-
-}
-
-
-XMLP.prototype._parseElement = function(iB) {
- var iE, iDE, iNE, iRet;
- var iType, strN, iLast;
-
- iDE = iE = this.m_xml.indexOf(">", iB);
- if(iE == -1) {
- return this._setErr(XMLP.ERR_CLOSE_ELM);
- }
-
- if(this.m_xml.charAt(iB) == "/") {
- iType = XMLP._ELM_E;
- iB++;
- } else {
- iType = XMLP._ELM_B;
- }
-
- if(this.m_xml.charAt(iE - 1) == "/") {
- if(iType == XMLP._ELM_E) {
- return this._setErr(XMLP.ERR_ELM_EMPTY);
- }
- iType = XMLP._ELM_EMP;
- iDE--;
- }
-
- iDE = SAXStrings.lastIndexOfNonWhitespace(this.m_xml, iB, iDE);
-
- //djohack
- //hack to allow for elements with single character names to be recognized
-
- /*if (iE - iB != 1 ) {
- if(SAXStrings.indexOfNonWhitespace(this.m_xml, iB, iDE) != iB) {
- return this._setErr(XMLP.ERR_ELM_NAME);
- }
- }*/
- // end hack -- original code below
-
- /*
- if(SAXStrings.indexOfNonWhitespace(this.m_xml, iB, iDE) != iB)
- return this._setErr(XMLP.ERR_ELM_NAME);
- */
- this._clearAttributes();
-
- iNE = SAXStrings.indexOfWhitespace(this.m_xml, iB, iDE);
- if(iNE == -1) {
- iNE = iDE + 1;
- }
- else {
- this.m_iP = iNE;
- while(this.m_iP < iDE) {
- // DEBUG: Remove
- //if(this.m_iP == iLast) return this._setErr(XMLP.ERR_INFINITELOOP);
- //iLast = this.m_iP;
- // DEBUG: Remove End
-
-
- iRet = this._parseAttribute(this.m_iP, iDE);
- if(iRet == XMLP._ERROR) return iRet;
- }
- }
-
- strN = this.m_xml.substring(iB, iNE);
-
- /*if(strN.indexOf("<") != -1) {
- return this._setErr(XMLP.ERR_ELM_LT_NAME);
- }*/
-
- this.m_name = strN;
- this.m_iP = iE + 1;
-
- return iType;
-
-}
-
-
-XMLP.prototype._parseEntity = function(iB) {
- var iE = this.m_xml.indexOf(";", iB);
- if(iE == -1) {
- return this._setErr(XMLP.ERR_CLOSE_ENTITY);
- }
-
- this.m_iP = iE + 1;
-
- return this._replaceEntity(this.m_xml, iB, iE);
-
-}
-
-
-XMLP.prototype._parsePI = function(iB) {
-
- var iE, iTB, iTE, iCB, iCE;
-
- iE = this.m_xml.indexOf("?>", iB);
- if(iE == -1) {
- return this._setErr(XMLP.ERR_CLOSE_PI);
- }
-
- iTB = SAXStrings.indexOfNonWhitespace(this.m_xml, iB, iE);
- if(iTB == -1) {
- return this._setErr(XMLP.ERR_PI_TARGET);
- }
-
- iTE = SAXStrings.indexOfWhitespace(this.m_xml, iTB, iE);
- if(iTE == -1) {
- iTE = iE;
- }
-
- iCB = SAXStrings.indexOfNonWhitespace(this.m_xml, iTE, iE);
- if(iCB == -1) {
- iCB = iE;
- }
-
- iCE = SAXStrings.lastIndexOfNonWhitespace(this.m_xml, iCB, iE);
- if(iCE == -1) {
- iCE = iE - 1;
- }
-
- this.m_name = this.m_xml.substring(iTB, iTE);
- this._setContent(XMLP._CONT_XML, iCB, iCE + 1);
- this.m_iP = iE + 2;
-
- return XMLP._PI;
-
-}
-
-
-XMLP.prototype._parseText = function(iB) {
- var iE, iEE;
-
- iE = this.m_xml.indexOf("<", iB);
- if(iE == -1) {
- iE = this.m_xml.length;
- }
-
- if(this.replaceEntities) {
- iEE = this.m_xml.indexOf("&", iB);
- if((iEE != -1) && (iEE <= iE)) {
- iE = iEE;
- }
- }
-
- this._setContent(XMLP._CONT_XML, iB, iE);
-
- this.m_iP = iE;
-
- return XMLP._TEXT;
-
-}
-
-
-XMLP.prototype._replaceEntities = function(strD, iB, iE) {
- if(SAXStrings.isEmpty(strD)) return "";
- iB = iB || 0;
- iE = iE || strD.length;
-
-
- var iEB, iEE, strRet = "";
-
- iEB = strD.indexOf("&", iB);
- iEE = iB;
-
- while((iEB > 0) && (iEB < iE)) {
- strRet += strD.substring(iEE, iEB);
-
- iEE = strD.indexOf(";", iEB) + 1;
-
- if((iEE == 0) || (iEE > iE)) {
- return this._setErr(XMLP.ERR_CLOSE_ENTITY);
- }
-
- iRet = this._replaceEntity(strD, iEB + 1, iEE - 1);
- if(iRet == XMLP._ERROR) {
- return iRet;
- }
-
- strRet += this.m_cAlt;
-
- iEB = strD.indexOf("&", iEE);
- }
-
- if(iEE != iE) {
- strRet += strD.substring(iEE, iE);
- }
-
- this._setContent(XMLP._CONT_ALT, strRet);
-
- return XMLP._ENTITY;
-
-}
-
-
-XMLP.prototype._replaceEntity = function(strD, iB, iE) {
- if(SAXStrings.isEmpty(strD)) return -1;
- iB = iB || 0;
- iE = iE || strD.length;
-
- switch(strD.substring(iB, iE)) {
- case "amp": strEnt = "&"; break;
- case "lt": strEnt = "<"; break;
- case "gt": strEnt = ">"; break;
- case "apos": strEnt = "'"; break;
- case "quot": strEnt = "\""; break;
- default:
- if(strD.charAt(iB) == "#") {
- strEnt = String.fromCharCode(parseInt(strD.substring(iB + 1, iE)))+'';
- } else {
- return this._setErr(XMLP.ERR_ENTITY_UNKNOWN);
- }
- break;
- }
- this._setContent(XMLP._CONT_ALT, strEnt);
-
- return XMLP._ENTITY;
-}
-
-
-XMLP.prototype._setContent = function(iSrc) {
- var args = arguments;
-
- if(XMLP._CONT_XML == iSrc) {
- this.m_cAlt = null;
- this.m_cB = args[1];
- this.m_cE = args[2];
- } else {
- this.m_cAlt = args[1];
- this.m_cB = 0;
- this.m_cE = args[1].length;
- }
- this.m_cSrc = iSrc;
-
-}
-
-
-XMLP.prototype._setErr = function(iErr) {
- var strErr = XMLP._errs[iErr];
-
- this.m_cAlt = strErr;
- this.m_cB = 0;
- this.m_cE = strErr.length;
- this.m_cSrc = XMLP._CONT_ALT;
-
- return XMLP._ERROR;
-
-}
-
-
-/**
-* function: SAXDriver
-* Author: Scott Severtson
-* Description:
-* SAXDriver is an object that basically wraps an XMLP instance, and provides an
-* event-based interface for parsing. This is the object users interact with when coding
-* with XML for <SCRIPT>
-**/
-
-var SAXDriver = function() {
- this.m_hndDoc = null;
- this.m_hndErr = null;
- this.m_hndLex = null;
-}
-
-
-// CONSTANTS
-SAXDriver.DOC_B = 1;
-SAXDriver.DOC_E = 2;
-SAXDriver.ELM_B = 3;
-SAXDriver.ELM_E = 4;
-SAXDriver.CHARS = 5;
-SAXDriver.PI = 6;
-SAXDriver.CD_B = 7;
-SAXDriver.CD_E = 8;
-SAXDriver.CMNT = 9;
-SAXDriver.DTD_B = 10;
-SAXDriver.DTD_E = 11;
-
-
-
-SAXDriver.prototype.parse = function(strD) {
- var parser = new XMLP(strD);
-
- if(this.m_hndDoc && this.m_hndDoc.setDocumentLocator) {
- this.m_hndDoc.setDocumentLocator(this);
- }
-
- this.m_parser = parser;
- this.m_bErr = false;
-
- if(!this.m_bErr) {
- this._fireEvent(SAXDriver.DOC_B);
- }
- this._parseLoop();
- if(!this.m_bErr) {
- this._fireEvent(SAXDriver.DOC_E);
- }
-
- this.m_xml = null;
- this.m_iP = 0;
-
-}
-
-
-SAXDriver.prototype.setDocumentHandler = function(hnd) {
-
- this.m_hndDoc = hnd;
-
-}
-
-
-SAXDriver.prototype.setErrorHandler = function(hnd) {
-
- this.m_hndErr = hnd;
-
-}
-
-
-SAXDriver.prototype.setLexicalHandler = function(hnd) {
-
- this.m_hndLex = hnd;
-
-}
-
-
- /**
- * LOCATOR/PARSE EXCEPTION INTERFACE
- ***/
-
-SAXDriver.prototype.getColumnNumber = function() {
-
- return this.m_parser.getColumnNumber();
-
-}
-
-
-SAXDriver.prototype.getLineNumber = function() {
-
- return this.m_parser.getLineNumber();
-
-}
-
-
-SAXDriver.prototype.getMessage = function() {
-
- return this.m_strErrMsg;
-
-}
-
-
-SAXDriver.prototype.getPublicId = function() {
-
- return null;
-
-}
-
-
-SAXDriver.prototype.getSystemId = function() {
-
- return null;
-
-}
-
-
- /***
- * Attribute List Interface
- **/
-
-SAXDriver.prototype.getLength = function() {
-
- return this.m_parser.getAttributeCount();
-
-}
-
-
-SAXDriver.prototype.getName = function(index) {
-
- return this.m_parser.getAttributeName(index);
-
-}
-
-
-SAXDriver.prototype.getValue = function(index) {
-
- return this.m_parser.getAttributeValue(index);
-
-}
-
-
-SAXDriver.prototype.getValueByName = function(name) {
-
- return this.m_parser.getAttributeValueByName(name);
-
-}
-
-
- /***
- * Private functions
- **/
-
-SAXDriver.prototype._fireError = function(strMsg) {
- this.m_strErrMsg = strMsg;
- this.m_bErr = true;
-
- if(this.m_hndErr && this.m_hndErr.fatalError) {
- this.m_hndErr.fatalError(this);
- }
-
-} // end function _fireError
-
-
-SAXDriver.prototype._fireEvent = function(iEvt) {
- var hnd, func, args = arguments, iLen = args.length - 1;
-
- if(this.m_bErr) return;
-
- if(SAXDriver.DOC_B == iEvt) {
- func = "startDocument"; hnd = this.m_hndDoc;
- }
- else if (SAXDriver.DOC_E == iEvt) {
- func = "endDocument"; hnd = this.m_hndDoc;
- }
- else if (SAXDriver.ELM_B == iEvt) {
- func = "startElement"; hnd = this.m_hndDoc;
- }
- else if (SAXDriver.ELM_E == iEvt) {
- func = "endElement"; hnd = this.m_hndDoc;
- }
- else if (SAXDriver.CHARS == iEvt) {
- func = "characters"; hnd = this.m_hndDoc;
- }
- else if (SAXDriver.PI == iEvt) {
- func = "processingInstruction"; hnd = this.m_hndDoc;
- }
- else if (SAXDriver.CD_B == iEvt) {
- func = "startCDATA"; hnd = this.m_hndLex;
- }
- else if (SAXDriver.CD_E == iEvt) {
- func = "endCDATA"; hnd = this.m_hndLex;
- }
- else if (SAXDriver.CMNT == iEvt) {
- func = "comment"; hnd = this.m_hndLex;
- }
-
- if(hnd && hnd[func]) {
- if(0 == iLen) {
- hnd[func]();
- }
- else if (1 == iLen) {
- hnd[func](args[1]);
- }
- else if (2 == iLen) {
- hnd[func](args[1], args[2]);
- }
- else if (3 == iLen) {
- hnd[func](args[1], args[2], args[3]);
- }
- }
-
-} // end function _fireEvent
-
-
-SAXDriver.prototype._parseLoop = function(parser) {
- var iEvent, parser;
-
- parser = this.m_parser;
- while(!this.m_bErr) {
- iEvent = parser.next();
-
- if(iEvent == XMLP._ELM_B) {
- this._fireEvent(SAXDriver.ELM_B, parser.getName(), this);
- }
- else if(iEvent == XMLP._ELM_E) {
- this._fireEvent(SAXDriver.ELM_E, parser.getName());
- }
- else if(iEvent == XMLP._ELM_EMP) {
- this._fireEvent(SAXDriver.ELM_B, parser.getName(), this);
- this._fireEvent(SAXDriver.ELM_E, parser.getName());
- }
- else if(iEvent == XMLP._TEXT) {
- this._fireEvent(SAXDriver.CHARS, parser.getContent(), parser.getContentBegin(), parser.getContentEnd() - parser.getContentBegin());
- }
- else if(iEvent == XMLP._ENTITY) {
- this._fireEvent(SAXDriver.CHARS, parser.getContent(), parser.getContentBegin(), parser.getContentEnd() - parser.getContentBegin());
- }
- else if(iEvent == XMLP._PI) {
- this._fireEvent(SAXDriver.PI, parser.getName(), parser.getContent().substring(parser.getContentBegin(), parser.getContentEnd()));
- }
- else if(iEvent == XMLP._CDATA) {
- this._fireEvent(SAXDriver.CD_B);
- this._fireEvent(SAXDriver.CHARS, parser.getContent(), parser.getContentBegin(), parser.getContentEnd() - parser.getContentBegin());
- this._fireEvent(SAXDriver.CD_E);
- }
- else if(iEvent == XMLP._COMMENT) {
- this._fireEvent(SAXDriver.CMNT, parser.getContent(), parser.getContentBegin(), parser.getContentEnd() - parser.getContentBegin());
- }
- else if(iEvent == XMLP._DTD) {
- }
- else if(iEvent == XMLP._ERROR) {
- this._fireError(parser.getContent());
- }
- else if(iEvent == XMLP._NONE) {
- return;
- }
- }
-
-} // end function _parseLoop
-
-/**
-* function: SAXStrings
-* Author: Scott Severtson
-* Description: a useful object containing string manipulation functions
-**/
-
-var _SAXStrings = function() {};
-
-
-_SAXStrings.WHITESPACE = " \t\n\r";
-_SAXStrings.NONWHITESPACE = /\S/;
-_SAXStrings.QUOTES = "\"'";
-
-
-_SAXStrings.prototype.getColumnNumber = function(strD, iP) {
- if((strD === null) || (strD.length === 0)) {
- return -1;
- }
- iP = iP || strD.length;
-
- var arrD = strD.substring(0, iP).split("\n");
- var strLine = arrD[arrD.length - 1];
- arrD.length--;
- var iLinePos = arrD.join("\n").length;
-
- return iP - iLinePos;
-
-} // end function getColumnNumber
-
-
-_SAXStrings.prototype.getLineNumber = function(strD, iP) {
- if((strD === null) || (strD.length === 0)) {
- return -1;
- }
- iP = iP || strD.length;
-
- return strD.substring(0, iP).split("\n").length
-} // end function getLineNumber
-
-
-_SAXStrings.prototype.indexOfNonWhitespace = function(strD, iB, iE) {
- if((strD === null) || (strD.length === 0)) {
- return -1;
- }
- iB = iB || 0;
- iE = iE || strD.length;
-
- //var i = strD.substring(iB, iE).search(_SAXStrings.NONWHITESPACE);
- //return i < 0 ? i : iB + i;
-
- while( strD.charCodeAt(iB++) < 33 );
- return (iB > iE)?-1:iB-1;
- /*for(var i = iB; i < iE; i++){
- if(_SAXStrings.WHITESPACE.indexOf(strD.charAt(i)) == -1) {
- return i;
- }
- }
- return -1;*/
-
-} // end function indexOfNonWhitespace
-
-
-_SAXStrings.prototype.indexOfWhitespace = function(strD, iB, iE) {
- if((strD === null) || (strD.length === 0)) {
- return -1;
- }
- iB = iB || 0;
- iE = iE || strD.length;
-
-
- while( strD.charCodeAt(iB++) >= 33 );
- return (iB > iE)?-1:iB-1;
-
- /*for(var i = iB; i < iE; i++) {
- if(_SAXStrings.WHITESPACE.indexOf(strD.charAt(i)) != -1) {
- return i;
- }
- }
- return -1;*/
-} // end function indexOfWhitespace
-
-
-_SAXStrings.prototype.isEmpty = function(strD) {
-
- return (strD == null) || (strD.length == 0);
-
-}
-
-
-_SAXStrings.prototype.lastIndexOfNonWhitespace = function(strD, iB, iE) {
- if((strD === null) || (strD.length === 0)) {
- return -1;
- }
- iB = iB || 0;
- iE = iE || strD.length;
-
- while( (iE >= iB) && strD.charCodeAt(--iE) < 33 );
- return (iE < iB)?-1:iE;
-
- /*for(var i = iE - 1; i >= iB; i--){
- if(_SAXStrings.WHITESPACE.indexOf(strD.charAt(i)) == -1){
- return i;
- }
- }
- return -1;*/
-}
-
-
-_SAXStrings.prototype.replace = function(strD, iB, iE, strF, strR) {
- if((strD == null) || (strD.length == 0)) {
- return "";
- }
- iB = iB || 0;
- iE = iE || strD.length;
-
- return strD.substring(iB, iE).split(strF).join(strR);
-
-};
-
-var SAXStrings = new _SAXStrings();
-
-
-
-/***************************************************************************************************************
-Stack: A simple stack class, used for verifying document structure.
-
- Author: Scott Severtson
-*****************************************************************************************************************/
-
-var Stack = function() {
- this.m_arr = new Array();
-};
-__extend__(Stack.prototype, {
- clear : function() {
- this.m_arr = new Array();
- },
- count : function() {
- return this.m_arr.length;
- },
- destroy : function() {
- this.m_arr = null;
- },
- peek : function() {
- if(this.m_arr.length == 0) {
- return null;
- }
- return this.m_arr[this.m_arr.length - 1];
- },
- pop : function() {
- if(this.m_arr.length == 0) {
- return null;
- }
- var o = this.m_arr[this.m_arr.length - 1];
- this.m_arr.length--;
- return o;
- },
- push : function(o) {
- this.m_arr[this.m_arr.length] = o;
- }
-});
-
-
-/**
-* function: isEmpty
-* Author: mike@idle.org
-* Description: convenience function to identify an empty string
-**/
-function isEmpty(str) {
- return (str==null) || (str.length==0);
-};
-
-
-/**
- * function __escapeXML__
- * author: David Joham djoham@yahoo.com
- * @param str : string - The string to be escaped
- * @return : string - The escaped string
- */
-var escAmpRegEx = /&/g;
-var escLtRegEx = /</g;
-var escGtRegEx = />/g;
-var quotRegEx = /"/g;
-var aposRegEx = /'/g;
-function __escapeXML__(str) {
- str = str.replace(escAmpRegEx, "&amp;").
- replace(escLtRegEx, "&lt;").
- replace(escGtRegEx, "&gt;").
- replace(quotRegEx, "&quot;").
- replace(aposRegEx, "&apos;");
-
- return str;
-};
-
-/**
- * function __unescapeXML__
- * author: David Joham djoham@yahoo.com
- * @param str : string - The string to be unescaped
- * @return : string - The unescaped string
- */
-var unescAmpRegEx = /&amp;/g;
-var unescLtRegEx = /&lt;/g;
-var unescGtRegEx = /&gt;/g;
-var unquotRegEx = /&quot;/g;
-var unaposRegEx = /&apos;/g;
-function __unescapeXML__(str) {
- str = str.replace(unescAmpRegEx, "&").
- replace(unescLtRegEx, "<").
- replace(unescGtRegEx, ">").
- replace(unquotRegEx, "\"").
- replace(unaposRegEx, "'");
-
- return str;
-};
-
-//DOMImplementation
-$debug("Defining DOMImplementation");
-/**
- * @class DOMImplementation - provides a number of methods for performing operations
- * that are independent of any particular instance of the document object model.
- *
- * @author Jon van Noort (jon@webarcana.com.au)
- */
-var DOMImplementation = function() {
- this.preserveWhiteSpace = false; // by default, ignore whitespace
- this.namespaceAware = true; // by default, handle namespaces
- this.errorChecking = true; // by default, test for exceptions
-};
-__extend__(DOMImplementation.prototype,{
- // @param feature : string - The package name of the feature to test.
- // the legal only values are "XML" and "CORE" (case-insensitive).
- // @param version : string - This is the version number of the package
- // name to test. In Level 1, this is the string "1.0".*
- // @return : boolean
- hasFeature : function(feature, version) {
- var ret = false;
- if (feature.toLowerCase() == "xml") {
- ret = (!version || (version == "1.0") || (version == "2.0"));
- }
- else if (feature.toLowerCase() == "core") {
- ret = (!version || (version == "2.0"));
- }
- return ret;
- },
- createDocumentType : function(qname, publicid, systemid){
- return new DOMDocumentType();
- },
- createDocument : function(nsuri, qname, doctype){
- //TODO - this currently returns an empty doc
- //but needs to handle the args
- return new HTMLDocument($implementation);
- },
- translateErrCode : function(code) {
- //convert DOMException Code to human readable error message;
- var msg = "";
-
- switch (code) {
- case DOMException.INDEX_SIZE_ERR : // 1
- msg = "INDEX_SIZE_ERR: Index out of bounds";
- break;
-
- case DOMException.DOMSTRING_SIZE_ERR : // 2
- msg = "DOMSTRING_SIZE_ERR: The resulting string is too long to fit in a DOMString";
- break;
-
- case DOMException.HIERARCHY_REQUEST_ERR : // 3
- msg = "HIERARCHY_REQUEST_ERR: The Node can not be inserted at this location";
- break;
-
- case DOMException.WRONG_DOCUMENT_ERR : // 4
- msg = "WRONG_DOCUMENT_ERR: The source and the destination Documents are not the same";
- break;
-
- case DOMException.INVALID_CHARACTER_ERR : // 5
- msg = "INVALID_CHARACTER_ERR: The string contains an invalid character";
- break;
-
- case DOMException.NO_DATA_ALLOWED_ERR : // 6
- msg = "NO_DATA_ALLOWED_ERR: This Node / NodeList does not support data";
- break;
-
- case DOMException.NO_MODIFICATION_ALLOWED_ERR : // 7
- msg = "NO_MODIFICATION_ALLOWED_ERR: This object cannot be modified";
- break;
-
- case DOMException.NOT_FOUND_ERR : // 8
- msg = "NOT_FOUND_ERR: The item cannot be found";
- break;
-
- case DOMException.NOT_SUPPORTED_ERR : // 9
- msg = "NOT_SUPPORTED_ERR: This implementation does not support function";
- break;
-
- case DOMException.INUSE_ATTRIBUTE_ERR : // 10
- msg = "INUSE_ATTRIBUTE_ERR: The Attribute has already been assigned to another Element";
- break;
-
- // Introduced in DOM Level 2:
- case DOMException.INVALID_STATE_ERR : // 11
- msg = "INVALID_STATE_ERR: The object is no longer usable";
- break;
-
- case DOMException.SYNTAX_ERR : // 12
- msg = "SYNTAX_ERR: Syntax error";
- break;
-
- case DOMException.INVALID_MODIFICATION_ERR : // 13
- msg = "INVALID_MODIFICATION_ERR: Cannot change the type of the object";
- break;
-
- case DOMException.NAMESPACE_ERR : // 14
- msg = "NAMESPACE_ERR: The namespace declaration is incorrect";
- break;
-
- case DOMException.INVALID_ACCESS_ERR : // 15
- msg = "INVALID_ACCESS_ERR: The object does not support this function";
- break;
-
- default :
- msg = "UNKNOWN: Unknown Exception Code ("+ code +")";
- }
-
- return msg;
- }
-});
-
-
-/**
-* Defined 'globally' to this scope. Remember everything is wrapped in a closure so this doesnt show up
-* in the outer most global scope.
-*/
-
-/**
- * process SAX events
- *
- * @author Jon van Noort (jon@webarcana.com.au), David Joham (djoham@yahoo.com) and Scott Severtson
- *
- * @param impl : DOMImplementation
- * @param doc : DOMDocument - the Document to contain the parsed XML string
- * @param p : XMLP - the SAX Parser
- *
- * @return : DOMDocument
- */
-function __parseLoop__(impl, doc, p) {
- var iEvt, iNode, iAttr, strName;
- var iNodeParent = doc;
-
- var el_close_count = 0;
-
- var entitiesList = new Array();
- var textNodesList = new Array();
-
- // if namespaceAware, add default namespace
- if (impl.namespaceAware) {
- var iNS = doc.createNamespace(""); // add the default-default namespace
- iNS.value = "http://www.w3.org/2000/xmlns/";
- doc._namespaces.setNamedItem(iNS);
- }
-
- // loop until SAX parser stops emitting events
- while(true) {
- // get next event
- iEvt = p.next();
-
- if (iEvt == XMLP._ELM_B) { // Begin-Element Event
- var pName = p.getName(); // get the Element name
- pName = trim(pName, true, true); // strip spaces from Element name
- if(pName.toLowerCase() == 'script')
- p.replaceEntities = false;
-
- if (!impl.namespaceAware) {
- iNode = doc.createElement(p.getName()); // create the Element
-
- // add attributes to Element
- for(var i = 0; i < p.getAttributeCount(); i++) {
- strName = p.getAttributeName(i); // get Attribute name
- iAttr = iNode.getAttributeNode(strName); // if Attribute exists, use it
-
- if(!iAttr) {
- iAttr = doc.createAttribute(strName); // otherwise create it
- }
-
- iAttr.value = p.getAttributeValue(i); // set Attribute value
- iNode.setAttributeNode(iAttr); // attach Attribute to Element
- }
- }
- else { // Namespace Aware
- // create element (with empty namespaceURI,
- // resolve after namespace 'attributes' have been parsed)
- iNode = doc.createElementNS("", p.getName());
-
- // duplicate ParentNode's Namespace definitions
- iNode._namespaces = __cloneNamedNodes__(iNodeParent._namespaces, iNode);
-
- // add attributes to Element
- for(var i = 0; i < p.getAttributeCount(); i++) {
- strName = p.getAttributeName(i); // get Attribute name
-
- // if attribute is a namespace declaration
- if (__isNamespaceDeclaration__(strName)) {
- // parse Namespace Declaration
- var namespaceDec = __parseNSName__(strName);
-
- if (strName != "xmlns") {
- iNS = doc.createNamespace(strName); // define namespace
- }
- else {
- iNS = doc.createNamespace(""); // redefine default namespace
- }
- iNS.value = p.getAttributeValue(i); // set value = namespaceURI
-
- iNode._namespaces.setNamedItem(iNS); // attach namespace to namespace collection
- }
- else { // otherwise, it is a normal attribute
- iAttr = iNode.getAttributeNode(strName); // if Attribute exists, use it
-
- if(!iAttr) {
- iAttr = doc.createAttributeNS("", strName); // otherwise create it
- }
-
- iAttr.value = p.getAttributeValue(i); // set Attribute value
- iNode.setAttributeNodeNS(iAttr); // attach Attribute to Element
-
- if (__isIdDeclaration__(strName)) {
- iNode.id = p.getAttributeValue(i); // cache ID for getElementById()
- }
- }
- }
-
- // resolve namespaceURIs for this Element
- if (iNode._namespaces.getNamedItem(iNode.prefix)) {
- iNode.namespaceURI = iNode._namespaces.getNamedItem(iNode.prefix).value;
- }
-
- // for this Element's attributes
- for (var i = 0; i < iNode.attributes.length; i++) {
- if (iNode.attributes.item(i).prefix != "") { // attributes do not have a default namespace
- if (iNode._namespaces.getNamedItem(iNode.attributes.item(i).prefix)) {
- iNode.attributes.item(i).namespaceURI = iNode._namespaces.getNamedItem(iNode.attributes.item(i).prefix).value;
- }
- }
- }
- }
-
- // if this is the Root Element
- if (iNodeParent.nodeType == DOMNode.DOCUMENT_NODE) {
- iNodeParent.documentElement = iNode; // register this Element as the Document.documentElement
- }
-
- iNodeParent.appendChild(iNode); // attach Element to parentNode
- iNodeParent = iNode; // descend one level of the DOM Tree
- }
-
- else if(iEvt == XMLP._ELM_E) { // End-Element Event
- //handle script tag
- if(iNodeParent.nodeName.toLowerCase() == 'script'){
- p.replaceEntities = true;
- $env.loadLocalScript(iNodeParent, p);
- }
- iNodeParent = iNodeParent.parentNode; // ascend one level of the DOM Tree
-
- }
-
- else if(iEvt == XMLP._ELM_EMP) { // Empty Element Event
- pName = p.getName(); // get the Element name
- pName = trim(pName, true, true); // strip spaces from Element name
-
- if (!impl.namespaceAware) {
- iNode = doc.createElement(pName); // create the Element
-
- // add attributes to Element
- for(var i = 0; i < p.getAttributeCount(); i++) {
- strName = p.getAttributeName(i); // get Attribute name
- iAttr = iNode.getAttributeNode(strName); // if Attribute exists, use it
-
- if(!iAttr) {
- iAttr = doc.createAttribute(strName); // otherwise create it
- }
-
- iAttr.value = p.getAttributeValue(i); // set Attribute value
- iNode.setAttributeNode(iAttr); // attach Attribute to Element
- }
- }
- else { // Namespace Aware
- // create element (with empty namespaceURI,
- // resolve after namespace 'attributes' have been parsed)
- iNode = doc.createElementNS("", p.getName());
-
- // duplicate ParentNode's Namespace definitions
- iNode._namespaces = __cloneNamedNodes__(iNodeParent._namespaces, iNode);
-
- // add attributes to Element
- for(var i = 0; i < p.getAttributeCount(); i++) {
- strName = p.getAttributeName(i); // get Attribute name
-
- // if attribute is a namespace declaration
- if (__isNamespaceDeclaration__(strName)) {
- // parse Namespace Declaration
- var namespaceDec = __parseNSName__(strName);
-
- if (strName != "xmlns") {
- iNS = doc.createNamespace(strName); // define namespace
- }
- else {
- iNS = doc.createNamespace(""); // redefine default namespace
- }
- iNS.value = p.getAttributeValue(i); // set value = namespaceURI
-
- iNode._namespaces.setNamedItem(iNS); // attach namespace to namespace collection
- }
- else { // otherwise, it is a normal attribute
- iAttr = iNode.getAttributeNode(strName); // if Attribute exists, use it
-
- if(!iAttr) {
- iAttr = doc.createAttributeNS("", strName); // otherwise create it
- }
-
- iAttr.value = p.getAttributeValue(i); // set Attribute value
- iNode.setAttributeNodeNS(iAttr); // attach Attribute to Element
-
- if (__isIdDeclaration__(strName)) {
- iNode.id = p.getAttributeValue(i); // cache ID for getElementById()
- }
- }
- }
-
- // resolve namespaceURIs for this Element
- if (iNode._namespaces.getNamedItem(iNode.prefix)) {
- iNode.namespaceURI = iNode._namespaces.getNamedItem(iNode.prefix).value;
- }
-
- // for this Element's attributes
- for (var i = 0; i < iNode.attributes.length; i++) {
- if (iNode.attributes.item(i).prefix != "") { // attributes do not have a default namespace
- if (iNode._namespaces.getNamedItem(iNode.attributes.item(i).prefix)) {
- iNode.attributes.item(i).namespaceURI = iNode._namespaces.getNamedItem(iNode.attributes.item(i).prefix).value;
- }
- }
- }
- }
-
- // if this is the Root Element
- if (iNodeParent.nodeType == DOMNode.DOCUMENT_NODE) {
- iNodeParent.documentElement = iNode; // register this Element as the Document.documentElement
- }
-
- iNodeParent.appendChild(iNode); // attach Element to parentNode
- }
- else if(iEvt == XMLP._TEXT || iEvt == XMLP._ENTITY) { // TextNode and entity Events
- // get Text content
- var pContent = p.getContent().substring(p.getContentBegin(), p.getContentEnd());
-
- if (!impl.preserveWhiteSpace ) {
- if (trim(pContent, true, true) == "") {
- pContent = ""; //this will cause us not to create the text node below
- }
- }
-
- if (pContent.length > 0) { // ignore empty TextNodes
- var textNode = doc.createTextNode(pContent);
- iNodeParent.appendChild(textNode); // attach TextNode to parentNode
-
- //the sax parser breaks up text nodes when it finds an entity. For
- //example hello&lt;there will fire a text, an entity and another text
- //this sucks for the dom parser because it looks to us in this logic
- //as three text nodes. I fix this by keeping track of the entity nodes
- //and when we're done parsing, calling normalize on their parent to
- //turn the multiple text nodes into one, which is what DOM users expect
- //the code to do this is at the bottom of this function
- if (iEvt == XMLP._ENTITY) {
- entitiesList[entitiesList.length] = textNode;
- }
- else {
- //I can't properly decide how to handle preserve whitespace
- //until the siblings of the text node are built due to
- //the entitiy handling described above. I don't know that this
- //will be all of the text node or not, so trimming is not appropriate
- //at this time. Keep a list of all the text nodes for now
- //and we'll process the preserve whitespace stuff at a later time.
- textNodesList[textNodesList.length] = textNode;
- }
- }
- }
- else if(iEvt == XMLP._PI) { // ProcessingInstruction Event
- // attach ProcessingInstruction to parentNode
- iNodeParent.appendChild(doc.createProcessingInstruction(p.getName(), p.getContent().substring(p.getContentBegin(), p.getContentEnd())));
- }
- else if(iEvt == XMLP._CDATA) { // CDATA Event
- // get CDATA data
- pContent = p.getContent().substring(p.getContentBegin(), p.getContentEnd());
-
- if (!impl.preserveWhiteSpace) {
- pContent = trim(pContent, true, true); // trim whitespace
- pContent.replace(/ +/g, ' '); // collapse multiple spaces to 1 space
- }
-
- if (pContent.length > 0) { // ignore empty CDATANodes
- iNodeParent.appendChild(doc.createCDATASection(pContent)); // attach CDATA to parentNode
- }
- }
- else if(iEvt == XMLP._COMMENT) { // Comment Event
- // get COMMENT data
- var pContent = p.getContent().substring(p.getContentBegin(), p.getContentEnd());
-
- if (!impl.preserveWhiteSpace) {
- pContent = trim(pContent, true, true); // trim whitespace
- pContent.replace(/ +/g, ' '); // collapse multiple spaces to 1 space
- }
-
- if (pContent.length > 0) { // ignore empty CommentNodes
- iNodeParent.appendChild(doc.createComment(pContent)); // attach Comment to parentNode
- }
- }
- else if(iEvt == XMLP._DTD) { // ignore DTD events
- }
- else if(iEvt == XMLP._ERROR) {
- $error("Fatal Error: " + p.getContent() +
- "\nLine: " + p.getLineNumber() +
- "\nColumn: " + p.getColumnNumber() + "\n");
- throw(new DOMException(DOMException.SYNTAX_ERR));
- }
- else if(iEvt == XMLP._NONE) { // no more events
- //steven woods notes that unclosed tags are rejected elsewhere and this check
- //breaks a table patching routine
- /*if (iNodeParent == doc) { // confirm that we have recursed back up to root
- break;
- }
- else {
- throw(new DOMException(DOMException.SYNTAX_ERR)); // one or more Tags were not closed properly
- }*/
- break;
-
- }
- }
-
- //normalize any entities in the DOM to a single textNode
- for (var i = 0; i < entitiesList.length; i++) {
- var entity = entitiesList[i];
- //its possible (if for example two entities were in the
- //same domnode, that the normalize on the first entitiy
- //will remove the parent for the second. Only do normalize
- //if I can find a parent node
- var parentNode = entity.parentNode;
- if (parentNode) {
- parentNode.normalize();
-
- //now do whitespace (if necessary)
- //it was not done for text nodes that have entities
- if(!impl.preserveWhiteSpace) {
- var children = parentNode.childNodes;
- for ( var j = 0; j < children.length; j++) {
- var child = children.item(j);
- if (child.nodeType == DOMNode.TEXT_NODE) {
- var childData = child.data;
- childData.replace(/\s/g, ' ');
- child.data = childData;
- }
- }
- }
- }
- }
-
- //do the preserve whitespace processing on the rest of the text nodes
- //It's possible (due to the processing above) that the node will have been
- //removed from the tree. Only do whitespace checking if parentNode is not null.
- //This may duplicate the whitespace processing for some nodes that had entities in them
- //but there's no way around that
- if (!impl.preserveWhiteSpace) {
- for (var i = 0; i < textNodesList.length; i++) {
- var node = textNodesList[i];
- if (node.parentNode != null) {
- var nodeData = node.data;
- nodeData.replace(/\s/g, ' ');
- node.data = nodeData;
- }
- }
-
- }
-};
-
-
-/**
- * @method DOMImplementation._isNamespaceDeclaration - Return true, if attributeName is a namespace declaration
- * @author Jon van Noort (jon@webarcana.com.au)
- * @param attributeName : string - the attribute name
- * @return : boolean
- */
-function __isNamespaceDeclaration__(attributeName) {
- // test if attributeName is 'xmlns'
- return (attributeName.indexOf('xmlns') > -1);
-};
-
-/**
- * @method DOMImplementation._isIdDeclaration - Return true, if attributeName is an id declaration
- * @author Jon van Noort (jon@webarcana.com.au)
- * @param attributeName : string - the attribute name
- * @return : boolean
- */
-function __isIdDeclaration__(attributeName) {
- // test if attributeName is 'id' (case insensitive)
- return (attributeName.toLowerCase() == 'id');
-};
-
-/**
- * @method DOMImplementation._isValidName - Return true,
- * if name contains no invalid characters
- * @author Jon van Noort (jon@webarcana.com.au)
- * @param name : string - the candidate name
- * @return : boolean
- */
-function __isValidName__(name) {
- // test if name contains only valid characters
- return name.match(re_validName);
-};
-var re_validName = /^[a-zA-Z_:][a-zA-Z0-9\.\-_:]*$/;
-
-/**
- * @method DOMImplementation._isValidString - Return true, if string does not contain any illegal chars
- * All of the characters 0 through 31 and character 127 are nonprinting control characters.
- * With the exception of characters 09, 10, and 13, (Ox09, Ox0A, and Ox0D)
- * Note: different from _isValidName in that ValidStrings may contain spaces
- * @author Jon van Noort (jon@webarcana.com.au)
- * @param name : string - the candidate string
- * @return : boolean
- */
-function __isValidString__(name) {
- // test that string does not contains invalid characters
- return (name.search(re_invalidStringChars) < 0);
-};
-var re_invalidStringChars = /\x01|\x02|\x03|\x04|\x05|\x06|\x07|\x08|\x0B|\x0C|\x0E|\x0F|\x10|\x11|\x12|\x13|\x14|\x15|\x16|\x17|\x18|\x19|\x1A|\x1B|\x1C|\x1D|\x1E|\x1F|\x7F/;
-
-/**
- * @method DOMImplementation._parseNSName - parse the namespace name.
- * if there is no colon, the
- * @author Jon van Noort (jon@webarcana.com.au)
- * @param qualifiedName : string - The qualified name
- * @return : NSName - [
- .prefix : string - The prefix part of the qname
- .namespaceName : string - The namespaceURI part of the qname
- ]
- */
-function __parseNSName__(qualifiedName) {
- var resultNSName = new Object();
-
- resultNSName.prefix = qualifiedName; // unless the qname has a namespaceName, the prefix is the entire String
- resultNSName.namespaceName = "";
-
- // split on ':'
- var delimPos = qualifiedName.indexOf(':');
- if (delimPos > -1) {
- // get prefix
- resultNSName.prefix = qualifiedName.substring(0, delimPos);
- // get namespaceName
- resultNSName.namespaceName = qualifiedName.substring(delimPos +1, qualifiedName.length);
- }
- return resultNSName;
-};
-
-/**
- * @method DOMImplementation._parseQName - parse the qualified name
- * @author Jon van Noort (jon@webarcana.com.au)
- * @param qualifiedName : string - The qualified name
- * @return : QName
- */
-function __parseQName__(qualifiedName) {
- var resultQName = new Object();
-
- resultQName.localName = qualifiedName; // unless the qname has a prefix, the local name is the entire String
- resultQName.prefix = "";
-
- // split on ':'
- var delimPos = qualifiedName.indexOf(':');
-
- if (delimPos > -1) {
- // get prefix
- resultQName.prefix = qualifiedName.substring(0, delimPos);
-
- // get localName
- resultQName.localName = qualifiedName.substring(delimPos +1, qualifiedName.length);
- }
-
- return resultQName;
-};
-
-$debug("Initializing document.implementation");
-var $implementation = new DOMImplementation();
-$implementation.namespaceAware = false;
-$implementation.errorChecking = false;$debug("Defining Document");
-/**
- * @class DOMDocument - The Document interface represents the entire HTML or XML document.
- * Conceptually, it is the root of the document tree, and provides the primary access to the document's data.
- *
- * @extends DOMNode
- * @author Jon van Noort (jon@webarcana.com.au)
- * @param implementation : DOMImplementation - the creator Implementation
- */
-var DOMDocument = function(implementation) {
- //$log("\tcreating dom document");
- this.DOMNode = DOMNode;
- this.DOMNode(this);
-
- this.doctype = null; // The Document Type Declaration (see DocumentType) associated with this document
- this.implementation = implementation; // The DOMImplementation object that handles this document.
- this.documentElement = null; // This is a convenience attribute that allows direct access to the child node that is the root element of the document
-
- this.nodeName = "#document";
- this._id = 0;
- this._lastId = 0;
- this._parseComplete = false; // initially false, set to true by parser
- this._url = "";
-
- this.ownerDocument = null;
-
- this._performingImportNodeOperation = false;
- //$log("\tfinished creating dom document " + this);
-};
-DOMDocument.prototype = new DOMNode;
-__extend__(DOMDocument.prototype, {
- addEventListener : function(){ window.addEventListener.apply(this, arguments); },
- removeEventListener : function(){ window.removeEventListener.apply(this, arguments); },
- attachEvent : function(){ window.addEventListener.apply(this, arguments); },
- detachEvent : function(){ window.removeEventListener.apply(this, arguments); },
- dispatchEvent : function(){ window.dispatchEvent.apply(this, arguments); },
-
- get styleSheets(){
- return [];/*TODO*/
- },
- get all(){
- return this.getElementsByTagName("*");
- },
- loadXML : function(xmlStr) {
- // create SAX Parser
- var parser = new XMLP(xmlStr+'');
-
- // create DOM Document
- var doc = new HTMLDocument(this.implementation);
- if(this === $document){
- $debug("Setting internal window.document");
- $document = doc;
- }
- // populate Document with Parsed Nodes
- try {
- __parseLoop__(this.implementation, doc, parser);
- //doc = html2dom(xmlStr+"", doc);
- //$log("\nhtml2xml\n" + doc.xml);
- } catch (e) {
- //$error(this.implementation.translateErrCode(e.code))
- $error(e);
- }
-
- // set parseComplete flag, (Some validation Rules are relaxed if this is false)
- doc._parseComplete = true;
- return doc;
- },
- load: function(url){
- $debug("Loading url into DOM Document: "+ url + " - (Asynch? "+$w.document.async+")");
- var scripts, _this = this;
- var xhr = new XMLHttpRequest();
- xhr.open("GET", url, $w.document.async);
- xhr.onreadystatechange = function(){
- try{
- _this.loadXML(xhr.responseText);
- }catch(e){
- $error("Error Parsing XML - ",e);
- _this.loadXML(
- "<html><head></head><body>"+
- "<h1>Parse Error</h1>"+
- "<p>"+e.toString()+"</p>"+
- "</body></html>");
- }
- _this._url = url;
-
- $info("Sucessfully loaded document at "+url);
- var event = document.createEvent();
- event.initEvent("load");
- $w.dispatchEvent( event );
- };
- xhr.send();
- },
- createEvent : function(eventType){
- var event;
- if(eventType === "UIEvents"){ event = new UIEvent();}
- else if(eventType === "MouseEvents"){ event = new MouseEvent();}
- else{ event = new Event(); }
- return event;
- },
- createExpression : function(xpath, nsuriMap){
- return new XPathExpression(xpath, nsuriMap);
- },
- createElement : function(tagName) {
- //$debug("DOMDocument.createElement( "+tagName+" )");
- // throw Exception if the tagName string contains an illegal character
- if (__ownerDocument__(this).implementation.errorChecking
- && (!__isValidName__(tagName))) {
- throw(new DOMException(DOMException.INVALID_CHARACTER_ERR));
- }
-
- // create DOMElement specifying 'this' as ownerDocument
- var node = new DOMElement(this);
-
- // assign values to properties (and aliases)
- node.tagName = tagName;
-
- return node;
- },
- createDocumentFragment : function() {
- // create DOMDocumentFragment specifying 'this' as ownerDocument
- var node = new DOMDocumentFragment(this);
- return node;
- },
- createTextNode: function(data) {
- // create DOMText specifying 'this' as ownerDocument
- var node = new DOMText(this);
-
- // assign values to properties (and aliases)
- node.data = data;
-
- return node;
- },
- createComment : function(data) {
- // create DOMComment specifying 'this' as ownerDocument
- var node = new DOMComment(this);
-
- // assign values to properties (and aliases)
- node.data = data;
-
- return node;
- },
- createCDATASection : function(data) {
- // create DOMCDATASection specifying 'this' as ownerDocument
- var node = new DOMCDATASection(this);
-
- // assign values to properties (and aliases)
- node.data = data;
-
- return node;
- },
- createProcessingInstruction : function(target, data) {
- // throw Exception if the target string contains an illegal character
- //$log("DOMDocument.createProcessingInstruction( "+target+" )");
- if (__ownerDocument__(this).implementation.errorChecking
- && (!__isValidName__(target))) {
- throw(new DOMException(DOMException.INVALID_CHARACTER_ERR));
- }
-
- // create DOMProcessingInstruction specifying 'this' as ownerDocument
- var node = new DOMProcessingInstruction(this);
-
- // assign values to properties (and aliases)
- node.target = target;
- node.data = data;
-
- return node;
- },
- createAttribute : function(name) {
- // throw Exception if the name string contains an illegal character
- //$log("DOMDocument.createAttribute( "+target+" )");
- if (__ownerDocument__(this).implementation.errorChecking
- && (!__isValidName__(name))) {
- throw(new DOMException(DOMException.INVALID_CHARACTER_ERR));
- }
-
- // create DOMAttr specifying 'this' as ownerDocument
- var node = new DOMAttr(this);
-
- // assign values to properties (and aliases)
- node.name = name;
-
- return node;
- },
- createElementNS : function(namespaceURI, qualifiedName) {
- //$log("DOMDocument.createElement( "+namespaceURI+", "+qualifiedName+" )");
- // test for exceptions
- if (__ownerDocument__(this).implementation.errorChecking) {
- // throw Exception if the Namespace is invalid
- if (!__isValidNamespace__(this, namespaceURI, qualifiedName)) {
- throw(new DOMException(DOMException.NAMESPACE_ERR));
- }
-
- // throw Exception if the qualifiedName string contains an illegal character
- if (!__isValidName__(qualifiedName)) {
- throw(new DOMException(DOMException.INVALID_CHARACTER_ERR));
- }
- }
-
- // create DOMElement specifying 'this' as ownerDocument
- var node = new DOMElement(this);
- var qname = __parseQName__(qualifiedName);
-
- // assign values to properties (and aliases)
- node.namespaceURI = namespaceURI;
- node.prefix = qname.prefix;
- node.localName = qname.localName;
- node.tagName = qualifiedName;
-
- return node;
- },
- createAttributeNS : function(namespaceURI, qualifiedName) {
- // test for exceptions
- if (__ownerDocument__(this).implementation.errorChecking) {
- // throw Exception if the Namespace is invalid
- if (!__isValidNamespace__(this, namespaceURI, qualifiedName, true)) {
- throw(new DOMException(DOMException.NAMESPACE_ERR));
- }
-
- // throw Exception if the qualifiedName string contains an illegal character
- if (!__isValidName__(qualifiedName)) {
- throw(new DOMException(DOMException.INVALID_CHARACTER_ERR));
- }
- }
-
- // create DOMAttr specifying 'this' as ownerDocument
- var node = new DOMAttr(this);
- var qname = __parseQName__(qualifiedName);
-
- // assign values to properties (and aliases)
- node.namespaceURI = namespaceURI;
- node.prefix = qname.prefix;
- node.localName = qname.localName;
- node.name = qualifiedName;
- node.nodeValue = "";
-
- return node;
- },
- createNamespace : function(qualifiedName) {
- // create DOMNamespace specifying 'this' as ownerDocument
- var node = new DOMNamespace(this);
- var qname = __parseQName__(qualifiedName);
-
- // assign values to properties (and aliases)
- node.prefix = qname.prefix;
- node.localName = qname.localName;
- node.name = qualifiedName;
- node.nodeValue = "";
-
- return node;
- },
- /** from David Flanagan's JavaScript - The Definitive Guide
- *
- * @param {String} xpathText
- * The string representing the XPath expression to evaluate.
- * @param {Node} contextNode
- * The node in this document against which the expression is to
- * be evaluated.
- * @param {Function} nsuriMapper
- * A function that will map from namespace prefix to to a full
- * namespace URL or null if no such mapping is required.
- * @param {Number} resultType
- * Specifies the type of object expected as a result, using
- * XPath conversions to coerce the result. Possible values for
- * type are the constrainsts defined by the XPathResult object.
- * (null if not required)
- * @param {XPathResult} result
- * An XPathResult object to be reused or null
- * if you want a new XPathResult object to be created.
- * @returns {XPathResult} result
- * A XPathResult object representing the evaluation of the
- * expression against the given context node.
- * @throws {Exception} e
- * This method may throw an exception if the xpathText contains
- * a syntax error, if the expression cannot be converted to the
- * desired resultType, if the expression contains namespaces
- * that nsuriMapper cannot resolve, or if contextNode is of the
- * wrong type or is not assosciated with this document.
- * @seealso
- * Document.evaluate
- */
- /*evaluate: function(xpathText, contextNode, nsuriMapper, resultType, result){
- return new XPathExpression().evaluate();
- },*/
- getElementById : function(elementId) {
- var retNode = null,
- node;
- // loop through all Elements in the 'all' collection
- var all = this.all;
- for (var i=0; i < all.length; i++) {
- node = all[i];
- // if id matches & node is alive (ie, connected (in)directly to the documentElement)
- if (node.id == elementId) {
- if((__ownerDocument__(node).documentElement._id == this.documentElement._id)){
- retNode = node;
- //$log("Found node with id = " + node.id);
- break;
- }
- }
- }
-
- //if(retNode == null){$log("Couldn't find id " + elementId);}
- return retNode;
- },
- normalizeDocument: function(){
- this.documentElement.normalize();
- },
- get nodeType(){
- return DOMNode.DOCUMENT_NODE;
- },
- get xml(){
- //$log("Serializing " + this);
- return this.documentElement.xml;
- },
- toString: function(){
- return "Document" + (typeof this._url == "string" ? ": " + this._url : "");
- },
- get defaultView(){ //TODO: why isnt this just 'return $w;'?
- return { getComputedStyle: function(elem){
- return { getPropertyValue: function(prop){
- prop = prop.replace(/\-(\w)/g,function(m,c){ return c.toUpperCase(); });
- var val = elem.style[prop];
- if ( prop == "opacity" && val == "" ){ val = "1"; }return val;
- }};
- }};
- },
- _genId : function() {
- this._lastId += 1; // increment lastId (to generate unique id)
- return this._lastId;
- }
-});
-
-
-var __isValidNamespace__ = function(doc, namespaceURI, qualifiedName, isAttribute) {
-
- if (doc._performingImportNodeOperation == true) {
- //we're doing an importNode operation (or a cloneNode) - in both cases, there
- //is no need to perform any namespace checking since the nodes have to have been valid
- //to have gotten into the DOM in the first place
- return true;
- }
-
- var valid = true;
- // parse QName
- var qName = __parseQName__(qualifiedName);
-
-
- //only check for namespaces if we're finished parsing
- if (this._parseComplete == true) {
-
- // if the qualifiedName is malformed
- if (qName.localName.indexOf(":") > -1 ){
- valid = false;
- }
-
- if ((valid) && (!isAttribute)) {
- // if the namespaceURI is not null
- if (!namespaceURI) {
- valid = false;
- }
- }
-
- // if the qualifiedName has a prefix
- if ((valid) && (qName.prefix == "")) {
- valid = false;
- }
-
- }
-
- // if the qualifiedName has a prefix that is "xml" and the namespaceURI is
- // different from "http://www.w3.org/XML/1998/namespace" [Namespaces].
- if ((valid) && (qName.prefix == "xml") && (namespaceURI != "http://www.w3.org/XML/1998/namespace")) {
- valid = false;
- }
-
- return valid;
-};
-
-$w.Document = DOMDocument;
-/*
-* parser.js
-*/
-/*
- * HTML Parser By John Resig (ejohn.org)
- * Original code by Erik Arvidsson, Mozilla Public License
- * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
- *
- * // Use like so:
- * HTMLParser(htmlString, {
- * start: function(tag, attrs, unary) {},
- * end: function(tag) {},
- * chars: function(text) {},
- * comment: function(text) {}
- * });
- *
- * // or to get an XML string:
- * HTMLtoXML(htmlString);
- *
- * // or to get an XML DOM Document
- * HTMLtoDOM(htmlString);
- *
- * // or to inject into an existing document/DOM node
- * HTMLtoDOM(htmlString, document);
- * HTMLtoDOM(htmlString, document.body);
- *
- */
- var html2dom, html2xml;
-
-(function(){
-
- // Regular Expressions for parsing tags and attributes
- var startTag = /^<([\w\:\-]+)((?:\s+[\w\:\-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/,
- endTag = /^<\/([\w\:\-]+)[^>]*>/,
- attr = /([\w\:\-]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g;
- // Empty Elements - HTML 4.01
- var empty = makeMap("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed");
-
- // Block Elements - HTML 4.01
- var block = makeMap("address,applet,blockquote,button,center,dd,del,dir,div,dl,dt,fieldset,form,frameset,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,p,pre,script,table,tbody,td,tfoot,th,thead,tr,ul");
-
- // Inline Elements - HTML 4.01
- var inline = makeMap("a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var");
-
- // Elements that you can, intentionally, leave open
- // (and which close themselves)
- var closeSelf = makeMap("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr");
-
- // Attributes that have their values filled in disabled="disabled"
- var fillAttrs = makeMap("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected");
-
- // Special Elements (can contain anything)
- var special = makeMap("script,style");
-
- var HTMLParser = function( html, handler ) {
- var index, chars, match, stack = [], last = html;
- stack.last = function(){
- return this[ this.length - 1 ];
- };
-
- while ( html ) {
- //$log("HTMLParser: chunking... ");
- chars = true;
-
- // Make sure we're not in a script or style element
- if ( !stack.last() || !special[ stack.last() ] ) {
-
- //$log("HTMLParser: ... ");
- // Comment
- if ( html.indexOf("<!--") === 0 ) {
- //$log("HTMLParser: comment ");
- index = html.indexOf("-->");
-
- if ( index >= 0 ) {
- if ( handler.comment )
- handler.comment( html.substring( 4, index ) );
- html = html.substring( index + 3 );
- chars = false;
- }
-
- // end tag
- } else if ( html.indexOf("</") === 0 ) {
- //$log("HTMLParser: endtag ");
- match = html.match( endTag );
-
- if ( match ) {
- //$log("HTMLParser: endtag match : "+match[0]);
- html = html.substring( match[0].length );
- match[0].replace( endTag, parseEndTag );
- chars = false;
- }
-
- // start tag
- } else if ( html.indexOf("<") === 0 ) {
- //$log("HTMLParser: starttag ");
- match = html.match( startTag );
-
- if ( match ) {
- //$log("HTMLParser: starttag match : "+match[0]);
- html = html.substring( match[0].length );
- match[0].replace( startTag, parseStartTag );
- chars = false;
- }
- }
-
- if ( chars ) {
- //$log("HTMLParser: other ");
- index = html.indexOf("<");
- var text = index < 0 ? html : html.substring( 0, index );
- html = index < 0 ? "" : html.substring( index );
- if ( handler.chars ){
- //$log("HTMLParser: chars " + text);
- handler.chars( text );
- }
- }
- } else {
- //$log("HTMLParser: special ");
- html = html.replace(new RegExp("(.*)<\/" + stack.last() + "[^>]*>"), function(all, text){
- text = text.replace(/<!--(.*?)-->/g, "$1").
- replace(/<!\[CDATA\[(.*?)]]>/g, "$1");
- if ( handler.chars ){
- //$log("HTMLParser: special chars " + text);
- handler.chars( text );
- }
- return "";
- });
- parseEndTag( "", stack.last() );
- }
- if ( html == last ){throw "Parse Error: " + html;}
- last = html;
- }
-
- // Clean up any remaining tags
- parseEndTag();
-
- function parseStartTag( tag, tagName, rest, unary ) {
- if ( block[ tagName ] ) {
- while ( stack.last() && inline[ stack.last() ] ) {
- parseEndTag( "", stack.last() );
- }
- }
-
- if ( closeSelf[ tagName ] && stack.last() == tagName ) {
- parseEndTag( "", tagName );
- }
-
- unary = empty[ tagName ] || !!unary;
-
- if ( !unary )
- stack.push( tagName );
-
- if ( handler.start ) {
- var attrs = [];
-
- rest.replace(attr, function(match, name) {
- var value = arguments[2] ? arguments[2] :
- arguments[3] ? arguments[3] :
- arguments[4] ? arguments[4] :
- fillAttrs[name] ? name : "";
-
- attrs.push({
- name: name,
- value: value,
- escaped: value.replace(/(^|[^\\])"/g, '$1\\\"') //"
- });
- });
-
- if ( handler.start ){
- //$log("unary ? : "+unary);
- handler.start( tagName, attrs, unary );
- }
- }
- }
-
- function parseEndTag( tag, tagName ) {
- var pos;
- // If no tag name is provided, clean shop
- if ( !tagName ){
- pos = 0;
- }else{
- // Find the closest opened tag of the same type
- for ( pos = stack.length - 1; pos >= 0; pos-- ){
- //$log("parseEndTag : "+stack[ pos ] );
- if ( stack[ pos ] == tagName ){
- break;
- }
- }
- }
- if ( pos >= 0 ) {
- // Close all the open elements, up the stack
- for ( var i = stack.length - 1; i >= pos; i-- ){
- if ( handler.end ){
- //$log("end : "+stack[ i ] );
- handler.end( stack[ i ] );
- }
- }
- // Remove the open elements from the stack
- //$log("setting stack length : " + stack.length + " -> " +pos );
- stack.length = pos;
- }
- }
- };
-
- html2xml = function( html ) {
- var results = "";
-
- HTMLParser(html, {
- start: function( tag, attrs, unary ) {
- results += "<" + tag;
-
- for ( var i = 0; i < attrs.length; i++ )
- results += " " + attrs[i].name + '="' + attrs[i].escaped + '"';
-
- results += (unary ? "/" : "") + ">";
- },
- end: function( tag ) {
- results += "</" + tag + ">";
- },
- chars: function( text ) {
- results += text;
- },
- comment: function( text ) {
- results += "<!--" + text + "-->";
- }
- });
-
- return results;
- };
-
- html2dom = function( html, doc ) {
- // There can be only one of these elements
- var one = makeMap("html,head,body,title");
-
- // Enforce a structure for the document
- /*var structure = {
- link: "head",
- base: "head"
- };*/
-
- if ( !doc ) {
- if ( typeof DOMDocument != "undefined" ){
- doc = new DOMDocument();
- }else if ( typeof document != "undefined" && document.implementation && document.implementation.createDocument ){
- doc = document.implementation.createDocument("", "", null);
- }else if ( typeof ActiveX != "undefined" ){
- doc = new ActiveXObject("Msxml.DOMDocument");
- }
- } else {
- doc = doc.ownerDocument ||
- doc.getOwnerDocument && doc.getOwnerDocument() ||
- doc;
- }
-
- var elems = [],
- documentElement = doc.documentElement ||
- doc.getDocumentElement && doc.getDocumentElement();
-
- // If we're dealing with an empty document then we
- // need to pre-populate it with the HTML document structure
- /*if ( !documentElement && doc.createElement ) (function(){
- //$log("HTMLtoDOM: adding structure... ");
- var html = doc.createElement("html");
- var head = doc.createElement("head");
- head.appendChild( doc.createElement("title") );
- html.appendChild( head );
- html.appendChild( doc.createElement("body") );
- doc.appendChild( html );
- doc.documentElement = html;
- })();*/
-
- // Find all the unique elements
- /*if ( doc.getElementsByTagName ){
- for ( var i in one ){
- one[ i ] = doc.getElementsByTagName( i )[0];
- }
- }*/
-
- // If we're working with a document, inject contents into
- // the body element
- var curParentNode;// = one.body;
-
- //$log("HTMLtoDOM: Parsing... ");
- HTMLParser( html, {
- start: function( tagName, attrs, unary ) {
-
- var elem;
- //$log("HTMLtoDOM: createElement... " + tagName);
- elem = doc.createElement( tagName );
-
-
- for ( var attr in attrs ){
- //$log("HTMLtoDOM: setAttribute... " + attrs[ attr ].name);
- elem.setAttribute( attrs[ attr ].name, attrs[ attr ].value );
- }
-
- if ( !doc.documentElement ){
- //$log("HTMLtoDOM: documentElement... " + elem.nodeName);
- doc.documentElement = elem;
- doc.appendChild( elem );
- }
-
- else if ( curParentNode && curParentNode.appendChild ){
- //$log("HTMLtoDOM: curParentNode.appendChild... " + curParentNode.nodeName + " -> " +elem.nodeName);
- curParentNode.appendChild( elem );
- }
-
- if ( !unary ) {
- //$log("start : push into elems[] " + tagName);
- elems.push( elem );
- curParentNode = elem;
- }
- },
- end: function( tag ) {
- //$log(tag + " : elems.lengths : "+elems.length);
- elems.length -= 1;
-
- // Init the new parentNode
- curParentNode = elems[ elems.length - 1 ];
-
- },
- chars: function( text ) {
- curParentNode.appendChild( doc.createTextNode( text ) );
- },
- comment: function( text ) {
- curParentNode.appendChild( doc.createComment( text ) );
- }
- });
-
- //$log("HTMLtoDOM: doc... " + doc);
- return doc;
- };
-
- function makeMap(str){
- var obj = {}, items = str.split(",");
- for ( var i = 0; i < items.length; i++ )
- obj[ items[i] ] = true;
- return obj;
- };
-
-})( );
-$debug("Defining HTMLDocument");
-/*
-* HTMLDocument - DOM Level 2
-*/
-/**
- * @class HTMLDocument - The Document interface represents the entire HTML or XML document.
- * Conceptually, it is the root of the document tree, and provides the primary access to the document's data.
- *
- * @extends DOMDocument
- */
-var HTMLDocument = function(implementation) {
- this.DOMDocument = DOMDocument;
- this.DOMDocument(implementation);
-
- this.title = "";
- this._refferer = "";
- this._domain;
- this._open = false;
-};
-HTMLDocument.prototype = new DOMDocument;
-__extend__(HTMLDocument.prototype, {
- createElement: function(tagName){
- // throw Exception if the tagName string contains an illegal character
- if (__ownerDocument__(this).implementation.errorChecking &&
- (!__isValidName__(tagName))) {
- throw(new DOMException(DOMException.INVALID_CHARACTER_ERR));
- }
- tagName = tagName.toUpperCase();
- // create DOMElement specifying 'this' as ownerDocument
- //This is an html document so we need to use explicit interfaces per the
- if( tagName.match(/^A$/)) {node = new HTMLAnchorElement(this);}
- else if(tagName.match(/AREA/)) {node = new HTMLAreaElement(this);}
- else if(tagName.match(/BASE/)) {node = new HTMLBaseElement(this);}
- else if(tagName.match(/BLOCKQUOTE|Q/)) {node = new HTMLQuoteElement(this);}
- else if(tagName.match(/BODY/)) {node = new HTMLElement(this);}
- else if(tagName.match(/BR/)) {node = new HTMLElement(this);}
- else if(tagName.match(/BUTTON/)) {node = new HTMLButtonElement(this);}
- else if(tagName.match(/CAPTION/)) {node = new HTMLElement(this);}
- else if(tagName.match(/COL|COLGROUP/)) {node = new HTMLTableColElement(this);}
- else if(tagName.match(/DEL|INS/)) {node = new HTMLModElement(this);}
- else if(tagName.match(/DIV/)) {node = new HTMLElement(this);}
- else if(tagName.match(/DL/)) {node = new HTMLElement(this);}
- else if(tagName.match(/FIELDSET/)) {node = new HTMLFieldSetElement(this);}
- else if(tagName.match(/FORM/)) {node = new HTMLFormElement(this);}
- else if(tagName.match(/^FRAME$/)) {node = new HTMLFrameElement(this);}
- else if(tagName.match(/FRAMESET/)) {node = new HTMLFrameSetElement(this);}
- else if(tagName.match(/H1|H2|H3|H4|H5|H6/)) {node = new HTMLElement(this);}
- else if(tagName.match(/HEAD/)) {node = new HTMLHeadElement(this);}
- else if(tagName.match(/HR/)) {node = new HTMLElement(this);}
- else if(tagName.match(/HTML/)) {node = new HTMLElement(this);}
- else if(tagName.match(/IFRAME/)) {node = new HTMLIFrameElement(this);}
- else if(tagName.match(/IMG/)) {node = new HTMLImageElement(this);}
- else if(tagName.match(/INPUT/)) {node = new HTMLInputElement(this);}
- else if(tagName.match(/LABEL/)) {node = new HTMLLabelElement(this);}
- else if(tagName.match(/LEGEND/)) {node = new HTMLLegendElement(this);}
- else if(tagName.match(/^LI$/)) {node = new HTMLElement(this);}
- else if(tagName.match(/LINK/)) {node = new HTMLLinkElement(this);}
- else if(tagName.match(/MAP/)) {node = new HTMLMapElement(this);}
- else if(tagName.match(/META/)) {node = new HTMLMetaElement(this);}
- else if(tagName.match(/OBJECT/)) {node = new HTMLObjectElement(this);}
- else if(tagName.match(/OL/)) {node = new HTMLElement(this);}
- else if(tagName.match(/OPTGROUP/)) {node = new HTMLOptGroupElement(this);}
- else if(tagName.match(/OPTION/)) {node = new HTMLOptionElement(this);;}
- else if(tagName.match(/^P$/)) {node = new HTMLElement(this);}
- else if(tagName.match(/PARAM/)) {node = new HTMLParamElement(this);}
- else if(tagName.match(/PRE/)) {node = new HTMLElement(this);}
- else if(tagName.match(/SCRIPT/)) {node = new HTMLScriptElement(this);}
- else if(tagName.match(/SELECT/)) {node = new HTMLSelectElement(this);}
- else if(tagName.match(/STYLE/)) {node = new HTMLStyleElement(this);}
- else if(tagName.match(/TABLE/)) {node = new HTMLTableElement(this);}
- else if(tagName.match(/TBODY|TFOOT|THEAD/)) {node = new HTMLSectionElement(this);}
- else if(tagName.match(/TD|TH/)) {node = new HTMLTableCellElement(this);}
- else if(tagName.match(/TEXTAREA/)) {node = new HTMLElement(this);}
- else if(tagName.match(/TITLE/)) {node = new HTMLElement(this);}
- else if(tagName.match(/TR/)) {node = new HTMLTableRowElement(this);}
- else if(tagName.match(/UL/)) {node = new HTMLElement(this);}
- else{
- node = new HTMLElement(this);
- }
-
- // assign values to properties (and aliases)
- node.tagName = tagName;
- return node;
- },
- get anchors(){
- return new HTMLCollection(this.getElementsByTagName('a'), 'Anchor');
-
- },
- get applets(){
- return new HTMLCollection(this.getElementsByTagName('applet'), 'Applet');
-
- },
- get body(){
- var nodelist = this.getElementsByTagName('body');
- return nodelist.item(0);
-
- },
- set body(html){
- return this.replaceNode(this.body,html);
-
- },
- //set/get cookie see cookie.js
- get domain(){
- return this._domain||window.location.domain;
-
- },
- set domain(){
- /* TODO - requires a bit of thought to enforce domain restrictions */
- return;
-
- },
- get forms(){
- return new HTMLCollection(this.getElementsByTagName('form'), 'Form');
- },
- get images(){
- return new HTMLCollection(this.getElementsByTagName('img'), 'Image');
-
- },
- get lastModified(){
- /* TODO */
- return this._lastModified;
-
- },
- get links(){
- return new HTMLCollection(this.getElementsByTagName('a'), 'Link');
-
- },
- get location(){
- return $w.location
- },
- get referrer(){
- /* TODO */
- return this._refferer;
-
- },
- get URL(){
- /* TODO*/
- return this._url;
-
- },
- close : function(){
- /* TODO */
- this._open = false;
- },
- getElementsByName : function(name){
- //returns a real Array + the DOMNodeList
- var retNodes = __extend__([],new DOMNodeList(this, this.documentElement)),
- node;
- // loop through all Elements in the 'all' collection
- var all = this.all;
- for (var i=0; i < all.length; i++) {
- node = all[i];
- if (node.nodeType == DOMNode.ELEMENT_NODE && node.getAttribute('name') == name) {
- retNodes.push(node);
- }
- }
- return retNodes;
- },
- open : function(){
- /* TODO */
- this._open = true;
- },
- write: function(htmlstring){
- /* TODO */
- return;
-
- },
- writeln: function(htmlstring){
- this.write(htmlstring+'\n');
- },
- toString: function(){
- return "Document" + (typeof this._url == "string" ? ": " + this._url : "");
- },
- get innerHTML(){
- return this.documentElement.outerHTML;
-
- },
- get __html__(){
- return true;
-
- }
-});
-
-$w.HTMLDocument = HTMLDocument;
-$debug("Defining HTMLElement");
-/*
-* HTMLElement - DOM Level 2
-*/
-var HTMLElement = function(ownerDocument) {
- this.DOMElement = DOMElement;
- this.DOMElement(ownerDocument);
-
- this.$css2props = null;
-};
-HTMLElement.prototype = new DOMElement;
-__extend__(HTMLElement.prototype, {
- get className() {
- return this.getAttribute("class")||"";
-
- },
- set className(val) {
- return this.setAttribute("class",trim(val));
-
- },
- get dir() {
- return this.getAttribute("dir")||"ltr";
-
- },
- set dir(val) {
- return this.setAttribute("dir",val);
-
- },
- get id(){
- return this.getAttribute('id')||'';
-
- },
- set id(id){
- this.setAttribute('id', id);
-
- },
- get innerHTML(){
- return this.childNodes.xml;
-
- },
- set innerHTML(html){
- //$debug("htmlElement.innerHTML("+html+")");
- //Should be replaced with HTMLPARSER usage
- var doc = new DOMParser().
- parseFromString('<div>'+html+'</div>');
- var parent = doc.documentElement;
- while(this.firstChild != null){
- this.removeChild( this.firstChild );
- }
- var importedNode;
- while(parent.firstChild != null){
- importedNode = this.importNode(
- parent.removeChild( parent.firstChild ), true);
- this.appendChild( importedNode );
- }
- //Mark for garbage collection
- doc = null;
- },
- get lang() {
- return this.getAttribute("lang")||"";
-
- },
- set lang(val) {
- return this.setAttribute("lang",val);
-
- },
- get offsetHeight(){
- return Number(this.style["height"].replace("px",""));
- },
- get offsetWidth(){
- return Number(this.style["width"].replace("px",""));
- },
- offsetLeft: 0,
- offsetRight: 0,
- get offsetParent(){
- /* TODO */
- return;
- },
- set offsetParent(element){
- /* TODO */
- return;
- },
- scrollHeight: 0,
- scrollWidth: 0,
- scrollLeft: 0,
- scrollRight: 0,
- get style(){
- if(this.$css2props === null){
- this.$css2props = new CSS2Properties({
- cssText:this.getAttribute("style")
- });
- }
- return this.$css2props
- },
- get title() {
- return this.getAttribute("title")||"";
-
- },
- set title(val) {
- return this.setAttribute("title",val);
-
- },
- //Not in the specs but I'll leave it here for now.
- get outerHTML(){
- return this.xml;
-
- },
- scrollIntoView: function(){
- /*TODO*/
- return;
-
- },
- onclick: function(event){
- __eval__(this.getAttribute('onclick')||'')
- },
- ondblclick: function(event){
- __eval__(this.getAttribute('ondblclick')||'');
- },
- onkeydown: function(event){
- __eval__(this.getAttribute('onkeydown')||'');
- },
- onkeypress: function(event){
- __eval__(this.getAttribute('onkeypress')||'');
- },
- onkeyup: function(event){
- __eval__(this.getAttribute('onkeyup')||'');
- },
- onmousedown: function(event){
- __eval__(this.getAttribute('onmousedown')||'');
- },
- onmousemove: function(event){
- __eval__(this.getAttribute('onmousemove')||'');
- },
- onmouseout: function(event){
- __eval__(this.getAttribute('onmouseout')||'');
- },
- onmouseover: function(event){
- __eval__(this.getAttribute('onmouseover')||'');
- },
- onmouseup: function(event){
- __eval__(this.getAttribute('onmouseup')||'');
- }
-});
-
-var __eval__ = function(script){
- try{
- eval(script);
- }catch(e){
- $error(e);
- }
-};
-
-var __registerEventAttrs__ = function(elm){
- if(elm.hasAttribute('onclick')){
- elm.addEventListener('click', elm.onclick );
- }
- if(elm.hasAttribute('ondblclick')){
- elm.addEventListener('dblclick', elm.onclick );
- }
- if(elm.hasAttribute('onkeydown')){
- elm.addEventListener('keydown', elm.onclick );
- }
- if(elm.hasAttribute('onkeypress')){
- elm.addEventListener('keypress', elm.onclick );
- }
- if(elm.hasAttribute('onkeyup')){
- elm.addEventListener('keyup', elm.onclick );
- }
- if(elm.hasAttribute('onmousedown')){
- elm.addEventListener('mousedown', elm.onclick );
- }
- if(elm.hasAttribute('onmousemove')){
- elm.addEventListener('mousemove', elm.onclick );
- }
- if(elm.hasAttribute('onmouseout')){
- elm.addEventListener('mouseout', elm.onclick );
- }
- if(elm.hasAttribute('onmouseover')){
- elm.addEventListener('mouseover', elm.onclick );
- }
- if(elm.hasAttribute('onmouseup')){
- elm.addEventListener('mouseup', elm.onclick );
- }
- return elm;
-};
-
-var __click__ = function(element){
- var event = new Event({
- target:element,
- currentTarget:element
- });
- event.initEvent("click");
- element.dispatchEvent(event);
-};
-var __submit__ = function(element){
- var event = new Event({
- target:element,
- currentTarget:element
- });
- event.initEvent("submit");
- element.dispatchEvent(event);
-};
-var __focus__ = function(element){
- var event = new Event({
- target:element,
- currentTarget:element
- });
- event.initEvent("focus");
- element.dispatchEvent(event);
-};
-var __blur__ = function(element){
- var event = new Event({
- target:element,
- currentTarget:element
- });
- event.initEvent("blur");
- element.dispatchEvent(event);
-};
-
-$w.HTMLElement = HTMLElement;
-$debug("Defining HTMLCollection");
-/*
-* HTMLCollection - DOM Level 2
-* Implementation Provided by Steven Wood
-*/
-var HTMLCollection = function(nodelist, type){
-
- __setArray__(this, []);
- for (var i=0; i<nodelist.length; i++) {
- this[i] = nodelist[i];
- }
-
- this.length = nodelist.length;
-
-}
-
-HTMLCollection.prototype = {
-
- item : function (idx) {
- var ret = null;
- if ((idx >= 0) && (idx < this.length)) {
- ret = this[idx];
- }
-
- return ret;
- },
-
- namedItem : function (name) {
- }
-};
-
-$w.HTMLCollection = HTMLCollection;
-
-/*var HTMLCollection = function(nodelist, type){
- var $items = [],
- $item, i;
- if(type === "Anchor" ){
- for(i=0;i<nodelist.length;i++){
- //The name property is required to be add to the collection
- if(nodelist.item(i).name){
- item = new nodelist.item(i);
- $items.push(item);
- this[nodelist.item(i).name] = item;
- }
- }
- }else if(type === "Link"){
- for(i=0;i<nodelist.length;i++){
- //The name property is required to be add to the collection
- if(nodelist.item(i).href){
- item = new nodelist.item(i);
- $items.push(item);
- this[nodelist.item(i).name] = item;
- }
- }
- }else if(type === "Form"){
- for(i=0;i<nodelist.length;i++){
- //The name property is required to be add to the collection
- if(nodelist.item(i).href){
- item = new nodelist.item(i);
- $items.push(item);
- this[nodelist.item(i).name] = item;
- }
- }
- }
- setArray(this, $items);
- return __extend__(this, {
- item : function(i){return this[i];},
- namedItem : function(name){return this[name];}
- });
-};*/
-
- $debug("Defining HTMLAnchorElement");
-/*
-* HTMLAnchorElement - DOM Level 2
-*/
-var HTMLAnchorElement = function(ownerDocument) {
- //$log("creating anchor element");
- this.HTMLElement = HTMLElement;
- this.HTMLElement(ownerDocument);
-};
-HTMLAnchorElement.prototype = new HTMLElement;
-__extend__(HTMLAnchorElement.prototype, {
- get accessKey() {
- return this.getAttribute("accesskey") || "";
-
- },
- set accessKey(val) {
- return this.setAttribute("accesskey",val);
-
- },
- get charset() {
- return this.getAttribute("charset") || "";
-
- },
- set charset(val) {
- return this.setAttribute("charset",val);
-
- },
- get coords() {
- return this.getAttribute("coords") || "";
-
- },
- set coords(val) {
- return this.setAttribute("coords",val);
-
- },
- get href() {
- return this.getAttribute("href") || "";
-
- },
- set href(val) {
- return this.setAttribute("href",val);
-
- },
- get hreflang() {
- return this.getAttribute("hreflang") || "";
-
- },
- set hreflang(val) {
- return this.setAttribute("hreflang",val);
-
- },
- get name() {
- return this.getAttribute("name") || "";
-
- },
- set name(val) {
- return this.setAttribute("name",val);
-
- },
- get rel() {
- return this.getAttribute("rel") || "";
-
- },
- set rel(val) {
- return this.setAttribute("rel",val);
-
- },
- get rev() {
- return this.getAttribute("rev") || "";
-
- },
- set rev(val) {
- return this.setAttribute("rev",val);
-
- },
- get shape() {
- return this.getAttribute("shape") || "";
-
- },
- set shape(val) {
- return this.setAttribute("shape",val);
-
- },
- get tabIndex() {
- return this.getAttribute("tabindex") || "";
-
- },
- set tabIndex(val) {
- return this.setAttribute("tabindex",val);
-
- },
- get target() {
- return this.getAttribute("target") || "";
-
- },
- set target(val) {
- return this.setAttribute("target",val);
-
- },
- get type() {
- return this.getAttribute("type") || "";
-
- },
- set type(val) {
- return this.setAttribute("type",val);
-
- },
- blur:function(){
- __blur__(this);
-
- },
- focus:function(){
- __focus__(this);
-
- }
-});
-
-$w.HTMLAnchorElement = HTMLAnchorElement;$debug("Defining Anchor");
-/*
-* Anchor - DOM Level 2
-*/
-var Anchor = function(ownerDocument) {
- this.HTMLAnchorElement = HTMLAnchorElement;
- this.HTMLAnchorElement(ownerDocument);
-};
-
-(function(){
- //static regular expressions
- var hash = new RegExp('(\\#.*)'),
- hostname = new RegExp('\/\/([^\:\/]+)'),
- pathname = new RegExp('(\/[^\\?\\#]*)'),
- port = new RegExp('\:(\\d+)\/'),
- protocol = new RegExp('(^\\w*\:)'),
- search = new RegExp('(\\?[^\\#]*)');
-
- __extend__(Anchor.prototype, {
- get hash(){
- var m = hash.exec(this.href);
- return m&&m.length>1?m[1]:"";
- },
- set hash(_hash){
- //setting the hash is the only property of the location object
- //that doesn't cause the window to reload
- _hash = _hash.indexOf('#')===0?_hash:"#"+_hash;
- this.href = this.protocol + this.host + this.pathname + this.search + _hash;
- },
- get host(){
- return this.hostname + (this.port !== "")?":"+this.port:"";
- },
- set host(_host){
- this.href = this.protocol + _host + this.pathname + this.search + this.hash;
- },
- get hostname(){
- var m = hostname.exec(this.href);
- return m&&m.length>1?m[1]:"";
- },
- set hostname(_hostname){
- this.href = this.protocol + _hostname + ((this.port=="")?"":(":"+this.port)) +
- this.pathname + this.search + this.hash;
- },
- get pathname(){
- var m = this.href;
- m = pathname.exec(m.substring(m.indexOf(this.hostname)));
- return m&&m.length>1?m[1]:"/";
- },
- set pathname(_pathname){
- this.href = this.protocol + this.host + _pathname +
- this.search + this.hash;
- },
- get port(){
- var m = port.exec(this.href);
- return m&&m.length>1?m[1]:"";
- },
- set port(_port){
- this.href = this.protocol + this.hostname + ":"+_port + this.pathname +
- this.search + this.hash;
- },
- get protocol(){
- return protocol.exec(this.href)[0];
- },
- set protocol(_protocol){
- this.href = _protocol + this.host + this.pathname +
- this.search + this.hash;
- },
- get search(){
- var m = search.exec(this.href);
- return m&&m.length>1?m[1]:"";
- },
- set search(_search){
- this.href = this.protocol + this.host + this.pathname +
- _search + this.hash;
- }
- });
-
-})();
-
-$w.Anchor = Anchor;
-$debug("Defining HTMLAreaElement");
-/*
-* HTMLAreaElement - DOM Level 2
-*/
-var HTMLAreaElement = function(ownerDocument) {
- this.HTMLElement = HTMLElement;
- this.HTMLElement(ownerDocument);
-};
-HTMLAreaElement.prototype = new HTMLElement;
-__extend__(HTMLAreaElement.prototype, {
- get accessKey(){
- return this.getAttribute('accesskey');
- },
- set accessKey(value){
- this.setAttribute('accesskey',value);
- },
- get alt(){
- return this.getAttribute('alt');
- },
- set alt(value){
- this.setAttribute('alt',value);
- },
- get coords(){
- return this.getAttribute('coords');
- },
- set coords(value){
- this.setAttribute('coords',value);
- },
- get href(){
- return this.getAttribute('href');
- },
- set href(value){
- this.setAttribute('href',value);
- },
- get noHref(){
- return this.hasAttribute('href');
- },
- get shape(){
- //TODO
- return 0;
- },
- get tabIndex(){
- return this.getAttribute('tabindex');
- },
- set tabIndex(value){
- this.setAttribute('tabindex',value);
- },
- get target(){
- return this.getAttribute('target');
- },
- set target(value){
- this.setAttribute('target',value);
- }
-});
-
-$w.HTMLAreaElement = HTMLAreaElement;
- $debug("Defining HTMLBaseElement");
-/*
-* HTMLBaseElement - DOM Level 2
-*/
-var HTMLBaseElement = function(ownerDocument) {
- //$log("creating anchor element");
- this.HTMLElement = HTMLElement;
- this.HTMLElement(ownerDocument);
-};
-HTMLBaseElement.prototype = new HTMLElement;
-__extend__(HTMLBaseElement.prototype, {
- get href(){
- return this.getAttribute('href');
- },
- set href(value){
- this.setAttribute('href',value);
- },
- get target(){
- return this.getAttribute('target');
- },
- set target(value){
- this.setAttribute('target',value);
- }
-});
-
-$w.HTMLBaseElement = HTMLBaseElement; $debug("Defining HTMLQuoteElement");
-/*
-* HTMLQuoteElement - DOM Level 2
-*/
-var HTMLQuoteElement = function(ownerDocument) {
- this.HTMLElement = HTMLElement;
- this.HTMLElement(ownerDocument);
-};
-HTMLQuoteElement.prototype = new HTMLElement;
-__extend__(HTMLQuoteElement.prototype, {
- get cite(){
- return this.getAttribute('cite');
- },
- set cite(value){
- this.setAttribute('cite',value);
- }
-});
-
-$w.HTMLQuoteElement = HTMLQuoteElement; $debug("Defining HTMLButtonElement");
-/*
-* HTMLButtonElement - DOM Level 2
-*/
-var HTMLButtonElement = function(ownerDocument) {
- this.HTMLElement = HTMLElement;
- this.HTMLElement(ownerDocument);
-};
-HTMLButtonElement.prototype = new HTMLElement;
-__extend__(HTMLButtonElement.prototype, {
- get form(){
- var parent = this.parent;
- while(parent.nodeName.toLowerCase() != 'form'){
- parent = parent.parent;
- }
- return parent;
- },
- get accessKey(){
- return this.getAttribute('accesskey');
- },
- set accessKey(value){
- this.setAttribute('accesskey',value);
- },
- get tabIndex(){
- return Number(this.getAttribute('tabindex'));
- },
- set tabIndex(value){
- this.setAttribute('tabindex',Number(value));
- },
- get type(){
- return this.getAttribute('type');
- },
- set type(value){
- this.setAttribute('type',value);
- },
- get value(){
- return this.getAttribute('value');
- },
- set value(value){
- this.setAttribute('value',value);
- }
-});
-
-$w.HTMLButtonElement = HTMLButtonElement; $debug("Defining HTMLTableColElement");
-/*
-* HTMLTableColElement - DOM Level 2
-*/
-var HTMLTableColElement = function(ownerDocument) {
- this.HTMLElement = HTMLElement;
- this.HTMLElement(ownerDocument);
-};
-HTMLTableColElement.prototype = new HTMLElement;
-__extend__(HTMLTableColElement.prototype, {
- get align(){
- return this.getAttribute('align');
- },
- set align(value){
- this.setAttribute('align', value);
- },
- get ch(){
- return this.getAttribute('ch');
- },
- set ch(value){
- this.setAttribute('ch', value);
- },
- get chOff(){
- return this.getAttribute('ch');
- },
- set chOff(value){
- this.setAttribute('ch', value);
- },
- get span(){
- return this.getAttribute('span');
- },
- set span(value){
- this.setAttribute('span', value);
- },
- get vAlign(){
- return this.getAttribute('valign');
- },
- set vAlign(value){
- this.setAttribute('valign', value);
- },
- get width(){
- return this.getAttribute('width');
- },
- set width(value){
- this.setAttribute('width', value);
- }
-});
-
-$w.HTMLTableColElement = HTMLTableColElement;
-$debug("Defining HTMLModElement");
-/*
-* HTMLModElement - DOM Level 2
-*/
-var HTMLModElement = function(ownerDocument) {
- this.HTMLElement = HTMLElement;
- this.HTMLElement(ownerDocument);
-};
-HTMLModElement.prototype = new HTMLElement;
-__extend__(HTMLModElement.prototype, {
- get cite(){
- return this.getAttribute('cite');
- },
- set cite(value){
- this.setAttribute('cite', value);
- },
- get dateTime(){
- return this.getAttribute('datetime');
- },
- set dateTime(value){
- this.setAttribute('datetime', value);
- }
-});
-
-$w.HTMLModElement = HTMLModElement; $debug("Defining HTMLFieldSetElement");
-/*
-* HTMLFieldSetElement - DOM Level 2
-*/
-var HTMLFieldSetElement = function(ownerDocument) {
- this.HTMLElement = HTMLElement;
- this.HTMLElement(ownerDocument);
-};
-HTMLFieldSetElement.prototype = new HTMLElement;
-__extend__(HTMLFieldSetElement.prototype, {
- get form(){
- var parent = this.parent;
- while(parent.nodeName.toLowerCase() != 'form'){
- parent = parent.parent;
- }
- return parent;
- }
-});
-
-$w.HTMLFieldSetElement = HTMLFieldSetElement; $debug("Defining HTMLFormElement");
-/*
-* HTMLFormElement - DOM Level 2
-*/
-var HTMLFormElement = function(ownerDocument){
- this.HTMLElement = HTMLElement;
- this.HTMLElement(ownerDocument);
-};
-HTMLFormElement.prototype = new HTMLElement;
-__extend__(HTMLFormElement.prototype,{
- get acceptCharset(){
- return this.getAttribute('accept-charset');
-
- },
- set acceptCharset(acceptCharset){
- this.setAttribute('accept-charset', acceptCharset);
-
- },
- get action(){
- return this.getAttribute('action');
-
- },
- set action(action){
- this.setAttribute('action', action);
-
- },
- get elements() {
- return this.getElementsByTagName("*");
-
- },
- get enctype(){
- return this.getAttribute('enctype');
-
- },
- set enctype(enctype){
- this.setAttribute('enctype', enctype);
-
- },
- get length() {
- return this.elements.length;
-
- },
- get method(){
- return this.getAttribute('method');
-
- },
- set method(action){
- this.setAttribute('method', method);
-
- },
- get name() {
- return this.getAttribute("name") || "";
-
- },
- set name(val) {
- return this.setAttribute("name",val);
-
- },
- get target() {
- return this.getAttribute("target") || "";
-
- },
- set target(val) {
- return this.setAttribute("target",val);
-
- },
- submit:function(){
- __submit__(this);
-
- },
- reset:function(){
- __reset__(this);
-
- }
-});
-
-$w.HTMLFormElement = HTMLFormElement;$debug("Defining HTMLFrameElement");
-/*
-* HTMLFrameElement - DOM Level 2
-*/
-var HTMLFrameElement = function(ownerDocument) {
- this.HTMLElement = HTMLElement;
- this.HTMLElement(ownerDocument);
-};
-HTMLFrameElement.prototype = new HTMLElement;
-__extend__(HTMLFrameElement.prototype, {
- get frameBorder(){
- return this.getAttribute('border')||"";
- },
- set frameBorder(value){
- this.setAttribute('border', value);
- },
- get longDesc(){
- return this.getAttribute('longdesc')||"";
- },
- set longDesc(value){
- this.setAttribute('longdesc', value);
- },
- get marginHeight(){
- return this.getAttribute('marginheight')||"";
- },
- set marginHeight(value){
- this.setAttribute('marginheight', value);
- },
- get marginWidth(){
- return this.getAttribute('marginwidth')||"";
- },
- set marginWidth(value){
- this.setAttribute('marginwidth', value);
- },
- get name(){
- return this.getAttribute('name')||"";
- },
- set name(value){
- this.setAttribute('name', value);
- },
- get noResize(){
- return this.getAttribute('noresize')||"";
- },
- set noResize(value){
- this.setAttribute('noresize', value);
- },
- get scrolling(){
- return this.getAttribute('scrolling')||"";
- },
- set scrolling(value){
- this.setAttribute('scrolling', value);
- },
- get src(){
- return this.getAttribute('src')||"";
- },
- set src(value){
- this.setAttribute('src', value);
- },
- get contentDocument(){
- $debug("getting content document for (i)frame");
- if(!this._content){
- this._content = new HTMLDocument($implementation);
- if(this.src.length > 0){
- $info("Loading frame content from " + this.src);
- try{
- this._content.load(this.src);
- }catch(e){
- $error("failed to load frame content: from " + this.src, e);
- }
- }
- }
- return true;
- }
-});
-
-$w.HTMLFrameElement = HTMLFrameElement;
-$debug("Defining HTMLFrameSetElement");
-/*
-* HTMLFrameSetElement - DOM Level 2
-*/
-var HTMLFrameSetElement = function(ownerDocument) {
- this.HTMLElement = HTMLElement;
- this.HTMLElement(ownerDocument);
-};
-HTMLFrameSetElement.prototype = new HTMLElement;
-__extend__(HTMLFrameSetElement.prototype, {
- get cols(){
- return this.getAttribute('cols');
- },
- set cols(value){
- this.setAttribute('cols', value);
- },
- get rows(){
- return this.getAttribute('rows');
- },
- set rows(value){
- this.setAttribute('rows', value);
- }
-});
-
-$w.HTMLFrameSetElement = HTMLFrameSetElement; $debug("Defining HTMLHeadElement");
-/*
-* HTMLHeadElement - DOM Level 2
-*/
-var HTMLHeadElement = function(ownerDocument) {
- this.HTMLElement = HTMLElement;
- this.HTMLElement(ownerDocument);
-};
-HTMLHeadElement.prototype = new HTMLElement;
-__extend__(HTMLHeadElement.prototype, {
- get profile(){
- return this.getAttribute('profile');
- },
- set profile(value){
- this.setAttribute('profile', value);
- },
- //we override this so we can apply browser behavior specific to head children
- //like loading scripts
- appendChild : function(newChild) {
- var newChild = HTMLElement.prototype.appendChild.apply(this,[newChild]);
- //__evalScript__(newChild);
- return newChild;
- },
- insertBefore : function(newChild, refChild) {
- var newChild = HTMLElement.prototype.insertBefore.apply(this,[newChild]);
- //__evalScript__(newChild);
- return newChild;
- }
-});
-
-var __evalScript__ = function(newChild){
- //check to see if this is a script element and apply a script loading strategy
- //the check against the ownerDocument isnt really enough to support frames in
- // the long run, but for now it's ok
- if(newChild.nodeType == DOMNode.ELEMENT_NODE &&
- newChild.ownerDocument == window.document ){
- if(newChild.nodeName.toUpperCase() == "SCRIPT"){
- $debug("loading script via policy. ");
- $policy.loadScript(newChild);
- }
- }
-};
-
-$w.HTMLHeadElement = HTMLHeadElement;
-$debug("Defining HTMLIFrameElement");
-/*
-* HTMLIFrameElement - DOM Level 2
-*/
-var HTMLIFrameElement = function(ownerDocument) {
- this.HTMLFrameElement = HTMLFrameElement;
- this.HTMLFrameElement(ownerDocument);
-};
-HTMLIFrameElement.prototype = new HTMLFrameElement;
-__extend__(HTMLIFrameElement.prototype, {
- get height() {
- return this.getAttribute("height") || "";
- },
- set height(val) {
- return this.setAttribute("height",val);
- },
- get width() {
- return this.getAttribute("width") || "";
- },
- set width(val) {
- return this.setAttribute("width",val);
- }
-});
-
-$w.HTMLIFrameElement = HTMLIFrameElement;
- $debug("Defining HTMLImageElement");
-/*
-* HTMLImageElement - DOM Level 2
-*/
-var HTMLImageElement = function(ownerDocument) {
- this.HTMLElement = HTMLElement;
- this.HTMLElement(ownerDocument);
-};
-HTMLImageElement.prototype = new HTMLElement;
-__extend__(HTMLImageElement.prototype, {
- get alt(){
- return this.getAttribute('alt');
- },
- set alt(value){
- this.setAttribute('alt', value);
- },
- get height(){
- return this.getAttribute('height');
- },
- set height(value){
- this.setAttribute('height', value);
- },
- get isMap(){
- return this.hasAttribute('map');
- },
- set useMap(value){
- this.setAttribute('map', value);
- },
- get longDesc(){
- return this.getAttribute('longdesc');
- },
- set longDesc(value){
- this.setAttribute('longdesc', value);
- },
- get name(){
- return this.getAttribute('name');
- },
- set name(value){
- this.setAttribute('name', value);
- },
- get src(){
- return this.getAttribute('src');
- },
- set src(value){
- this.setAttribute('src', value);
- },
- get width(){
- return this.getAttribute('width');
- },
- set width(value){
- this.setAttribute('width', value);
- }
-});
-
-$w.HTMLImageElement = HTMLImageElement;$debug("Defining HTMLInputElement");
-/*
-* HTMLInputElement - DOM Level 2
-*/
-var HTMLInputElement = function(ownerDocument) {
- this.HTMLElement = HTMLElement;
- this.HTMLElement(ownerDocument);
-};
-HTMLInputElement.prototype = new HTMLElement;
-__extend__(HTMLInputElement.prototype, {
- get defaultValue(){
- return this.getAttribute('defaultValue');
- },
- set defaultValue(value){
- this.setAttribute('defaultValue', value);
- },
- get defaultChecked(){
- return this.getAttribute('defaultChecked');
- },
- get form(){
- var parent = this.parent;
- while(parent.nodeName.toLowerCase() != 'form'){
- parent = parent.parent;
- }
- return parent;
- },
- get accessKey(){
- return this.getAttribute('accesskey');
- },
- set accessKey(value){
- this.setAttribute('accesskey',value);
- },
- get access(){
- return this.getAttribute('access');
- },
- set access(value){
- this.setAttribute('access', value);
- },
- get alt(){
- return this.getAttribute('alt');
- },
- set alt(value){
- this.setAttribute('alt', value);
- },
- get checked(){
- return (this.getAttribute('checked')=='checked');
- },
- set checked(value){
- this.setAttribute('checked', (value ? 'checked' :''));
- },
- get disabled(){
- return (this.getAttribute('disabled')=='disabled');
- },
- set disabled(value){
- this.setAttribute('disabled', (value ? 'disabled' :''));
- },
- get maxLength(){
- return Number(this.getAttribute('maxlength')||'0');
- },
- set maxLength(value){
- this.setAttribute('maxlength', value);
- },
- get name(){
- return this.getAttribute('name')||'';
- },
- set name(value){
- this.setAttribute('name', value);
- },
- get readOnly(){
- return (this.getAttribute('readonly')=='readonly');
- },
- set readOnly(value){
- this.setAttribute('readonly', (value ? 'readonly' :''));
- },
- get size(){
- return this.getAttribute('size');
- },
- set size(value){
- this.setAttribute('size', value);
- },
- get src(){
- return this.getAttribute('src');
- },
- set src(value){
- this.setAttribute('src', value);
- },
- get tabIndex(){
- return Number(this.getAttribute('tabindex'));
- },
- set tabIndex(value){
- this.setAttribute('tabindex',Number(value));
- },
- get type(){
- return this.getAttribute('type');
- },
- set type(value){
- this.setAttribute('type',value);
- },
- get useMap(){
- return this.getAttribute('map');
- },
- get value(){
- return this.getAttribute('value');
- },
- set value(value){
- this.setAttribute('value',value);
- },
- blur:function(){
- __blur__(this);
-
- },
- focus:function(){
- __focus__(this);
-
- },
- select:function(){
- __select__(this);
-
- },
- click:function(){
- __click__(this);
-
- }
-});
-
-$w.HTMLInputElement = HTMLInputElement;$debug("Defining HTMLLabelElement");
-/*
-* HTMLLabelElement - DOM Level 2
-*/
-var HTMLLabelElement = function(ownerDocument) {
- this.HTMLElement = HTMLElement;
- this.HTMLElement(ownerDocument);
-};
-HTMLLabelElement.prototype = new HTMLElement;
-__extend__(HTMLLabelElement.prototype, {
- get form(){
- var parent = this.parent;
- while(parent.nodeName.toLowerCase() != 'form'){
- parent = parent.parent;
- }
- return parent;
- },
- get accessKey(){
- return this.getAttribute('accesskey');
- },
- set accessKey(value){
- this.setAttribute('accesskey',value);
- },
- get htmlFor(){
- return this.getAttribute('for');
- },
- set htmlFor(value){
- this.setAttribute('for',value);
- }
-});
-
-$w.HTMLLabelElement = HTMLLabelElement; $debug("Defining HTMLLegendElement");
-/*
-* HTMLLegendElement - DOM Level 2
-*/
-var HTMLLegendElement = function(ownerDocument) {
- this.HTMLElement = HTMLElement;
- this.HTMLElement(ownerDocument);
-};
-HTMLLegendElement.prototype = new HTMLElement;
-__extend__(HTMLLegendElement.prototype, {
- get form(){
- var parent = this.parent;
- while(parent.nodeName.toLowerCase() != 'form'){
- parent = parent.parent;
- }
- return parent;
- },
- get accessKey(){
- return this.getAttribute('accesskey');
- },
- set accessKey(value){
- this.setAttribute('accesskey',value);
- }
-});
-
-$w.HTMLLegendElement = HTMLLegendElement; /**
-* Link - HTMLElement
-*/
-$w.__defineGetter__("Link", function(){
- return function(){
- throw new Error("Object cannot be created in this context");
- };
-});
-
-
-$debug("Defining HTMLLinkElement");
-/*
-* HTMLLinkElement - DOM Level 2
-*/
-var HTMLLinkElement = function(ownerDocument) {
- this.HTMLElement = HTMLElement;
- this.HTMLElement(ownerDocument);
-};
-HTMLLinkElement.prototype = new HTMLElement;
-__extend__(HTMLLinkElement.prototype, {
- get disabled(){
- return this.getAttribute('disabled');
- },
- set disabled(value){
- this.setAttribute('disabled',value);
- },
- get charset(){
- return this.getAttribute('charset');
- },
- set charset(value){
- this.setAttribute('charset',value);
- },
- get href(){
- return this.getAttribute('href');
- },
- set href(value){
- this.setAttribute('href',value);
- },
- get hreflang(){
- return this.getAttribute('hreflang');
- },
- set hreflang(value){
- this.setAttribute('hreflang',value);
- },
- get media(){
- return this.getAttribute('media');
- },
- set media(value){
- this.setAttribute('media',value);
- },
- get rel(){
- return this.getAttribute('rel');
- },
- set rel(value){
- this.setAttribute('rel',value);
- },
- get rev(){
- return this.getAttribute('rev');
- },
- set rev(value){
- this.setAttribute('rev',value);
- },
- get target(){
- return this.getAttribute('target');
- },
- set target(value){
- this.setAttribute('target',value);
- },
- get type(){
- return this.getAttribute('type');
- },
- set type(value){
- this.setAttribute('type',value);
- }
-});
-
-$w.HTMLLinkElement = HTMLLinkElement;
-$debug("Defining HTMLMapElement");
-/*
-* HTMLMapElement - DOM Level 2
-*/
-var HTMLMapElement = function(ownerDocument) {
- this.HTMLElement = HTMLElement;
- this.HTMLElement(ownerDocument);
-};
-HTMLMapElement.prototype = new HTMLElement;
-__extend__(HTMLMapElement.prototype, {
- get areas(){
- return this.getElementsByTagName('area');
- },
- get name(){
- return this.getAttribute('name');
- },
- set name(value){
- this.setAttribute('name',value);
- }
-});
-
-$w.HTMLMapElement = HTMLMapElement;$debug("Defining HTMLMetaElement");
-/*
-* HTMLMetaElement - DOM Level 2
-*/
-var HTMLMetaElement = function(ownerDocument) {
- this.HTMLElement = HTMLElement;
- this.HTMLElement(ownerDocument);
-};
-HTMLMetaElement.prototype = new HTMLElement;
-__extend__(HTMLMetaElement.prototype, {
- get content(){
- return this.getAttribute('content');
- },
- set content(value){
- this.setAttribute('content',value);
- },
- get httpEquiv(){
- return this.getAttribute('http-equiv');
- },
- set httpEquiv(value){
- this.setAttribute('http-equiv',value);
- },
- get name(){
- return this.getAttribute('name');
- },
- set name(value){
- this.setAttribute('name',value);
- },
- get scheme(){
- return this.getAttribute('scheme');
- },
- set scheme(value){
- this.setAttribute('scheme',value);
- }
-});
-
-$w.HTMLMetaElement = HTMLMetaElement;
-$debug("Defining HTMLObjectElement");
-/*
-* HTMLObjectElement - DOM Level 2
-*/
-var HTMLObjectElement = function(ownerDocument) {
- this.HTMLElement = HTMLElement;
- this.HTMLElement(ownerDocument);
-};
-HTMLObjectElement.prototype = new HTMLElement;
-__extend__(HTMLObjectElement.prototype, {
- get code(){
- return this.getAttribute('code');
- },
- set code(value){
- this.setAttribute('code',value);
- },
- get archive(){
- return this.getAttribute('archive');
- },
- set archive(value){
- this.setAttribute('archive',value);
- },
- get codeBase(){
- return this.getAttribute('codebase');
- },
- set codeBase(value){
- this.setAttribute('codebase',value);
- },
- get codeType(){
- return this.getAttribute('codetype');
- },
- set codeType(value){
- this.setAttribute('codetype',value);
- },
- get data(){
- return this.getAttribute('data');
- },
- set data(value){
- this.setAttribute('data',value);
- },
- get declare(){
- return this.getAttribute('declare');
- },
- set declare(value){
- this.setAttribute('declare',value);
- },
- get height(){
- return this.getAttribute('height');
- },
- set height(value){
- this.setAttribute('height',value);
- },
- get standby(){
- return this.getAttribute('standby');
- },
- set standby(value){
- this.setAttribute('standby',value);
- },
- get tabIndex(){
- return this.getAttribute('tabindex');
- },
- set tabIndex(value){
- this.setAttribute('tabindex',value);
- },
- get type(){
- return this.getAttribute('type');
- },
- set type(value){
- this.setAttribute('type',value);
- },
- get useMap(){
- return this.getAttribute('usemap');
- },
- set useMap(value){
- this.setAttribute('usemap',value);
- },
- get width(){
- return this.getAttribute('width');
- },
- set width(value){
- this.setAttribute('width',value);
- },
- get contentDocument(){
- return this.ownerDocument;
- }
-});
-
-$w.HTMLObjectElement = HTMLObjectElement;
- $debug("Defining HTMLOptGroupElement");
-/*
-* HTMLOptGroupElement - DOM Level 2
-*/
-var HTMLOptGroupElement = function(ownerDocument) {
- this.HTMLElement = HTMLElement;
- this.HTMLElement(ownerDocument);
-};
-HTMLOptGroupElement.prototype = new HTMLElement;
-__extend__(HTMLOptGroupElement.prototype, {
- get disabled(){
- return this.getAttribute('disabled');
- },
- set disabled(value){
- this.setAttribute('disabled',value);
- },
- get label(){
- return this.getAttribute('label');
- },
- set label(value){
- this.setAttribute('label',value);
- },
-});
-
-$w.HTMLOptGroupElement = HTMLOptGroupElement; $debug("Defining HTMLOptionElement");
-/*
-* HTMLOptionElement - DOM Level 2
-*/
-var HTMLOptionElement = function(ownerDocument) {
- this.HTMLElement = HTMLElement;
- this.HTMLElement(ownerDocument);
-};
-HTMLOptionElement.prototype = new HTMLElement;
-__extend__(HTMLOptionElement.prototype, {
- get form(){
- var parent = this.parent;
- while(parent.nodeName.toLowerCase() != 'form'){
- parent = parent.parent;
- }
- return parent;
- },
- get defaultSelected(){
- return this.getAttribute('defaultSelected');
- },
- set defaultSelected(value){
- this.setAttribute('defaultSelected',value);
- },
- get text(){
- return ((this.nodeValue === null) || (this.nodeValue ===undefined)) ?
- this.innerHTML :
- this.nodeValue;
- },
- get index(){
- var options = this.parent.childNodes;
- for(var i; i<options.length;i++){
- if(this == options[i])
- return i;
- }
- return -1;
- },
- get disabled(){
- return this.getAttribute('disabled');
- },
- set disabled(value){
- this.setAttribute('disabled',value);
- },
- get label(){
- return this.getAttribute('label');
- },
- set label(value){
- this.setAttribute('label',value);
- },
- get selected(){
- return (this.getAttribute('selected')=='selected');
- },
- set selected(value){
- this.setAttribute('selected', (value ? 'selected' :''));
- },
- get value(){
- return ((this.getAttribute('value') === undefined) || (this.getAttribute('value') === null)) ?
- this.text :
- this.getAttribute('value');
- },
- set value(value){
- this.setAttribute('value',value);
- }
-});
-
-$w.HTMLOptionElement = HTMLOptionElement;
-$debug("Defining HTMLParamElement");
-/*
-* HTMLParamElement - DOM Level 2
-*/
-var HTMLParamElement = function(ownerDocument) {
- this.HTMLElement = HTMLElement;
- this.HTMLElement(ownerDocument);
-};
-HTMLParamElement.prototype = new HTMLElement;
-__extend__(HTMLParamElement.prototype, {
- get name(){
- return this.getAttribute('name');
- },
- set name(value){
- this.setAttribute('name',value);
- },
- get type(){
- return this.getAttribute('type');
- },
- set type(value){
- this.setAttribute('type',value);
- },
- get value(){
- return this.getAttribute('value');
- },
- set value(value){
- this.setAttribute('value',value);
- },
- get valueType(){
- return this.getAttribute('valuetype');
- },
- set valueType(value){
- this.setAttribute('valuetype',value);
- },
-});
-
-$w.HTMLParamElement = HTMLParamElement;
- $debug("Defining HTMLScriptElement");
-/*
-* HTMLScriptElement - DOM Level 2
-*/
-var HTMLScriptElement = function(ownerDocument) {
- this.HTMLElement = HTMLElement;
- this.HTMLElement(ownerDocument);
-};
-HTMLScriptElement.prototype = new HTMLElement;
-__extend__(HTMLScriptElement.prototype, {
- get text(){
- // text of script is in a child node of the element
- // scripts with < operator must be in a CDATA node
- for (var i=0; i<this.childNodes.length; i++) {
- if (this.childNodes[i].nodeType == DOMNode.CDATA_SECTION_NODE) {
- return this.childNodes[i].nodeValue;
- }
- }
- // otherwise there will be a text node containing the script
- if (this.childNodes[0] && this.childNodes[0].nodeType == DOMNode.TEXT_NODE) {
- return this.childNodes[0].nodeValue;
- }
- return this.nodeValue;
-
- },
- get htmlFor(){
- return this.getAttribute('for');
- },
- set htmlFor(value){
- this.setAttribute('for',value);
- },
- get event(){
- return this.getAttribute('event');
- },
- set event(value){
- this.setAttribute('event',value);
- },
- get charset(){
- return this.getAttribute('charset');
- },
- set charset(value){
- this.setAttribute('charset',value);
- },
- get defer(){
- return this.getAttribute('defer');
- },
- set defer(value){
- this.setAttribute('defer',value);
- },
- get src(){
- return this.getAttribute('src');
- },
- set src(value){
- this.setAttribute('src',value);
- },
- get type(){
- return this.getAttribute('type');
- },
- set type(value){
- this.setAttribute('type',value);
- }
-});
-
-$w.HTMLScriptElement = HTMLScriptElement;$debug("Defining HTMLSelectElement");
-/*
-* HTMLSelectElement - DOM Level 2
-*/
-var HTMLSelectElement = function(ownerDocument) {
- this.HTMLElement = HTMLElement;
- this.HTMLElement(ownerDocument);
-};
-HTMLSelectElement.prototype = new HTMLElement;
-__extend__(HTMLSelectElement.prototype, {
- get type(){
- return this.getAttribute('type');
- },
- get selectedIndex(){
- var options = this.options;
- for(var i=0;i<options.length;i++){
- if(options[i].selected){
- return i;
- }
- };
- return -1;
- },
- set selectedIndex(value){
- if (this.selectedIndex != -1) {
- this.options[this.selectedIndex].selected = '';
- }
- var option = this.options[Number(value)];
- if (option) {
- option.selected = 'selected';
- }
- },
- get value(){
- return this.getAttribute('value')||'';
- },
- set value(value) {
- var options = this.options,
- i, index;
- for (i=0; i<options.length; i++) {
- if (options[i].value == value) {
- index = i;
- break;
- }
- }
- if (index !== undefined) {
- this.setAttribute('value', value);
- this.selectedIndex = index;
- }
- },
- get length(){
- return this.options.length;
- },
- get form(){
- var parent = this.parent;
- while(parent.nodeName.toLowerCase() != 'form'){
- parent = parent.parent;
- }
- return parent;
- },
- get options(){
- return this.getElementsByTagName('option');
- },
- get disabled(){
- return (this.getAttribute('disabled')=='disabled');
- },
- set disabled(value){
- this.setAttribute('disabled', (value ? 'disabled' :''));
- },
- get multiple(){
- return this.getAttribute('multiple');
- },
- set multiple(value){
- this.setAttribute('multiple',value);
- },
- get name(){
- return this.getAttribute('name')||'';
- },
- set name(value){
- this.setAttribute('name',value);
- },
- get size(){
- return Number(this.getAttribute('size'));
- },
- set size(value){
- this.setAttribute('size',value);
- },
- get tabIndex(){
- return Number(this.getAttribute('tabindex'));
- },
- set tabIndex(value){
- this.setAttribute('tabindex',value);
- },
- add : function(){
- __add__(this);
- },
- remove : function(){
- __remove__(this);
- },
- blur: function(){
- __blur__(this);
- },
- focus: function(){
- __focus__(this);
- }
-});
-
-$w.HTMLSelectElement = HTMLSelectElement;$debug("Defining HTMLStyleElement");
-/*
-* HTMLStyleElement - DOM Level 2
-*/
-var HTMLStyleElement = function(ownerDocument) {
- this.HTMLElement = HTMLElement;
- this.HTMLElement(ownerDocument);
-};
-HTMLStyleElement.prototype = new HTMLElement;
-__extend__(HTMLStyleElement.prototype, {
- get disabled(){
- return this.getAttribute('disabled');
- },
- set disabled(value){
- this.setAttribute('disabled',value);
- },
- get media(){
- return this.getAttribute('media');
- },
- set media(value){
- this.setAttribute('media',value);
- },
- get type(){
- return this.getAttribute('type');
- },
- set type(value){
- this.setAttribute('type',value);
- }
-});
-
-$w.HTMLStyleElement = HTMLStyleElement;$debug("Defining HTMLTableElement");
-/*
-* HTMLTableElement - DOM Level 2
-* Implementation Provided by Steven Wood
-*/
-var HTMLTableElement = function(ownerDocument) {
- this.HTMLElement = HTMLElement;
- this.HTMLElement(ownerDocument);
-
-};
-
-HTMLTableElement.prototype = new HTMLElement;
-__extend__(HTMLTableElement.prototype, {
-
- get tFoot() {
- //tFoot returns the table footer.
- return this.getElementsByTagName("tfoot")[0];
- },
-
- createTFoot : function () {
- var tFoot = this.tFoot;
-
- if (!tFoot) {
- tFoot = document.createElement("tfoot");
- this.appendChild(tFoot);
- }
-
- return tFoot;
- },
-
- deleteTFoot : function () {
- var foot = this.tFoot;
- if (foot) {
- foot.parentNode.removeChild(foot);
- }
- },
-
- get tHead() {
- //tHead returns the table head.
- return this.getElementsByTagName("thead")[0];
- },
-
- createTHead : function () {
- var tHead = this.tHead;
-
- if (!tHead) {
- tHead = document.createElement("thead");
- this.insertBefore(tHead, this.firstChild);
- }
-
- return tHead;
- },
-
- deleteTHead : function () {
- var head = this.tHead;
- if (head) {
- head.parentNode.removeChild(head);
- }
- },
-
- appendChild : function (child) {
-
- var tagName = child.tagName.toLowerCase();
- if (tagName === "tr") {
- // need an implcit <tbody> to contain this...
- if (!this.currentBody) {
- this.currentBody = document.createElement("tbody");
-
- DOMNode.prototype.appendChild.apply(this, [this.currentBody]);
- }
-
- return this.currentBody.appendChild(child);
-
- } else if (tagName === "tbody" || tagName === "tfoot" && this.currentBody) {
- this.currentBody = child;
- return DOMNode.prototype.appendChild.apply(this, arguments);
-
- } else {
- return DOMNode.prototype.appendChild.apply(this, arguments);
- }
- },
-
- get tBodies() {
- return new HTMLCollection(this.getElementsByTagName("tbody"));
-
- },
-
- get rows() {
- return new HTMLCollection(this.getElementsByTagName("tr"));
- },
-
- insertRow : function (idx) {
- if (idx === undefined) {
- throw new Error("Index omitted in call to HTMLTableElement.insertRow ");
- }
-
- var rows = this.rows,
- numRows = rows.length,
- node,
- inserted,
- lastRow;
-
- if (idx > numRows) {
- throw new Error("Index > rows.length in call to HTMLTableElement.insertRow");
- }
-
- var inserted = document.createElement("tr");
- // If index is -1 or equal to the number of rows,
- // the row is appended as the last row. If index is omitted
- // or greater than the number of rows, an error will result
- if (idx === -1 || idx === numRows) {
- lastRow = rows[rows.length-1];
- lastRow.parentNode.appendChild(inserted);
- } else {
- rows[idx].parentNode.insertBefore(inserted, rows[idx]);
- }
-
- return inserted;
- },
-
- deleteRow : function (idx) {
- var elem = this.rows[idx];
- elem.parentNode.removeChild(elem);
- },
-
- get summary() {
- return this.getAttribute("summary");
- },
-
- set summary(summary) {
- this.setAttribute("summary", summary);
- },
-
- get align() {
- return this.getAttribute("align");
- },
-
- set align(align) {
- this.setAttribute("align", align);
- },
-
-
- get bgColor() {
- return this.getAttribute("bgColor");
- },
-
- set bgColor(bgColor) {
- return this.setAttribute("bgColor", bgColor);
- },
-
- get cellPadding() {
- return this.getAttribute("cellPadding");
- },
-
- set cellPadding(cellPadding) {
- return this.setAttribute("cellPadding", cellPadding);
- },
-
-
- get cellSpacing() {
- return this.getAttribute("cellSpacing");
- },
-
- set cellSpacing(cellSpacing) {
- this.setAttribute("cellSpacing", cellSpacing);
- },
-
- get frame() {
- return this.getAttribute("frame");
- },
-
- set frame(frame) {
- this.setAttribute("frame", frame);
- },
-
- get rules() {
- return this.getAttribute("rules");
- },
-
- set rules(rules) {
- this.setAttribute("rules", rules);
- },
-
- get width() {
- return this.getAttribute("width");
- },
-
- set width(width) {
- this.setAttribute("width", width);
- }
-
-});
-
-$w.HTMLTableElement = HTMLTableElement; $debug("Defining HTMLTableSectionElement");
-/*
-* HTMLxElement - DOM Level 2
-* - Contributed by Steven Wood
-*/
-var HTMLTableSectionElement = function(ownerDocument) {
- this.HTMLElement = HTMLElement;
- this.HTMLElement(ownerDocument);
-};
-HTMLTableSectionElement.prototype = new HTMLElement;
-__extend__(HTMLTableSectionElement.prototype, {
-
- appendChild : function (child) {
-
- // disallow nesting of these elements.
- if (child.tagName.match(/TBODY|TFOOT|THEAD/)) {
- return this.parentNode.appendChild(child);
- } else {
- return DOMNode.prototype.appendChild.apply(this, arguments);
- }
-
- },
-
- get align() {
- return this.getAttribute("align");
- },
-
- get ch() {
- return this.getAttribute("ch");
- },
-
- set ch(ch) {
- this.setAttribute("ch", ch);
- },
-
- // ch gets or sets the alignment character for cells in a column.
- set chOff(chOff) {
- this.setAttribute("chOff", chOff);
- },
-
- get chOff(chOff) {
- return this.getAttribute("chOff");
- },
-
- get vAlign () {
- return this.getAttribute("vAlign");
- },
-
- get rows() {
- return new HTMLCollection(this.getElementsByTagName("tr"));
- },
-
- insertRow : function (idx) {
- if (idx === undefined) {
- throw new Error("Index omitted in call to HTMLTableSectionElement.insertRow ");
- }
-
- var numRows = this.rows.length,
- node = null;
-
- if (idx > numRows) {
- throw new Error("Index > rows.length in call to HTMLTableSectionElement.insertRow");
- }
-
- var row = document.createElement("tr");
- // If index is -1 or equal to the number of rows,
- // the row is appended as the last row. If index is omitted
- // or greater than the number of rows, an error will result
- if (idx === -1 || idx === numRows) {
- this.appendChild(row);
- } else {
- node = this.firstChild;
-
- for (var i=0; i<idx; i++) {
- node = node.nextSibling;
- }
- }
-
- this.insertBefore(row, node);
-
- return row;
- },
-
- deleteRow : function (idx) {
- var elem = this.rows[idx];
- this.removeChild(elem);
- }
-
-});
-
-$w.HTMLTableSectionElement = HTMLTableSectionElement;
-$debug("Defining HTMLTableCellElement");
-/*
-* HTMLTableCellElement - DOM Level 2
-* Implementation Provided by Steven Wood
-*/
-var HTMLTableCellElement = function(ownerDocument) {
- this.HTMLElement = HTMLElement;
- this.HTMLElement(ownerDocument);
-};
-HTMLTableCellElement.prototype = new HTMLElement;
-__extend__(HTMLTableCellElement.prototype, {
-
-
- // TODO :
-
-});
-
-$w.HTMLTableCellElement = HTMLTableCellElement;$debug("Defining HTMLTableRowElement");
-/*
-* HTMLRowElement - DOM Level 2
-* Implementation Provided by Steven Wood
-*/
-var HTMLTableRowElement = function(ownerDocument) {
- this.HTMLElement = HTMLElement;
- this.HTMLElement(ownerDocument);
-
-};
-HTMLTableRowElement.prototype = new HTMLElement;
-__extend__(HTMLTableRowElement.prototype, {
-
- // align gets or sets the horizontal alignment of data within cells of the row.
- get align() {
- return this.getAttribute("align");
- },
-
- get bgColor() {
- return this.getAttribute("bgcolor");
- },
-
- get cells() {
- var nl = this.getElementsByTagName("td");
- return new HTMLCollection(nl);
- },
-
- get ch() {
- return this.getAttribute("ch");
- },
-
- set ch(ch) {
- this.setAttribute("ch", ch);
- },
-
- // ch gets or sets the alignment character for cells in a column.
- set chOff(chOff) {
- this.setAttribute("chOff", chOff);
- },
-
- get chOff(chOff) {
- return this.getAttribute("chOff");
- },
-
- get rowIndex() {
- var nl = this.parentNode.childNodes;
- for (var i=0; i<nl.length; i++) {
- if (nl[i] === this) {
- return i;
- }
- }
- },
-
- get sectionRowIndex() {
- var nl = this.parentNode.getElementsByTagName(this.tagName);
- for (var i=0; i<nl.length; i++) {
- if (nl[i] === this) {
- return i;
- }
- }
- },
-
- get vAlign () {
- return this.getAttribute("vAlign");
- },
-
- insertCell : function (idx) {
- if (idx === undefined) {
- throw new Error("Index omitted in call to HTMLTableRow.insertCell");
- }
-
- var numCells = this.cells.length,
- node = null;
-
- if (idx > numCells) {
- throw new Error("Index > rows.length in call to HTMLTableRow.insertCell");
- }
-
- var cell = document.createElement("td");
-
- if (idx === -1 || idx === numCells) {
- this.appendChild(cell);
- } else {
-
-
- node = this.firstChild;
-
- for (var i=0; i<idx; i++) {
- node = node.nextSibling;
- }
- }
-
- this.insertBefore(cell, node);
-
- return cell;
- },
-
- deleteCell : function (idx) {
- var elem = this.cells[idx];
- this.removeChild(elem);
- }
-
-});
-
-$w.HTMLTableRowElement = HTMLTableRowElement;
-/**
- * @author thatcher
- */
-$debug("Defining XMLSerializer");
-/*
-* XMLSerializer
-*/
-$w.__defineGetter__("XMLSerializer", function(){
- return new XMLSerializer(arguments);
-});
-
-var XMLSerializer = function() {
-
-};
-__extend__(XMLSerializer.prototype, {
- serializeToString: function(node){
- return node.xml;
- }
-});/**
- * @author thatcher
- */
-$debug("Defining XPathExpression");
-/*
-* XPathExpression
-*/
-$w.__defineGetter__("XPathExpression", function(){
- return XPathExpression;
-});
-
-var XPathExpression = function() {};
-__extend__(XPathExpression.prototype, {
- evaluate: function(){
- //TODO for now just return an empty XPathResult
- return new XPathResult();
- }
-});/**
- * @author thatcher
- */
-$debug("Defining XPathResult");
-/*
-* XPathResult
-*/
-$w.__defineGetter__("XPathResult", function(){
- return XPathResult;
-});
-
-var XPathResult = function() {
- this.snapshotLength = 0;
- this.stringValue = '';
-};
-
-__extend__( XPathResult, {
- ANY_TYPE: 0,
- NUMBER_TYPE: 1,
- STRING_TYPE: 2,
- BOOLEAN_TYPE: 3,
- UNORDERED_NODE_ITERATOR_TYPE: 4,
- ORDERED_NODEITERATOR_TYPE: 5,
- UNORDERED_NODE_SNAPSHOT_TYPE: 6,
- ORDERED_NODE_SNAPSHOT_TYPE: 7,
- ANY_ORDERED_NODE_TYPE: 8,
- FIRST_ORDERED_NODE_TYPE: 9
-});
-
-__extend__(XPathResult.prototype, {
- get booleanValue(){
- //TODO
- },
- get invalidIteration(){
- //TODO
- },
- get numberValue(){
- //TODO
- },
- get resultType(){
- //TODO
- },
- get singleNodeValue(){
- //TODO
- },
- iterateNext: function(){
- //TODO
- },
- snapshotItem: function(index){
- //TODO
- }
-});
-
-/**
- * @author thatcher
- */
-
-$w.__defineGetter__("XSLTProcessor", function(){
- return new XSLTProcessor(arguments);
-});
-
-var XSLTProcessor = function() {
- this.__stylesheet__ = null;
-};
-__extend__(XSLTProcessor.prototype, {
- clearParameters: function(){
- //TODO
- },
- getParameter: function(nsuri, name){
- //TODO
- },
- importStyleSheet: function(stylesheet){
- this.__stylesheet__ = stylesheet;
- },
- removeParameter: function(nsuri, name){
- //TODO
- },
- reset: function(){
- //TODO
- },
- setParameter: function(nsuri, name, value){
- //TODO
- },
- transformToDocument: function(sourceNode){
- return xsltProcess(sourceNode, this.__stylesheet__);
- },
- transformToFragment: function(sourceNode, ownerDocument){
- return xsltProcess(sourceNode, this.__stylesheet__).childNodes;
- }
-});$debug("Defining Event");
-/*
-* event.js
-*/
-var Event = function(options){
- if(options === undefined){
- options={target:window,currentTarget:window};
- }
- __extend__(this,{
- CAPTURING_PHASE : 1,
- AT_TARGET : 2,
- BUBBLING_PHASE : 3
- });
- $debug("Creating new Event");
- var $bubbles = options.bubbles?options.bubbles:true,
- $cancelable = options.cancelable?options.cancelable:true,
- $currentTarget = options.currentTarget?options.currentTarget:null,
- $eventPhase = options.eventPhase?options.eventPhase:Event.CAPTURING_PHASE,
- $target = options.eventPhase?options.eventPhase:document,
- $timestamp = options.timestamp?options.timestamp:new Date().getTime().toString(),
- $type = options.type?options.type:"";
- return __extend__(this,{
- get bubbles(){return $bubbles;},
- get cancelable(){return $cancelable;},
- get currentTarget(){return $currentTarget;},
- get eventPhase(){return $eventPhase;},
- get target(){return $target;},
- get timestamp(){return $timestamp;},
- get type(){return $type;},
- initEvent: function(type,bubbles,cancelable){
- $type=type?type:$type;
- $bubbles=bubbles?bubbles:$bubbles;
- $cancelable=cancelable?cancelable:$cancelable;
- },
- preventDefault: function(){return;/* TODO */},
- stopPropagation: function(){return;/* TODO */}
- });
-};
-
-$w.Event = Event;
-$debug("Defining MouseEvent");
-/*
-* mouseevent.js
-*/
-$debug("Defining MouseEvent");
-/*
-* uievent.js
-*/
-
-var $onblur,
- $onfocus,
- $onresize;/*
-* CSS2Properties - DOM Level 2 CSS
-*/
-var CSS2Properties = function(options){
- __extend__(this, __supportedStyles__);
- __cssTextToStyles__(this, options.cssText?options.cssText:"");
-};
-__extend__(CSS2Properties.prototype, {
- get cssText(){
- return Array.prototype.apply.join(this,[';\n']);
- },
- set cssText(cssText){
- __cssTextToStyles__(this, cssText);
- },
- getPropertyCSSValue : function(){
-
- },
- getPropertyPriority : function(){
-
- },
- getPropertyValue : function(name){
- var camelCase = name.replace(/\-(\w)/g, function(all, letter){
- return letter.toUpperCase();
- });
- var i, value = this[camelCase];
- if(value === undefined){
- for(i=0;i<this.length;i++){
- if(this[i]===name){
- return this[i];
- }
- }
- }
- return value;
- },
- item : function(index){
- return this[index];
- },
- removeProperty: function(){
-
- },
- setProperty: function(){
-
- },
- toString:function(){
- if (this.length >0){
- return "{\n\t"+Array.prototype.join.apply(this,[';\n\t'])+"}\n";
- }else{
- return '';
- }
- }
-});
-
-var __cssTextToStyles__ = function(css2props, cssText){
- var styleArray=[];
- var style, name, value, camelCaseName, w3cName, styles = cssText.split(';');
- for ( var i = 0; i < styles.length; i++ ) {
- //$log("Adding style property " + styles[i]);
- style = styles[i].split(':');
- if ( style.length == 2 ){
- //keep a reference to the original name of the style which was set
- //this is the w3c style setting method.
- styleArray[styleArray.length] = w3cName = styles[i];
- //camel case for dash case
- value = trim(style[1]);
- camelCaseName = trim(style[0].replace(/\-(\w)/g, function(all, letter){
- return letter.toUpperCase();
- }));
- $debug('CSS Style Name: ' + camelCaseName);
- if(css2props[camelCaseName]!==undefined){
- //set the value internally with camelcase name
- $debug('Setting css ' + camelCaseName + ' to ' + value);
- css2props[camelCaseName] = value;
- };
- }
- }
- __setArray__(css2props, styleArray);
-};
-//Obviously these arent all supported but by commenting out various sections
-//this provides a single location to configure what is exposed as supported.
-//These will likely need to be functional getters/setters in the future to deal with
-//the variation on input formulations
-var __supportedStyles__ = {
- azimuth: "",
- background: "",
- backgroundAttachment: "",
- backgroundColor: "",
- backgroundImage: "",
- backgroundPosition: "",
- backgroundRepeat: "",
- border: "",
- borderBottom: "",
- borderBottomColor: "",
- borderBottomStyle: "",
- borderBottomWidth: "",
- borderCollapse: "",
- borderColor: "",
- borderLeft: "",
- borderLeftColor: "",
- borderLeftStyle: "",
- borderLeftWidth: "",
- borderRight: "",
- borderRightColor: "",
- borderRightStyle: "",
- borderRightWidth: "",
- borderSpacing: "",
- borderStyle: "",
- borderTop: "",
- borderTopColor: "",
- borderTopStyle: "",
- borderTopWidth: "",
- borderWidth: "",
- bottom: "",
- captionSide: "",
- clear: "",
- clip: "",
- color: "",
- content: "",
- counterIncrement: "",
- counterReset: "",
- cssFloat: "",
- cue: "",
- cueAfter: "",
- cueBefore: "",
- cursor: "",
- direction: "",
- display: "",
- elevation: "",
- emptyCells: "",
- font: "",
- fontFamily: "",
- fontSize: "",
- fontSizeAdjust: "",
- fontStretch: "",
- fontStyle: "",
- fontVariant: "",
- fontWeight: "",
- height: "",
- left: "",
- letterSpacing: "",
- lineHeight: "",
- listStyle: "",
- listStyleImage: "",
- listStylePosition: "",
- listStyleType: "",
- margin: "",
- marginBottom: "",
- marginLeft: "",
- marginRight: "",
- marginTop: "",
- markerOffset: "",
- marks: "",
- maxHeight: "",
- maxWidth: "",
- minHeight: "",
- minWidth: "",
- opacity: 1,
- orphans: "",
- outline: "",
- outlineColor: "",
- outlineOffset: "",
- outlineStyle: "",
- outlineWidth: "",
- overflow: "",
- overflowX: "",
- overflowY: "",
- padding: "",
- paddingBottom: "",
- paddingLeft: "",
- paddingRight: "",
- paddingTop: "",
- page: "",
- pageBreakAfter: "",
- pageBreakBefore: "",
- pageBreakInside: "",
- pause: "",
- pauseAfter: "",
- pauseBefore: "",
- pitch: "",
- pitchRange: "",
- position: "",
- quotes: "",
- richness: "",
- right: "",
- size: "",
- speak: "",
- speakHeader: "",
- speakNumeral: "",
- speakPunctuation: "",
- speechRate: "",
- stress: "",
- tableLayout: "",
- textAlign: "",
- textDecoration: "",
- textIndent: "",
- textShadow: "",
- textTransform: "",
- top: "",
- unicodeBidi: "",
- verticalAlign: "",
- visibility: "",
- voiceFamily: "",
- volume: "",
- whiteSpace: "",
- widows: "",
- width: "",
- wordSpacing: "",
- zIndex: ""
-};
-
-$w.CSS2Properties = CSS2Properties;/*
-* CSSRule - DOM Level 2
-*/
-var CSSRule = function(options){
- var $style,
- $selectorText = options.selectorText?options.selectorText:"";
- $style = new CSS2Properties({
- cssText:options.cssText?options.cssText:null
- });
- return __extend__(this, {
- get style(){
- return $style;
- },
- get selectorText(){
- return $selectorText;
- },
- set selectorText(selectorText){
- $selectorText = selectorText;
- }
- });
-};
-$w.CSSRule = CSSRule;
-/*
-* CSSStyleSheet - DOM Level 2
-*/
-var CSSStyleSheet = function(options){
- var $cssRules,
- $disabled = options.disabled?options.disabled:false,
- $href = options.href?options.href:null,
- $parentStyleSheet = options.parentStyleSheet?options.parentStyleSheet:null,
- $title = options.title?options.title:"",
- $type = "text/css";
-
- function parseStyleSheet(text){
- $debug("parsing css");
- //this is pretty ugly, but text is the entire text of a stylesheet
- var cssRules = [];
- if (!text) text = "";
- text = trim(text.replace(/\/\*(\r|\n|.)*\*\//g,""));
- // TODO: @import ?
- var blocks = text.split("}");
- blocks.pop();
- var i, len = blocks.length;
- var definition_block, properties, selectors;
- for (i=0; i<len; i++){
- definition_block = blocks[i].split("{");
- if(definition_block.length === 2){
- selectors = definition_block[0].split(",");
- for(var j=0;j<selectors.length;j++){
- cssRules.push(new CSSRule({
- selectorText:selectors[j],
- cssText:definition_block[1]
- }));
- }
- __setArray__($cssRules, cssRules);
- }
- }
- };
- parseStyleSheet(options.text);
- return __extend__(this, {
- get cssRules(){return $cssRules;},
- get rule(){return $cssRules;},//IE - may be deprecated
- get href(){return $href;},
- get parentStyleSheet(){return $parentStyleSheet;},
- get title(){return $title;},
- get type(){return $type;},
- addRule: function(selector, style, index){/*TODO*/},
- deleteRule: function(index){/*TODO*/},
- insertRule: function(rule, index){/*TODO*/},
- removeRule: function(index){this.deleteRule(index);}//IE - may be deprecated
- });
-};
-
-$w.CSSStyleSheet = CSSStyleSheet;
-/*
-* location.js
-* - requires env
-*/
-$debug("Initializing Window Location.");
-//the current location
-var $location = '';
-
-$w.__defineSetter__("location", function(url){
- //$w.onunload();
- $location = $env.location(url);
- setHistory($location);
- $w.document.load($location);
-});
-
-$w.__defineGetter__("location", function(url){
- var hash = new RegExp('(\\#.*)'),
- hostname = new RegExp('\/\/([^\:\/]+)'),
- pathname = new RegExp('(\/[^\\?\\#]*)'),
- port = new RegExp('\:(\\d+)\/'),
- protocol = new RegExp('(^\\w*\:)'),
- search = new RegExp('(\\?[^\\#]*)');
- return {
- get hash(){
- var m = hash.exec(this.href);
- return m&&m.length>1?m[1]:"";
- },
- set hash(_hash){
- //setting the hash is the only property of the location object
- //that doesn't cause the window to reload
- _hash = _hash.indexOf('#')===0?_hash:"#"+_hash;
- $location = this.protocol + this.host + this.pathname +
- this.search + _hash;
- setHistory(_hash, "hash");
- },
- get host(){
- return this.hostname + (this.port !== "")?":"+this.port:"";
- },
- set host(_host){
- $w.location = this.protocol + _host + this.pathname +
- this.search + this.hash;
- },
- get hostname(){
- var m = hostname.exec(this.href);
- return m&&m.length>1?m[1]:"";
- },
- set hostname(_hostname){
- $w.location = this.protocol + _hostname + ((this.port==="")?"":(":"+this.port)) +
- this.pathname + this.search + this.hash;
- },
- get href(){
- //This is the only env specific function
- return $location;
- },
- set href(url){
- $w.location = url;
- },
- get pathname(){
- var m = this.href;
- m = pathname.exec(m.substring(m.indexOf(this.hostname)));
- return m&&m.length>1?m[1]:"/";
- },
- set pathname(_pathname){
- $w.location = this.protocol + this.host + _pathname +
- this.search + this.hash;
- },
- get port(){
- var m = port.exec(this.href);
- return m&&m.length>1?m[1]:"";
- },
- set port(_port){
- $w.location = this.protocol + this.hostname + ":"+_port + this.pathname +
- this.search + this.hash;
- },
- get protocol(){
- return protocol.exec(this.href)[0];
- },
- set protocol(_protocol){
- $w.location = _protocol + this.host + this.pathname +
- this.search + this.hash;
- },
- get search(){
- var m = search.exec(this.href);
- return m&&m.length>1?m[1]:"";
- },
- set search(_search){
- $w.location = this.protocol + this.host + this.pathname +
- _search + this.hash;
- },
- toString: function(){
- return this.href;
- },
- reload: function(force){
- //TODO
- },
- replace: function(url){
- //TODO
- }
- };
-});
-
-/*
-* history.js
-*/
-
- $info("Initializing Window History.");
- $currentHistoryIndex = 0;
- $history = [];
-
- // Browser History
- $w.__defineGetter__("history", function(){
- return {
- get length(){ return $history.length; },
- back : function(count){
- if(count){
- go(-count);
- }else{go(-1);}
- },
- forward : function(count){
- if(count){
- go(count);
- }else{go(1);}
- },
- go : function(target){
- if(typeof target == "number"){
- target = $currentHistoryIndex+target;
- if(target > -1 && target < $history.length){
- if($history[target].location == "hash"){
- $w.location.hash = $history[target].value;
- }else{
- $w.location = $history[target].value;
- }
- $currentHistoryIndex = target;
- //remove the last item added to the history
- //since we are moving inside the history
- $history.pop();
- }
- }else{
- //TODO: walk throu the history and find the 'best match'
- }
- }
- };
- });
-
- //Here locationPart is the particutlar method/attribute
- // of the location object that was modified. This allows us
- // to modify the correct portion of the location object
- // when we navigate the history
- var setHistory = function( value, locationPart){
- $info("adding value to history: " +value);
- $currentHistoryIndex++;
- $history.push({
- location: locationPart||"href",
- value: value
- });
- };
- /*
-* navigator.js
-* - requires env
-*/
-$debug("Initializing Window Navigator.");
-
-var $appCodeName = $env.appCodeName;//eg "Mozilla"
-var $appName = $env.appName;//eg "Gecko/20070309 Firefox/2.0.0.3"
-
-// Browser Navigator
-$w.__defineGetter__("navigator", function(){
- return {
- get appCodeName(){
- return $appCodeName;
- },
- get appName(){
- return $appName;
- },
- get appVersion(){
- return $version +" ("+
- $w.navigator.platform +"; "+
- "U; "+//?
- $env.os_name+" "+$env.os_arch+" "+$env.os_version+"; "+
- $env.lang+"; "+
- "rv:"+$revision+
- ")";
- },
- get cookieEnabled(){
- return true;
- },
- get mimeTypes(){
- return [];
- },
- get platform(){
- return $env.platform;
- },
- get plugins(){
- return [];
- },
- get userAgent(){
- return $w.navigator.appCodeName + "/" + $w.navigator.appVersion + " " + $w.navigator.appName;
- },
- javaEnabled : function(){
- return $env.javaEnabled;
- }
- };
-});
-
-/*
-* timer.js
-*/
-
-
-$debug("Initializing Window Timer.");
-
-//private
-var $timers = [];
-
-$w.setTimeout = function(fn, time){
- var num;
- return num = window.setInterval(function(){
- fn();
- window.clearInterval(num);
- }, time);
-};
-
-window.setInterval = function(fn, time){
- var num = $timers.length+1;
-
- if (typeof fn == 'string') {
- var fnstr = fn;
- fn = function() {
- eval(fnstr);
- };
- }
- if(time===0){
- fn();
- }else{
- $debug("Creating timer number "+num);
- $timers[num] = new $env.timer(fn, time);
- $timers[num].start();
- }
- return num;
-};
-
-window.clearInterval = window.clearTimeout = function(num){
- if ( $timers[num] ) {
-
- $debug("Deleting timer number "+num);
- $timers[num].stop();
- delete $timers[num];
- }
-};
- /*
-* event.js
-*/
-// Window Events
-$debug("Initializing Window Event.");
-var $events = [],
- $onerror,
- $onload,
- $onunload;
-
-$w.addEventListener = function(type, fn){
- //$log("adding event listener " + type);
- if ( !this.uuid ) {
- this.uuid = $events.length;
- $events[this.uuid] = {};
- }
- if ( !$events[this.uuid][type] ){
- $events[this.uuid][type] = [];
- }
- if ( $events[this.uuid][type].indexOf( fn ) < 0 ){
- $events[this.uuid][type].push( fn );
- }
-};
-
-$w.removeEventListener = function(type, fn){
- if ( !this.uuid ) {
- this.uuid = $events.length;
- $events[this.uuid] = {};
- }
- if ( !$events[this.uuid][type] ){
- $events[this.uuid][type] = [];
- }
- $events[this.uuid][type] =
- $events[this.uuid][type].filter(function(f){
- return f != fn;
- });
-};
-
-$w.dispatchEvent = function(event){
- $debug("dispatching event " + event.type);
- //the window scope defines the $event object, for IE(^^^) compatibility;
- $event = event;
- if (!event.target) {
- event.target = this;
- }
- $debug("event target: " + event.target);
- if ( event.type ) {
- if ( this.uuid && $events[this.uuid][event.type] ) {
- var _this = this;
- $events[this.uuid][event.type].forEach(function(fn){
- $debug('calling event handler '+fn+' on target '+_this);
- fn.call( _this, event );
- });
- }
-
- if (this["on" + event.type]) {
- $debug('calling event handler '+event.type+' on target '+this);
- this["on" + event.type].call(_this, event);
- }
- }
- if(this.parentNode){
- this.parentNode.dispatchEvent.call(this.parentNode,event);
- }
-};
-
-$w.__defineGetter__('onerror', function(){
- return function(){
- //$w.dispatchEvent('error');
- };
-});
-
-$w.__defineSetter__('onerror', function(fn){
- //$w.addEventListener('error', fn);
-});
-
-/*$w.__defineGetter__('onload', function(){
- return function(){
- //var event = document.createEvent();
- //event.initEvent("load");
- //$w.dispatchEvent(event);
- };
-});
-
-$w.__defineSetter__('onload', function(fn){
- //$w.addEventListener('load', fn);
-});
-
-$w.__defineGetter__('onunload', function(){
- return function(){
- //$w.dispatchEvent('unload');
- };
-});
-
-$w.__defineSetter__('onunload', function(fn){
- //$w.addEventListener('unload', fn);
-});*//*
-* xhr.js
-*/
-$debug("Initializing Window XMLHttpRequest.");
-// XMLHttpRequest
-// Originally implemented by Yehuda Katz
-$w.XMLHttpRequest = function(){
- this.headers = {};
- this.responseHeaders = {};
- $debug("creating xhr");
-};
-
-XMLHttpRequest.prototype = {
- open: function(method, url, async, user, password){
- this.readyState = 1;
- if (async === false ){
- this.async = false;
- }else{ this.async = true; }
- this.method = method || "GET";
- this.url = $env.location(url);
- this.onreadystatechange();
- },
- setRequestHeader: function(header, value){
- this.headers[header] = value;
- },
- getResponseHeader: function(header){ },
- send: function(data){
- var _this = this;
-
- function makeRequest(){
- $env.connection(_this, function(){
- var responseXML = null;
- _this.__defineGetter__("responseXML", function(){
- if ( _this.responseText.match(/^\s*</) ) {
- if(responseXML){
- return responseXML;
-
- }else{
- try {
- $debug("parsing response text into xml document");
- responseXML = $domparser.parseFromString(_this.responseText+"");
- return responseXML;
- } catch(e) { return null;/*TODO: need to flag an error here*/}
- }
- }else{return null;}
- });
- }, data);
- _this.onreadystatechange();
- }
- if (this.async){
- $debug("XHR sending asynch;");
- $env.runAsync(makeRequest);
- }else{
- $debug("XHR sending synch;");
- makeRequest();
- }
- },
- abort: function(){
- //TODO
- },
- onreadystatechange: function(){
- //TODO
- },
- getResponseHeader: function(header){
- var rHeader, returnedHeaders;
- if (this.readyState < 3){
- throw new Error("INVALID_STATE_ERR");
- } else {
- returnedHeaders = [];
- for (rHeader in this.responseHeaders) {
- if (rHeader.match(new RegExp(header, "i")))
- returnedHeaders.push(this.responseHeaders[rHeader]);
- }
- if (returnedHeaders.length){ return returnedHeaders.join(", "); }
- }return null;
- },
- getAllResponseHeaders: function(){
- var header, returnedHeaders = [];
- if (this.readyState < 3){
- throw new Error("INVALID_STATE_ERR");
- } else {
- for (header in this.responseHeaders){
- returnedHeaders.push( header + ": " + this.responseHeaders[header] );
- }
- }return returnedHeaders.join("\r\n");
- },
- async: true,
- readyState: 0,
- responseText: "",
- status: 0
-};/*
-* css.js
-*/
-$debug("Initializing Window CSS");
-// returns a CSS2Properties object that represents the style
-// attributes and values used to render the specified element in this
-// window. Any length values are always expressed in pixel, or
-// absolute values.
-$w.getComputedStyle = function(elt, pseudo_elt){
- //TODO
- //this is a naive implementation
- $debug("Getting computed style");
- return elt?elt.style:new CSS2Properties({cssText:""});
-};/*
-* screen.js
-*/
-$debug("Initializing Window Screen.");
-
-var $availHeight = 600,
- $availWidth = 800,
- $colorDepth = 16,
- $height = 600,
- $width = 800;
-
-$w.__defineGetter__("screen", function(){
- return {
- get availHeight(){return $availHeight;},
- get availWidth(){return $availWidth;},
- get colorDepth(){return $colorDepth;},
- get height(){return $height;},
- get width(){return $width;}
- };
-});
-
-
-$w.moveBy = function(dx,dy){
- //TODO
-};
-
-$w.moveTo = function(x,y) {
- //TODO
-};
-
-/*$w.print = function(){
- //TODO
-};*/
-
-$w.resizeBy = function(dw, dh){
- $w.resizeTo($width+dw,$height+dh);
-};
-
-$w.resizeTo = function(width, height){
- $width = (width <= $availWidth) ? width : $availWidth;
- $height = (height <= $availHeight) ? height : $availHeight;
-};
-
-
-$w.scroll = function(x,y){
- //TODO
-};
-$w.scrollBy = function(dx, dy){
- //TODO
-};
-$w.scrollTo = function(x,y){
- //TODO
-};/*
-* dialog.js
-*/
-$debug("Initializing Window Dialogs.");
-$w.alert = function(message){
- $env.warn(message);
-};
-
-$w.confirm = function(question){
- //TODO
-};
-
-$w.prompt = function(message, defaultMsg){
- //TODO
-};/**
-* jQuery AOP - jQuery plugin to add features of aspect-oriented programming (AOP) to jQuery.
-* http://jquery-aop.googlecode.com/
-*
-* Licensed under the MIT license:
-* http://www.opensource.org/licenses/mit-license.php
-*
-* Version: 1.1
-*/
-window.$profiler;
-
-(function() {
-
- var _after = 1;
- var _before = 2;
- var _around = 3;
- var _intro = 4;
- var _regexEnabled = true;
-
- /**
- * Private weaving function.
- */
- var weaveOne = function(source, method, advice) {
-
- var old = source[method];
-
- var aspect;
- if (advice.type == _after)
- aspect = function() {
- var returnValue = old.apply(this, arguments);
- return advice.value.apply(this, [returnValue, method]);
- };
- else if (advice.type == _before)
- aspect = function() {
- advice.value.apply(this, [arguments, method]);
- return old.apply(this, arguments);
- };
- else if (advice.type == _intro)
- aspect = function() {
- return advice.value.apply(this, arguments);
- };
- else if (advice.type == _around) {
- aspect = function() {
- var invocation = { object: this, args: arguments };
- return advice.value.apply(invocation.object, [{ arguments: invocation.args, method: method, proceed :
- function() {
- return old.apply(invocation.object, invocation.args);
- }
- }] );
- };
- }
-
- aspect.unweave = function() {
- source[method] = old;
- pointcut = source = aspect = old = null;
- };
-
- source[method] = aspect;
-
- return aspect;
-
- };
-
-
- /**
- * Private weaver and pointcut parser.
- */
- var weave = function(pointcut, advice)
- {
-
- var source = (typeof(pointcut.target.prototype) != 'undefined') ? pointcut.target.prototype : pointcut.target;
- var advices = [];
-
- // If it's not an introduction and no method was found, try with regex...
- if (advice.type != _intro && typeof(source[pointcut.method]) == 'undefined')
- {
-
- for (var method in source)
- {
- if (source[method] != null && source[method] instanceof Function && method.match(pointcut.method))
- {
- advices[advices.length] = weaveOne(source, method, advice);
- }
- }
-
- if (advices.length == 0)
- throw 'No method: ' + pointcut.method;
-
- }
- else
- {
- // Return as an array of one element
- advices[0] = weaveOne(source, pointcut.method, advice);
- }
-
- return _regexEnabled ? advices : advices[0];
-
- };
-
- window.$profiler =
- {
- /**
- * Creates an advice after the defined point-cut. The advice will be executed after the point-cut method
- * has completed execution successfully, and will receive one parameter with the result of the execution.
- * This function returns an array of weaved aspects (Function).
- *
- * @example jQuery.aop.after( {target: window, method: 'MyGlobalMethod'}, function(result) { alert('Returned: ' + result); } );
- * @result Array<Function>
- *
- * @example jQuery.aop.after( {target: String, method: 'indexOf'}, function(index) { alert('Result found at: ' + index + ' on:' + this); } );
- * @result Array<Function>
- *
- * @name after
- * @param Map pointcut Definition of the point-cut to apply the advice. A point-cut is the definition of the object/s and method/s to be weaved.
- * @option Object target Target object to be weaved.
- * @option String method Name of the function to be weaved. Regex are supported, but not on built-in objects.
- * @param Function advice Function containing the code that will get called after the execution of the point-cut. It receives one parameter
- * with the result of the point-cut's execution.
- *
- * @type Array<Function>
- * @cat Plugins/General
- */
- after : function(pointcut, advice)
- {
- return weave( pointcut, { type: _after, value: advice } );
- },
-
- /**
- * Creates an advice before the defined point-cut. The advice will be executed before the point-cut method
- * but cannot modify the behavior of the method, or prevent its execution.
- * This function returns an array of weaved aspects (Function).
- *
- * @example jQuery.aop.before( {target: window, method: 'MyGlobalMethod'}, function() { alert('About to execute MyGlobalMethod'); } );
- * @result Array<Function>
- *
- * @example jQuery.aop.before( {target: String, method: 'indexOf'}, function(index) { alert('About to execute String.indexOf on: ' + this); } );
- * @result Array<Function>
- *
- * @name before
- * @param Map pointcut Definition of the point-cut to apply the advice. A point-cut is the definition of the object/s and method/s to be weaved.
- * @option Object target Target object to be weaved.
- * @option String method Name of the function to be weaved. Regex are supported, but not on built-in objects.
- * @param Function advice Function containing the code that will get called before the execution of the point-cut.
- *
- * @type Array<Function>
- * @cat Plugins/General
- */
- before : function(pointcut, advice)
- {
- return weave( pointcut, { type: _before, value: advice } );
- },
-
-
- /**
- * Creates an advice 'around' the defined point-cut. This type of advice can control the point-cut method execution by calling
- * the functions '.proceed()' on the 'invocation' object, and also, can modify the arguments collection before sending them to the function call.
- * This function returns an array of weaved aspects (Function).
- *
- * @example jQuery.aop.around( {target: window, method: 'MyGlobalMethod'}, function(invocation) {
- * alert('# of Arguments: ' + invocation.arguments.length);
- * return invocation.proceed();
- * } );
- * @result Array<Function>
- *
- * @example jQuery.aop.around( {target: String, method: 'indexOf'}, function(invocation) {
- * alert('Searching: ' + invocation.arguments[0] + ' on: ' + this);
- * return invocation.proceed();
- * } );
- * @result Array<Function>
- *
- * @example jQuery.aop.around( {target: window, method: /Get(\d+)/}, function(invocation) {
- * alert('Executing ' + invocation.method);
- * return invocation.proceed();
- * } );
- * @desc Matches all global methods starting with 'Get' and followed by a number.
- * @result Array<Function>
- *
- *
- * @name around
- * @param Map pointcut Definition of the point-cut to apply the advice. A point-cut is the definition of the object/s and method/s to be weaved.
- * @option Object target Target object to be weaved.
- * @option String method Name of the function to be weaved. Regex are supported, but not on built-in objects.
- * @param Function advice Function containing the code that will get called around the execution of the point-cut. This advice will be called with one
- * argument containing one function '.proceed()', the collection of arguments '.arguments', and the matched method name '.method'.
- *
- * @type Array<Function>
- * @cat Plugins/General
- */
- around : function(pointcut, advice)
- {
- return weave( pointcut, { type: _around, value: advice } );
- },
-
- /**
- * Creates an introduction on the defined point-cut. This type of advice replaces any existing methods with the same
- * name. To restore them, just unweave it.
- * This function returns an array with only one weaved aspect (Function).
- *
- * @example jQuery.aop.introduction( {target: window, method: 'MyGlobalMethod'}, function(result) { alert('Returned: ' + result); } );
- * @result Array<Function>
- *
- * @example jQuery.aop.introduction( {target: String, method: 'log'}, function() { alert('Console: ' + this); } );
- * @result Array<Function>
- *
- * @name introduction
- * @param Map pointcut Definition of the point-cut to apply the advice. A point-cut is the definition of the object/s and method/s to be weaved.
- * @option Object target Target object to be weaved.
- * @option String method Name of the function to be weaved.
- * @param Function advice Function containing the code that will be executed on the point-cut.
- *
- * @type Array<Function>
- * @cat Plugins/General
- */
- introduction : function(pointcut, advice)
- {
- return weave( pointcut, { type: _intro, value: advice } );
- },
-
- /**
- * Configures global options.
- *
- * @name setup
- * @param Map settings Configuration options.
- * @option Boolean regexMatch Enables/disables regex matching of method names.
- *
- * @example jQuery.aop.setup( { regexMatch: false } );
- * @desc Disable regex matching.
- *
- * @type Void
- * @cat Plugins/General
- */
- setup: function(settings)
- {
- _regexEnabled = settings.regexMatch;
- }
- };
-
-})();
-
-
-var $profile = window.$profile = {};
-
-
-var __profile__ = function(id, invocation){
- var start = new Date().getTime();
- var retval = invocation.proceed();
- var finish = new Date().getTime();
- $profile[id] = $profile[id] ? $profile[id] : {};
- $profile[id].callCount = $profile[id].callCount !== undefined ?
- $profile[id].callCount+1 : 0;
- $profile[id].times = $profile[id].times ? $profile[id].times : [];
- $profile[id].times[$profile[id].callCount++] = (finish-start);
- return retval;
-};
-
-
-window.$profiler.stats = function(raw){
- var max = 0,
- avg = -1,
- min = 10000000,
- own = 0;
- for(var i = 0;i<raw.length;i++){
- if(raw[i] > 0){
- own += raw[i];
- };
- if(raw[i] > max){
- max = raw[i];
- }
- if(raw[i] < min){
- min = raw[i];
- }
- }
- avg = Math.floor(own/raw.length);
- return {
- min: min,
- max: max,
- avg: avg,
- own: own
- };
-};
-
-if(Envjs.profile){
- /**
- * CSS2Properties
- */
- window.$profiler.around({ target: CSS2Properties, method:"getPropertyCSSValue"}, function(invocation) {
- return __profile__("CSS2Properties.getPropertyCSSValue", invocation);
- });
- window.$profiler.around({ target: CSS2Properties, method:"getPropertyPriority"}, function(invocation) {
- return __profile__("CSS2Properties.getPropertyPriority", invocation);
- });
- window.$profiler.around({ target: CSS2Properties, method:"getPropertyValue"}, function(invocation) {
- return __profile__("CSS2Properties.getPropertyValue", invocation);
- });
- window.$profiler.around({ target: CSS2Properties, method:"item"}, function(invocation) {
- return __profile__("CSS2Properties.item", invocation);
- });
- window.$profiler.around({ target: CSS2Properties, method:"removeProperty"}, function(invocation) {
- return __profile__("CSS2Properties.removeProperty", invocation);
- });
- window.$profiler.around({ target: CSS2Properties, method:"setProperty"}, function(invocation) {
- return __profile__("CSS2Properties.setProperty", invocation);
- });
- window.$profiler.around({ target: CSS2Properties, method:"toString"}, function(invocation) {
- return __profile__("CSS2Properties.toString", invocation);
- });
-
-
- /**
- * DOMNode
- */
-
- window.$profiler.around({ target: DOMNode, method:"hasAttributes"}, function(invocation) {
- return __profile__("DOMNode.hasAttributes", invocation);
- });
- window.$profiler.around({ target: DOMNode, method:"insertBefore"}, function(invocation) {
- return __profile__("DOMNode.insertBefore", invocation);
- });
- window.$profiler.around({ target: DOMNode, method:"replaceChild"}, function(invocation) {
- return __profile__("DOMNode.replaceChild", invocation);
- });
- window.$profiler.around({ target: DOMNode, method:"removeChild"}, function(invocation) {
- return __profile__("DOMNode.removeChild", invocation);
- });
- window.$profiler.around({ target: DOMNode, method:"replaceChild"}, function(invocation) {
- return __profile__("DOMNode.replaceChild", invocation);
- });
- window.$profiler.around({ target: DOMNode, method:"appendChild"}, function(invocation) {
- return __profile__("DOMNode.appendChild", invocation);
- });
- window.$profiler.around({ target: DOMNode, method:"hasChildNodes"}, function(invocation) {
- return __profile__("DOMNode.hasChildNodes", invocation);
- });
- window.$profiler.around({ target: DOMNode, method:"cloneNode"}, function(invocation) {
- return __profile__("DOMNode.cloneNode", invocation);
- });
- window.$profiler.around({ target: DOMNode, method:"normalize"}, function(invocation) {
- return __profile__("DOMNode.normalize", invocation);
- });
- window.$profiler.around({ target: DOMNode, method:"isSupported"}, function(invocation) {
- return __profile__("DOMNode.isSupported", invocation);
- });
- window.$profiler.around({ target: DOMNode, method:"getElementsByTagName"}, function(invocation) {
- return __profile__("DOMNode.getElementsByTagName", invocation);
- });
- window.$profiler.around({ target: DOMNode, method:"getElementsByTagNameNS"}, function(invocation) {
- return __profile__("DOMNode.getElementsByTagNameNS", invocation);
- });
- window.$profiler.around({ target: DOMNode, method:"importNode"}, function(invocation) {
- return __profile__("DOMNode.importNode", invocation);
- });
- window.$profiler.around({ target: DOMNode, method:"contains"}, function(invocation) {
- return __profile__("DOMNode.contains", invocation);
- });
- window.$profiler.around({ target: DOMNode, method:"compareDocumentPosition"}, function(invocation) {
- return __profile__("DOMNode.compareDocumentPosition", invocation);
- });
-
-
- /**
- * DOMDocument
- */
- window.$profiler.around({ target: DOMDocument, method:"addEventListener"}, function(invocation) {
- return __profile__("DOMDocument.addEventListener", invocation);
- });
- window.$profiler.around({ target: DOMDocument, method:"removeEventListener"}, function(invocation) {
- return __profile__("DOMDocument.removeEventListener", invocation);
- });
- window.$profiler.around({ target: DOMDocument, method:"attachEvent"}, function(invocation) {
- return __profile__("DOMDocument.attachEvent", invocation);
- });
- window.$profiler.around({ target: DOMDocument, method:"detachEvent"}, function(invocation) {
- return __profile__("DOMDocument.detachEvent", invocation);
- });
- window.$profiler.around({ target: DOMDocument, method:"dispatchEvent"}, function(invocation) {
- return __profile__("DOMDocument.dispatchEvent", invocation);
- });
- window.$profiler.around({ target: DOMDocument, method:"loadXML"}, function(invocation) {
- return __profile__("DOMDocument.loadXML", invocation);
- });
- window.$profiler.around({ target: DOMDocument, method:"load"}, function(invocation) {
- return __profile__("DOMDocument.load", invocation);
- });
- window.$profiler.around({ target: DOMDocument, method:"createEvent"}, function(invocation) {
- return __profile__("DOMDocument.createEvent", invocation);
- });
- window.$profiler.around({ target: DOMDocument, method:"createExpression"}, function(invocation) {
- return __profile__("DOMDocument.createExpression", invocation);
- });
- window.$profiler.around({ target: DOMDocument, method:"createElement"}, function(invocation) {
- return __profile__("DOMDocument.createElement", invocation);
- });
- window.$profiler.around({ target: DOMDocument, method:"createDocumentFragment"}, function(invocation) {
- return __profile__("DOMDocument.createDocumentFragment", invocation);
- });
- window.$profiler.around({ target: DOMDocument, method:"createTextNode"}, function(invocation) {
- return __profile__("DOMDocument.createTextNode", invocation);
- });
- window.$profiler.around({ target: DOMDocument, method:"createComment"}, function(invocation) {
- return __profile__("DOMDocument.createComment", invocation);
- });
- window.$profiler.around({ target: DOMDocument, method:"createCDATASection"}, function(invocation) {
- return __profile__("DOMDocument.createCDATASection", invocation);
- });
- window.$profiler.around({ target: DOMDocument, method:"createProcessingInstruction"}, function(invocation) {
- return __profile__("DOMDocument.createProcessingInstruction", invocation);
- });
- window.$profiler.around({ target: DOMDocument, method:"createAttribute"}, function(invocation) {
- return __profile__("DOMDocument.createAttribute", invocation);
- });
- window.$profiler.around({ target: DOMDocument, method:"createElementNS"}, function(invocation) {
- return __profile__("DOMDocument.createElementNS", invocation);
- });
- window.$profiler.around({ target: DOMDocument, method:"createAttributeNS"}, function(invocation) {
- return __profile__("DOMDocument.createAttributeNS", invocation);
- });
- window.$profiler.around({ target: DOMDocument, method:"createNamespace"}, function(invocation) {
- return __profile__("DOMDocument.createNamespace", invocation);
- });
- window.$profiler.around({ target: DOMDocument, method:"getElementById"}, function(invocation) {
- return __profile__("DOMDocument.getElementById", invocation);
- });
- window.$profiler.around({ target: DOMDocument, method:"normalizeDocument"}, function(invocation) {
- return __profile__("DOMDocument.normalizeDocument", invocation);
- });
-
-
- /**
- * HTMLDocument
- */
- window.$profiler.around({ target: HTMLDocument, method:"createElement"}, function(invocation) {
- return __profile__("HTMLDocument.createElement", invocation);
- });
-
- /**
- * DOMParser
- */
- window.$profiler.around({ target: DOMParser, method:"parseFromString"}, function(invocation) {
- return __profile__("DOMParser.parseFromString", invocation);
- });
-
- /**
- * DOMNodeList
- */
- window.$profiler.around({ target: DOMNodeList, method:"item"}, function(invocation) {
- return __profile__("DOMNode.item", invocation);
- });
- window.$profiler.around({ target: DOMNodeList, method:"toString"}, function(invocation) {
- return __profile__("DOMNode.toString", invocation);
- });
-
- /**
- * XMLP
- */
- window.$profiler.around({ target: XMLP, method:"_addAttribute"}, function(invocation) {
- return __profile__("XMLP._addAttribute", invocation);
- });
- window.$profiler.around({ target: XMLP, method:"_checkStructure"}, function(invocation) {
- return __profile__("XMLP._checkStructure", invocation);
- });
- window.$profiler.around({ target: XMLP, method:"_clearAttributes"}, function(invocation) {
- return __profile__("XMLP._clearAttributes", invocation);
- });
- window.$profiler.around({ target: XMLP, method:"_findAttributeIndex"}, function(invocation) {
- return __profile__("XMLP._findAttributeIndex", invocation);
- });
- window.$profiler.around({ target: XMLP, method:"getAttributeCount"}, function(invocation) {
- return __profile__("XMLP.getAttributeCount", invocation);
- });
- window.$profiler.around({ target: XMLP, method:"getAttributeName"}, function(invocation) {
- return __profile__("XMLP.getAttributeName", invocation);
- });
- window.$profiler.around({ target: XMLP, method:"getAttributeValue"}, function(invocation) {
- return __profile__("XMLP.getAttributeValue", invocation);
- });
- window.$profiler.around({ target: XMLP, method:"getAttributeValueByName"}, function(invocation) {
- return __profile__("XMLP.getAttributeValueByName", invocation);
- });
- window.$profiler.around({ target: XMLP, method:"getColumnNumber"}, function(invocation) {
- return __profile__("XMLP.getColumnNumber", invocation);
- });
- window.$profiler.around({ target: XMLP, method:"getContentBegin"}, function(invocation) {
- return __profile__("XMLP.getContentBegin", invocation);
- });
- window.$profiler.around({ target: XMLP, method:"getContentEnd"}, function(invocation) {
- return __profile__("XMLP.getContentEnd", invocation);
- });
- window.$profiler.around({ target: XMLP, method:"getLineNumber"}, function(invocation) {
- return __profile__("XMLP.getLineNumber", invocation);
- });
- window.$profiler.around({ target: XMLP, method:"getName"}, function(invocation) {
- return __profile__("XMLP.getName", invocation);
- });
- window.$profiler.around({ target: XMLP, method:"next"}, function(invocation) {
- return __profile__("XMLP.next", invocation);
- });
- window.$profiler.around({ target: XMLP, method:"_parse"}, function(invocation) {
- return __profile__("XMLP._parse", invocation);
- });
- window.$profiler.around({ target: XMLP, method:"_parse"}, function(invocation) {
- return __profile__("XMLP._parse", invocation);
- });
- window.$profiler.around({ target: XMLP, method:"_parseAttribute"}, function(invocation) {
- return __profile__("XMLP._parseAttribute", invocation);
- });
- window.$profiler.around({ target: XMLP, method:"_parseCDATA"}, function(invocation) {
- return __profile__("XMLP._parseCDATA", invocation);
- });
- window.$profiler.around({ target: XMLP, method:"_parseComment"}, function(invocation) {
- return __profile__("XMLP._parseComment", invocation);
- });
- window.$profiler.around({ target: XMLP, method:"_parseDTD"}, function(invocation) {
- return __profile__("XMLP._parseDTD", invocation);
- });
- window.$profiler.around({ target: XMLP, method:"_parseElement"}, function(invocation) {
- return __profile__("XMLP._parseElement", invocation);
- });
- window.$profiler.around({ target: XMLP, method:"_parseEntity"}, function(invocation) {
- return __profile__("XMLP._parseEntity", invocation);
- });
- window.$profiler.around({ target: XMLP, method:"_parsePI"}, function(invocation) {
- return __profile__("XMLP._parsePI", invocation);
- });
- window.$profiler.around({ target: XMLP, method:"_parseText"}, function(invocation) {
- return __profile__("XMLP._parseText", invocation);
- });
- window.$profiler.around({ target: XMLP, method:"_replaceEntities"}, function(invocation) {
- return __profile__("XMLP._replaceEntities", invocation);
- });
- window.$profiler.around({ target: XMLP, method:"_replaceEntity"}, function(invocation) {
- return __profile__("XMLP._replaceEntity", invocation);
- });
- window.$profiler.around({ target: XMLP, method:"_setContent"}, function(invocation) {
- return __profile__("XMLP._setContent", invocation);
- });
- window.$profiler.around({ target: XMLP, method:"_setErr"}, function(invocation) {
- return __profile__("XMLP._setErr", invocation);
- });
-
-
- /**
- * SAXDriver
- */
- window.$profiler.around({ target: SAXDriver, method:"parse"}, function(invocation) {
- return __profile__("SAXDriver.parse", invocation);
- });
- window.$profiler.around({ target: SAXDriver, method:"setDocumentHandler"}, function(invocation) {
- return __profile__("SAXDriver.setDocumentHandler", invocation);
- });
- window.$profiler.around({ target: SAXDriver, method:"setErrorHandler"}, function(invocation) {
- return __profile__("SAXDriver.setErrorHandler", invocation);
- });
- window.$profiler.around({ target: SAXDriver, method:"setLexicalHandler"}, function(invocation) {
- return __profile__("SAXDriver.setLexicalHandler", invocation);
- });
- window.$profiler.around({ target: SAXDriver, method:"getColumnNumber"}, function(invocation) {
- return __profile__("SAXDriver.getColumnNumber", invocation);
- });
- window.$profiler.around({ target: SAXDriver, method:"getLineNumber"}, function(invocation) {
- return __profile__("SAXDriver.getLineNumber", invocation);
- });
- window.$profiler.around({ target: SAXDriver, method:"getMessage"}, function(invocation) {
- return __profile__("SAXDriver.getMessage", invocation);
- });
- window.$profiler.around({ target: SAXDriver, method:"getPublicId"}, function(invocation) {
- return __profile__("SAXDriver.getPublicId", invocation);
- });
- window.$profiler.around({ target: SAXDriver, method:"getSystemId"}, function(invocation) {
- return __profile__("SAXDriver.getSystemId", invocation);
- });
- window.$profiler.around({ target: SAXDriver, method:"getLength"}, function(invocation) {
- return __profile__("SAXDriver.getLength", invocation);
- });
- window.$profiler.around({ target: SAXDriver, method:"getName"}, function(invocation) {
- return __profile__("SAXDriver.getName", invocation);
- });
- window.$profiler.around({ target: SAXDriver, method:"getValue"}, function(invocation) {
- return __profile__("SAXDriver.getValue", invocation);
- });
- window.$profiler.around({ target: SAXDriver, method:"getValueByName"}, function(invocation) {
- return __profile__("SAXDriver.getValueByName", invocation);
- });
- window.$profiler.around({ target: SAXDriver, method:"_fireError"}, function(invocation) {
- return __profile__("SAXDriver._fireError", invocation);
- });
- window.$profiler.around({ target: SAXDriver, method:"_fireEvent"}, function(invocation) {
- return __profile__("SAXDriver._fireEvent", invocation);
- });
- window.$profiler.around({ target: SAXDriver, method:"_parseLoop"}, function(invocation) {
- return __profile__("SAXDriver._parseLoop", invocation);
- });
-
- /**
- * SAXStrings
- */
- window.$profiler.around({ target: SAXStrings, method:"getColumnNumber"}, function(invocation) {
- return __profile__("SAXStrings.getColumnNumber", invocation);
- });
- window.$profiler.around({ target: SAXStrings, method:"getLineNumber"}, function(invocation) {
- return __profile__("SAXStrings.getLineNumber", invocation);
- });
- window.$profiler.around({ target: SAXStrings, method:"indexOfNonWhitespace"}, function(invocation) {
- return __profile__("SAXStrings.indexOfNonWhitespace", invocation);
- });
- window.$profiler.around({ target: SAXStrings, method:"indexOfWhitespace"}, function(invocation) {
- return __profile__("SAXStrings.indexOfWhitespace", invocation);
- });
- window.$profiler.around({ target: SAXStrings, method:"isEmpty"}, function(invocation) {
- return __profile__("SAXStrings.isEmpty", invocation);
- });
- window.$profiler.around({ target: SAXStrings, method:"lastIndexOfNonWhitespace"}, function(invocation) {
- return __profile__("SAXStrings.lastIndexOfNonWhitespace", invocation);
- });
- window.$profiler.around({ target: SAXStrings, method:"replace"}, function(invocation) {
- return __profile__("SAXStrings.replace", invocation);
- });
-
- /**
- * Stack - SAX Utility
- window.$profiler.around({ target: Stack, method:"clear"}, function(invocation) {
- return __profile__("Stack.clear", invocation);
- });
- window.$profiler.around({ target: Stack, method:"count"}, function(invocation) {
- return __profile__("Stack.count", invocation);
- });
- window.$profiler.around({ target: Stack, method:"destroy"}, function(invocation) {
- return __profile__("Stack.destroy", invocation);
- });
- window.$profiler.around({ target: Stack, method:"peek"}, function(invocation) {
- return __profile__("Stack.peek", invocation);
- });
- window.$profiler.around({ target: Stack, method:"pop"}, function(invocation) {
- return __profile__("Stack.pop", invocation);
- });
- window.$profiler.around({ target: Stack, method:"push"}, function(invocation) {
- return __profile__("Stack.push", invocation);
- });
- */
-}
-
-/*
-* document.js
-*
-* DOM Level 2 /DOM level 3 (partial)
-*
-* This file adds the document object to the window and allows you
-* you to set the window.document using an html string or dom object.
-*
-*/
-
-// read only reference to the Document object
-
-$debug("Initializing window.document.");
-var $async = false;
-__extend__(HTMLDocument.prototype, {
- get async(){ return $async;},
- set async(async){ $async = async; },
- get baseURI(){ return $env.location('./'); },
- get URL(){ return $w.location.href; }
-});
-
-
-
-var $document = new HTMLDocument($implementation);
-$w.__defineGetter__("document", function(){
- return $document;
-});
-$debug("Defining document.cookie");
-/*
-* cookie.js
-* - requires env
-*/
-
-var $cookies = {
- persistent:{
- //domain - key on domain name {
- //path - key on path {
- //name - key on name {
- //value : cookie value
- //other cookie properties
- //}
- //}
- //}
- //expire - provides a timestamp for expiring the cookie
- //cookie - the cookie!
- },
- temporary:{//transient is a reserved word :(
- //like above
- }
-};
-
-//HTMLDocument cookie
-document.__defineSetter__("cookie", function(cookie){
- var i,name,value,properties = {},attr,attrs = cookie.split(";");
- //for now the strategy is to simply create a json object
- //and post it to a file in the .cookies.js file. I hate parsing
- //dates so I decided not to implement support for 'expires'
- //(which is deprecated) and instead focus on the easier 'max-age'
- //(which succeeds 'expires')
- cookie = {};//keyword properties of the cookie
- for(i=0;i<attrs.length;i++){
- attr = attrs[i].split("=");
- if(attr.length > 0){
- name = trim(attr[0]);
- value = trim(attr[1]);
- if(name=='max-age'){
- //we'll have to set a timer to check these
- //and garbage collect expired cookies
- cookie[name] = parseInt(value, 10);
- } else if(name=='domain'){
- if(domainValid(value)){
- cookie['domain']=value;
- }else{
- cookie['domain']=$w.location.domain;
- }
- } else if(name=='path'){
- //not sure of any special logic for path
- cookie['path'] = value;
- } else {
- //its not a cookie keyword so store it in our array of properties
- //and we'll serialize individually in a moment
- properties[name] = value;
- }
- }else{
- if(attr[0] == 'secure'){
- cookie[attr[0]] = true;
- }
- }
- }
- if(!cookie['max-age']){
- //it's a transient cookie so it only lasts as long as
- //the window.location remains the same
- mergeCookie($cookies.temporary, cookie, properties);
- }else if(cookie['max-age']===0){
- //delete the cookies
- //TODO
- }else{
- //the cookie is persistent
- mergeCookie($cookies.persistent, cookie, properties);
- persistCookies();
- }
-});
-
-document.__defineGetter__("cookie", function(c){
- //The cookies that are returned must belong to the same domain
- //and be at or below the current window.location.path. Also
- //we must check to see if the cookie was set to 'secure' in which
- //case we must check our current location.protocol to make sure it's
- //https:
- var allcookies = [], i;
- //TODO
-});
-
-
-
-var domainValid = function(domain){
- //make sure the domain
- //TODO
-};
-
-var mergeCookie = function(target, cookie, properties){
- var name, now;
- if(!target[cookie.domain]){
- target[cookie.domain] = {};
- }
- if(!target[cookie.domain][cookie.path]){
- target[cookie.domain][cookie.path] = {};
- }
- for(name in properties){
- now = new Date().getTime();
- target[cookie.domain][cookie.path][name] = {
- value:properties[name],
- "@env:secure":cookie.secure,
- "@env:max-age":cookie['max-age'],
- "@env:date-created":now,
- "@env:expiration":now + cookie['max-age']
- };
- }
-};
-
-var persistCookies = function(){
- //TODO
- //I think it should be done via $env so it can be customized
-};
-
-var loadCookies = function(){
- //TODO
- //should also be configurable via $env
-};
-
-//We simply use the default ajax get to load the .cookies.js file
-//if it doesn't exist we create it with a post. Cookies are maintained
-//in memory, but serialized with each set.
-$info("Loading Cookies");
-try{
- //TODO - load cookies
- loadCookies();
-}catch(e){
- //TODO - fail gracefully
-}
- /*
-* outro.js
-*/
-
-})(window, Envjs);
-
-}catch(e){
- Envjs.error("ERROR LOADING ENV : " + e + "\nLINE SOURCE:\n" + Envjs.lineSource(e));
-}
diff --git a/utils/lib/file-bootstrap.js b/utils/lib/file-bootstrap.js
deleted file mode 100755
index 1ee69e6..0000000
--- a/utils/lib/file-bootstrap.js
+++ /dev/null
@@ -1,170 +0,0 @@
-
-// NOTE: this file is used is the bootstrapping process,
-// so any "requires" must be accounted for in narwhal.js
-
-// use the "file" module as the exports object.
-var exports = require("file");
-
-/* path manipulation, needed by the sandbox module in the
- * bootstrapping process before "require" is ready for use */
-
-if (/\bwindows\b/i.test(system.os)) {
- exports.ROOT = "\\";
- exports.SEPARATOR = "\\";
- exports.ALT_SEPARATOR = "/";
-} else {
- exports.ROOT = "/";
- exports.SEPARATOR = "/";
- exports.ALT_SEPARATOR = undefined;
-}
-
-// we need to make sure the separator regex is always in sync with the separators.
-// this caches the generated regex and rebuild if either separator changes.
-exports.SEPARATORS_RE = function() {
- if (separatorCached !== exports.SEPARATOR || altSeparatorCached !== exports.ALT_SEPARATOR) {
- separatorCached = exports.SEPARATOR;
- altSeparatorCached = exports.ALT_SEPARATOR;
- separatorReCached = new RegExp("[" +
- (separatorCached || '').replace(/[-[\]{}()*+?.\\^$|,#\s]/g, "\\$&") +
- (altSeparatorCached || '').replace(/[-[\]{}()*+?.\\^$|,#\s]/g, "\\$&") +
- "]", "g");
- }
- return separatorReCached;
-}
-var separatorCached, altSeparatorCached, separatorReCached;
-
-exports.join = function () {
- return exports.normal(Array.prototype.join.call(arguments, exports.SEPARATOR));
-};
-
-exports.split = function (path) {
- var parts;
- try {
- parts = String(path).split(exports.SEPARATORS_RE());
- } catch (exception) {
- throw new Error("Cannot split " + (typeof path) + ', "' + path + '"');
- }
- // this special case helps isAbsolute
- // distinguish an empty path from an absolute path
- if (parts.length == 1 && parts[0] == "")
- return [];
- return parts;
-};
-
-exports.resolve = function () {
- var root = "";
- var parents = [];
- var children = [];
- var leaf = "";
- for (var i = 0; i < arguments.length; i++) {
- var path = String(arguments[i]);
- if (path == "")
- continue;
- var parts = path.split(exports.SEPARATORS_RE());
- if (exports.isAbsolute(path)) {
- root = parts.shift() + exports.SEPARATOR;
- parents = [];
- children = [];
- }
- leaf = parts.pop();
- if (leaf == "." || leaf == "..") {
- parts.push(leaf);
- leaf = "";
- }
- for (var j = 0; j < parts.length; j++) {
- var part = parts[j];
- if (part == "." || part == '') {
- } else if (part == "..") {
- if (children.length) {
- children.pop();
- } else {
- if (root) {
- } else {
- parents.push("..");
- }
- }
- } else {
- children.push(part);
- }
- };
- }
- path = parents.concat(children).join(exports.SEPARATOR);
- if (path) leaf = exports.SEPARATOR + leaf;
- return root + path + leaf;
-};
-
-exports.normal = function (path) {
- return exports.resolve(path);
-};
-
-// XXX not standard
-exports.isAbsolute = function (path) {
- // for absolute paths on any operating system,
- // the first path component always determines
- // whether it is relative or absolute. On Unix,
- // it is empty, so ['', 'foo'].join('/') == '/foo',
- // '/foo'.split('/') == ['', 'foo'].
- var parts = exports.split(path);
- // split('') == []. '' is not absolute.
- // split('/') == ['', ''] is absolute.
- // split(?) == [''] does not occur.
- if (parts.length == 0)
- return false;
- var first = parts[0];
- if (/\bwindows\b/i.test(system.os)) {
- return /:$/.test(first);
- } else {
- return first == "";
- }
-};
-
-// XXX not standard
-exports.isRelative = function (path) {
- return !exports.isAbsolute(path);
-};
-
-/*** root
- returns the Unix root path
- or corresponding Windows drive
- for a given path.
-*/
-// XXX not standard
-exports.root = function (path) {
- if (!exports.isAbsolute(path))
- path = require("file").absolute(path);
- var parts = exports.split(path);
- return exports.join(parts[0], '');
-};
-
-exports.dirname = function (path) {
- var parts = exports.split(path);
- // XXX needs to be sensitive to the root for
- // Windows compatibility
- parts.pop();
- return exports.join.apply(null, parts) || ".";
-};
-
-// XXX the extension argument is not standard
-exports.basename = function (path, extension) {
- var basename = path.split(exports.SEPARATORS_RE()).pop();
- if (extension)
- basename = basename.replace(
- new RegExp(RegExp.escape(extension) + '$'),
- ''
- );
- return basename;
-};
-
-exports.extension = function (path) {
- path = exports.basename(path);
- path = path.replace(/^\.*/, '');
- var index = path.lastIndexOf(".");
- return index <= 0 ? "" : path.substring(index);
-};
-
-// XXX not standard, deprecated
-exports.extname = function (path) {
- system.log.warn('extname is deprecated in favor of extension');
- return exports.extension(path);
-};
-
diff --git a/utils/lib/file.js b/utils/lib/file.js
deleted file mode 100755
index 8c354ba..0000000
--- a/utils/lib/file.js
+++ /dev/null
@@ -1,447 +0,0 @@
-
-// NOTE: portions of the "file" module are implemented in "file-bootstrap" and "file-platform",
-// which are loaded at the bottom of this file to allow for overriding default implementations
-
-var io = require('io');
-
-/* streams */
-
-exports.open = function (path, mode, options) {
-
- // it's possible to confuse options and mode,
- // particularly with exports.read(path, options).
- // if a mode string is passed into options,
- // tollerate it.
- if (typeof options == 'string') {
- options = {
- mode: exports.mode(options)
- }
- }
-
- // we'll channel all of the arguments through
- // the options object, so create an empty one if none
- // was given.
- if (!options)
- options = {};
-
- // if options were specified as the first (and
- // presumably only) argument, use those options,
- // overriding any in the options object if both
- // were provided.
- if (typeof path == 'object') {
- for (var key in path) {
- if (Object.prototype.hasOwnProperty.call(path, key)) {
- options[key] = path[key];
- }
- }
- }
- // if the path is a string, however, write it
- // onto the options object alone.
- if (typeof path == 'string')
- options.path = path;
-
- // accumulate the mode from options.mode and
- // the mode arg through successive generations;
- // coerce the options.mode to an object, suitable
- // for updates
- options.mode = exports.mode(options.mode);
- // update options.mode with the mode argument
- if (mode)
- options.mode = exports.mode(mode, options.mode);
-
-
- // channel all the options back into local variables
- path = options.path;
- mode = options.mode;
- var permissions = options.permissions,
- charset = options.charset,
- buffering = options.buffering,
- recordSeparator = options.recordSeparator,
- fieldSeparator = options.fieldSeparator;
-
- // and decompose the mode object
- var read = mode.read,
- write = mode.write,
- append = mode.append,
- update = mode.update,
- binary = mode.binary;
-
- // read by default
- if (!(read || write || append))
- read = mode.read = true;
-
- // create a byte stream
- var raw = exports.FileIO(path, mode, permissions);
-
- // if we're in binary mode, just return the raw
- // stream
- if (binary)
- return raw;
-
- // otherwise, go through the courses to return the
- // appropriate reader, writer, or updater, buffered,
- // line buffered, and charset decoded/encoded
- // abstraction
-
- var lineBuffering = buffering == 1 || buffering === undefined && raw.isatty && raw.isatty();
- // leaving buffering undefined is a signal to the platform implementation
- // that it ought to pick a good size on its own.
- if (buffering < 0) {
- throw new Error("invalid buffering size");
- }
- if (buffering === 0) {
- throw new Error("can't have unbuffered text IO");
- }
-
- return new io.TextIOWrapper(raw, mode, lineBuffering, buffering, charset, options);
-
-};
-
-/*
- idempotent normalization of acceptable formats for
- file modes.
-*/
-exports.mode = function (mode, result) {
- if (!result)
- result = {
- read: false,
- write: false,
- append: false,
- update: false,
- binary: false,
- canonical: false,
- exclusive: false
- };
- else if (typeof result != 'object')
- throw new Error("Mode to update is not a proper mode object: " + result);
-
- if (mode === undefined || mode === null) {
- } else if (mode instanceof String || typeof mode == "string") {
- mode.split("").forEach(function (option) {
- if (option == 'r') {
- result.read = true;
- } else if (option == 'w') {
- result.write = true;
- } else if (option == 'a') {
- result.append = true;
- } else if (option == '+') {
- result.update = false;
- } else if (option == 'b') {
- result.binary = true;
- } else if (option == 't') {
- result.binary = false;
- } else if (option == 'c') {
- result.canonical = true;
- } else if (option == 'x') {
- result.exclusive = true;
- } else {
- throw new Error("unrecognized mode option in mode: " + option);
- }
- });
- } else if (mode instanceof Array) {
- mode.forEach(function (option) {
- if (Object.prototype.hasOwnProperty.call(result, option)) {
- result[option] = true;
- } else {
- throw new Error("unrecognized mode option in mode: " + option);
- }
- });
- } else if (mode instanceof Object) {
- for (var option in mode) {
- if (Object.prototype.hasOwnProperty.call(mode, option)) {
- if (Object.prototype.hasOwnProperty.call(result, option)) {
- result[option] = !!mode[option];
- } else {
- throw new Error("unrecognized mode option in mode: " + option);
- }
- }
- }
- } else {
- throw new Error("unrecognized mode: " + mode);
- }
-
- return result;
-};
-
-/* read, write, &c */
-
-exports.read = function (path, options) {
- path = String(path);
- var file = exports.open(path, 'r', options);
- try {
- return file.read();
- } finally {
- file.close();
- }
-};
-
-exports.write = function (path, data, options) {
- path = String(path);
- var file = exports.open(path, 'w', options);
- try {
- file.write(data);
- file.flush();
- } finally {
- file.close();
- }
-};
-
-exports.copy = function (source, target) {
- source = exports.path(source);
- target = exports.path(target);
- var data = source.read();
- target.write(data);
-};
-
-exports.list = function (path) {
- path = String(path);
- if (!path)
- path = ".";
- return implementation.list(path);
-};
-
-exports.listTree = function (path) {
- path = String(path);
- var paths = [path];
- if (exports.isDirectory(path)) {
- exports.list(path).forEach(function (child) {
- paths.push.apply(
- paths,
- exports.listTree(exports.join(path, child))
- );
- });
- }
- return paths;
-};
-
-exports.glob = function (pattern) {
- pattern = String(pattern);
- pattern = pattern.replace(/\*\*/g, '*/**/*');
- var parts = exports.split(pattern);
- var paths = [''];
- parts.forEach(function (part) {
-
- if (part == "") {
- } else if (part == "**") {
- paths = Array.prototype.concat.apply(
- [],
- paths.map(function (path) {
- return exports.listTree(path);
- })
- );
- } else if (/[\*\?]/.test(part)) {
- var pattern = new RegExp('^'+
- part.split('*').map(function (part) {
- return part.split('?').map(function (part) {
- return RegExp.escape(part);
- }).join('.');
- }).join('.*?')
- +'$');
- paths = Array.prototype.concat.apply([], paths.map(function (path) {
- if (path != "" && !exports.isDirectory(path))
- return [];
- return exports.list(path).filter(function (name) {
- return pattern.test(name);
- }).map(function (name) {
- return exports.join(path, name);
- }).filter(function (path) {
- return exports.exists(path);
- });
- }));
- } else if (part == "...") {
- paths = Array.prototype.concat.apply(
- [],
- paths.map(function (path) {
- var heredity = [];
- var parts = exports.split(exports.absolute(path));
- while (parts.length) {
- heredity.push(exports.join.apply(null, parts));
- parts.pop();
- }
- return heredity;
- })
- );
- } else {
- paths = paths.map(function (path) {
- return exports.join(path, part);
- });
- }
-
- // uniqueness
- var visited = {};
- paths = paths.filter(function (path) {
- var result = !Object.prototype.hasOwnProperty.call(visited, path);
- visited[path] = true;
- return result;
- });
-
- });
- return paths;
-};
-
-exports.rmtree = function(path) {
- if (exports.isDirectory(path)) {
- exports.list(path).forEach(function (name) {
- exports.rmtree(exports.join(path, name));
- });
- exports.rmdir(path);
- } else {
- exports.remove(path);
- }
-};
-
-/* path manipulation */
-
-exports.relative = function (source, target) {
- if (!target) {
- target = source;
- source = exports.cwd() + '/';
- }
- source = exports.absolute(source);
- target = exports.absolute(target);
- source = source.split(exports.SEPARATORS_RE());
- target = target.split(exports.SEPARATORS_RE());
- source.pop();
- while (
- source.length &&
- target.length &&
- target[0] == source[0]) {
- source.shift();
- target.shift();
- }
- while (source.length) {
- source.shift();
- target.unshift("..");
- }
- return target.join(exports.SEPARATORS_RE());
-};
-
-exports.absolute = function (path) {
- return exports.resolve(exports.join(exports.cwd(), ''), path);
-};
-
-/* path wrapper, for chaining */
-
-exports.path = function (/*path*/) {
- return exports.Path(exports.join.apply(exports, arguments));
-};
-
-var Path = exports.Path = function (path) {
- if (!(this instanceof exports.Path))
- return new exports.Path(path);
- this.toString = function () {
- return path;
- };
-};
-
-Path.prototype = new String();
-
-Path.prototype.valueOf = function () {
- return this.toString();
-};
-
-Path.prototype.join = function () {
- return exports.Path(
- exports.join.apply(
- null,
- [this.toString()].concat(Array.prototype.slice.call(arguments))
- )
- );
-};
-
-Path.prototype.resolve = function () {
- return exports.Path(
- exports.resolve.apply(
- null,
- [this.toString()].concat(Array.prototype.slice.call(arguments))
- )
- );
-};
-
-Path.prototype.to = function (target) {
- return exports.Path(exports.relative(this.toString(), target));
-};
-
-Path.prototype.from = function (target) {
- return exports.Path(exports.relative(target, this.toString()));
-};
-
-Path.prototype.listPaths = function () {
- var self = this;
- return exports.list(this).map(function (name) {
- return self.join(name);
- });
-};
-
-var pathed = [
- 'absolute',
- 'basename',
- 'canonical',
- 'dirname',
- 'normal',
- 'relative'
-];
-
-for (var i = 0; i < pathed.length; i++) {
- var name = pathed[i];
- Path.prototype[name] = (function (name) {
- return function () {
- return exports.Path(exports[name].apply(
- this,
- [this.toString()].concat(Array.prototype.slice.call(arguments))
- ));
- };
- })(name);
-}
-
-var trivia = [
- 'chmod',
- 'chown',
- 'copy',
- 'exists',
- 'extname',
- 'isDirectory',
- 'isFile',
- 'isLink',
- 'isReadable',
- 'isWritable',
- 'link',
- 'linkExists',
- 'list',
- 'mkdir',
- 'mkdirs',
- 'move',
- 'mtime',
- 'open',
- 'read',
- 'remove',
- 'rename',
- 'rmdir',
- 'rmtree',
- 'size',
- 'split',
- 'stat',
- 'symlink',
- 'touch',
- 'write'
-];
-
-for (var i = 0; i < trivia.length; i++) {
- var name = trivia[i];
- Path.prototype[name] = (function (name) {
- return function () {
- var result = exports[name].apply(
- this,
- [this.toString()].concat(Array.prototype.slice.call(arguments))
- );
- if (result === undefined)
- result = this;
- return result;
- };
- })(name);
-}
-
-// load "file-bootstrap" and "file-platform", which in turn load "file" and modify it's module object.
-// "platform" gets priority so it's loaded last.
-require("file-bootstrap");
-require("file-platform");
diff --git a/utils/lib/hash.js b/utils/lib/hash.js
deleted file mode 100755
index 7caa086..0000000
--- a/utils/lib/hash.js
+++ /dev/null
@@ -1,28 +0,0 @@
-// Hash object
-
-var Hash = exports.Hash = {};
-
-Hash.merge = function(hash, other) {
- var merged = {};
- if (hash) Hash.update(merged, hash);
- if (other) Hash.update(merged, other);
- return merged;
-}
-
-Hash.update = function(hash, other) {
- for (var key in other)
- hash[key] = other[key];
- return hash;
-}
-
-Hash.forEach = function(hash, block) {
- for (var key in hash)
- block(key, hash[key]);
-}
-
-Hash.map = function(hash, block) {
- var result = [];
- for (var key in hash)
- result.push(block(key, hash[key]));
- return result;
-}
diff --git a/utils/lib/hashp.js b/utils/lib/hashp.js
deleted file mode 100755
index a125375..0000000
--- a/utils/lib/hashp.js
+++ /dev/null
@@ -1,65 +0,0 @@
-var Hash = require("hash").Hash;
-
-// HashP : Case Preserving hash, used for headers
-
-var HashP = exports.HashP = {};
-
-HashP.get = function(hash, key) {
- var ikey = _findKey(hash, key);
- if (ikey !== null)
- return hash[ikey];
- // not found
- return undefined;
-}
-
-HashP.set = function(hash, key, value) {
- // do case insensitive search, and delete if present
- var ikey = _findKey(hash, key);
- if (ikey && ikey !== key)
- delete hash[ikey];
- // set it, preserving key case
- hash[key] = value;
-}
-
-HashP.unset = function(hash, key) {
- // do case insensitive search, and delete if present
- var ikey = _findKey(hash, key),
- value;
- if (ikey) {
- value = hash[ikey];
- delete hash[ikey];
- }
- return value;
-}
-
-HashP.includes = function(hash, key) {
- return HashP.get(hash, key) !== undefined
-}
-
-HashP.merge = function(hash, other) {
- var merged = {};
- if (hash) HashP.update(merged, hash);
- if (other) HashP.update(merged, other);
- return merged;
-}
-
-HashP.update = function(hash, other) {
- for (var key in other)
- HashP.set(hash, key, other[key]);
- return hash;
-}
-
-HashP.forEach = Hash.forEach;
-HashP.map = Hash.map;
-
-var _findKey = function(hash, key) {
- // optimization
- if (hash[key] !== undefined)
- return key;
- // case insensitive search
- var key = key.toLowerCase();
- for (var i in hash)
- if (i.toLowerCase() === key)
- return i;
- return null;
-}
diff --git a/utils/lib/http.js b/utils/lib/http.js
deleted file mode 100755
index 904dc6d..0000000
--- a/utils/lib/http.js
+++ /dev/null
@@ -1,17 +0,0 @@
-
-var implementation = require('http-platform');
-
-exports.open = function (url, mode, options) {
- // todo mode negotiation, particularly for binary vs text buffering
- return new implementation.IO(url);
-};
-
-exports.read = function (url) {
- var stream = exports.open(url);
- try {
- return stream.read();
- } finally {
- stream.close();
- }
-};
-
diff --git a/utils/lib/io.js b/utils/lib/io.js
deleted file mode 100755
index 8f5fd52..0000000
--- a/utils/lib/io.js
+++ /dev/null
@@ -1,38 +0,0 @@
-// IO: platform independent
-
-var implementation = require("io-platform");
-
-for (var name in implementation) {
- if (Object.prototype.hasOwnProperty.call(implementation, name)) {
- exports[name] = implementation[name];
- }
-};
-
-exports.IO.prototype.puts = function() {
- this.write(arguments.length === 0 ? "\n" : Array.prototype.join.apply(arguments, ["\n"]) + "\n");
-}
-
-exports.Peekable = function (input) {
- this._input = input;
- this._buffer = new exports.StringIO();
-};
-
-exports.Peekable.prototype.read = function (length) {
- if (arguments.length == 0)
- return this._buffer.read() + this._input.read();
- else if (this._buffer.length)
- return this._buffer.read(length);
- else
- return this._input.read(length);
-};
-
-exports.Peekable.prototype.peek = function (length) {
- while (this._buffer.length < length) {
- var read = this._input.read(length - this._buffer.length);
- if (!read.length)
- break;
- this._buffer.write(read);
- }
- return this._buffer.substring(0, length);
-};
-
diff --git a/utils/lib/jsmin.js b/utils/lib/jsmin.js
deleted file mode 100755
index 37f9afb..0000000
--- a/utils/lib/jsmin.js
+++ /dev/null
@@ -1,315 +0,0 @@
-/* jsmin.js - 2006-08-31
-Author: Franck Marcia
-This work is an adaptation of jsminc.c published by Douglas Crockford.
-Permission is hereby granted to use the Javascript version under the same
-conditions as the jsmin.c on which it is based.
-
-jsmin.c
-2006-05-04
-
-Copyright (c) 2002 Douglas Crockford (www.crockford.com)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-The Software shall be used for Good, not Evil.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
-Update:
- add level:
- 1: minimal, keep linefeeds if single
- 2: normal, the standard algorithm
- 3: agressive, remove any linefeed and doesn't take care of potential
- missing semicolons (can be regressive)
-*/
-
-String.prototype.has = function(c) {
- return this.indexOf(c) > -1;
-};
-
-exports.encode = function (input, level, comment) {
-
- if (input === undefined) {
- input = comment;
- comment = '';
- level = 2;
- } else if (level === undefined || level < 1 || level > 3) {
- level = 2;
- }
-
- if (!comment) {
- comment = "";
- }
-
- if (comment.length > 0) {
- comment += '\n';
- }
-
- var a = '',
- b = '',
- EOF = -1,
- LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',
- DIGITS = '0123456789',
- ALNUM = LETTERS + DIGITS + '_$\\',
- theLookahead = EOF;
-
-
- /* isAlphanum -- return true if the character is a letter, digit, underscore,
- dollar sign, or non-ASCII character.
- */
-
- function isAlphanum(c) {
- return c != EOF && (ALNUM.has(c) || c.charCodeAt(0) > 126);
- }
-
-
- /* get -- return the next character. Watch out for lookahead. If the
- character is a control character, translate it to a space or
- linefeed.
- */
-
- function get() {
-
- var c = theLookahead;
- if (get.i == get.l) {
- return EOF;
- }
- theLookahead = EOF;
- if (c == EOF) {
- c = input.charAt(get.i);
- ++get.i;
- }
- if (c >= ' ' || c == '\n') {
- return c;
- }
- if (c == '\r') {
- return '\n';
- }
- return ' ';
- }
-
- get.i = 0;
- get.l = input.length;
-
-
- /* peek -- get the next character without getting it.
- */
-
- function peek() {
- theLookahead = get();
- return theLookahead;
- }
-
-
- /* next -- get the next character, excluding comments. peek() is used to see
- if a '/' is followed by a '/' or '*'.
- */
-
- function next() {
-
- var c = get();
- if (c == '/') {
- switch (peek()) {
- case '/':
- for (;;) {
- c = get();
- if (c <= '\n') {
- return c;
- }
- }
- break;
- case '*':
- get();
- for (;;) {
- switch (get()) {
- case '*':
- if (peek() == '/') {
- get();
- return ' ';
- }
- break;
- case EOF:
- throw 'Error: Unterminated comment.';
- }
- }
- break;
- default:
- return c;
- }
- }
- return c;
- }
-
-
- /* action -- do something! What you do is determined by the argument:
- 1 Output A. Copy B to A. Get the next B.
- 2 Copy B to A. Get the next B. (Delete A).
- 3 Get the next B. (Delete B).
- action treats a string as a single character. Wow!
- action recognizes a regular expression if it is preceded by ( or , or =.
- */
-
- function action(d) {
-
- var r = [];
-
- if (d == 1) {
- r.push(a);
- }
-
- if (d < 3) {
- a = b;
- if (a == '\'' || a == '"') {
- for (;;) {
- r.push(a);
- a = get();
- if (a == b) {
- break;
- }
- if (a <= '\n') {
- throw 'Error: unterminated string literal: ' + a;
- }
- if (a == '\\') {
- r.push(a);
- a = get();
- }
- }
- }
- }
-
- b = next();
-
- if (b == '/' && '(,=:[!&|'.has(a)) {
- r.push(a);
- r.push(b);
- for (;;) {
- a = get();
- if (a == '/') {
- break;
- } else if (a =='\\') {
- r.push(a);
- a = get();
- } else if (a <= '\n') {
- throw 'Error: unterminated Regular Expression literal';
- }
- r.push(a);
- }
- b = next();
- }
-
- return r.join('');
- }
-
-
- /* m -- Copy the input to the output, deleting the characters which are
- insignificant to JavaScript. Comments will be removed. Tabs will be
- replaced with spaces. Carriage returns will be replaced with
- linefeeds.
- Most spaces and linefeeds will be removed.
- */
-
- function m() {
-
- var r = [];
- a = '\n';
-
- r.push(action(3));
-
- while (a != EOF) {
- switch (a) {
- case ' ':
- if (isAlphanum(b)) {
- r.push(action(1));
- } else {
- r.push(action(2));
- }
- break;
- case '\n':
- switch (b) {
- case '{':
- case '[':
- case '(':
- case '+':
- case '-':
- r.push(action(1));
- break;
- case ' ':
- r.push(action(3));
- break;
- default:
- if (isAlphanum(b)) {
- r.push(action(1));
- } else {
- if (level == 1 && b != '\n') {
- r.push(action(1));
- } else {
- r.push(action(2));
- }
- }
- }
- break;
- default:
- switch (b) {
- case ' ':
- if (isAlphanum(a)) {
- r.push(action(1));
- break;
- }
- r.push(action(3));
- break;
- case '\n':
- if (level == 1 && a != '\n') {
- r.push(action(1));
- } else {
- switch (a) {
- case '}':
- case ']':
- case ')':
- case '+':
- case '-':
- case '"':
- case '\'':
- if (level == 3) {
- r.push(action(3));
- } else {
- r.push(action(1));
- }
- break;
- default:
- if (isAlphanum(a)) {
- r.push(action(1));
- } else {
- r.push(action(3));
- }
- }
- }
- break;
- default:
- r.push(action(1));
- break;
- }
- }
- }
-
- return r.join('');
- }
-
- ret = m(input);
- return comment + ret;
-
-};
-
diff --git a/utils/lib/logger.js b/utils/lib/logger.js
deleted file mode 100755
index 8db60e7..0000000
--- a/utils/lib/logger.js
+++ /dev/null
@@ -1,53 +0,0 @@
-// Logging
-//
-// FATAL: an unhandleable error that results in a program crash
-// ERROR: a handleable error condition
-// WARN: a warning
-// INFO: generic (useful) information about system operation
-// DEBUG: low-level information for developers
-// (Stolen from Ruby)
-//
-
-var Logger = exports.Logger = function(output) {
- if (typeof output === "string")
- this.output = system.fs.open(output, "a");
- else
- this.output = output;
-
- this.level = Logger.INFO;
-};
-
-Logger.FATAL = 0;
-Logger.ERROR = 1;
-Logger.WARN = 2;
-Logger.INFO = 3;
-Logger.DEBUG = 4;
-
-Logger.SEV_LABEL = ["FATAL", "ERROR", "WARN" , "INFO" , "DEBUG"];
-
-Logger.prototype.fatal = function() {
- return this.add(Logger.FATAL, this.format(Logger.FATAL, arguments));
-};
-Logger.prototype.error = function() {
- return this.add(Logger.ERROR, this.format(Logger.ERROR, arguments));
-};
-Logger.prototype.warn = function() {
- return this.add(Logger.WARN, this.format(Logger.WARN, arguments));
-};
-Logger.prototype.info = function() {
- return this.add(Logger.INFO, this.format(Logger.INFO, arguments));
-};
-Logger.prototype.debug = function() {
- return this.add(Logger.DEBUG, this.format(Logger.DEBUG, arguments));
-};
-
-Logger.prototype.add = function(severity, message, progname) {
- if (severity > this.level)
- return false;
- this.output.write(message || progname);
-};
-
-Logger.prototype.format = function(severity, args) {
- return new Date() + " ["+Logger.SEV_LABEL[severity].toLowerCase()+"] " +Array.prototype.join.apply(args, [" "]).replace(/\n/g, "");
-};
-
diff --git a/utils/lib/md4.js b/utils/lib/md4.js
deleted file mode 100755
index fe9a292..0000000
--- a/utils/lib/md4.js
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
-
- Version 2.1 Copyright (C) Jerrad Pierce, Paul Johnston 1999 - 2002.
- Distributed under the BSD License
-
- Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
- See http://pajhome.org.uk/crypt/md5 for more info.
-
-*/
-
-/**
-
- A JavaScript implementation of the RSA Data Security, Inc. MD4 Message
- Digest Algorithm, as defined in RFC 1320.
-
-*/
-
-var util = require('./util');
-var struct = require('./struct');
-
-/*** hash
- returns a hexadecimal string of the md4 hash for a given byte string
-*/
-exports.hash = function (s, _characterSize) {
- if (util.no(_characterSize))
- _characterSize = struct.characterSize;
- return struct.binl2bin(core_md4(struct.str2binl(s), s.length * _characterSize));
-};
-
-/*
- Calculate the MD4 of an array of little-endian words, and a bit length
-*/
-var core_md4 = function (x, len) {
- /* append padding */
- x[len >> 5] |= 0x80 << (len % 32);
- x[(((len + 64) >>> 9) << 4) + 14] = len;
-
- var a = 1732584193;
- var b = -271733879;
- var c = -1732584194;
- var d = 271733878;
-
- for(var i = 0; i < x.length; i += 16) {
- var olda = a;
- var oldb = b;
- var oldc = c;
- var oldd = d;
-
- a = md4_ff(a, b, c, d, x[i+ 0], 3 );
- d = md4_ff(d, a, b, c, x[i+ 1], 7 );
- c = md4_ff(c, d, a, b, x[i+ 2], 11);
- b = md4_ff(b, c, d, a, x[i+ 3], 19);
- a = md4_ff(a, b, c, d, x[i+ 4], 3 );
- d = md4_ff(d, a, b, c, x[i+ 5], 7 );
- c = md4_ff(c, d, a, b, x[i+ 6], 11);
- b = md4_ff(b, c, d, a, x[i+ 7], 19);
- a = md4_ff(a, b, c, d, x[i+ 8], 3 );
- d = md4_ff(d, a, b, c, x[i+ 9], 7 );
- c = md4_ff(c, d, a, b, x[i+10], 11);
- b = md4_ff(b, c, d, a, x[i+11], 19);
- a = md4_ff(a, b, c, d, x[i+12], 3 );
- d = md4_ff(d, a, b, c, x[i+13], 7 );
- c = md4_ff(c, d, a, b, x[i+14], 11);
- b = md4_ff(b, c, d, a, x[i+15], 19);
-
- a = md4_gg(a, b, c, d, x[i+ 0], 3 );
- d = md4_gg(d, a, b, c, x[i+ 4], 5 );
- c = md4_gg(c, d, a, b, x[i+ 8], 9 );
- b = md4_gg(b, c, d, a, x[i+12], 13);
- a = md4_gg(a, b, c, d, x[i+ 1], 3 );
- d = md4_gg(d, a, b, c, x[i+ 5], 5 );
- c = md4_gg(c, d, a, b, x[i+ 9], 9 );
- b = md4_gg(b, c, d, a, x[i+13], 13);
- a = md4_gg(a, b, c, d, x[i+ 2], 3 );
- d = md4_gg(d, a, b, c, x[i+ 6], 5 );
- c = md4_gg(c, d, a, b, x[i+10], 9 );
- b = md4_gg(b, c, d, a, x[i+14], 13);
- a = md4_gg(a, b, c, d, x[i+ 3], 3 );
- d = md4_gg(d, a, b, c, x[i+ 7], 5 );
- c = md4_gg(c, d, a, b, x[i+11], 9 );
- b = md4_gg(b, c, d, a, x[i+15], 13);
-
- a = md4_hh(a, b, c, d, x[i+ 0], 3 );
- d = md4_hh(d, a, b, c, x[i+ 8], 9 );
- c = md4_hh(c, d, a, b, x[i+ 4], 11);
- b = md4_hh(b, c, d, a, x[i+12], 15);
- a = md4_hh(a, b, c, d, x[i+ 2], 3 );
- d = md4_hh(d, a, b, c, x[i+10], 9 );
- c = md4_hh(c, d, a, b, x[i+ 6], 11);
- b = md4_hh(b, c, d, a, x[i+14], 15);
- a = md4_hh(a, b, c, d, x[i+ 1], 3 );
- d = md4_hh(d, a, b, c, x[i+ 9], 9 );
- c = md4_hh(c, d, a, b, x[i+ 5], 11);
- b = md4_hh(b, c, d, a, x[i+13], 15);
- a = md4_hh(a, b, c, d, x[i+ 3], 3 );
- d = md4_hh(d, a, b, c, x[i+11], 9 );
- c = md4_hh(c, d, a, b, x[i+ 7], 11);
- b = md4_hh(b, c, d, a, x[i+15], 15);
-
- a = struct.addU32(a, olda);
- b = struct.addU32(b, oldb);
- c = struct.addU32(c, oldc);
- d = struct.addU32(d, oldd);
-
- }
- return [a, b, c, d];
-
-};
-
-/*
- These functions implement the basic operation for each round of the
- algorithm.
-*/
-
-var md4_cmn = function (q, a, b, x, s, t) {
- return struct.addU32(struct.rolU32(struct.addU32(a, q, x, t), s), b);
-};
-var md4_ff = function (a, b, c, d, x, s) {
- return md4_cmn((b & c) | ((~b) & d), a, 0, x, s, 0);
-};
-var md4_gg = function (a, b, c, d, x, s) {
- return md4_cmn((b & c) | (b & d) | (c & d), a, 0, x, s, 1518500249);
-};
-var md4_hh = function (a, b, c, d, x, s) {
- return md4_cmn(b ^ c ^ d, a, 0, x, s, 1859775393);
-};
-
-/*
- Calculate the HMAC-MD4, of a key and some data
-*/
-var core_hmac_md4 = function (key, data, _characterSize) {
- if (no(_characterSize))
- _characterSize = struct.characterSize;
- var bkey = struct.str2binl(key);
- if(bkey.length > 16) bkey = core_md4(bkey, key.length * _characterSize);
-
- var ipad = [], opad = [];
- for(var i = 0; i < 16; i++) {
- ipad[i] = bkey[i] ^ 0x36363636;
- opad[i] = bkey[i] ^ 0x5C5C5C5C;
- }
-
- var hash = core_md4(ipad.concat(struct.str2binl(data)), 512 + data.length * _characterSize);
- return core_md4(opad.concat(hash), 512 + 128);
-};
-
diff --git a/utils/lib/md5.js b/utils/lib/md5.js
deleted file mode 100755
index 43cd514..0000000
--- a/utils/lib/md5.js
+++ /dev/null
@@ -1,164 +0,0 @@
-
-/*
- A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
- Digest Algorithm, as defined in RFC 1321.
- Version 2.1 Copyright (C) Paul Johnston 1999 - 2002.
- Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
- Distributed under the BSD License
- See http://pajhome.org.uk/crypt/md5 for more info.
-*/
-
-var util = require('./util');
-var struct = require('./struct');
-
-/*
- * Configurable variables. You may need to tweak these to be compatible with
- * the server-side, but the defaults work in most cases.
- */
-
-/*** hash
- returns a hex string of the md5 hash for a given string.
-*/
-exports.hash = function (s, _characterSize) {
- if (util.no(_characterSize)) _characterSize = struct.characterSize;
- return struct.binl2bin(core_md5(struct.str2binl(s), s.length * _characterSize));
-};
-
-/*
- * Calculate the MD5 of an array of little-endian words, and a bit length
- */
-var core_md5 = function (x, len) {
- /* append padding */
- x[len >> 5] |= 0x80 << ((len) % 32);
- x[(((len + 64) >>> 9) << 4) + 14] = len;
-
- var a = 1732584193;
- var b = -271733879;
- var c = -1732584194;
- var d = 271733878;
-
- for (var i = 0; i < x.length; i += 16) {
- var olda = a;
- var oldb = b;
- var oldc = c;
- var oldd = d;
-
- a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);
- d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);
- c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819);
- b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);
- a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);
- d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426);
- c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);
- b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);
- a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416);
- d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);
- c = md5_ff(c, d, a, b, x[i+10], 17, -42063);
- b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);
- a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682);
- d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);
- c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);
- b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329);
-
- a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);
- d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
- c = md5_gg(c, d, a, b, x[i+11], 14, 643717713);
- b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);
- a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);
- d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083);
- c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);
- b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);
- a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438);
- d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);
- c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);
- b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501);
- a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);
- d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);
- c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473);
- b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);
-
- a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);
- d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);
- c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562);
- b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);
- a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
- d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353);
- c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);
- b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);
- a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174);
- d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);
- c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);
- b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189);
- a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);
- d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);
- c = md5_hh(c, d, a, b, x[i+15], 16, 530742520);
- b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);
-
- a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);
- d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415);
- c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);
- b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);
- a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571);
- d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);
- c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);
- b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);
- a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359);
- d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);
- c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);
- b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649);
- a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);
- d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);
- c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259);
- b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);
-
- a = struct.addU32(a, olda);
- b = struct.addU32(b, oldb);
- c = struct.addU32(c, oldc);
- d = struct.addU32(d, oldd);
- }
- return [a, b, c, d];
-
-};
-
-/*
- * These functions implement the four basic operations the algorithm uses.
- */
-
-var md5_cmn = function (q, a, b, x, s, t) {
- return struct.addU32(struct.rolU32(struct.addU32(a, q, x, t), s), b);
-};
-
-var md5_ff = function (a, b, c, d, x, s, t) {
- return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
-};
-
-var md5_gg = function (a, b, c, d, x, s, t) {
- return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
-};
-
-var md5_hh = function (a, b, c, d, x, s, t) {
- return md5_cmn(b ^ c ^ d, a, b, x, s, t);
-};
-
-var md5_ii = function (a, b, c, d, x, s, t) {
- return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
-};
-
-/*
- * Calculate the HMAC-MD5, of a key and some data
- */
-var core_hmac_md5 = function (key, data, _characterSize) {
- if (util.no(_characterSize)) _characterSize = struct.characterSize;
- var bkey = struct.str2binl(key);
- if(bkey.length > 16) bkey = core_md5(bkey, key.length * _characterSize);
-
- var ipad = [], opad = [];
- for (var i = 0; i < 16; i++) {
- ipad[i] = bkey[i] ^ 0x36363636;
- opad[i] = bkey[i] ^ 0x5C5C5C5C;
- }
-
- var hash = core_md5(ipad.concat(struct.str2binl(data)), 512 + data.length * _characterSize);
- return core_md5(opad.concat(hash), 512 + 128);
-};
-
diff --git a/utils/lib/mime.js b/utils/lib/mime.js
deleted file mode 100755
index bbc22ff..0000000
--- a/utils/lib/mime.js
+++ /dev/null
@@ -1,166 +0,0 @@
-/**
- This module provides basic functions for handling mime-types. It can
- handle matching mime-types against a list of media-ranges. See section
- 14.1 of the HTTP specification [RFC 2616] for a complete explanation.
-
- <http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1>
-
- A port to JavaScript of Joe Gregorio's MIME-Type Parser:
-
- <http://code.google.com/p/mimeparse/>
-
- Ported by J. Chris Anderson <jchris@apache.org>, targeting the Spidermonkey runtime.
-
- To run the tests, open mimeparse-js-test.html in a browser.
- Ported from version 0.1.2.
- Comments are mostly excerpted from the original.
-*/
-
-var util = require("util");
-
-/*** parseMimeType
- Carves up a mime-type and returns an Array of the
- [type, subtype, params] where "params" is a Hash of all
- the parameters for the media range.
-
- For example, the media range "application/xhtml;q=0.5" would
- get parsed into::
-
- ["application", "xhtml", { "q" : "0.5" }]
-*/
-exports.parseMimeType = function (mimeType) {
- var fullType, typeParts, params = {}, parts = mimeType.split(';');
- for (var i=0; i < parts.length; i++) {
- var p = parts[i].split('=');
- if (p.length == 2) {
- params[util.trim(p[0])] = util.trim(p[1]);
- }
- };
- fullType = parts[0].replace(/^\s+/, '').replace(/\s+$/, '');
- if (fullType == '*') fullType = '*/*';
- typeParts = fullType.split('/');
- return [typeParts[0], typeParts[1], params];
-};
-
-/*** parseMediaRange
- Carves up a media range and returns an Array of the
- [type, subtype, params] where "params" is a Object with
- all the parameters for the media range.
-
- For example, the media range "application/*;q=0.5" would
- get parsed into::
-
- ["application", "*", { "q" : "0.5" }]
-
- In addition this function also guarantees that there
- is a value for "q" in the params dictionary, filling it
- in with a proper default if necessary.
-*/
-exports.parseMediaRange = function (range) {
- var q, parsedType = exports.parseMimeType(range);
- if (!parsedType[2]['q']) {
- parsedType[2]['q'] = '1';
- } else {
- q = parseFloat(parsedType[2]['q']);
- if (isNaN(q)) {
- parsedType[2]['q'] = '1';
- } else if (q > 1 || q < 0) {
- parsedType[2]['q'] = '1';
- }
- }
- return parsedType;
-};
-
-/*** fitnessAndQualityParsed
- Find the best match for a given mime-type against
- a list of media_ranges that have already been
- parsed by parseMediaRange(). Returns an array of
- the fitness value and the value of the 'q' quality
- parameter of the best match, or (-1, 0) if no match
- was found. Just as for qualityParsed(), 'parsed_ranges'
- must be a list of parsed media ranges.
-*/
-exports.fitnessAndQualityParsed = function (mimeType, parsedRanges) {
- var bestFitness = -1, bestFitQ = 0, target = exports.parseMediaRange(mimeType);
- var targetType = target[0], targetSubtype = target[1], targetParams = target[2];
-
- for (var i=0; i < parsedRanges.length; i++) {
- var parsed = parsedRanges[i];
- var type = parsed[0], subtype = parsed[1], params = parsed[2];
- if ((type == targetType || type == "*" || targetType == "*") &&
- (subtype == targetSubtype || subtype == "*" || targetSubtype == "*")) {
- var matchCount = 0;
- for (param in targetParams) {
- if (param != 'q' && params[param] && params[param] == targetParams[param]) {
- matchCount += 1;
- }
- }
-
- var fitness = (type == targetType) ? 100 : 0;
- fitness += (subtype == targetSubtype) ? 10 : 0;
- fitness += matchCount;
-
- if (fitness > bestFitness) {
- bestFitness = fitness;
- bestFitQ = params["q"];
- }
- }
- };
- return [bestFitness, parseFloat(bestFitQ)];
-};
-
-/*** qualityParsed
- Find the best match for a given mime-type against
- a list of media_ranges that have already been
- parsed by parseMediaRange(). Returns the
- 'q' quality parameter of the best match, 0 if no
- match was found. This function bahaves the same as quality()
- except that 'parsedRanges' must be a list of
- parsed media ranges.
-*/
-exports.qualityParsed = function (mimeType, parsedRanges) {
- return exports.fitnessAndQualityParsed(mimeType, parsedRanges)[1];
-};
-
-/*** quality
- Returns the quality 'q' of a mime-type when compared
- against the media-ranges in ranges. For example::
-
- >>> Mimeparse.quality('text/html','text/*;q=0.3, text/html;q=0.7, text/html;level=1, text/html;level=2;q=0.4, *\/*;q=0.5')
- 0.7
-*/
-exports.quality = function (mimeType, ranges) {
- return exports.qualityParsed(mimeType, parseRanges(ranges));
-};
-
-/*** bestMatch
- Takes a list of supported mime-types and finds the best
- match for all the media-ranges listed in header. The value of
- header must be a string that conforms to the format of the
- HTTP Accept: header. The value of 'supported' is a list of
- mime-types::
-
- >>> bestMatch(['application/xbel+xml', 'text/xml'], 'text/*;q=0.5,*\/*; q=0.1')
- 'text/xml'
-*/
-exports.bestMatch = function (supported, header) {
- var parsedHeader = parseRanges(header);
- var weighted = [];
- for (var i=0; i < supported.length; i++) {
- weighted.push([
- exports.fitnessAndQualityParsed(supported[i], parsedHeader),
- supported[i]
- ])
- };
- weighted.sort();
- return weighted[weighted.length-1][0][1] ? weighted[weighted.length-1][1] : '';
-};
-
-function parseRanges(ranges) {
- var parsedRanges = [], rangeParts = ranges.split(",");
- for (var i=0; i < rangeParts.length; i++) {
- parsedRanges.push(exports.parseMediaRange(rangeParts[i]));
- };
- return parsedRanges;
-};
-
diff --git a/utils/lib/narwhal.js b/utils/lib/narwhal.js
deleted file mode 100755
index 61b3beb..0000000
--- a/utils/lib/narwhal.js
+++ /dev/null
@@ -1,117 +0,0 @@
-
-var args = require("args");
-
-var parser = exports.parser = new args.Parser();
-
-parser.arg('script').optional();
-
-parser.help(
- 'Runs the Narwhal JavaScript interpreter.\n' +
- 'If no script is specified, runs interactively.'
-);
-
-// override the parser's Option type and add the "todo"
-// action chain
-
-parser.Option = function () {
- args.Option.apply(this, arguments);
-};
-parser.Option.prototype = new args.Option();
-parser.Option.prototype.todo = function (command) {
- return this.action(function (options, name, value) {
- options.todo.push([command, value]);
- });
-};
-
-parser.def('todo', []);
-
-parser.option('-e', '-c', '--command', 'command')
- .help("evaluate command")
- .todo("eval")
- .halt();
-
-parser.option('-r', '--require', 'module')
- .help("pre-load a module")
- .todo("require");
-
-parser.option('-m', '--module', 'main')
- .help("run a library module as a script")
- .set()
- .halt();
-
-parser.option('-I', '--include', 'lib')
- .help("add a library path to loader in the position of highest precedence")
- .todo("include");
-
-parser.option('-p', '--package', 'packagePrefixes')
- .help("add a package prefix directory")
- .push();
-
-parser.option('-i', '--interactive', 'interactive')
- .help('enter interactive mode after running scripts')
- .set(true)
- .hidden();
-
-parser.option('-E', '--no-use-env', 'useEnv')
- .help('ignore environment variables like JS_PATH, NARWHAL_PATH')
- .def(true)
- .set(false)
- .hidden();
-
-parser.option('-d', '--debug', 'debug')
- .help('set debug mode, system.debug = true')
- .inc();
-
-parser.option('-P', '--no-packages', 'noPackages')
- .help("don't load packages automatically")
- .set(true);
-
-parser.option('-v', '--verbose', 'verbose')
- .help("verbose mode: trace 'require' calls.")
- .set(true);
-
-parser.option('-x', '--shebang', 'shebang')
- .help('skip every line before the Unix #!shebang for non-Unix shebangs')
- .set(true)
- .hidden();
-
-parser.option('-u', '--unbuffered')
- .help('unbuffered stdin and stdout')
- .set(true)
- .hidden();
-
-parser.option('-l', '--log', 'level')
- .help('set the log level')
- .choices({'critical': 0, 'error': 1, 'warn': 2, 'info': 3, 'debug': 4});
-
-parser.option('-:', '--path', 'delimiter')
- .help("prints an augmented PATH with all package bins/")
- .todo("path");
-
-parser.option('-V', '--version')
- .help("print Narwhal version number and exit.")
- .action(function () {
- this.print("Narwhal Version 0.");
- this.exit();
- });
-
-parser.option('-O', 'optimize').inc().hidden();
-
-parser.option('--bogus');
-
-parser.option('--narwhal')
- .def('left')
- .choices(['left', 'right'])
- .action(function (options, name, value) {
- this.print(exports[value.toUpperCase()]);
- })
- .halt()
- .hidden();
-
-parser.helpful();
-
-// and now for something completely different
-
-exports.LEFT = " ,\n ,f\n ,t,\n ,:L.\n tL,\n :EDDEKL :Lt\n DDDDLGKKKK ,,tD\n ,GDDfi.itLKKEKL tEi\n DDEEf,,tfLLDEEDL,D\n .GEDEf,itLLfDLDLDDfD\n DDEDLf,,fLLGLLDLDti:DL\n DGDDGL,tttLDLDLfttttiLD\n GDDLLt,fLLLDLLtLi,ttfLG\n GGDGt,tLLLDfftii,i,ttLf\n DGLLtttftftttf,,tttitLt\n DEtftttLffttttii ttfLfj\n .DLtittftLftt,,i,,itLfLj\n DGL;t,tftiti,,,,,,tLLLt\n DGGttttttii,,,,,:,tttDG\n ,DLtjtiitii,,:,:,,t ,tG:\n DDjttttt,ii,,,,:::t:ttL\n ;GLjtttti,i,,, ,,LG,,ft\n DDLttftttti;,,ifDLDtiit\n EGLjtjftt,,,ifLt DLt,:\n DGfffijittfftt .DLLt\n:DGfjffftfLft EEDf\n:EGfftjjLLj EED\n:DGfLfjLGG ;E,\n GGfffLLL\n DGffLDf\n DGLfGL.\n fGLfGL\n DGLDL\n EGGGG\n DLGG\n EGLL\n ELG\n EEDKDGEE\n jKEKKKK\n EEKKKK\n DEE\n .EEKG\n Lf";
-exports.RIGHT = ",\nf,\n ,t,\n .L:,\n ,Lt\n tL: LKEDDE:\n Dt,, KKKKGLDDDD\n iEt LKEKKLti.ifDDG,\n D,LDEEDLLft,,fEEDD\n DfDDLDLDfLLti,fEDEG.\n LD:itDLDLLGLLf,,fLDEDD\n DLittttfLDLDLttt,LGDDGD\n GLftt,iLtLLDLLLf,tLLDDG\n fLtt,i,iitffDLLLt,tGDGG\n tLtittt,,ftttftftttLLGD\n jfLftt iittttffLtttftED\n jLfLti,,i,,ttfLtfttitLD.\n tLLLt,,,,,,ititft,t;LGD\n GDttt,:,,,,,iittttttGGD\n :Gt, t,,:,:,,iitiitjtLD,\n Ltt:t:::,,,,ii,tttttjDD\n tf,,GL,, ,,,i,ittttjLG;\n tiitDLDfi,,;ittttfttLDD\n :,tLD tLfi,,,ttfjtjLGE\n tLLD. ttffttijifffGD\n fDEE tfLftfffjfGD:\n DEE jLLjjtffGE:\n ,E; GGLjfLfGD:\n LLLfffGG\n fDLffGD\n .LGfLGD\n LGfLGf\n LDLGD\n GGGGE\n GGLD\n LLGE\n GLE\n EEGDKDEE\n KKKKEKj\n KKKKEE\n EED\n GKEE.\n fL\n";
-
diff --git a/utils/lib/narwhal/repl.js b/utils/lib/narwhal/repl.js
deleted file mode 100755
index 4eab332..0000000
--- a/utils/lib/narwhal/repl.js
+++ /dev/null
@@ -1,96 +0,0 @@
-try {
- var Narcissus = require("narcissus/parse");
-} catch(e) {
-}
-
-var util = require('util');
-
-var PROMPT_NORMAL = "js> ",
- PROMPT_INCOMPLETE = " > "
-
-var buffer = "";
-function readln(input) {
- while (!(/\n/).test(buffer))
- buffer += input.read(100).toString();
-
- var lines = buffer.split("\n"),
- line = lines.shift();
-
- buffer = lines.join("\n");
-
- return line
-}
-
-exports.repl = function() {
-
- var buffer = "",
- bufferedLines = [],
- pendingLines = [];
-
- system.stdout.write(PROMPT_NORMAL);
- system.stdout.flush();
-
- while (true) {
-
- // TODO: replace with real readln
- var line = system.stdin.readLine();
- if (!line) {
- system.stdout.write("\n");
- system.stdout.flush();
- break;
- }
-
- line = util.trimEnd(line);
- var text = pendingLines.join("\n") + "\n" + line;
- if (line == "" || !incomplete(text)) {
-
- pendingLines = [];
-
- try {
- var result = system.evalGlobal(text);
- var repr = util.repr(result);
- if (repr.length > 76 || /\n/.test(repr))
- repr = String(result);
- if (!util.no(result)) {
- system.stdout.write(repr + '\n');
- system.stdout.flush();
- global._ = result;
- }
- } catch (e) {
- system.stdout.write(" exception from uncaught JavaScript throw: " + e + "\n");
- }
-
- } else
- pendingLines.push(line);
-
- if (pendingLines.length > 0)
- system.stdout.write(PROMPT_INCOMPLETE);
- else
- system.stdout.write(PROMPT_NORMAL);
- system.stdout.flush();
-
- }
-}
-
-function incomplete(text) {
- if (!Narcissus)
- return false;
-
- var incomp = true;
- try {
- var t = new Narcissus.Tokenizer(text);
- var x = new Narcissus.CompilerContext(false);
- var n = Narcissus.Script(t, x);
- incomp = !t.done;
- } catch (e) {
- if (!t.done) {
- print(e);
- return false;
- }
- }
- return incomp;
-}
-
-if (module.id == require.main)
- exports.repl();
-
diff --git a/utils/lib/narwhal/server-test.js b/utils/lib/narwhal/server-test.js
deleted file mode 100755
index 24724a1..0000000
--- a/utils/lib/narwhal/server-test.js
+++ /dev/null
@@ -1,3 +0,0 @@
-var util = require("util");
-print("Hello, World!");
-print(util.keys({"a": 10, "b": 20}).join(', '));
diff --git a/utils/lib/narwhal/server.js b/utils/lib/narwhal/server.js
deleted file mode 100755
index 5e4580a..0000000
--- a/utils/lib/narwhal/server.js
+++ /dev/null
@@ -1,211 +0,0 @@
-
-var fs = require('file');
-var util = require('util');
-var sandboxing = require('sandbox');
-var Loader = sandboxing.Loader;
-var AttenuatedLoader = sandboxing.AttenuatedLoader;
-var Sandbox = sandboxing.Sandbox;
-
-var contentType = "application/x-javascript";
-
-exports.Bundler = function (system) {
- var self = {};
-
- system = util.copy(system);
- system.platforms = util.copy(system.platforms);
- system.platforms.unshift('browser');
- var paths = util.copy(require.paths);
- paths.unshift(system.prefix + '/platforms/browser/lib');
-
- var loader = AttenuatedLoader(Loader({"paths": paths}));
- var sandbox = Sandbox({'loader': loader, 'system': system});
-
- sandbox.force('system');
- sandbox('global');
- sandbox('packages').main();
-
- self.dependencies = function (baseId) {
- var dependencies = [];
- loader.fetch(baseId).replace(
- /require\s*\(\s*(['"])([^'"]+)\1\s*\)/g,
- function (all, quote, id) {
- dependencies.push(loader.resolve(id, baseId));
- return all;
- }
- );
- return dependencies;
- };
-
- self.transitiveDependencies = function (id, visited) {
- var result = [];
- if (!visited)
- visited = {};
- if (util.has(visited, id))
- return result;
- visited[id] = true;
- result.push(id);
- self.dependencies(id).forEach(function (id) {
- result.push.apply(
- result,
- self.transitiveDependencies(id, visited)
- );
- });
- return result;
- };
-
- self.module = function (id) {
- return loader.fetch(id);
- };
-
- self.factory = function (id) {
- if (util.has(factories, id))
- return util.get(factories, id);
- var factory = (
- 'require.register(' + util.enquote(id) + ',' +
- 'function(require,exports,module,system,print){' +
- loader.fetch(id) +
- '/**/\n});'
- );
- util.set(factories, id, factory);
- return factory;
- };
-
- self.factories = function (id) {
- return self.dependencies(id).map(self.factory).join('');
- };
-
- self.transitiveFactories = function (id) {
- return self.transitiveDependencies(id).map(self.factory).join('');
- };
-
- self.bundle = function (id) {
- var bootstrap = fs.path(module.path).resolve('../../platforms/browser/bootstrap.js').read();
- return exports.jsmin(bootstrap).replace(/\s*$/, '') + '.call(this,' + self.factories(id) + ')';
- };
-
- self.inline = function (id, path) {
- var inline = fs.path(module.path).resolve('../../platforms/browser/inline.js').read().replace(/\s*$/, '');
- var ids = self.transitiveDependencies(id).concat(['sandbox']);
- util.sort(ids, util.by(function (id) {
- return -self.factory(id).length;
- }));
- return inline + '.call(this, ' +
- JSON.encode(ids) + ',' +
- JSON.encode(id) + ',' +
- JSON.encode(path) +
- ')';
- };
-
- var timestamps = {};
- var factories = {};
-
- self.App = function () {
- // modules?{id} that loads modules from module/{id}
- // module/{id}.js
- // bundle/{id}.js -> including {guids} for postcache, including cache prediction, including loader
- // version/{mtime}/{id}.js -> minified, factorized, cached, mtime verified
- return require("jack/directory").Directory({
- 'module': self.moduleApp,
- 'bundle': self.bundleApp,
- 'factory': self.factoryApp
- });
- };
-
- self.moduleApp = function (env) {
- var id = env.PATH_INFO.replace(/^\//, '').replace(/\.js$/, '');
- return [
- 200,
- {"Content-type": contentType},
- [self.module(id)]
- ];
- };
-
- self.bundleApp = function (env) {
- var id = env.PATH_INFO.replace(/^\//, '').replace(/\.js$/, '');
- return [
- 200,
- {"Content-type": contentType},
- [self.transitiveFactories(id)]
- ];
- };
-
- self.factoryApp = function (env) {
- var id = env.PATH_INFO.replace(/^\//, '').replace(/\.js$/, '');
- return [200, {"Content-type": contentType}, [self.factory(id)]];
- };
-
- return self;
-};
-
-exports.jsmin = function (text) {
- if (require("jsmin").encode === undefined)
- throw new Error("I should not be.");
- return require("jsmin").encode(text);
-};
-
-exports.App = function (app, path) {
- // TODO use path
- var bundler = exports.Bundler(system);
- var jsApp = bundler.App();
- return function (env) {
-
- if (/^\/js\//.test(env.PATH_INFO)) {
- env.SCRIPT_NAME = env.SCRIPT_NAME + 'js/';
- env.PATH_INFO = env.PATH_INFO.substring(3);
- return jsApp(env);
- }
-
- var self = {};
- self.inline = function (id) {
- return bundler.inline(id, env.SCRIPT_NAME + 'js/factory/');
- };
- self.xhr = function (id) {
- return env.javascript.path + '/module/modules?path=' + env.javascript.path + '/module/&' + id;
- };
- self.path = env.SCRIPT_NAME + '/js';
-
- env.javascript = self;
- return app(env);
- };
-};
-
-if (require.main == module.id) {
- var app = require('jack/directory').Directory(
- {
-
- /* this is the inline script solution that uses
- * massively parallel script injection and a heuristic
- * for transitive dependencies */
- "": function (env) {
- return [
- 200,
- {'Content-type': 'text/html'},
- [
- '<html><head><script>' +
- env.javascript.inline('narwhal/server-test') +
- '</script></head><body></body></html>'
- ]
- ];
- },
-
- /* this uses dynamic, synchronous http requests */
- "xhr": function (env) {
- return [
- 200,
- {'Content-type': 'text/html'},
- [
- '<script src="' +
- env.javascript.xhr('narwhal/server-test') +
- '"></script>'
- ]
- ];
- }
-
- }
- );
- app = exports.App(app);
- app = require("jack").ContentLength(app);
- exports.app = app;
- require("jackup").main(["jackup", module.path]);
-}
-
diff --git a/utils/lib/narwhal/tusk.js b/utils/lib/narwhal/tusk.js
deleted file mode 100755
index ded05cc..0000000
--- a/utils/lib/narwhal/tusk.js
+++ /dev/null
@@ -1,169 +0,0 @@
-
-var fs = require("file");
-var packages = require("packages");
-var util = require("util");
-var json = require("json");
-var http = require("http");
-
-var minCatalogVersion = 1;
-
-var args = require("args");
-var parser = exports.parser = new args.Parser();
-
-parser.help('A Narwhal project package manager.');
-
-// parser.option('sources', exports.sources);
-
-parser.command('list', module.id + '/list')
-
-parser.command('install', module.id + '/install');
-
-parser.command('upgrade', null)
- .help('downloads the latest version of a package');
-
-parser.command('remove', null)
- .help('removes the local copy of package');
-
-parser.command('update', module.id + '/update');
-
-parser.command('search', null)
- .help('searches the package catalog');
-
-parser.command('init', module.id + '/init');
-
-parser.command('platform', module.id + '/platform');
-
-parser.command('freeze', null)
- .help('writes a freeze.json file');
-
-parser.command('bundle', null)
- .help('creates an archive of your project and its package dependencies');
-
-parser.command('reheat', module.id + '/reheat');
-
-parser.command('clone', module.id + '/clone');
-
-parser.command('catalog', module.id + '/catalog');
-
-parser.command('create-catalog', module.id + '/create-catalog');
-
-parser.command('orphans', null)
- .help('lists packages that are no longer wanted by the user or other packages.')
-
-parser.command('consolidate', module.id + '/consolidate');
-
-parser.helpful();
-
-// utilities
-//
-
-exports.getDirectory = function () {
- return fs.path(system.packagePrefixes[0]);
-};
-
-exports.getPackagesDirectory = function () {
- return exports.getDirectory().join('packages');
-};
-
-exports.getTuskDirectory = function () {
- var tuskDirectory = exports.getDirectory().join('.tusk');
- tuskDirectory.mkdirs();
- return tuskDirectory;
-}
-
-exports.getZipsDirectory = function () {
- return exports.getDirectory().join('zips');
-};
-
-exports.getCatalogPath = function () {
- return exports.getTuskDirectory().join('catalog.json');
-};
-
-exports.readCatalog = function () {
- var catalogPath = exports.getCatalogPath();
- if (!catalogPath.exists())
- throw new Error(catalogPath + " does not exist.");
- if (!catalogPath.isFile())
- throw new Error(catalogPath + " is not a file.");
- var catalog = json.decode(catalogPath.read({charset: 'utf-8'}));
- if (catalog.version === undefined || +catalog.version < minCatalogVersion)
- throw new Error("catalog is out of date. use tusk update or create-catalog");
- return catalog;
-};
-
-exports.writeCatalog = function (catalog) {
- var catalogPath = exports.getCatalogPath();
- print('Writing ' + catalogPath);
- return catalogPath.write(
- json.encode(catalog, null, 4),
- {charset: 'utf-8'}
- );
-};
-
-exports.update = function (options) {
- require('./tusk/update').update.call(this, options);
-};
-
-exports.getSourcesPath = function () {
- var try1 = exports.getTuskDirectory().join('sources.json');
- var try2 = exports.getDirectory().join('sources.json');
- if (try1.isFile())
- return try1;
- if (try2.isFile())
- return try2;
-};
-
-exports.readSources = function () {
- var sources = json.decode(exports.getSourcesPath().read(
- {charset: 'utf-8'}
- ));
- if (
- sources.version === undefined ||
- +sources.version < minCatalogVersion
- )
- throw new Error(
- "sources file is out of date. version " +
- minCatalogVersion + " is required."
- );
- sources.packages = sources.packages || {};
- return sources;
-};
-
-exports.writeSources = function (sources) {
- return exports.getSourcesPath().write(
- json.encode(sources, null, 4),
- {charset: 'utf-8'}
- );
-};
-
-exports.getNotesPath = function () {
- return exports.getTuskDirectory().join('notes.json');
-};
-
-exports.readNotes = function () {
- var notesPath = exports.getNotesPath();
- if (!notesPath.isFile())
- return {};
- return json.decode(notesPath.read(
- {charset: 'utf-8'}
- ));
-};
-
-exports.writeNotes = function (notes) {
- return exports.getNotesPath().write(
- json.encode(notes, null, 4),
- {charset: 'utf-8'}
- );
-};
-
-// run it
-
-exports.main = function (args) {
- var options = parser.parse(args);
- if (!options.acted)
- parser.printHelp(options);
-};
-
-if (module.id == require.main)
- exports.main(system.args);
-
diff --git a/utils/lib/narwhal/tusk/bin.js b/utils/lib/narwhal/tusk/bin.js
deleted file mode 100755
index fdd8716..0000000
--- a/utils/lib/narwhal/tusk/bin.js
+++ /dev/null
@@ -1,13 +0,0 @@
-
-var util = require('util');
-var tusk = require('../tusk');
-var args = require('args');
-
-var parser = exports.parser = new args.Parser();
-
-parser.help('lists all packaged executables');
-
-parser.action(function (options) {
-});
-
-
diff --git a/utils/lib/narwhal/tusk/bundle.js b/utils/lib/narwhal/tusk/bundle.js
deleted file mode 100755
index e69de29..0000000
--- a/utils/lib/narwhal/tusk/bundle.js
+++ /dev/null
diff --git a/utils/lib/narwhal/tusk/catalog.js b/utils/lib/narwhal/tusk/catalog.js
deleted file mode 100755
index 347bfcc..0000000
--- a/utils/lib/narwhal/tusk/catalog.js
+++ /dev/null
@@ -1,15 +0,0 @@
-
-var tusk = require("../tusk");
-var util = require("util");
-var args = require("args");
-
-var parser = exports.parser = new args.Parser();
-
-parser.help('lists all packages in the catalog');
-
-parser.action(function (options) {
- if (!tusk.getCatalogPath().isFile())
- require('./update').update.call(this, options);
- Object.keys(tusk.readCatalog().packages).forEach(print);
-});
-
diff --git a/utils/lib/narwhal/tusk/clone.js b/utils/lib/narwhal/tusk/clone.js
deleted file mode 100755
index 425dc5c..0000000
--- a/utils/lib/narwhal/tusk/clone.js
+++ /dev/null
@@ -1,66 +0,0 @@
-
-var tusk = require("../tusk");
-var os = require("os");
-var util = require("util");
-var args = require("args");
-
-var parser = exports.parser = new args.Parser();
-
-parser.help('clones a package from its version control system.')
-
-parser.args('package');
-
-parser.option('-o', '--owner', 'owner')
- .help("clone from the owner's repository")
- .bool()
- .inverse();
-
-parser.option('-u', '--user', 'user')
- .help('overrides the user name from which to clone the package')
- .set();
-
-parser.action(function (options) {
- var self = this;
- if (!util.len(options.args))
- throw new Error("Package name required");
- var packagesDirectory = tusk.getPackagesDirectory();
- var sources = tusk.readSources().packages;
- var catalog = tusk.readCatalog().packages;
- var owner = options.owner;
- options.args.forEach(function (name) {
- if (!util.has(sources, name))
- throw new Error("Package does not exist: " + name);
- var source = util.get(sources, name);
- if (source.type !== "github")
- throw new Error("Package " + util.enquote(name) + " is not a Github package.");
- });
- options.args.forEach(function (name) {
- var source = util.get(sources, name);
- var githubName = util.get(source, 'name', name);
- var user = options.user || source.user;
- var command = [
- 'git',
- 'clone',
- owner ?
- (
- 'git@github.com:' + user +
- '/' + githubName + '.git'
- ):
- (
- 'git://github.com/' +
- user + '/' + githubName + '.git'
- ),
- packagesDirectory.join(name)
- ];
- self.print('\0cyan(' + command.map(function (term) {
- var enquoted = os.enquote(term);
- if (enquoted != "'" + term + "'")
- return enquoted;
- return term;
- }).join(' ') + '\0)');
- os.system(command);
- });
-});
-
-parser.helpful();
-
diff --git a/utils/lib/narwhal/tusk/consolidate.js b/utils/lib/narwhal/tusk/consolidate.js
deleted file mode 100755
index 9decdc8..0000000
--- a/utils/lib/narwhal/tusk/consolidate.js
+++ /dev/null
@@ -1,25 +0,0 @@
-
-var tusk = require("../tusk");
-var util = require("util");
-var args = require("args");
-var fs = require("file");
-var packages = require("packages");
-
-var parser = exports.parser = new args.Parser();
-
-parser.help('consolidates all installed packages into the current sea.');
-
-parser.action(function (options) {
- var self = this;
- var packagesDirectory = tusk.getPackagesDirectory();
- util.forEachApply(util.items(packages.catalog), function (name, info) {
- var target = packagesDirectory.join(name);
- if (!target.exists()) {
- fs.symlink(info.directory, target);
- self.print(target + ' -> ' + info.directory);
- }
- });
-});
-
-parser.helpful();
-
diff --git a/utils/lib/narwhal/tusk/create-catalog.js b/utils/lib/narwhal/tusk/create-catalog.js
deleted file mode 100755
index f717cea..0000000
--- a/utils/lib/narwhal/tusk/create-catalog.js
+++ /dev/null
@@ -1,79 +0,0 @@
-
-var tusk = require("../tusk");
-var util = require("util");
-var args = require("args");
-var http = require("http");
-var json = require("json");
-
-var parser = exports.parser = new args.Parser();
-
-parser.help('creates a catalog of packages from sources.json');
-
-parser.action(function (options) {
- var self = this;
- var sources = tusk.readSources();
- var catalog = {};
- catalog['!'] = "This file is generated by 'tusk create-catalog', copied from '.tusk', and committed only so that it may be downloaded from Github with 'tusk update'.";
- catalog.version = util.copy(sources.version);
- var packages = catalog.packages = {};
- util.forEachApply(
- util.items(sources.packages || {}),
- function (name, source) {
- var info;
-
- if (source['package.json'])
- info = util.copy(source['package.json']);
-
- if (source.type == "inline") {
- if (!info) {
- self.print(
- "\0red(dropped:\0) " + name +
- " \0blue(because it did not provide a " +
- "package.json inline.\0)"
- );
- return;
- }
-
- } else if (source.type == "github") {
-
- var githubName = source.name || name;
- if (!source.user)
- throw new Error("package source " + util.enquote(name) + " did not have a github user name");
- var project = source.user + '/' + githubName;
- var url = "http://github.com/" + project + "/raw/master/package.json";
-
- // download package.json if not already provided
- if (!info) {
- try {
- var text = http.read(url).toString('utf-8');
- } catch (exception) {
- self.print("\0red(dropped:\0) " + name + " \0blue(because of an HTTP error\0)");
- return;
- }
- try {
- info = json.decode(text);
- } catch (exception) {
- self.print("\0red(dropped:\0) " + name + " \0blue(because of a JSON error\0)");
- return;
- }
- }
-
- info.githubName = githubName;
- info.type = "zip";
- info.location = 'http://github.com/' + source.user + '/' + githubName + '/zipball/master';
-
- } else {
- throw new Error(
- "Project " + util.enquote(name) +
- " has an urecognized type: " +
- util.enquote(source.type)
- );
- }
-
- self.print('\0green(' + name + '\0)');
- packages[name] = info;
- }
- );
- tusk.writeCatalog(catalog);
-});
-
diff --git a/utils/lib/narwhal/tusk/freeze.js b/utils/lib/narwhal/tusk/freeze.js
deleted file mode 100755
index e69de29..0000000
--- a/utils/lib/narwhal/tusk/freeze.js
+++ /dev/null
diff --git a/utils/lib/narwhal/tusk/init.js b/utils/lib/narwhal/tusk/init.js
deleted file mode 100755
index 3c73fda..0000000
--- a/utils/lib/narwhal/tusk/init.js
+++ /dev/null
@@ -1,60 +0,0 @@
-
-var fs = require("file");
-var json = require("json");
-var util = require("util");
-var args = require("args");
-var parser = exports.parser = new args.Parser();
-
-parser.help('initializes a Narwhal package/project directory');
-
-parser.option('--name', 'name').def("").set();
-parser.option('--author', 'author').def("").set();
-parser.option('--dependency', 'dependencies').push();
-parser.option('--contributor', 'contributors').push();
-
-parser.action(function (options, parentOptions) {
- parentOptions.acted = true;
- var packageInfo = {};
- var path;
- if (options.args.length && !/^-/.test(options.args[0]))
- path = options.args.shift();
- else
- path = fs.cwd();
- util.update(packageInfo, options);
- delete packageInfo.args;
- delete packageInfo.command;
- path = fs.path(path).absolute();
- print(path);
- path.join('.tusk').mkdirs();
- path.join('bin').mkdirs();
- path.join('lib').mkdirs();
- system.platforms.forEach(function (platform) {
- platform = path.join('platforms', platform);
- platform.join('lib').mkdirs();
- });
- path.join('packages').mkdirs();
-
- var sea = path.join('bin', 'sea');
- fs.path(system.prefix).join('bin', 'sea').copy(sea);
- sea.chmod(0755);
-
- var activate = path.join('bin', 'activate.bash');
- fs.path(system.prefix).join('bin', 'activate.bash')
- .copy(activate);
- activate.relative().symlink(activate.resolve('activate'));
-
- path.join('README').touch();
- path.join('narwhal.conf')
- .write('NARWHAL_DEFAULT_PLATFORM=' + system.platform);
- var packagePath = path.join('package.json');
- if (packagePath.isFile())
- util.complete(
- packageInfo,
- json.decode(packagePath.read({charset:'utf-8'}))
- );
- packagePath.write(
- json.encode(packageInfo, null, 4),
- {charset:'utf-8'}
- );
-});
-
diff --git a/utils/lib/narwhal/tusk/install.js b/utils/lib/narwhal/tusk/install.js
deleted file mode 100755
index 9d024dd..0000000
--- a/utils/lib/narwhal/tusk/install.js
+++ /dev/null
@@ -1,215 +0,0 @@
-
-var tusk = require("../tusk");
-var util = require("util");
-var args = require("args");
-var fs = require("file");
-var json = require("json");
-var http = require("http");
-var zip = require("zip");
-var packages = require("packages");
-
-var parser = exports.parser = new args.Parser();
-
-parser.help('downloads and installs a package and its dependencies');
-
-parser.action(function (options) {
- exports.install.call(this, options, options.args);
-});
-
-exports.install = function (options, names) {
-
- if (!tusk.getCatalogPath().isFile()) {
- if (options.simulate) {
- this.print("Run 'tusk update' or 'tusk create-catalog' to get a catalog.");
- return;
- }
- tusk.update.call(this, options);
- }
-
- var parser = this;
- var catalog = tusk.readCatalog();
-
- // download a catalog if the current catalog
- // does not have a version label.
- if (!catalog.version) {
- this.print("Run 'tusk update' or 'tusk create-catalog' to get a catalog.");
- this.print("Your catalog version is no longer supported.");
- return;
- }
-
- // validate the requested names against those
- // in the catalog of downloadable packages.
- var names = names.filter(function (name) {
- if (!util.has(catalog.packages, name)) {
- parser.print("ERROR: Package not found: " + util.enquote(name));
- return false;
- }
- return true;
- });
-
- // load the notes on user-requested and dependency packages
- // for book keeping.
- var notes = tusk.readNotes();
- names.forEach(function (name) {
- if (!notes[name]) {
- notes[name] = {};
- }
- notes[name].requester = "user";
- });
- tusk.writeNotes(notes);
-
- // note broken dependency chains
- var errors = [];
- var dependencies = exports.dependencies(catalog.packages, names, errors);
- if (errors.length) {
- print('The following dependencies could not be found in the catalog:');
- printUl(errors.map(function (ancestry) {
- return ancestry.join(' <- ');
- }));
- print('Please notify the package system maintainers.');
- this.exit();
- }
-
- // notify of packages already installed
- var already = exports.already(packages.catalog, names);
- if (already.length) {
- print('The following packages are already installed:');
- printUl(already);
- }
-
- // note missing packages
- var missing = exports.missing(packages.catalog, dependencies);
- if (!missing.length) {
- print('No new packages to install.');
- this.exit();
- }
- print('The following packages will be downloaded and installed:');
- printUl(missing);
-
- // download missing packages
- var zipsDirectory = tusk.getZipsDirectory();
- zipsDirectory.mkdirs();
- missing.forEach(function (name) {
- var info = catalog.packages[name];
- print('Downloading: ' + info.location);
- if (options.simulate)
- return;
- var zipFile = zipsDirectory.join(name + '.zip')
- if (options.resume && zipFile.isFile())
- return;
- var targetPath = tusk.getDirectory().join('packages', name);
- var zipData = http.read(info.location, 'b');
- zipFile.write(zipData, 'b');
- });
-
- // install missing packages
- missing.forEach(function (name) {
- if (!notes[name])
- notes[name] = {}
- if (!notes[name].files)
- notes[name].files = [];
- if (!notes[name].requester)
- notes[name].requester = "module";
- try {
- var zipFile = zipsDirectory.join(name + '.zip')
- print('Unzipping: ' + zipFile);
- if (options.simulate)
- return;
- var targetPath = tusk.getDirectory().join('packages', name);
-
- // unzip
- new zip.Unzip(zipFile).forEach(function (entry) {
- if (entry.isDirectory())
- return;
- var parts = fs.split(entry.getName());
- parts.shift(); // name-project-comment ref dirname
- var path = targetPath.join(fs.join.apply(null, parts));
- path.dirname().mkdirs();
- notes[name].files.push(path);
- print(path);
- path.write(entry.read('b'), 'b');
- });
-
- // write package.json if it was not in the
- // archive
- var packageJson = targetPath.join('package.json');
- if (!packageJson.isFile())
- packageJson.write(
- json.encode(catalog.packages[name], null, 4),
- {'charset': 'UTF-8'}
- );
-
- // make bins executable and make symlinks
- // in $SEA/bin
- var bin = targetPath.join('bin');
- if (bin.isDirectory())
- bin.list().forEach(function (name) {
- var target = targetPath.join('bin', name);
- target.chmod(0755);
- var sea = tusk.getDirectory().join('bin');
- var source = sea.join(name);
- var relative = sea.to(target);
- if (!source.linkExists()) {
- target.symlink(source);
- }
- });
-
- notes[name].finished = true;
- } catch (exception) {
- var packageJsonPath = tusk.getDirectory().join('packages', name, 'package.json');
- if (packageJsonPath.isFile())
- packageJsonPath.remove();
- throw exception;
- } finally {
- tusk.writeNotes(notes);
- /*
- if (zipFile.isFile())
- zipFile.remove();
- */
- }
- });
-
- print('Done.');
-
-};
-
-function printUl(lines) {
- lines.forEach(function (line) {
- print(' * ' + line);
- });
-};
-
-exports.dependencies = function (catalog, names, errors) {
- var dependencies = {};
- names.forEach(function (name) {
- scan(catalog, dependencies, name, [], errors);
- });
- return Object.keys(dependencies);
-};
-
-var scan = function (catalog, dependencies, name, ancestry, errors) {
- if (util.has(dependencies, name))
- return;
- ancestry = [name].concat(ancestry);
- if (!util.has(catalog, name)) {
- errors.push(ancestry);
- return;
- }
- dependencies[name] = true;
- (catalog[name].dependencies || []).forEach(function (child) {
- scan(catalog, dependencies, child, ancestry, errors);
- });
-};
-
-exports.already = function (catalog, names) {
- return names.filter(function (packageName) {
- return util.has(catalog, packageName);
- });
-};
-
-exports.missing = function (catalog, names) {
- return names.filter(function (packageName) {
- return !util.has(catalog, packageName);
- });
-};
-
diff --git a/utils/lib/narwhal/tusk/list.js b/utils/lib/narwhal/tusk/list.js
deleted file mode 100755
index 3eab4ad..0000000
--- a/utils/lib/narwhal/tusk/list.js
+++ /dev/null
@@ -1,20 +0,0 @@
-
-var tusk = require("../tusk");
-var util = require("util");
-var args = require("args");
-var packages = require("packages");
-
-var parser = exports.parser = new args.Parser();
-
-parser.help('lists all installed packages');
-
-parser.action(function (options) {
- var self = this;
- Object.keys(packages.catalog).forEach(function (name) {
- self.print(
- name + ' \0magenta(' +
- packages.catalog[name].directory + '\0)'
- );
- });
-});
-
diff --git a/utils/lib/narwhal/tusk/orphans.js b/utils/lib/narwhal/tusk/orphans.js
deleted file mode 100755
index e69de29..0000000
--- a/utils/lib/narwhal/tusk/orphans.js
+++ /dev/null
diff --git a/utils/lib/narwhal/tusk/platform.js b/utils/lib/narwhal/tusk/platform.js
deleted file mode 100755
index 48ac58c..0000000
--- a/utils/lib/narwhal/tusk/platform.js
+++ /dev/null
@@ -1,33 +0,0 @@
-
-var os = require('os');
-var util = require('util');
-var tusk = require('../tusk');
-var args = require('args');
-
-var parser = exports.parser = new args.Parser();
-
-parser.help('selects a platform for the current "sea"');
-
-parser.arg('platform').optional();
-
-parser.action(function (options) {
- var self = this;
- var directory = tusk.getDirectory();
- var platformsDirectory = directory.join('platforms');
- if (options.args.length == 0) {
- platformsDirectory.list().forEach(function (platformName) {
- self.print(platformName);
- });
- } else {
- var platform = options.args.shift();
- if (!util.has(platformsDirectory.list(), platform))
- throw new Error("No such platform");
- var narwhalConf = directory.join('narwhal.conf');
- narwhalConf.write(
- 'NARWHAL_DEFAULT_PLATFORM=' +
- os.enquote(platform)
- );
- }
-});
-
-
diff --git a/utils/lib/narwhal/tusk/reheat.js b/utils/lib/narwhal/tusk/reheat.js
deleted file mode 100755
index b1dd510..0000000
--- a/utils/lib/narwhal/tusk/reheat.js
+++ /dev/null
@@ -1,15 +0,0 @@
-
-var tusk = require("../tusk");
-var install = require('./install');
-var util = require("util");
-var args = require("args");
-var packages = require('packages');
-var parser = exports.parser = new args.Parser();
-
-parser.help('reconsistutes the exact versions of all dependencies from a frozen project');
-
-parser.action(function (options, name) {
- var names = packages.root.dependencies || [];
- install.install.call(this, options, names);
-});
-
diff --git a/utils/lib/narwhal/tusk/remove.js b/utils/lib/narwhal/tusk/remove.js
deleted file mode 100755
index c8329bd..0000000
--- a/utils/lib/narwhal/tusk/remove.js
+++ /dev/null
@@ -1,15 +0,0 @@
-
-var tusk = require("../tusk");
-var util = require("util");
-var args = require("args");
-var parser = exports.parser = new args.Parser();
-
-parser.help('removes the local copy of package');
-
-parser.action(function (options) {
- var names = options.args;
-});
-
-exports.remove = function () {
-};
-
diff --git a/utils/lib/narwhal/tusk/search.js b/utils/lib/narwhal/tusk/search.js
deleted file mode 100755
index e69de29..0000000
--- a/utils/lib/narwhal/tusk/search.js
+++ /dev/null
diff --git a/utils/lib/narwhal/tusk/update.js b/utils/lib/narwhal/tusk/update.js
deleted file mode 100755
index ea05d1a..0000000
--- a/utils/lib/narwhal/tusk/update.js
+++ /dev/null
@@ -1,21 +0,0 @@
-
-var tusk = require("../tusk");
-var util = require("util");
-var args = require("args");
-var http = require("http");
-
-var parser = exports.parser = new args.Parser();
-
-parser.help('downloads the newest package catalog');
-
-parser.action(function (options) {
- exports.update.call(this, options);
-});
-
-exports.update = function (options) {
- this.print('\0blue(Downloading catalog.\0)');
- var catalogData = http.read('http://github.com/tlrobinson/narwhal/raw/master/catalog.json');
- this.print('\0green(Saving catalog.\0)');
- tusk.getCatalogPath().write(catalogData, 'b');
-};
-
diff --git a/utils/lib/narwhal/tusk/upgrade.js b/utils/lib/narwhal/tusk/upgrade.js
deleted file mode 100755
index e69de29..0000000
--- a/utils/lib/narwhal/tusk/upgrade.js
+++ /dev/null
diff --git a/utils/lib/os.js b/utils/lib/os.js
deleted file mode 100755
index 7bffef7..0000000
--- a/utils/lib/os.js
+++ /dev/null
@@ -1,29 +0,0 @@
-
-var platform = require('os-platform');
-for (var name in platform) {
- if (Object.prototype.hasOwnProperty.call(platform, name)) {
- exports[name] = platform[name];
- }
-}
-
-exports.system = function (command, options) {
- var process = exports.popen(command, options);
- return process.communicate(
- '',
- system.stdout,
- system.stderr
- ).code;
-};
-
-exports.command = function (command) {
- var process = exports.popen(command);
- var result = process.communicate();
- if (result.code !== 0)
- throw new Error(result.stderr.read());
- return result.stdout.read();
-};
-
-exports.enquote = function (word) {
- return "'" + String(word).replace(/'/g, "'\"'\"'") + "'";
-};
-
diff --git a/utils/lib/packages.js b/utils/lib/packages.js
deleted file mode 100755
index 976f991..0000000
--- a/utils/lib/packages.js
+++ /dev/null
@@ -1,336 +0,0 @@
-
-var util = require('./util');
-var json = require('./json');
-var fs = require('./file');
-
-exports.main = function main() {
- // finds, reads, and analyzes packages,
- // then applies its findings (synthesizes)
- // to the loader and system.
- // this involves a breadth first search for packages
- // and packages within packages (readPackages),
- // and performing platform-specific analysis and
- // synthesis.
-
- if (system.packagePrefixes === undefined)
- throw new Error(
- "system.packagePrefix is undefined in packages loader. " +
- "(platform=" + system.platform + ")"
- );
-
- exports.load(system.packagePrefixes);
-
-};
-
-exports.load = function (packagePrefixes) {
-
- // the packages platform module, if it exists,
- // performs platform-specific actions on each package.
- var packagesPlatform;
- try {
- packagesPlatform = require('packages-platform');
- } catch (exception) {
- }
-
- // depth first search of the packages tree and roots
- var catalog = {};
- var root = exports.readPackages(packagePrefixes, catalog);
-
- exports.verify(catalog);
-
- // a topological sort of the packages based on their
- // stated dependencies and contained platform-specific
- // components
- var packageOrder = exports.sortedPackages(catalog);
-
- // analysis
- var analysis = {};
- exports.analyze(analysis, packageOrder);
- // platform-specific analysis
- if (packagesPlatform)
- packagesPlatform.analyze(analysis, packageOrder);
-
- // synthesis
- exports.synthesize(analysis);
- // platform-specific synthesis
- if (packagesPlatform)
- packagesPlatform.synthesize(analysis);
-
- // preload modules
- analysis.preloadModules.forEach(function(id) {
- system.log.debug("Preloading module: "+id);
- try {
- require(id);
- } catch (e) {
- system.log.warn("Error preloading module: "+e);
- }
- });
-
- // record results
- exports.catalog = catalog;
- exports.packageOrder = packageOrder;
- exports.root = root;
- exports.analysis = analysis;
- return exports;
-};
-
-/*** readPackages
- recursively loads all package data from package.json files
- and packages/ directories, starting with the given directory,
- usually the system.packagePrefix.
-*/
-exports.readPackages = function readPackages(prefixes, catalog) {
- // construct an object graph from package json files
- // through a breadth first search of the root package and
- // its transitive packages/ directories.
-
- if (!catalog)
- throw new Error("must pass a package data object as the second argument to readPackages.");
-
- var visitedPackages = {};
- var root;
-
- prefixes = util.copy(prefixes);
- if (typeof prefixes == 'string')
- prefixes = [prefixes];
-
- // queue-based breadth-first-search of the package
- // tree starting with the "root", usually
- // system.packagePrefix
- while (prefixes.length) {
- var queue = [fs.path(prefixes.shift())];
- while (queue.length) {
-
- var packageDirectory = queue.shift();
- var name = packageDirectory.basename();
-
- // check for cyclic symbolic linkage
- var canonicalPackageDirectory = packageDirectory.canonical();
- if (Object.prototype.hasOwnProperty.call(visitedPackages, canonicalPackageDirectory))
- continue;
- visitedPackages[canonicalPackageDirectory] = true;
-
- // check for duplicate package names
- if (Object.prototype.hasOwnProperty.call(catalog, name)) {
- continue;
- }
-
- if (!packageDirectory.join('package.json').isFile()) {
- //system.log.warn('No package.json in ' + packageDirectory);
- continue;
- }
-
- var packageDatum;
- try {
- var packageDatumJson = packageDirectory.join('package.json').read().toString();
- packageDatum = json.parse(packageDatumJson || '{}');
-
- // look for local, user overrides
- var local = packageDirectory.join('local.json');
- if (local.isFile()) {
- local = json.parse(local.read().toString());
- for (var name in local) {
- if (Object.prototype.hasOwnProperty.call(local, name)) {
- packageDatum[name] = local[name];
- }
- }
- }
-
- name = packageDatum.name || name;
- catalog[name] = packageDatum;
- packageDatum.directory = packageDirectory.join('');
-
- // enqueue sub packages
- var packagesDirectories = packageDatum.packages;
- if (typeof packagesDirectories == "string")
- packagesDirectories = [packagesDirectories];
- if (packagesDirectories === undefined)
- packagesDirectories = ["packages"];
- packagesDirectories.forEach(function (packagesDirectory) {
- packagesDirectory = packageDirectory.join(packagesDirectory);
- if (packagesDirectory.isDirectory()) {
- packagesDirectory.listPaths().forEach(function (packageDirectory) {
- if (packageDirectory.isDirectory()) {
- queue.push(packageDirectory);
- }
- });
- }
- });
-
- // enqueue parent package root
- var parents = packageDatum.parent;
- if (parents !== null) {
- if (typeof parents == "string")
- parents = [parents];
- if (parents === undefined)
- parents = ["parent"];
- parents.forEach(function (parent) {
- parent = packageDirectory.join('').resolve(parent);
- if (parent.isDirectory()) {
- prefixes.push(parent);
- }
- });
- }
-
- // the first package we encounter gets
- // top-billing, the root package
- if (!root)
- root = packageDatum;
-
- } catch (exception) {
- system.log.error("Could not load package '" + name + "'. " + exception);
- }
-
- }
- }
-
- return root;
-};
-
-/*** verify
- scans a package object for missing dependencies and throws away
- any package that has unmet dependencies.
-*/
-exports.verify = function verify(catalog) {
- for (var name in catalog) {
- if (Object.prototype.hasOwnProperty.call(catalog, name)) {
- try {
- scan(catalog, name);
- } catch (exception) {
- if (typeof exception == "string") {
- } else {
- throw exception;
- }
- }
- }
- }
-};
-
-var scan = function scan(catalog, name) {
- var packageDatum = catalog[name];
- if (!packageDatum)
- throw name;
- try {
- if (packageDatum.dependencies) {
- packageDatum.dependencies.forEach(function (dependency) {
- scan(catalog, dependency);
- });
- }
- } catch (exception) {
- if (typeof exception == "string")
- system.log.error(
- 'Threw away package ' + name +
- ' because it depends on ' + exception +
- '.'
- );
- delete catalog[name];
- throw name;
- }
-};
-
-/*** sortedPackages
- returns an array of packages in order from the most
- dependent to least dependent, sorted based on
- their transitive dependencies.
-*/
-exports.sortedPackages = function sortedPackages(packageData) {
- var order = topo(packageData);
- var sorted = [];
- for (var i = 0; i < order.length; i++)
- sorted[i] = packageData[order[i]];
- return sorted;
-};
-
-var topo = function topo(graph) {
- var sorted = [],
- visited = {};
- for (var name in graph) {
- if (
- Object.prototype.hasOwnProperty.call(graph, name) &&
- !Object.prototype.hasOwnProperty.call(visited, name)
- ) {
- sorted.push.apply(sorted, _topo(graph, name, visited));
- }
- }
- return sorted;
-};
-
-var _topo = function _topo(graph, name, visited) {
- var node = graph[name];
- if (Object.prototype.hasOwnProperty.call(visited, node))
- return [];
- visited[name] = true;
- var sorted = [];
- if (graph[name] === undefined) {
- system.log.error('"' + name + '" package does not exist.');
- }
- var dependencies = graph[name].dependencies || [];
- for (var i = 0; i < dependencies.length; i++) {
- var dependency = dependencies[i];
- if (Object.prototype.hasOwnProperty.call(visited, dependency))
- continue;
- visited[dependency] = true;
- sorted.push.apply(sorted, _topo(graph, dependency, visited));
- }
- sorted.push(name);
- return sorted;
-};
-
-/*** analyze
- constructs prioritized top-level module paths
- based on the given sorted package array.
-*/
-exports.analyze = function analyze(analysis, catalog) {
- analysis.libPaths = [];
- analysis.preloadModules = [];
- catalog.forEach(function (packageData) {
-
- // libraries
- if (typeof packageData.lib == 'string')
- packageData.lib = [packageData.lib];
- if (!packageData.lib)
- packageData.lib = ['lib'];
-
- // platforms
- var platforms = 'platforms';
- var platformLibs = [];
- if (packageData.platforms)
- platforms = packageData.platforms;
- system.platforms.forEach(function (platform) {
- var platformDir = packageData.directory.join(platforms, platform, 'lib');
- if (platformDir.isDirectory())
- platformLibs.push(platformDir);
- });
-
- packageData.lib = platformLibs.concat(packageData.lib);
- for (var i = 0; i < packageData.lib.length; i++) {
- packageData.lib[i] = packageData.directory.resolve(packageData.lib[i]);
- }
-
- analysis.libPaths.unshift.apply(analysis.libPaths, packageData.lib);
-
- // add any preload librarys to analysis
- if (packageData.preload)
- analysis.preloadModules.unshift.apply(analysis.preloadModules, packageData.preload);
- });
-};
-
-/*** synthesize
- applies the results of the analysis on the current
- execution environment.
-*/
-exports.synthesize = function synthesize(analysis) {
- exports.addJsPaths(analysis.libPaths);
-};
-
-/*** addJsPaths
-*/
-exports.addJsPaths = function addJsPaths(jsPaths) {
- // add package paths to the loader
- if (require.paths)
- require.paths.splice.apply(
- require.paths,
- [0, require.paths.length].concat(jsPaths)
- );
-};
-
diff --git a/utils/lib/promise.js b/utils/lib/promise.js
deleted file mode 100755
index 4539c14..0000000
--- a/utils/lib/promise.js
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * Copyright 2007-2009 Tyler Close under the terms of the MIT X license found
- * at http://www.opensource.org/licenses/mit-license.html
- *
- * ref_send.js version: 2009-05-11
- */
-"use strict";
-
-var enqueue = require('reactor').enqueue;
-
-/**
- * Enqueues a task to be run in a future turn.
- * @param task function to invoke later
- */
-exports.run = enqueue;
-
-/**
- * Constructs a rejected promise.
- * @param reason value describing the failure
- */
-exports.reject = reject;
-
-/**
- * Constructs a promise for an immediate reference.
- * @param value immediate reference
- */
-exports.ref = ref;
-
-/**
- * Constructs a ( promise, resolver ) pair.
- *
- * The resolver is a callback to invoke with a more resolved value for
- * the promise. To fulfill the promise, simply invoke the resolver with
- * an immediate reference. To reject the promise, invoke the resolver
- * with the return from a call to reject(). To put the promise in the
- * same state as another promise, invoke the resolver with that other
- * promise.
- */
-exports.defer = defer;
-
-/**
- * Gets the current value of a promise.
- * @param value promise or immediate reference to evaluate
- */
-exports.near = function (value) {
- return ('function' === typeof value) ? value() : value;
-};
-
-/**
- * Registers an observer on a promise.
- * @param value promise or immediate reference to observe
- * @param fulfilled function to be called with the resolved value
- * @param rejected function to be called with the rejection reason
- * @return promise for the return value from the invoked callback
- */
-exports.when = function (value, fulfilled, rejected) {
- var r = defer();
- var done = false; // ensure the untrusted promise makes at most a
- // single call to one of the callbacks
- forward(promise(value), 'WHEN', function (x) {
- if (done) { throw new Error(); }
- done = true;
- r.resolve(ref(x)('WHEN', fulfilled, rejected));
- }, function (reason) {
- if (done) { throw new Error(); }
- done = true;
- r.resolve(rejected ? rejected(reason) : reject(reason));
- });
- return r.promise;
-};
-
-/**
- * Gets the value of a property in a future turn.
- * @param target promise or immediate reference for target object
- * @param noun name of property to get
- * @return promise for the property value
- */
-exports.get = function (target, noun) {
- var r = defer();
- forward(promise(target), 'GET', r.resolve, noun);
- return r.promise;
-};
-
-/**
- * Invokes a method in a future turn.
- * @param target promise or immediate reference for target object
- * @param verb name of method to invoke
- * @param argv array of invocation arguments
- * @return promise for the return value
- */
-exports.post = function (target, verb, argv) {
- var r = defer();
- forward(promise(target), 'POST', r.resolve, verb, argv);
- return r.promise;
-};
-
-/**
- * Sets the value of a property in a future turn.
- * @param target promise or immediate reference for target object
- * @param noun name of property to set
- * @param value new value of property
- * @return promise for the return value
- */
-exports.put = function (target, noun, value) {
- var r = defer();
- forward(promise(target), 'PUT', r.resolve, noun, value);
- return r.promise;
-};
-
-/**
- * Deletes a property in a future turn.
- * @param target promise or immediate reference for target object
- * @param noun name of property to delete
- * @return promise for the return value
- */
-exports.remove = function (target, noun) {
- var r = defer();
- forward(promise(target), 'DELETE', r.resolve, noun);
- return r.promise;
-};
-
-function reject(reason) {
- return function (op, arg1, arg2, arg3) {
- if (undefined === op) {
- return { '!' : reason };
- }
- if ('WHEN' === op) { return arg2 ? arg2(reason) : reject(reason); }
- return arg1 ? arg1(reject(reason)) : reject(reason);
- };
-}
-
-function ref(value) {
- if (null === value || undefined === value) {
- return reject({ $: [ 'NaO' ] });
- }
- if ('number' === typeof value && !isFinite(value)) {
- return reject({ $: [ 'NaN' ] });
- }
- return function (op, arg1, arg2, arg3) {
- if (undefined === op) { return value; }
-
- var r;
- switch (op) {
- case 'WHEN':
- r = value;
- break;
- case 'GET':
- r = (undefined === arg2) ? value : value[arg2];
- break;
- case 'POST':
- if (undefined === arg2) {
- r = reject({});
- } else {
- r = value[arg2](arg3);
- }
- break;
- case 'PUT':
- if (undefined === arg2) {
- r = reject({});
- } else {
- value[arg2] = arg3;
- r = {};
- }
- break;
- case 'DELETE':
- if (undefined === arg2) {
- r = reject({});
- } else {
- delete value[arg2];
- r = {};
- }
- break;
- default:
- r = reject({});
- }
- return arg1 ? arg1(r) : r;
- };
-}
-
-/**
- * Enqueues a promise operation.
- *
- * The above functions, reject() and ref(), each construct a kind of
- * promise. Other libraries can provide other kinds of promises by
- * implementing the same API. A promise is a function with signature:
- * function (op, arg1, arg2, arg3). The first argument determines the
- * interpretation of the remaining arguments. The following cases must be
- * handled:
- *
- * 'op' is undefined:
- * Return the most resolved current value of the promise.
- *
- * 'op' is "WHEN":
- * 'arg1': callback to invoke with the fulfilled value of the promise
- * 'arg2': callback to invoke with the rejection reason for the promise
- *
- * 'op' is "GET":
- * 'arg1': callback to invoke with the value of the named property
- * 'arg2': name of the property to read
- *
- * 'op' is "POST":
- * 'arg1': callback to invoke with the return value from the invocation
- * 'arg2': name of the method to invoke
- * 'arg3': array of invocation arguments
- *
- * 'op' is "PUT":
- * 'arg1': callback to invoke with the return value from the operation
- * 'arg2': name of the property to set
- * 'arg3': new value of property
- *
- * 'op' is "DELETE":
- * 'arg1': callback to invoke with the return value from the operation
- * 'arg2': name of the property to delete
- *
- * 'op' is unrecognized:
- * 'arg1': callback to invoke with a rejected promise
- */
-function forward(p, op, arg1, arg2, arg3) {
- enqueue(function () { p(op, arg1, arg2, arg3); });
-}
-
-/**
- * Gets the corresponding promise for a given reference.
- */
-function promise(value) {
- return ('function' === typeof value) ? value : ref(value);
-}
-
-function defer() {
- var value;
- var pending = [];
- var tail = function (op, arg1, arg2, arg3) {
- if (undefined === op) { return pending ? tail : value(); }
- if (pending) {
- pending.push({ op: op, arg1: arg1, arg2: arg2, arg3: arg3 });
- } else {
- forward(value, op, arg1, arg2, arg3);
- }
- };
- return {
- promise: tail,
- resolve: function (p) {
- if (!pending) { return; }
-
- var todo = pending;
- pending = null;
- value = promise(p);
-
- var i, len = todo.length, task;
- for (i = 0; i < len; ++i) {
- task = todo[i];
- forward(value, task.op, task.arg1, task.arg2, task.arg3);
- }
- }
- };
-}
-
diff --git a/utils/lib/regexp.js b/utils/lib/regexp.js
deleted file mode 100755
index f9dca58..0000000
--- a/utils/lib/regexp.js
+++ /dev/null
@@ -1,12 +0,0 @@
-// RegExp
-
-/*** RegExp.escape
- accepts a string; returns the string with regex metacharacters escaped.
- the returned string can safely be used within a regex to match a literal
- string. escaped characters are [, ], {, }, (, ), -, *, +, ?, ., \, ^, $,
- |, #, [comma], and whitespace.
-*/
-RegExp.escape = function (str) {
- return str.replace(/[-[\]{}()*+?.\\^$|,#\s]/g, "\\$&");
-};
-
diff --git a/utils/lib/sandbox.js b/utils/lib/sandbox.js
deleted file mode 100755
index 93b77e0..0000000
--- a/utils/lib/sandbox.js
+++ /dev/null
@@ -1,394 +0,0 @@
-
-// NOTE: this file is used is the bootstrapping process,
-// so any "requires" must be accounted for in narwhal.js
-
-exports.Loader = function (options) {
- var loader = {};
- var factories = options.factories || {};
- var paths = options.paths;
- var extensions = options.extensions || ["", ".js"];
- var timestamps = {};
-
- loader.resolve = exports.resolve;
-
- loader.find = function (topId) {
- for (var j = 0; j < extensions.length; j++) {
- var extension = extensions[j];
- if (system.fs.isAbsolute(topId)) {
- var path = topId + extension;
- if (system.fs.isFile(path)) {
- return path;
- }
- }
- else {
- for (var i = 0; i < paths.length; i++) {
- var path = system.fs.join(paths[i], topId + extension);
- if (system.fs.isFile(path))
- return path;
- }
- }
- }
- throw new Error("require error: couldn't find \"" + topId + '"');
- };
-
- loader.fetch = function (topId, path) {
- if (!path)
- path = loader.find(topId);
- if (typeof system.fs.mtime === "function")
- timestamps[path] = system.fs.mtime(path);
- var text = system.fs.read(path, {
- 'charset': 'utf-8'
- });
- // we leave the endline so the error line numbers align
- text = text.replace(/^#[^\n]+\n/, "\n");
- return text;
- };
-
- loader.evaluate = function (text, topId) {
- if (system.evaluate) {
- var fileName = loader.find(topId);
- var factory = system.evaluate(text, fileName, 1);
- factory.path = fileName;
- return factory;
- } else {
- return new Function("require", "exports", "module", "system", "print", text);
- }
- };
-
- loader.load = function (topId) {
- if (!Object.prototype.hasOwnProperty.call(factories, topId)) {
- loader.reload(topId);
- } else if (typeof system.fs.mtime === "function") {
- var filePath = loader.find(topId);
- if (!Object.prototype.hasOwnProperty.call(timestamps, filePath) ||
- system.fs.mtime(filePath) > timestamps[filePath])
- loader.reload(topId);
- }
- return factories[topId];
- };
-
- loader.reload = function (topId, path) {
- factories[topId] = loader.evaluate(loader.fetch(topId, path), topId);
- };
-
- loader.isLoaded = function (topId) {
- return Object.prototype.hasOwnProperty.call(factories, topId);
- };
-
- loader.paths = paths;
- loader.extensions = extensions;
-
- return loader;
-};
-
-exports.MultiLoader = function (options) {
-
- var factories = options.factories || {};
-
- var self = {};
- self.paths = options.paths || [];
- self.loader = options.loader || exports.Loader(options);
- self.loaders = options.loaders || [
- ["", self.loader],
- [".js", self.loader]
- ];
-
- self.resolve = exports.resolve;
-
- self.find = function (topId) {
- for (var j = 0; j < self.loaders.length; j++) {
- var pair = self.loaders[j];
- var extension = pair[0];
- var loader = pair[1];
- if (system.fs.isAbsolute(topId)) {
- var path = topId + extension;
- if (system.fs.isFile(path)) {
- return [loader, path];
- }
- }
- else {
- for (var i = 0; i < self.paths.length; i++) {
- var path = system.fs.join(self.paths[i], topId + extension);
- if (system.fs.isFile(path)) {
- return [loader, path];
- }
- }
- }
- }
- throw "require error: couldn't find \"" + topId + '"';
- };
-
- self.load = function (topId) {
- if (!Object.prototype.hasOwnProperty.call(factories, topId))
- self.reload(topId);
- return factories[topId];
- };
-
- self.reload = function (topId) {
- var pair = self.find(topId);
- var loader = pair[0];
- var path = pair[1];
- loader.reload(topId, path);
- factories[topId] = loader.load(topId, path);
- };
-
- self.isLoaded = function (topId) {
- return Object.prototype.hasOwnProperty.call(factories, topId);
- };
-
- return self;
-};
-
-exports.AttenuatedLoader = function (loader) {
- var self = {};
-
- self.resolve = Object.freeze(function (id, baseId) {
- return loader.resolve(id, baseId);
- });
-
- self.fetch = Object.freeze(function (topId) {
- if (/\./.test(topId))
- throw new Error("Invalid module identifier");
- return loader.fetch(topId);
- });
-
- self.load = Object.freeze(function (topId, path) {
- if (/\./.test(topId))
- throw new Error("Invalid module identifier");
- return loader.load(topId, path);
- });
-
- self.reload = Object.freeze(function (topId) {
- if (/\./.test(topId))
- throw new Error("Invalid module identifier");
- return loader.reload(topId, path);
- });
-
- return Object.freeze(self);
-};
-
-exports.Sandbox = function (options) {
- options = options || {};
- var loader = options.loader;
- var sandboxSystem = options.system || system;
- var modules = options.modules || {};
- var debug = options.debug !== undefined ? !!options.debug : system.debug;
-
- // managed print free variable in the sandbox forwards
- // to system.print
- var print = options.print || function () {
- return sandboxSystem.print.apply(sandboxSystem, arguments);
- };
-
- var debugDepth = 0;
- var mainId;
-
- var sandbox = function (id, baseId, force, reload) {
- id = loader.resolve(id, baseId);
-
- /* populate memo with module instance */
- if (!Object.prototype.hasOwnProperty.call(modules, id) || force) {
-
- if (sandbox.debug) {
- debugDepth++;
- var debugAcc = "";
- for (var i = 0; i < debugDepth; i++) debugAcc += "+";
- system.print(debugAcc + " " + id, 'module');
- }
-
- var globals = {};
- if (sandbox.debug) {
- // record globals
- for (var name in global)
- globals[name] = true;
- }
-
- if (!Object.prototype.hasOwnProperty.call(modules, id) || reload)
- modules[id] = {};
- var exports = modules[id];
- if (reload)
- loader.reload(id);
-
- var factory = null;
- try {
- factory = loader.load(id);
- } finally {
- // poor man's catch and rethrow (Rhino sets file/line to where the exception is thrown, not created)
- if (!factory) {
- delete modules[id];
- if (sandbox.debug)
- debugDepth--;
- }
- }
- var require = Require(id, factory.path);
- var module = {
- 'id': id,
- 'path': factory.path
- };
- factory(require, exports, module, sandboxSystem, print);
-
- if (sandbox.debug) {
- // check for new globals
- for (var name in global)
- if (!globals[name])
- system.log.warn("NEW GLOBAL: " + name);
- }
-
- if (sandbox.debug) {
- var debugAcc = "";
- for (var i = 0; i < debugDepth; i++) debugAcc += "-";
- system.print(debugAcc + " " + id, 'module');
- debugDepth--;
- }
-
- }
-
- /* support curryId for modules in which it is requested */
- var exports = modules[id];
- var imports = {};
- var importsUsed = false;
- var curryUsed = false;
- for (var name in exports) {
- try {
- // This try/catch block is needed to handle wrapped Java
- // objects in Rhino.
- curryUsed = (
- typeof exports[name] == "function" &&
- exports[name].xNarwhalCurryId
- );
- } catch (exception) {};
-
- if (curryUsed) {
- importsUsed = true;
- imports[name] = (function (callback) {
- var curried = function () {
- return callback.apply(
- this,
- [baseId].concat(Array.prototype.slice.call(arguments, 0))
- );
- };
- curried.xNarwhalCurryId = callback;
- return curried;
- })(exports[name].xNarwhalCurryId);
- } else {
- imports[name] = exports[name];
- }
- }
-
- if (!importsUsed)
- imports = exports;
-
- return imports;
-
- };
-
- var Require = function (baseId, fileName) { // XXX deprecated fileName
- var require = function (id) {
- //try {
- return sandbox(id, baseId);
- //} catch (exception) {
- // if (exception.message)
- // exception.message += ' in ' + baseId;
- // throw exception;
- //}
- };
- require.id = baseId; // XXX deprecated
- require.loader = loader;
- require.fileName = fileName; // XXX deprecated
- require.main = mainId; // XXX deprecated
- require.paths = loader.paths;
- require.extensions = loader.extensions;
- /* offers a facility to request the module id
- * in which a function was imported */
- // XXX deprecated (will need to be moved to module object)
- require.xNarwhalCurryId = function (callback) {
- var curried = function () {
- return callback.apply(
- this,
- [baseId].concat(Array.prototype.slice.call(arguments))
- );
- };
- curried.curryId = callback;
- return curried;
- };
- return require;
- };
-
- sandbox.force = function (id) {
- return sandbox(id, '', true);
- };
-
- sandbox.main = function (id) {
- mainId = id;
- return sandbox(id);
- };
-
- sandbox.loader = loader;
- sandbox.system = system;
- sandbox.paths = loader.paths;
- sandbox.extensions = loader.extensions;
- sandbox.debug = debug;
-
- return sandbox;
-};
-
-exports.PrefixLoader = function (prefix, loader) {
- var self = this || {};
-
- self.resolve = function (id, baseId) {
- return loader.resolve(id, baseId);
- };
-
- /**** evaluate
- */
- self.evaluate = function (text, topId) {
- return loader.evaluate(text, prefix + topId);
- };
-
- /**** fetch
- */
- self.fetch = function (topId) {
- return loader.fetch(prefix + topId);
- };
-
- /**** load
- */
- self.load = function (topId) {
- return loader.load(prefix + topId);
- };
-
- return self;
-};
-
-exports.sandbox = function(main, system, options) {
- options = options || {};
- var prefix = options['prefix'];
- var loader = options['loader'] || require.loader;
- var modules = options['modules'] || {};
- var print = options['print'];
- var debug = options['debug'];
- if (!loader) throw new Error(
- "sandbox cannot operate without a loader, either explicitly " +
- "provided as an option, or implicitly provided by the current " +
- "sandbox's 'loader' object."
- );
- if (prefix)
- loader = exports.PrefixLoader(prefix, loader);
- var sandbox = exports.Sandbox({
- modules: modules,
- loader: loader,
- system: system,
- print: print,
- debug: debug
- });
- return sandbox.main(main);
-};
-
-exports.resolve = function (id, baseId) {
- if (typeof id != "string")
- throw new Error("module id '" + id + "' is not a String");
- if (id.charAt(0) == ".") {
- id = system.fs.dirname(baseId) + "/" + id;
- }
- return system.fs.normal(id);
-};
diff --git a/utils/lib/sha.js b/utils/lib/sha.js
deleted file mode 100755
index d9ce79f..0000000
--- a/utils/lib/sha.js
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
-
- A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
- in FIPS PUB 180-1
- Version 2.1a Copyright Paul Johnston 2000 - 2002.
- Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
- Distributed under the BSD License
- See http://pajhome.org.uk/crypt/md5 for details.
-
-*/
-var util = require('./util');
-var struct = require('./struct');
-
-/*** hash
-*/
-exports.hash = function (s, _characterSize) {
- if (util.no(_characterSize)) _characterSize = struct.characterSize;
- return struct.binb2bin(core_sha(struct.str2binb(s), s.length * _characterSize));
-};
-
-/* Perform a simple self-test to see if the VM is working */
-exports.test = function () {
- assert.eq("a9993e364706816aba3e25717850c26c9cd0d89d", exports.hash("abc").toString(16));
-};
-
-/* Calculate the SHA-1 of an array of big-endian words, and a bit length */
-var core_sha = function (x, len) {
- /* append padding */
- x[len >> 5] |= 0x80 << (24 - len % 32);
- x[((len + 64 >> 9) << 4) + 15] = len;
-
- var w = [];
- var a = 1732584193;
- var b = -271733879;
- var c = -1732584194;
- var d = 271733878;
- var e = -1009589776;
-
- for(var i = 0; i < x.length; i += 16) {
- var olda = a;
- var oldb = b;
- var oldc = c;
- var oldd = d;
- var olde = e;
-
- for(var j = 0; j < 80; j++) {
- if(j < 16) w[j] = x[i + j];
- else w[j] = struct.rolU32(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1);
- var t = struct.addU32(struct.rolU32(a, 5), sha_ft(j, b, c, d), e, w[j], sha_kt(j));
- e = d;
- d = c;
- c = struct.rolU32(b, 30);
- b = a;
- a = t;
- }
-
- a = struct.addU32(a, olda);
- b = struct.addU32(b, oldb);
- c = struct.addU32(c, oldc);
- d = struct.addU32(d, oldd);
- e = struct.addU32(e, olde);
- }
- return [a, b, c, d, e];
-
-};
-
-/*
- * Perform the appropriate triplet combination function for the current
- * iteration
- */
-var sha_ft = function (t, b, c, d) {
- if(t < 20) return (b & c) | ((~b) & d);
- if(t < 40) return b ^ c ^ d;
- if(t < 60) return (b & c) | (b & d) | (c & d);
- return b ^ c ^ d;
-};
-
-/*
- * Determine the appropriate additive constant for the current iteration
- */
-var sha_kt = function (t) {
- return (t < 20) ? 1518500249 : (t < 40) ? 1859775393 :
- (t < 60) ? -1894007588 : -899497514;
-};
-
-/*
- * Calculate the HMAC-SHA1 of a key and some data
- */
-var core_hmac_sha = function (key, data, _characterSize) {
- if (util.no(_characterSize)) _characterSize = struct.characterSize;
- var bkey = struct.str2binb(key);
- if(bkey.length > 16) bkey = core_sha(bkey, key.length * _characterSize);
-
- var ipad = [], opad = [];
- for(var i = 0; i < 16; i++) {
- ipad[i] = bkey[i] ^ 0x36363636;
- opad[i] = bkey[i] ^ 0x5C5C5C5C;
- }
-
- var hash = core_sha(ipad.concat(struct.str2binb(data)), 512 + data.length * _characterSize);
- return core_sha(opad.concat(hash), 512 + 160);
-};
-
-if (module.id == require.main) {
- var assert = require("./test/assert");
- require("os").exit(require("test/runner").run(exports));
-}
-
diff --git a/utils/lib/sha256.js b/utils/lib/sha256.js
deleted file mode 100755
index 4f19670..0000000
--- a/utils/lib/sha256.js
+++ /dev/null
@@ -1,102 +0,0 @@
-/*file chiron src/crypt/sha256.js */
-
-var struct = require('./struct');
-var util = require('./util');
-
-/*** hash
-*/
-exports.hash = function (s, _characterSize) {
- if (util.no(_characterSize)) _characterSize = struct.characterSize;
- return struct.binb2bin(core(struct.str2binb(s, _characterSize), s.length * _characterSize));
-};
-
-var S = function (X, n) { return ( X >>> n ) | (X << (32 - n)); }
-var R = function (X, n) { return ( X >>> n ); }
-var Ch = function (x, y, z) { return ((x & y) ^ ((~x) & z)); }
-var Maj = function (x, y, z) { return ((x & y) ^ (x & z) ^ (y & z)); }
-var Sigma0256 = function (x) { return (S(x, 2) ^ S(x, 13) ^ S(x, 22)); }
-var Sigma1256 = function (x) { return (S(x, 6) ^ S(x, 11) ^ S(x, 25)); }
-var Gamma0256 = function (x) { return (S(x, 7) ^ S(x, 18) ^ R(x, 3)); }
-var Gamma1256 = function (x) { return (S(x, 17) ^ S(x, 19) ^ R(x, 10)); }
-
-var K = [
- 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5,
- 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5,
- 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3,
- 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174,
- 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC,
- 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA,
- 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7,
- 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967,
- 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13,
- 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85,
- 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3,
- 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070,
- 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5,
- 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3,
- 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208,
- 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2
-];
-
-var HASH = [
- 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A,
- 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19
-];
-
-var core = function (m, l) {
- var W = [];
- var a, b, c, d, e, f, g, h, i, j;
- var T1, T2;
-
- m[l >> 5] |= 0x80 << (24 - l % 32);
- m[((l + 64 >> 9) << 4) + 15] = l;
-
- for ( var i = 0; i<m.length; i+=16 ) {
- a = HASH[0];
- b = HASH[1];
- c = HASH[2];
- d = HASH[3];
- e = HASH[4];
- f = HASH[5];
- g = HASH[6];
- h = HASH[7];
-
- for ( var j = 0; j<64; j++) {
- if (j < 16) W[j] = m[j + i];
- else W[j] = struct.addU32(Gamma1256(W[j - 2]), W[j - 7], Gamma0256(W[j - 15]), W[j - 16]);
-
- T1 = struct.addU32(h, Sigma1256(e), Ch(e, f, g), K[j], W[j]);
- T2 = struct.addU32(Sigma0256(a), Maj(a, b, c));
-
- h = g;
- g = f;
- f = e;
- e = struct.addU32(d, T1);
- d = c;
- c = b;
- b = a;
- a = struct.addU32(T1, T2);
- }
-
- HASH[0] = struct.addU32(a, HASH[0]);
- HASH[1] = struct.addU32(b, HASH[1]);
- HASH[2] = struct.addU32(c, HASH[2]);
- HASH[3] = struct.addU32(d, HASH[3]);
- HASH[4] = struct.addU32(e, HASH[4]);
- HASH[5] = struct.addU32(f, HASH[5]);
- HASH[6] = struct.addU32(g, HASH[6]);
- HASH[7] = struct.addU32(h, HASH[7]);
- }
- return HASH;
-};
-
-/**
-
- References
- ==========
-
- http://www.webtoolkit.info/
- Secure Hash Algorithm (SHA256)
-
-*/
-
diff --git a/utils/lib/struct.js b/utils/lib/struct.js
deleted file mode 100755
index 7ec1909..0000000
--- a/utils/lib/struct.js
+++ /dev/null
@@ -1,228 +0,0 @@
-
-var util = require("util");
-var binary = require("binary");
-
-/*** alphabet16Upper
-*/
-exports.alphabet16Upper = "0123456789ABCDEF";
-
-/*** alphabet16Lower
-*/
-exports.alphabet16Lower = "0123456789abcdef";
-
-/*** alphabet16
- ``alphabet16Lower`` is the default hexadecimal alphabet.
- This value can be overridden on the module
- and function level.
-*/
-
-exports.alphabet16 = exports.alphabet16Lower;
-
-/*** alphabet36
-*/
-exports.alphabet36 = "0123456789abcdefghijklmnopqrstuvwxyz";
-
-/*** alphabet64
-*/
-exports.alphabet64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
-/*** padBase64
- base-64 pad character. "=" for strict RFC compliance, "" for brevity
- "=" by default.
- This value can be overridden on the module
- and function level.
-*/
-exports.padBase64 = "=";
-
-/*** characterSize
- bits per input character. 8 - ASCII; 16 - Unicode
- This value can be overridden on the module
- and function level.
-*/
-exports.characterSize = 8;
-
-/*** ord
- Returns the character code ordinal (offset in the ASCII or Unicode tables)
- for a given single character.
-
- - inverse: `chr`
-
-*/
-exports.ord = function (chr) {
- return chr.charCodeAt();
-};
-
-/*** chr
- Returns the character for a given character code ordinal (offset in the
- ASCII or Unicode tables).
-
- - inverse: `ord`
-
-*/
-exports.chr = function (ord) {
- return String.fromCharCode(ord);
-};
-
-/* undocumented addU32
- Add integers, wrapping at 2**32. This uses 16-bit operations internally
- to work around bugs in some JavaScript interpreters.
-
- - `variadic`
-*/
-exports.addU32 = function (/* ... */) {
- var acc = 0;
- for (var i = 0; i < arguments.length; i++) {
- var x = arguments[i];
- var lsw = (acc & 0xFFFF) + (x & 0xFFFF);
- var msw = (acc >> 16) + (x >> 16) + (lsw >> 16);
- acc = (msw << 16) | (lsw & 0xFFFF);
- }
- return acc;
-};
-
-/* undocumented rolU32
- Bitwise rotate a 32-bit number to the left.
-*/
-exports.rolU32 = function (num, cnt) {
- return (num << cnt) | (num >>> (32 - cnt));
-};
-
-/* undocumented str2binl
- Convert a string to an array of little-endian words
- If characterSize is ASCII, characters >255 have their hi-byte silently ignored.
-*/
-exports.str2binl = function (str, _characterSize) {
- if (util.no(_characterSize))
- _characterSize = exports.characterSize;
- var bin = [];
- var mask = (1 << _characterSize) - 1;
- for (var i = 0; i < str.length * _characterSize; i += _characterSize)
- bin[i>>5] |= (str.charCodeAt(i / _characterSize) & mask) << (i % 32);
- return bin;
-};
-
-/* undocumented str2binb
- Convert an 8-bit or 16-bit string to an array of big-endian words
- In 8-bit function, characters >255 have their hi-byte silently ignored.
-*/
-exports.str2binb = function (str, _characterSize) {
- if (util.no(_characterSize))
- _characterSize = exports.characterSize;
- var bin = [];
- var mask = (1 << _characterSize) - 1;
- for (var i = 0; i < str.length * _characterSize; i += _characterSize)
- bin[i>>5] |= (
- (str.charCodeAt(i / _characterSize) & mask) <<
- (32 - _characterSize - i % 32)
- );
- return bin;
-};
-
-/* undocumented binl2str
- Convert an array of little-endian words to a string
-*/
-exports.binl2str = function (bin, _characterSize) {
- return exports.binl2bin(bin, _characterSize).decodeToString('ascii');
-};
-
-/* undocumented binl2bin
- Convert an array of little-endian words to a string
-*/
-exports.binl2bin = function (bin, _characterSize) {
- if (util.no(_characterSize))
- _characterSize = exports.characterSize;
- var str = [];
- var mask = (1 << _characterSize) - 1;
- for (var i = 0; i < bin.length * 32; i += _characterSize)
- str.push((bin[i>>5] >>> (i % 32)) & mask);
- return binary.ByteString(str);
-};
-
-/* undocumented binb2str
- Convert an array of big-endian words to a string
-*/
-exports.binb2str = function (bin, _characterSize) {
- return exports.binb2bin(bin, _characterSize).decodeToString('ascii');
-};
-
-/* undocumented binb2bin
- Convert an array of big-endian words to a string
-*/
-exports.binb2bin = function (bin, _characterSize) {
- if (util.no(_characterSize))
- _characterSize = exports.characterSize;
- var str = [];
- var mask = (1 << _characterSize) - 1;
- for (var i = 0; i < bin.length * 32; i += _characterSize)
- str.push((bin[i>>5] >>> (32 - _characterSize - i % 32)) & mask);
- return binary.ByteString(str);
-};
-
-/* undocumented binl2hex
- Convert an array of little-endian words to a hex string.
-*/
-exports.binl2hex = function (binarray, _alphabet16) {
- if (util.no(_alphabet16))
- _alphabet16 = exports.alphabet16;
- var str = "";
- for (var i = 0; i < binarray.length * 4; i++) {
- str += _alphabet16.charAt((binarray[i>>2] >> ((i % 4) * 8 + 4)) & 0xF) +
- _alphabet16.charAt((binarray[i>>2] >> ((i % 4) * 8)) & 0xF);
- }
- return str;
-};
-
-/* undocumented binb2hex
- Convert an array of big-endian words to a hex string.
-*/
-exports.binb2hex = function (binarray, _alphabet16) {
- if (util.no(_alphabet16))
- _alphabet16 = exports.alphabet16;
- var str = "";
- for (var i = 0; i < binarray.length * 4; i++) {
- str += _alphabet16.charAt((binarray[i>>2] >> ((3 - i % 4)*8+4)) & 0xF) +
- _alphabet16.charAt((binarray[i>>2] >> ((3 - i % 4) * 8)) & 0xF);
- }
- return str;
-};
-
-/* undocumented binl2base64
- Convert an array of little-endian words to a base-64 string
-*/
-exports.binl2base64 = function (binarray) {
- var str = "";
- for (var i = 0; i < binarray.length * 4; i += 3) {
- var triplet = (
- (((binarray[i >> 2] >> 8 * (i % 4)) & 0xFF) << 16) |
- (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8) |
- ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF)
- );
- for (var j = 0; j < 4; j++) {
- if (i * 8 + j * 6 > binarray.length * 32)
- str += exports.padBase64;
- else str += exports.alphabet64.charAt((triplet >> 6*(3-j)) & 0x3F);
- }
- }
- return str;
-};
-
-/* undocumented binb2base64
- Convert an array of big-endian words to a base-64 string
-*/
-exports.binb2base64 = function (binarray) {
- var str = "";
- for (var i = 0; i < binarray.length * 4; i += 3) {
- var triplet = (
- (((binarray[i >> 2] >> 8 * (3 - i % 4)) & 0xFF) << 16) |
- (((binarray[i+1 >> 2] >> 8 * (3 - (i+1)%4)) & 0xFF) << 8 ) |
- ((binarray[i+2 >> 2] >> 8 * (3 - (i+2)%4)) & 0xFF)
- );
- for (var j = 0; j < 4; j++) {
- if (i * 8 + j * 6 > binarray.length * 32)
- str += exports.padBase64;
- else str += exports.alphabet64.charAt((triplet >> 6*(3-j)) & 0x3F);
- }
- }
- return str;
-};
-
diff --git a/utils/lib/term.js b/utils/lib/term.js
deleted file mode 100755
index 6e60ebe..0000000
--- a/utils/lib/term.js
+++ /dev/null
@@ -1,166 +0,0 @@
-
-var util = require('util');
-
-var terms = [
- 'ansi',
- 'vt100',
- 'xtermc',
- 'xterm-color',
- 'gnome-terminal'
-];
-
-exports.Stream = function (system) {
- var self = Object.create(system.stdout);
- var output = system.stdout;
- var errput = system.stderr;
- var env = system.env || {};
- var fore = "";
- var back = "";
- var bold = "0";
- var stack = [];
- var enabled = util.has(terms, env.TERM);
-
- self.writeCode = function (code) {
- if (enabled) {
- output.flush();
- errput.write(code).flush();
- }
- return self;
- };
-
- self.print = function () {
- // todo recordSeparator, fieldSeparator
- self.write(Array.prototype.join.call(arguments, " ") + "\n");
- self.flush();
- return self;
- };
-
- self.write = function (string) {
- var at = 0;
- self.update(bold, fore, back);
- while (at < string.length) {
- var pos = string.indexOf("\0", at);
- if (pos == -1) {
- // no additional marks, advanced to end
- output.write(string.substring(at, string.length));
- at = string.length;
- } else {
- output.write(string.substring(at, pos));
- at = pos + 1;
- if (string.charAt(at) == ")") {
- if (!stack.length)
- throw new Error("No colors on the stack at " + at);
- var pair = stack.pop();
- bold = pair[0];
- fore = pair[1];
- at = at + 1;
- self.update(bold, fore, back);
- } else {
- var paren = string.indexOf("(", at);
- stack.push([bold, fore, back]);
- var command = string.substring(at, paren);
- if (command == "bold") {
- bold = "1";
- } else if (Object.prototype.hasOwnProperty.call(exports.colors, command)) {
- fore = exports.colors[command];
- } else if (
- /^:/.test(command) &&
- Object.prototype.hasOwnProperty.call(exports.colors, command.substring(1))
- ) {
- back = exports.colors[command.substring(1)];
- } else {
- throw new Error("No such command: " + command);
- }
- self.update(bold, fore, back);
- at = paren + 1;
- }
- }
- }
- self.update("0", "", "");
- };
-
- self.update = function (bold, fore, back) {
- return self.writeCode(
- "\033[" + [
- bold,
- (fore.length ? "3" + fore : ""),
- (back.length ? "4" + back : ""),
- ].filter(function (string) {
- return string.length;
- }).join(";") + "m"
- );
- };
-
- self.moveTo = function (y, x) {
- return self.writeCode("\033[" + y + ";" + x + "H");
- };
-
- self.moveBy = function (y, x) {
- if (y == 0) {
- } else if (y < 0) {
- self.writeCode("\033[" + (-y) + "A");
- } else {
- self.writeCode("\033[" + y + "B");
- }
- if (x == 0) {
- } else if (x > 0) {
- self.writeCode("\033[" + x + "C");
- } else {
- self.writeCode("\033[" + (-x) + "D");
- }
- errput.flush();
- return self;
- };
-
- self.home = function () {
- return self.writeCode("\033[H");
- };
-
- self.clear = function () {
- return self.writeCode("\033[2J");
- };
- self.clearUp = function () {
- return self.writeCode("\033[1J");
- };
- self.cearDown = function () {
- return self.writeCode("\033[J");
- };
- self.clearLine = function () {
- return self.writeCode("\033[2K");
- };
- self.clearLeft = function () {
- return self.writeCode("\033[1K");
- };
- self.clearRight = function () {
- return self.writeCode("\033[K");
- };
-
- self.update(bold, fore, back);
-
- return self;
-};
-
-exports.colors = {
- "black": "0",
- "red": "1",
- "green": "2",
- "orange": "3",
- "yellow": "3",
- "blue": "4",
- "violet": "5",
- "magenta": "5",
- "purple": "5",
- "cyan": "6",
- "white": "7"
-}
-
-exports.stream = new exports.Stream(system);
-
-if (module.id == require.main) {
- exports.stream.print("white\0red(red\0blue(blue\0)red\0)white");
- Object.keys(exports.colors).forEach(function (name) {
- exports.stream.print("\0" + name + "(" + name + "\0)");
- exports.stream.print("\0bold(\0" + name + "(" + name + "\0)\0)");
- });
-}
-
diff --git a/utils/lib/test/assert.js b/utils/lib/test/assert.js
deleted file mode 100755
index dde0d2d..0000000
--- a/utils/lib/test/assert.js
+++ /dev/null
@@ -1,91 +0,0 @@
-var equiv = require("./equiv").equiv,
- jsDump = require("./jsdump").jsDump,
- util = require("../util");
-
-var assert = exports;
-
-function fail(message) {
- throw new AssertionError(message);
-}
-
-assert.isTrue = function(assertion, message) {
- if (assertion !== true)
- fail((message || "") + "\nExpected true." +
- "\nActual = " + assertion);
-}
-
-assert.isFalse = function(assertion, message) {
- if (assertion !== false)
- fail((message || "") + "\nExpected false." +
- "\nActual = " + assertion);
-}
-
-assert.isNull = function(assertion, message) {
- if (assertion !== null)
- fail((message || "") + "\nExpected null." +
- "\nActual = " + assertion);
-}
-
-assert.isNaN = function(assertion, message) {
- if (!isNaN(assertion))
- fail((message || "") + "\nExpected NaN." +
- "\nActual = " + assertion);
-}
-
-assert.isEqual = function(expected, actual, message) {
- if (expected !== actual)
- fail((message || "") + "\nExpected equal to = " + jsDump.parse(expected) +
- "\nActual = " + jsDump.parse(actual));
-}
-
-assert.is = function (expected, actual, message) {
- if (!util.is(expected, actual))
- fail((message || "") + "\nExpected identical = " + jsDump.parse(expected) +
- "\nActual = " + jsDump.parse(actual));
-};
-
-assert.isSame = function(expected, actual, message) {
- if (!equiv(expected, actual))
- fail((message || "") + "\nExpected same as = " + jsDump.parse(expected) +
- "\nActual = " + jsDump.parse(actual));
-}
-
-assert.eq = function (expected, actual, message) {
- if (!util.eq(expected, actual))
- fail((message || "") + "\nExpected equal = " + jsDump.parse(expected) +
- "\nActual = " + jsDump.parse(actual));
-};
-
-
-assert.isDiff = function(expected, actual, message) {
- if (equiv(expected, actual))
- fail((message || "") + "\nExpected different than = " + jsDump.parse(expected) +
- "\nActual = " + jsDump.parse(actual));
-}
-
-assert.throwsError = function(block, type, message) {
- var threw = false,
- exception = null;
-
- try {
- block();
- } catch (e) {
- threw = true;
- exception = e;
- }
-
- if (!threw)
- fail("Expected exception" + (message ? ": " + message : ""));
-
- if (type !== undefined && !(exception instanceof type))
- fail("Expected exception type '"+type+
- "', actually '"+exception+"'" + (message ? ": " + message : ""));
-}
-
-
-var AssertionError = exports.AssertionError = function(message) {
- this.name = "AssertionError";
- this.message = message;
-}
-
-AssertionError.prototype = new Error();
diff --git a/utils/lib/test/equiv.js b/utils/lib/test/equiv.js
deleted file mode 100755
index 9628119..0000000
--- a/utils/lib/test/equiv.js
+++ /dev/null
@@ -1,188 +0,0 @@
-// Hoozit
-// Determine what is o.
-function hoozit(o) {
- if (typeof o === "string") {
- return "string";
-
- } else if (typeof o === "boolean") {
- return "boolean";
-
- } else if (typeof o === "number") {
-
- if (isNaN(o)) {
- return "nan";
- } else {
- return "number";
- }
-
- } else if (typeof o === "undefined") {
- return "undefined";
-
- // consider: typeof null === object
- } else if (o === null) {
- return "null";
-
- // consider: typeof [] === object
- } else if (o instanceof Array) {
- return "array";
-
- // consider: typeof new Date() === object
- } else if (o instanceof Date) {
- return "date";
-
- // consider: /./ instanceof Object;
- // /./ instanceof RegExp;
- // typeof /./ === "function"; // => false in IE and Opera,
- // true in FF and Safari
- } else if (o instanceof RegExp) {
- return "regexp";
-
- } else if (typeof o === "object") {
- return "object";
-
- } else if (o instanceof Function) {
- return "function";
- }
-}
-
-// Call the o related callback with the given arguments.
-function bindCallbacks(o, callbacks, args) {
- var prop = hoozit(o);
- if (prop) {
- if (hoozit(callbacks[prop]) === "function") {
- return callbacks[prop].apply(callbacks, args);
- } else {
- return callbacks[prop]; // or undefined
- }
- }
-}
-
-// Equiv
-// Test for equality any JavaScript type.
-// Discussions and reference: http://philrathe.com/articles/equiv
-// Test suites: http://philrathe.com/tests/equiv
-// Author: Philippe Rathé <prathe@gmail.com>
-var equiv = exports.equiv = function () {
-
- var innerEquiv; // the real equiv function
- var callers = []; // stack to decide between skip/abort functions
-
-
- var callbacks = function () {
-
- // for string, boolean, number and null
- function useStrictEquality(b, a) {
- return a === b;
- }
-
- return {
- "string": useStrictEquality,
- "boolean": useStrictEquality,
- "number": useStrictEquality,
- "null": useStrictEquality,
- "undefined": useStrictEquality,
-
- "nan": function (b) {
- return isNaN(b);
- },
-
- "date": function (b, a) {
- return hoozit(b) === "date" && a.valueOf() === b.valueOf();
- },
-
- "regexp": function (b, a) {
- return hoozit(b) === "regexp" &&
- a.source === b.source && // the regex itself
- a.global === b.global && // and its modifers (gmi) ...
- a.ignoreCase === b.ignoreCase &&
- a.multiline === b.multiline;
- },
-
- // - skip when the property is a method of an instance (OOP)
- // - abort otherwise,
- // initial === would have catch identical references anyway
- "function": function () {
- var caller = callers[callers.length - 1];
- return caller !== Object &&
- typeof caller !== "undefined";
- },
-
- "array": function (b, a) {
- var i;
- var len;
-
- // b could be an object literal here
- if ( ! (hoozit(b) === "array")) {
- return false;
- }
-
- len = a.length;
- if (len !== b.length) { // safe and faster
- return false;
- }
- for (i = 0; i < len; i++) {
- if( ! innerEquiv(a[i], b[i])) {
- return false;
- }
- }
- return true;
- },
-
- "object": function (b, a) {
- var i;
- var eq = true; // unless we can proove it
- var aProperties = [], bProperties = []; // collection of strings
-
- // comparing constructors is more strict than using instanceof
- if ( a.constructor !== b.constructor) {
- return false;
- }
-
- // stack constructor before traversing properties
- callers.push(a.constructor);
-
- for (i in a) { // be strict: don't ensures hasOwnProperty and go deep
-
- aProperties.push(i); // collect a's properties
-
- if ( ! innerEquiv(a[i], b[i])) {
- eq = false;
- }
- }
-
- callers.pop(); // unstack, we are done
-
- for (i in b) {
- bProperties.push(i); // collect b's properties
- }
-
- // Ensures identical properties name
- return eq && innerEquiv(aProperties.sort(), bProperties.sort());
- }
- };
- }();
-
- innerEquiv = function () { // can take multiple arguments
- var args = Array.prototype.slice.apply(arguments);
- if (args.length < 2) {
- return true; // end transition
- }
-
- return (function (a, b) {
- if (a === b) {
- return true; // catch the most you can
-
- } else if (typeof a !== typeof b || a === null || b === null || typeof a === "undefined" || typeof b === "undefined") {
- return false; // don't lose time with error prone cases
-
- } else {
- return bindCallbacks(a, callbacks, [b, a]);
- }
-
- // apply transition with (1..n) arguments
- })(args[0], args[1]) && arguments.callee.apply(this, args.splice(1, args.length -1));
- };
-
- return innerEquiv;
-
-}(); \ No newline at end of file
diff --git a/utils/lib/test/jsdump.js b/utils/lib/test/jsdump.js
deleted file mode 100755
index c0d4aed..0000000
--- a/utils/lib/test/jsdump.js
+++ /dev/null
@@ -1,165 +0,0 @@
-/**
- * jsDump
- * Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
- * Licensed under BSD (http://www.opensource.org/licenses/bsd-license.php)
- * Date: 5/15/2008
- * @projectDescription Advanced and extensible data dumping for Javascript.
- * @version 1.0.0
- * @author Ariel Flesler
- */
-var jsDump;
-
-(function(){
- function quote( str ){
- return '"' + str.toString().replace(/"/g, '\\"') + '"';
- };
- function literal( o ){
- return o + '';
- };
- function join( pre, arr, post ){
- var s = jsDump.separator(),
- base = jsDump.indent(),
- inner = jsDump.indent(1);
- if( arr.join )
- arr = arr.join( ',' + s + inner );
- if( !arr )
- return pre + post;
- return [ pre, inner + arr, base + post ].join(s);
- };
- function array( arr ){
- var i = arr.length, ret = Array(i);
- this.up();
- while( i-- )
- ret[i] = this.parse( arr[i] );
- this.down();
- return join( '[', ret, ']' );
- };
-
- var reName = /^function (\w+)/;
-
- jsDump = {
- parse:function( obj, type ){//type is used mostly internally, you can fix a (custom)type in advance
- var parser = this.parsers[ type || this.typeOf(obj) ];
- type = typeof parser;
-
- return type == 'function' ? parser.call( this, obj ) :
- type == 'string' ? parser :
- this.parsers.error;
- },
- typeOf:function( obj ){
- var type = typeof obj,
- f = 'function';//we'll use it 3 times, save it
- return type != 'object' && type != f ? type :
- !obj ? 'null' :
- obj.exec ? 'regexp' :// some browsers (FF) consider regexps functions
- obj.getHours ? 'date' :
- obj.scrollBy ? 'window' :
- obj.nodeName == '#document' ? 'document' :
- obj.nodeName ? 'node' :
- obj.item ? 'nodelist' : // Safari reports nodelists as functions
- obj.callee ? 'arguments' :
- obj.call || obj.constructor != Array && //an array would also fall on this hack
- (obj+'').indexOf(f) != -1 ? f : //IE reports functions like alert, as objects
- 'length' in obj ? 'array' :
- type;
- },
- separator:function(){
- return this.multiline ? this.HTML ? '<br />' : '\n' : this.HTML ? '&nbsp;' : ' ';
- },
- indent:function( extra ){// extra can be a number, shortcut for increasing-calling-decreasing
- if( !this.multiline )
- return '';
- var chr = this.indentChar;
- if( this.HTML )
- chr = chr.replace(/\t/g,' ').replace(/ /g,'&nbsp;');
- return Array( this._depth_ + (extra||0) ).join(chr);
- },
- up:function( a ){
- this._depth_ += a || 1;
- },
- down:function( a ){
- this._depth_ -= a || 1;
- },
- setParser:function( name, parser ){
- this.parsers[name] = parser;
- },
- // The next 3 are exposed so you can use them
- quote:quote,
- literal:literal,
- join:join,
- //
- _depth_: 1,
- // This is the list of parsers, to modify them, use jsDump.setParser
- parsers:{
- window: '[Window]',
- document: '[Document]',
- error:'[ERROR]', //when no parser is found, shouldn't happen
- unknown: '[Unknown]',
- 'null':'null',
- undefined:'undefined',
- 'function':function( fn ){
- var ret = 'function',
- name = 'name' in fn ? fn.name : (reName.exec(fn)||[])[1];//functions never have name in IE
- if( name )
- ret += ' ' + name;
- ret += '(';
-
- ret = [ ret, this.parse( fn, 'functionArgs' ), '){'].join('');
- return join( ret, this.parse(fn,'functionCode'), '}' );
- },
- array: array,
- nodelist: array,
- arguments: array,
- object:function( map ){
- var ret = [ ];
- this.up();
- for( var key in map )
- ret.push( this.parse(key,'key') + ': ' + this.parse(map[key]) );
- this.down();
- return join( '{', ret, '}' );
- },
- node:function( node ){
- var open = this.HTML ? '&lt;' : '<',
- close = this.HTML ? '&gt;' : '>';
-
- var tag = node.nodeName.toLowerCase(),
- ret = open + tag;
-
- for( var a in this.DOMAttrs ){
- var val = node[this.DOMAttrs[a]];
- if( val )
- ret += ' ' + a + '=' + this.parse( val, 'attribute' );
- }
- return ret + close + open + '/' + tag + close;
- },
- functionArgs:function( fn ){//function calls it internally, it's the arguments part of the function
- var l = fn.length;
- if( !l ) return '';
-
- var args = Array(l);
- while( l-- )
- args[l] = String.fromCharCode(97+l);//97 is 'a'
- return ' ' + args.join(', ') + ' ';
- },
- key:quote, //object calls it internally, the key part of an item in a map
- functionCode:'[code]', //function calls it internally, it's the content of the function
- attribute:quote, //onode calls it internally, it's an html attribute value
- string:quote,
- date:quote,
- regexp:literal, //regex
- number:literal,
- 'boolean':literal
- },
- DOMAttrs:{//attributes to dump from nodes, name=>realName
- id:'id',
- name:'name',
- 'class':'className'
- },
- HTML:false,//if true, entities are escaped ( <, >, \t, space and \n )
- indentChar:' ',//indentation unit
- multiline:true //if true, items in a collection, are separated by a \n, else just a space.
- };
-
-})();
-
-exports.jsDump = jsDump;
diff --git a/utils/lib/test/runner.js b/utils/lib/test/runner.js
deleted file mode 100755
index 1bdb43c..0000000
--- a/utils/lib/test/runner.js
+++ /dev/null
@@ -1,80 +0,0 @@
-var util = require('util');
-var assert = require("./assert");
-
-exports.run = function(objectOrModule, context) {
-
- if (typeof objectOrModule === "string")
- objectOrModule = require(objectOrModule);
-
- if (!objectOrModule)
- throw "Nothing to run";
-
- var localContext = context || { passed : 0, failed : 0, error : 0, depth : 0 };
- localContext.depth++;
-
- for (var spaces=""; spaces.length < localContext.depth * 2; spaces += " ");
-
- for (var property in objectOrModule) {
- if (property.match(/^test/)) {
- print(spaces + "+ Running "+property);
- if (typeof objectOrModule[property] == "function") {
- if (typeof objectOrModule.setup === "function")
- objectOrModule.setup();
-
- var globals = {};
- for (var name in system.global) {
- globals[name] = true;
- }
-
- try {
- try {
- objectOrModule[property]();
- } finally {
- if (!objectOrModule.isMonkey) {
- for (var name in system.global) {
- if (!globals[name]) {
- delete system.global[name];
- throw new assert.AssertionError("New global introduced: " + util.enquote(name));
- }
- }
- }
- }
-
- localContext.passed++;
- } catch (e) {
- if (e.name === "AssertionError") {
- print("Assertion Failed in "+property+": " + e);
-
- if (e.rhinoException)
- e.rhinoException.printStackTrace();
- else if (e.javaException)
- e. javaException.printStackTrace();
-
- localContext.failed++;
- } else {
- print("Exception in "+property+": " + e);
-
- if (e.rhinoException)
- e.rhinoException.printStackTrace();
- else if (e.javaException)
- e. javaException.printStackTrace();
-
- localContext.error++;
- }
- } finally {
- if (typeof objectOrModule.teardown === "function")
- objectOrModule.teardown();
- }
- } else {
- exports.run(objectOrModule[property], localContext);
- }
- }
- }
-
- localContext.depth--;
-
- if (context === undefined)
- print("Passed "+localContext.passed+"; Failed "+localContext.failed+"; Error "+localContext.error+";");
-
- return localContext.failed + localContext.error;
-};
diff --git a/utils/lib/tusk.js b/utils/lib/tusk.js
deleted file mode 100755
index b14428d..0000000
--- a/utils/lib/tusk.js
+++ /dev/null
@@ -1,202 +0,0 @@
-
-var fs = require("file");
-var packages = require("packages");
-var util = require("util");
-var json = require("json");
-var http = require("http");
-
-exports.getDirectory = function () {
- return fs.path(system.packagePrefixes[0]);
-};
-
-exports.getPackagesDirectory = function () {
- return exports.getDirectory().join('packages');
-};
-
-exports.getTuskDirectory = function () {
- var tuskDirectory = exports.getDirectory().join('.tusk');
- tuskDirectory.mkdirs();
- return tuskDirectory;
-}
-
-exports.getZipsDirectory = function () {
- return exports.getDirectory().join('zips');
-};
-
-exports.getCatalogPath = function () {
- return exports.getTuskDirectory().join('catalog.json');
-};
-
-exports.readCatalog = function () {
- return json.decode(exports.getCatalogPath().read(
- {charset: 'utf-8'}
- ));
-};
-
-exports.writeCatalog = function (catalog) {
- var catalogPath = exports.getCatalogPath();
- print('Writing ' + catalogPath);
- return catalogPath.write(
- json.encode(catalog, null, 4),
- {charset: 'utf-8'}
- );
-};
-
-exports.getSourcesPath = function () {
- return exports.getDirectory().join('sources.json');
-};
-
-exports.readSources = function () {
- return json.decode(exports.getSourcesPath().read(
- {charset: 'utf-8'}
- ));
-};
-
-exports.writeSources = function (sources) {
- return exports.getSourcesPath().write(
- json.encode(sources, null, 4),
- {charset: 'utf-8'}
- );
-};
-
-exports.getNotesPath = function () {
- return exports.getTuskDirectory().join('notes.json');
-};
-
-exports.readNotes = function () {
- var notesPath = exports.getNotesPath();
- if (!notesPath.isFile())
- return {};
- return json.decode(notesPath.read(
- {charset: 'utf-8'}
- ));
-};
-
-exports.writeNotes = function (notes) {
- return exports.getNotesPath().write(
- json.encode(notes, null, 4),
- {charset: 'utf-8'}
- );
-};
-
-// commands
-//
-
-exports.update = function (options) {
- print('Downloading catalog.');
- var catalogData = http.read('http://github.com/tlrobinson/narwhal/raw/master/catalog.json');
- print('Saving catalog.');
- exports.getCatalogPath().write(catalogData, 'b');
-};
-
-exports.createCatalog = function (options) {
- var sources = exports.readSources();
- var catalog = {};
- catalog.version = util.copy(sources.version);
- var packages = catalog.packages = {};
- util.forEachApply(
- util.items(sources.packages || {}),
- function (name, source) {
- var info;
- print(name);
- if (source.type == "inline") {
- info = util.copy(source['package.json']);
- } else if (source.type == "github") {
- var githubName = source.name || name;
- if (!source.user)
- throw new Error("package source " + util.enquote(name) + " did not have a github user name");
- var project = source.user + '/' + githubName;
- var url = "http://github.com/" + project + "/raw/master/package.json";
- var text = http.read(url).toString('utf-8');
- info = json.decode(text);
- info.type = "zip";
- info.location = 'http://github.com/' + source.user + '/' + githubName + '/zipball/master';
- } else {
- throw new Error(
- "Project " + exports.enquote(name) +
- " has an urecognized type: " +
- exports.enquote(source.type)
- );
- }
- packages[name] = info;
- }
- );
- exports.writeCatalog(catalog);
-};
-
-exports.list = function (options) {
- var self = this;
- Object.keys(packages.catalog).forEach(function (name) {
- self.print(
- name + ' \0magenta(' +
- packages.catalog[name].directory + '\0)'
- );
- });
-};
-
-exports.catalog = function (options) {
- Object.keys(exports.readCatalog().packages).forEach(print);
-};
-
-
-var args = require("args");
-var parser = exports.parser = new args.Parser();
-
-parser.help('A Narwhal project package manager.');
-
-// parser.option('sources', exports.sources);
-
-parser.command('list', exports.list)
- .help('lists all installed packages');
-
-parser.command('install', module.id + '/install');
-
-parser.command('upgrade', exports.upgrade)
- .help('downloads the latest version of a package');
-
-parser.command('remove', exports.remove)
- .help('removes the local copy of package');
-
-parser.command('update', exports.update)
- .help('downloads the newest package catalog');
-
-parser.command('search', exports.search)
- .help('searches the package catalog');
-
-parser.command('init', module.id + '/init');
-
-parser.command('platform', module.id + '/platform');
-
-parser.command('freeze', exports.freeze)
- .help('writes a freeze.json file');
-
-parser.command('reheat', exports.reheat)
- .help('reconsistutes the exact versions of all dependencies from a frozen site.');
-
-parser.command('clone', module.id + '/clone');
-
-parser.command('catalog', exports.catalog)
- .help('lists all packages in the catalog');
-
-parser.command('create-catalog', exports.createCatalog)
- .help('creates a catalog of packages from sources.json');
-
-parser.command('update-sources')
- .help('downloads the newest list of package sources')
-
-parser.command('orphans')
- .help('lists packages that are no longer wanted by the user or other packages.')
-
-parser.command('consolidate', module.id + '/consolidate');
-
-parser.helpful();
-
-exports.main = function (args) {
- var options = parser.parse(args);
- if (!options.acted)
- parser.printHelp(options);
-};
-
-if (module.id == require.main)
- return exports.main(system.args);
-
diff --git a/utils/lib/unload.js b/utils/lib/unload.js
deleted file mode 100755
index fde1948..0000000
--- a/utils/lib/unload.js
+++ /dev/null
@@ -1,13 +0,0 @@
-
-var observers = [];
-
-exports.when = function (observer) {
- observers.unshift(observer);
-};
-
-exports.send = function () {
- observers.forEach(function (observer) {
- observer();
- });
-};
-
diff --git a/utils/lib/uri.js b/utils/lib/uri.js
deleted file mode 100755
index 24a76d0..0000000
--- a/utils/lib/uri.js
+++ /dev/null
@@ -1,55 +0,0 @@
-// original code: http://code.google.com/p/js-uri/
-
-// Based on the regex in RFC2396 Appendix B.
-var URI_RE = /^(?:([^:\/?\#]+):)?(?:\/\/([^\/?\#]*))?([^?\#]*)(?:\?([^\#]*))?(?:\#(.*))?/;
-
-/**
- * Uniform Resource Identifier (URI) - RFC3986
- */
-var URI = exports.URI = function(str) {
- if (!str) str = "";
- var result = str.match(URI_RE);
- this.scheme = result[1] || null;
- this.authority = result[2] || null;
- this.path = result[3] || null;
- this.query = result[4] || null;
- this.fragment = result[5] || null;
-}
-
-/**
- * Convert the URI to a String.
- */
-URI.prototype.toString = function () {
- var str = "";
-
- if (this.scheme)
- str += this.scheme + ":";
-
- if (this.authority)
- str += "//" + this.authority;
-
- if (this.path)
- str += this.path;
-
- if (this.query)
- str += "?" + this.query;
-
- if (this.fragment)
- str += "#" + this.fragment;
-
- return str;
-}
-
-URI.parse = function(uri) {
- return new URI(uri);
-}
-
-URI.unescape = function(str, plus) {
- return decodeURI(str).replace(/\+/g, " ");
-}
-
-URI.unescapeComponent = function(str, plus) {
- return decodeURIComponent(str).replace(/\+/g, " ");
-}
-
-
diff --git a/utils/lib/url.js b/utils/lib/url.js
deleted file mode 100755
index 897ebc1..0000000
--- a/utils/lib/url.js
+++ /dev/null
@@ -1,323 +0,0 @@
-
-/**** keys
- members of a parsed URI object.
-*/
-exports.keys = [
- "url",
- "protocol",
- "authorityRoot",
- "authority",
- "userInfo",
- "user",
- "password",
- "domain",
- "domains",
- "port",
- "path",
- "root",
- "directory",
- "directories",
- "file",
- "query",
- "anchor"
-];
-
-/**** expressionKeys
- members of a parsed URI object that you get
- from evaluting the strict regular expression.
-*/
-exports.expressionKeys = [
- "url",
- "protocol",
- "authorityRoot",
- "authority",
- "userInfo",
- "user",
- "password",
- "domain",
- "port",
- "path",
- "root",
- "directory",
- "file",
- "query",
- "anchor"
-];
-
-/**** strictExpression
-*/
-exports.strictExpression = new RegExp( /* url */
- "^" +
- "(?:" +
- "([^:/?#]+):" + /* protocol */
- ")?" +
- "(?:" +
- "(//)" + /* authorityRoot */
- "(" + /* authority */
- "(?:" +
- "(" + /* userInfo */
- "([^:@]*)" + /* user */
- ":?" +
- "([^:@]*)" + /* password */
- ")?" +
- "@" +
- ")?" +
- "([^:/?#]*)" + /* domain */
- "(?::(\\d*))?" + /* port */
- ")" +
- ")?" +
- "(" + /* path */
- "(/?)" + /* root */
- "((?:[^?#/]*/)*)" +
- "([^?#]*)" + /* file */
- ")" +
- "(?:\\?([^#]*))?" + /* query */
- "(?:#(.*))?" /*anchor */
-);
-
-/**** Parser
- returns a URI parser function given
- a regular expression that renders
- `expressionKeys` and returns an `Object`
- mapping all `keys` to values.
-*/
-exports.Parser = function (expression) {
- return function (url) {
- if (typeof url == "undefined")
- throw new Error("HttpError: URL is undefined");
- if (typeof url != "string") return new Object(url);
-
- var items = {};
- var parts = expression.exec(url);
-
- for (var i = 0; i < parts.length; i++) {
- items[exports.expressionKeys[i]] = parts[i] ? parts[i] : "";
- }
-
- items.root = (items.root || items.authorityRoot) ? '/' : '';
-
- items.directories = items.directory.split("/");
- if (items.directories[items.directories.length - 1] == "") {
- items.directories.pop();
- }
-
- /* normalize */
- var directories = [];
- for (var i = 0; i < items.directories.length; i++) {
- var directory = items.directories[i];
- if (directory == '.') {
- } else if (directory == '..') {
- if (directories.length && directories[directories.length - 1] != '..')
- directories.pop();
- else
- directories.push('..');
- } else {
- directories.push(directory);
- }
- }
- items.directories = directories;
-
- items.domains = items.domain.split(".");
-
- return items;
- };
-};
-
-/**** parse
- a strict URI parser.
-*/
-exports.parse = exports.Parser(exports.strictExpression);
-
-/**** format
- accepts a parsed URI object and returns
- the corresponding string.
-*/
-exports.format = function (object) {
- if (typeof(object) == 'undefined')
- throw new Error("UrlError: URL undefined for urls#format");
- if (object instanceof String || typeof(object) == 'string')
- return object;
- var domain =
- object.domains ?
- object.domains.join(".") :
- object.domain;
- var userInfo = (
- object.user ||
- object.password
- ) ?
- (
- (object.user || "") +
- (object.password ? ":" + object.password : "")
- ) :
- object.userInfo;
- var authority = (
- userInfo ||
- domain ||
- object.port
- ) ? (
- (userInfo ? userInfo + "@" : "") +
- (domain || "") +
- (object.port ? ":" + object.port : "")
- ) :
- object.authority;
- var directory =
- object.directories ?
- object.directories.join("/") :
- object.directory;
- var path =
- directory || object.file ?
- (
- (directory ? directory + "/" : "") +
- (object.file || "")
- ) :
- object.path;
- return (
- (object.protocol ? object.protocol + ":" : "") +
- (authority ? "//" + authority : "") +
- (object.root || (authority && path) ? "/" : "") +
- (path ? path : "") +
- (object.query ? "?" + object.query : "") +
- (object.anchor ? "#" + object.anchor : "")
- ) || object.url || "";
-};
-
-/**** resolveObject
- returns an object representing a URL resolved from
- a relative location and a source location.
-*/
-exports.resolveObject = function (source, relative) {
- if (!source)
- return relative;
-
- source = exports.parse(source);
- relative = exports.parse(relative);
-
- if (relative.url == "")
- return source;
-
- delete source.url;
- delete source.authority;
- delete source.domain;
- delete source.userInfo;
- delete source.path;
- delete source.directory;
-
- if (
- relative.protocol && relative.protocol != source.protocol ||
- relative.authority && relative.authority != source.authority
- ) {
- source = relative;
- } else {
- if (relative.root) {
- source.directories = relative.directories;
- } else {
-
- var directories = relative.directories;
- for (var i = 0; i < directories.length; i++) {
- var directory = directories[i];
- if (directory == ".") {
- } else if (directory == "..") {
- if (source.directories.length) {
- source.directories.pop();
- } else {
- source.directories.push('..');
- }
- } else {
- source.directories.push(directory);
- }
- }
-
- if (relative.file == ".") {
- relative.file = "";
- } else if (relative.file == "..") {
- source.directories.pop();
- relative.file = "";
- }
- }
- }
-
- if (relative.root)
- source.root = relative.root;
- if (relative.protcol)
- source.protocol = relative.protocol;
- if (!(!relative.path && relative.anchor))
- source.file = relative.file;
- source.query = relative.query;
- source.anchor = relative.anchor;
-
- return source;
-};
-
-/**** relativeObject
- returns an object representing a relative URL to
- a given target URL from a source URL.
-*/
-exports.relativeObject = function (source, target) {
- target = exports.parse(target);
- source = exports.parse(source);
-
- delete target.url;
-
- if (
- target.protocol == source.protocol &&
- target.authority == source.authority
- ) {
- delete target.protocol;
- delete target.authority;
- delete target.userInfo;
- delete target.user;
- delete target.password;
- delete target.domain;
- delete target.domains;
- delete target.port;
- if (
- !!target.root == !!source.root && !(
- target.root &&
- target.directories[0] != source.directories[0]
- )
- ) {
- delete target.path;
- delete target.root;
- delete target.directory;
- while (
- source.directories.length &&
- target.directories.length &&
- target.directories[0] == source.directories[0]
- ) {
- target.directories.shift();
- source.directories.shift();
- }
- while (source.directories.length) {
- source.directories.shift();
- target.directories.unshift('..');
- }
-
- if (!target.root && !target.directories.length && !target.file && source.file)
- target.directories.push('.');
-
- if (source.file == target.file)
- delete target.file;
- if (source.query == target.query)
- delete target.query;
- if (source.anchor == target.anchor)
- delete target.anchor;
- }
- }
-
- return target;
-};
-
-/**** resolve
- returns a URL resovled to a relative URL from a source URL.
-*/
-exports.resolve = function (source, relative) {
- return exports.format(exports.resolveObject(source, relative));
-};
-
-/**** relative
- returns a relative URL to a target from a source.
-*/
-exports.relative = function (source, target) {
- return exports.format(exports.relativeObject(source, target));
-};
-
diff --git a/utils/lib/utf8.js b/utils/lib/utf8.js
deleted file mode 100755
index e1c742d..0000000
--- a/utils/lib/utf8.js
+++ /dev/null
@@ -1,64 +0,0 @@
-
-var binary = require('./binary');
-
-/*** encode
- converts a Unicode character string into a UTF-8
- character stream.
-*/
-exports.encode = function (string) {
- string = string.replace(/\r\n/g,"\n");
- var utftext = [];
-
- for (var n = 0; n < string.length; n++) {
-
- var c = string.charCodeAt(n);
-
- if (c < 128) {
- utftext.push(c);
- }
- else if((c > 127) && (c < 2048)) {
- utftext.push((c >> 6) | 192);
- utftext.push((c & 63) | 128);
- }
- else {
- utftext.push((c >> 12) | 224);
- utftext.push(((c >> 6) & 63) | 128);
- utftext.push((c & 63) | 128);
- }
-
- }
-
- return binary.ByteString(utftext);
-};
-
-/*** decode
- Converts a UTF-8 character string into a
- Unicode character string.
-*/
-exports.decode = function (utftext) {
- var string = "";
- var i = 0;
- var c = c1 = c2 = 0;
-
- while (i < utftext.length) {
-
- c = utftext.charCodeAt(i);
-
- if (c < 128) {
- string += String.fromCharCode(c);
- i++;
- } else if ((c > 191) && (c < 224)) {
- c2 = utftext.charCodeAt(i+1);
- string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
- i += 2;
- } else {
- c2 = utftext.charCodeAt(i+1);
- c3 = utftext.charCodeAt(i+2);
- string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
- i += 3;
- }
- }
-
- return string;
-};
-
diff --git a/utils/lib/util.js b/utils/lib/util.js
deleted file mode 100755
index 510e322..0000000
--- a/utils/lib/util.js
+++ /dev/null
@@ -1,864 +0,0 @@
-
-// a decorator for functions that curry "polymorphically",
-// that is, that return a function that can be tested
-// against various objects if they're only "partially
-// completed", or fewer arguments than needed are used.
-//
-// this enables the idioms:
-// [1, 2, 3].every(lt(4)) eq true
-// [1, 2, 3].map(add(1)) eq [2, 3, 4]
-// [{}, {}, {}].forEach(set('a', 10))
-//
-exports.operator = function (name, length, block) {
- var operator = function () {
- var args = exports.array(arguments);
- var completion = function (object) {
- if (
- typeof object == "object" &&
- object !== null && // seriously? typeof null == "object"
- name in object && // would throw if object === null
- // not interested in literal objects:
- !Object.prototype.hasOwnProperty.call(object, name)
- )
- return object[name].apply(object, args);
- return block.apply(
- this,
- [object].concat(args)
- );
- };
- if (arguments.length < length) {
- // polymoprhic curry, delayed completion
- return completion;
- } else {
- // immediate completion
- return completion.call(this, args.shift());
- }
- };
- operator.name = name;
- operator.displayName = name;
- operator.length = length;
- operator.operator = block;
- return operator;
-};
-
-exports.no = function (value) {
- return value === null || value === undefined;
-};
-
-// object
-
-exports.object = exports.operator('object', 1, function (object) {
- var items = object;
- if (!items.length)
- items = exports.items(object);
- var copy = {};
- for (var i = 0; i < items.length; i++) {
- var item = items[i];
- var key = item[0];
- var value = item[1];
- copy[key] = value;
- }
- return copy;
-});
-
-exports.object.copy = function (object) {
- var copy = {};
- exports.object.keys(object).forEach(function (key) {
- copy[key] = object[key];
- });
- return copy;
-};
-
-exports.object.deepCopy = function (object) {
- var copy = {};
- exports.object.keys(object).forEach(function (key) {
- copy[key] = exports.deepCopy(object[key]);
- });
- return copy;
-};
-
-exports.object.eq = function (a, b, stack) {
- return (
- !exports.no(a) && !exports.no(b) &&
- exports.array.eq(
- exports.sort(exports.object.keys(a)),
- exports.sort(exports.object.keys(b))
- ) &&
- exports.object.keys(a).every(function (key) {
- return exports.eq(a[key], b[key], stack);
- })
- );
-};
-
-exports.object.len = function (object) {
- return exports.object.keys(object).length;
-};
-
-exports.object.has = function (object, key) {
- return Object.prototype.hasOwnProperty.call(object, key);
-};
-
-exports.object.keys = function (object) {
- var keys = [];
- for (var key in object) {
- if (exports.object.has(object, key))
- keys.push(key);
- }
- return keys;
-};
-
-exports.object.values = function (object) {
- var values = [];
- exports.object.keys(object).forEach(function (key) {
- values.push(object[key]);
- });
- return values;
-};
-
-exports.object.items = function (object) {
- var items = [];
- exports.object.keys(object).forEach(function (key) {
- items.push([key, object[key]]);
- });
- return items;
-};
-
-exports.object.update = function (target, source) {
- for (var key in source) {
- if (exports.object.has(source, key)) {
- target[key] = source[key];
- }
- }
-};
-
-exports.object.complete = function (target, source) {
- for (var key in source) {
- if (
- exports.object.has(source, key) &&
- !exports.object.has(target, key)
- ) {
- target[key] = source[key];
- }
- }
-};
-
-exports.object.repr = function (object) {
- return "{" +
- exports.object.keys(object)
- .map(function (key) {
- return exports.enquote(key) + ": " +
- exports.repr(object[key]);
- }).join(", ") +
- "}";
-};
-
-// array
-
-exports.array = function (array) {
- if (!exports.isArrayLike(array))
- return exports.items(array);
- return Array.prototype.slice.call(array);
-};
-
-exports.isArrayLike = function(object) {
- return object &&
- typeof object === "object" &&
- (
- object.constructor === Array ||
- typeof object.callee !== "undefined"
- );
-};
-
-exports.array.copy = exports.array;
-
-exports.array.deepCopy = function (array) {
- return array.map(exports.deepCopy);
-};
-
-exports.array.len = function (array) {
- return array.length;
-};
-
-exports.array.has = function (array, value) {
- return Array.prototype.indexOf.call(array, value) >= 0;
-};
-
-exports.array.put = function (array, key, value) {
- array.splice(key, 0, value);
- return array;
-};
-
-exports.array.del = function (array, begin, end) {
- array.splice(begin, end === undefined ? 1 : (end - begin));
- return array;
-};
-
-exports.array.eq = function (a, b, stack) {
- return exports.isArrayLike(b) &&
- a.length == b.length &&
- exports.zip(a, b).every(exports.apply(function (a, b) {
- return exports.eq(a, b, stack);
- }));
-};
-
-exports.array.lt = function (a, b) {
- var length = Math.max(a.length, b.length);
- for (var i = 0; i < length; i++)
- if (!exports.eq(a[i], b[i]))
- return exports.lt(a[i], b[i]);
- return false;
-};
-
-exports.array.repr = function (array) {
- return "[" + exports.map(array, exports.repr).join(', ') + "]";
-};
-
-exports.apply = exports.operator('apply', 2, function (args, block) {
- return block.apply(this, args);
-});
-
-exports.copy = exports.operator('copy', 1, function (object) {
- if (exports.no(object))
- return object;
- if (exports.isArrayLike(object))
- return exports.array.copy(object);
- if (typeof object == 'object')
- return exports.object.copy(object);
- return object;
-});
-
-exports.deepCopy = exports.operator('deepCopy', 1, function (object) {
- if (exports.no(object))
- return object;
- if (exports.isArrayLike(object))
- return exports.array.deepCopy(object);
- if (typeof object == 'object')
- return exports.object.deepCopy(object);
- return object;
-});
-
-exports.repr = exports.operator('repr', 1, function (object) {
- if (exports.no(object))
- return String(object);
- if (exports.isArrayLike(object))
- return exports.array.repr(object);
- if (typeof object == 'object')
- return exports.object.repr(object);
- if (typeof object == 'string')
- return exports.enquote(object);
- return object.toString();
-});
-
-exports.keys = exports.operator('keys', 1, function (object) {
- if (exports.isArrayLike(object))
- return exports.range(object.length);
- else if (typeof object == 'object')
- return exports.object.keys(object);
- return [];
-});
-
-exports.values = exports.operator('values', 1, function (object) {
- if (exports.isArrayLike(object))
- return exports.array(object);
- else if (typeof object == 'object')
- return exports.object.values(object);
- return [];
-});
-
-exports.items = exports.operator('items', 1, function (object) {
- if (exports.isArrayLike(object) || typeof object == "string")
- return exports.enumerate(object);
- else if (typeof object == 'object')
- return exports.object.items(object);
- return [];
-});
-
-exports.len = exports.operator('len', 1, function (object) {
- if (exports.isArrayLike(object))
- return exports.array.len(object);
- else if (typeof object == 'object')
- return exports.object.len(object);
-});
-
-exports.has = exports.operator('has', 2, function (object, value) {
- if (exports.isArrayLike(object))
- return exports.array.has(object, value);
- else if (typeof object == 'object')
- return exports.object.has(object, value);
- return false;
-});
-
-exports.get = exports.operator('get', 2, function (object, key, value) {
- if (typeof object == "string") {
- if (!typeof key == "number")
- throw new Error("TypeError: String keys must be numbers");
- if (!exports.has(exports.range(object.length), key)) {
- if (arguments.length == 3)
- return value;
- throw new Error("KeyError: " + exports.repr(key));
- }
- return items.charAt(object);
- }
- if (typeof object == "object") {
- if (!exports.object.has(object, key)) {
- if (arguments.length == 3)
- return value;
- throw new Error("KeyError: " + exports.repr(key));
- }
- return object[key];
- }
- throw new Error("Object does not have keys: " + exports.repr(object));
-});
-
-exports.set = exports.operator('set', 3, function (object, key, value) {
- object[key] = value;
- return object;
-});
-
-exports.getset = exports.operator('getset', 3, function (object, key, value) {
- if (!exports.has(object, key))
- exports.set(object, key, value);
- return exports.get(object, key);
-});
-
-exports.del = exports.operator('del', 2, function (object, begin, end) {
- if (exports.isArrayLike(object))
- return exports.array.del(object, begin, end);
- delete object[begin];
- return object;
-});
-
-exports.cut = exports.operator('cut', 2, function (object, key) {
- var result = exports.get(object, key);
- exports.del(object, key);
- return result;
-});
-
-exports.put = exports.operator('put', 2, function (object, key, value) {
- if (exports.isArrayLike(object))
- return exports.array.put(object, key, value);
- return exports.set(object, key, value);
-});
-
-exports.update = exports.operator('update', 2, function (target, source) {
- exports.object.update(target, source);
-});
-
-exports.complete = exports.operator('complete', 2, function (target, source) {
- exports.object.complete(target, source);
-});
-
-// TODO insert
-// TODO remove
-// TODO discard
-
-exports.range = function () {
- var start = 0, stop = 0, step = 1;
- if (arguments.length == 1) {
- stop = arguments[0];
- } else if (arguments.length == 2) {
- start = arguments[0];
- stop = arguments[1];
- } else if (arguments.length == 3) {
- start = arguments[0];
- stop = arguments[1];
- step = arguments[2];
- }
- var range = [];
- for (var i = start; i < stop; i += step)
- range.push(i);
- return range;
-};
-
-exports.forEach = function (array, block) {
- Array.prototype.forEach.call(array, block);
-};
-
-exports.forEachApply = function (array, block) {
- Array.prototype.forEach.call(array, exports.apply(block));
-};
-
-exports.map = function (array, block, context) {
- return Array.prototype.map.call(array, block, context);
-};
-
-exports.mapApply = function (array, block) {
- return Array.prototype.map.call(array, exports.apply(block));
-};
-
-exports.every = exports.operator('every', 2, function (array, block, context) {
- return exports.all(exports.map(array, block, context));
-});
-
-exports.some = exports.operator('some', 2, function (array, block, context) {
- return exports.any(exports.map(array, block, context));
-});
-
-exports.all = exports.operator('all', 1, function (array) {
- for (var i = 0; i < array.length; i++)
- if (!array[i])
- return false;
- return true;
-});
-
-exports.any = exports.operator('all', 1, function (array) {
- for (var i = 0; i < array.length; i++)
- if (array[i])
- return true;
- return false;
-});
-
-exports.reduce = exports.operator('reduce', 2, function (array, block, basis) {
- return array.reduce.apply(array, arguments);
-});
-
-exports.reduceRight = exports.operator('reduceRight', 2, function (array, block, basis) {
- return array.reduceRight.apply(array, arguments);
-});
-
-exports.zip = function () {
- return exports.transpose(arguments);
-};
-
-exports.transpose = function (array) {
- var transpose = [];
- for (var i = 0; i < array.length; i++) {
- var row = array[i];
- for (var j = 0; j < row.length; j++) {
- var cell = row[j];
- if (!transpose[j])
- transpose[j] = [];
- transpose[j][i] = cell;
- }
- }
- return transpose;
-};
-
-exports.enumerate = function (array, start) {
- if (exports.no(start))
- start = 0;
- return exports.zip(
- exports.range(start, start + array.length),
- array
- );
-};
-
-// arithmetic, transitive, and logical operators
-
-exports.is = function (a, b) {
- return a === b;
-};
-
-exports.eq = exports.operator('eq', 2, function (a, b, stack) {
- if (!stack)
- stack = [];
- if (a === b)
- return true;
- if (typeof a !== typeof b)
- return false;
- if (exports.no(a))
- return exports.no(b);
- if (typeof a == "date")
- return a.valueOf() == b.valueOf();
- if (typeof a == "regexp")
- return a.source == b.source &&
- a.global == b.global &&
- a.ignoreCase == b.ignoreCase &&
- a.multiline == b.multiline;
- if (typeof a == "function") {
- var caller = stack[stack.length - 1];
- return caller !== Object &&
- typeof caller != "undefined";
- }
- if (exports.isArrayLike(a))
- return exports.array.eq(
- a, b,
- stack.concat([a.constructor])
- );
- if (typeof a == 'object')
- return exports.object.eq(
- a, b,
- stack.concat([a.constructor])
- );
- return a == b;
-});
-
-exports.ne = exports.operator('ne', 2, function (a, b) {
- return !exports.eq(a, b);
-});
-
-exports.lt = exports.operator('lt', 2, function (a, b) {
- if (exports.no(a) != exports.no(b))
- return exports.no(a) > exports.no(b);
- if (exports.isArrayLike(a) && exports.isArrayLike(b))
- return exports.array.lt(a, b);
- return a < b;
-});
-
-exports.gt = exports.operator('gt', 2, function (a, b) {
- return !(exports.lt(a, b) || exports.eq(a, b));
-});
-
-exports.le = exports.operator(2, 'le', function (a, b) {
- return exports.lt(a, b) || exports.eq(a, b);
-});
-
-exports.ge = exports.operator(2, 'ge', function (a, b) {
- return !exports.lt(a, b);
-});
-
-/*** by
- returns a `comparator` that compares
- values based on the values resultant from
- a given `relation`.
- accepts a `relation` and an optional comparator.
-
- To sort a list of objects based on their
- "a" key::
-
- objects.sort(by(get("a")))
-
- To get those in descending order::
-
- objects.sort(by(get("a")), desc)
-
- `by` returns a comparison function that also tracks
- the arguments you used to construct it. This permits
- `sort` and `sorted` to perform a Schwartzian transform
- which can increase the performance of the sort
- by a factor of 2.
-*/
-exports.by = function (relation) {
- var compare = arguments[1];
- if (exports.no(compare))
- compare = exports.compare;
- var comparator = function (a, b) {
- a = relation(a);
- b = relation(b);
- return compare(a, b);
- };
- comparator.by = relation;
- comparator.compare = compare;
- return comparator;
-};
-
-exports.compare = exports.operator(2, 'compare', function (a, b) {
- if (exports.no(a) != exports.no(b))
- return exports.no(b) - exports.no(a);
- if (typeof a == "number" && typeof b == "number")
- return a - b;
- return exports.eq(a, b) ? 0 : exports.lt(a, b) ? -1 : 1;
-});
-
-/*** sort
- an in-place array sorter that uses a deep comparison
- function by default (compare), and improves performance if
- you provide a comparator returned by "by", using a
- Schwartzian transform.
-*/
-exports.sort = function (array, compare) {
- if (exports.no(compare))
- compare = exports.compare;
- if (compare.by) {
- /* schwartzian transform */
- array.splice.apply(
- array,
- [0, array.length].concat(
- array.map(function (value) {
- return [compare.by(value), value];
- }).sort(function (a, b) {
- return exports.compare(a[0], b[0]);
- }).map(function (pair) {
- return pair[1];
- })
- )
- );
- } else {
- array.sort(compare);
- }
- return array;
-};
-
-/*** sorted
- returns a sorted copy of an array using a deep
- comparison function by default (compare), and
- improves performance if you provide a comparator
- returned by "by", using a Schwartzian transform.
-*/
-exports.sorted = function (array, compare) {
- return exports.sort(exports.array.copy(array), compare);
-};
-
-// string
-
-/*** escape
- escapes all characters of a string that are
- special to JavaScript and many other languages.
- Recognizes all of the relevant
- control characters and formats all other
- non-printable characters as Hex byte escape
- sequences or Unicode escape sequences depending
- on their size.
-
- Pass ``true`` as an optional second argument and
- ``escape`` produces valid contents for escaped
- JSON strings, wherein non-printable-characters are
- all escaped with the Unicode ``\u`` notation.
-*/
-/* more Steve Levithan flagrence */
-var escapeExpression = /[^ !#-[\]-~]/g;
-/* from Doug Crockford's JSON library */
-var escapePatterns = {
- '\b': '\\b', '\t': '\\t',
- '\n': '\\n', '\f': '\\f', '\r': '\\r',
- '"' : '\\"', '\\': '\\\\'
-};
-exports.escape = function (value, strictJson) {
- if (typeof value != "string")
- throw new Error(
- module.path +
- "#escape: requires a string. got " +
- exports.repr(value)
- );
- return value.replace(
- escapeExpression,
- function (match) {
- if (escapePatterns[match])
- return escapePatterns[match];
- match = match.charCodeAt();
- if (!strictJson && match < 256)
- return "\\x" + exports.padBegin(match.toString(16), 2);
- return '\\u' + exports.padBegin(match.toString(16), 4);
- }
- );
-};
-
-/*** enquote
- transforms a string into a string literal, escaping
- all characters of a string that are special to
- JavaScript and and some other languages.
-
- ``enquote`` uses double quotes to be JSON compatible.
-
- Pass ``true`` as an optional second argument to
- be strictly JSON compliant, wherein all
- non-printable-characters are represented with
- Unicode escape sequences.
-*/
-exports.enquote = function (value, strictJson) {
- return '"' + exports.escape(value, strictJson) + '"';
-};
-
-/*** expand
- transforms tabs to an equivalent number of spaces.
-*/
-// TODO special case for \r if it ever matters
-exports.expand = function (str, tabLength) {
- str = String(str);
- tabLength = tabLength || 4;
- var output = [],
- tabLf = /[\t\n]/g,
- lastLastIndex = 0,
- lastLfIndex = 0,
- charsAddedThisLine = 0,
- tabOffset, match;
- while (match = tabLf.exec(str)) {
- if (match[0] == "\t") {
- tabOffset = (
- tabLength - 1 -
- (
- (match.index - lastLfIndex) +
- charsAddedThisLine
- ) % tabLength
- );
- charsAddedThisLine += tabOffset;
- output.push(
- str.slice(lastLastIndex, match.index) +
- operator.mul(" ", tabOffset + 1)
- );
- } else if (match[0] === "\n") {
- output.push(str.slice(lastLastIndex, tabLf.lastIndex));
- lastLfIndex = tabLf.lastIndex;
- charsAddedThisLine = 0;
- }
- lastLastIndex = tabLf.lastIndex;
- }
- return output.join("") + str.slice(lastLastIndex);
-};
-
-var trimBeginExpression = /^\s\s*/g;
-exports.trimBegin = function (value) {
- return String(value).replace(trimBeginExpression, "");
-};
-
-var trimEndExpression = /\s\s*$/g;
-exports.trimEnd = function (value) {
- return String(value).replace(trimEndExpression, "");
-};
-
-exports.trim = function (value) {
- return String(value).replace(trimBeginExpression, "").replace(trimEndExpression, "");
-};
-
-/* generates padBegin and padEnd */
-var augmentor = function (augment) {
- return function (value, length, pad) {
- if (exports.no(pad)) pad = '0';
- if (exports.no(length)) length = 2;
- value = String(value);
- while (value.length < length) {
- value = augment(value, pad);
- }
- return value;
- };
-};
-
-/*** padBegin
-
- accepts:
- - a `String` or `Number` value
- - a minimum length of the resultant `String`:
- by default, 2
- - a pad string: by default, ``'0'``.
-
- returns a `String` of the value padded up to at least
- the minimum length. adds the padding to the begining
- side of the `String`.
-
-*/
-exports.padBegin = augmentor(function (value, pad) {
- return pad + value;
-});
-
-/*** padEnd
-
- accepts:
- - a `String` or `Number` value
- - a minimum length of the resultant `String`:
- by default, 2
- - a pad string: by default, ``'0'``.
-
- returns a `String` of the value padded up to at least
- the minimum length. adds the padding to the end
- side of the `String`.
-
-*/
-exports.padEnd = augmentor(function (value, pad) {
- return value + pad;
-});
-
-/*** splitName
- splits a string into a `List` of words from an origin
- string.
-*/
-var splitNameExpression = /[a-z]+|[A-Z](?:[a-z]+|[A-Z]*(?![a-z]))|[.\d]+/g;
-exports.splitName = function (value) {
- return String(value).match(splitNameExpression);
-};
-
-/*** joinName
- joins a list of words with a given delimiter
- between alphanumeric words.
-*/
-exports.joinName = function (delimiter, parts) {
- if (exports.no(delimiter)) delimiter = '_';
- parts.unshift([]);
- return parts.reduce(function (parts, part) {
- if (
- part.match(/\d/) &&
- exports.len(parts) && parts[parts.length-1].match(/\d/)
- ) {
- return parts.concat([delimiter + part]);
- } else {
- return parts.concat([part]);
- }
- }).join('');
-};
-
-/*** upper
- converts a name to ``UPPER CASE`` using
- a given delimiter between numeric words.
-
- see:
- - `lower`
- - `camel`
- - `title`
-
-*/
-exports.upper = function (value, delimiter) {
- if (exports.no(delimiter))
- return value.toUpperCase();
- return exports.splitName(value).map(function (part) {
- return part.toUpperCase();
- }).join(delimiter);
-};
-
-/*** lower
- converts a name to a ``lower case`` using
- a given delimiter between numeric words.
-
- see:
- - `upper`
- - `camel`
- - `title`
-
-*/
-exports.lower = function (value, delimiter) {
- if (exports.no(delimiter))
- return String(value).toLowerCase();
- return exports.splitName(value).map(function (part) {
- return part.toLowerCase();
- }).join(delimiter);
-};
-
-/*** camel
- converts a name to ``camel Case`` using
- a given delimiter between numeric words.
-
- see:
- - `lower`
- - `upper`
- - `title`
-
-*/
-exports.camel = function (value, delimiter) {
- return exports.joinName(
- delimiter,
- exports.mapApply(
- exports.enumerate(exports.splitName(value)),
- function (n, part) {
- if (n) {
- return (
- part.substring(0, 1).toUpperCase() +
- part.substring(1).toLowerCase()
- );
- } else {
- return part.toLowerCase();
- }
- }
- )
- );
-};
-
-/*** title
- converts a name to ``Title Case`` using
- a given delimiter between numeric words.
-
- see:
- - `lower`
- - `upper`
- - `camel`
-
-*/
-exports.title = function (value, delimiter) {
- return exports.joinName(
- delimiter,
- exports.splitName(value).map(function (part) {
- return (
- part.substring(0, 1).toUpperCase() +
- part.substring(1).toLowerCase()
- );
- })
- );
-};
-
diff --git a/utils/lib/xregexp.js b/utils/lib/xregexp.js
deleted file mode 100755
index 4b67fd0..0000000
--- a/utils/lib/xregexp.js
+++ /dev/null
@@ -1,521 +0,0 @@
-// RegExp
-
-/** provides an augmented, cross-browser implementation of regular expressions
- including support for additional modifiers and syntax. several convenience
- methods and a recursive-construct parser are also included.
-*/
-
-/*preamble-steven-levithan
- XRegExp 0.6.1
- Copyright (c) 2007-2008 Steven Levithan <http://stevenlevithan.com>
- MIT license
- Based on XRegExp 0.5.1
-*/
-/*preamble-kris-kowal
- Copyright (c) 2002-2008 Kris Kowal <http://cixar.com/~kris.kowal>
- MIT License
- Migrated to module system
-*/
-
-/** provides an augmented, cross-browser implementation of regular expressions
- including support for additional modifiers and syntax. several convenience
- methods and a recursive-construct parser are also included.
-*/
-
-// copy various native globals for reference. can't use the name ``native``
-// because it's a reserved JavaScript keyword.
-var real = {
- exec: RegExp.prototype.exec,
- match: String.prototype.match,
- replace: String.prototype.replace,
- split: String.prototype.split
- },
- /* regex syntax parsing with support for all the necessary cross-
- browser and context issues (escapings, character classes, etc.) */
- lib = {
- part: /(?:[^\\([#\s.]+|\\(?!k<[\w$]+>|[pP]{[^}]+})[\S\s]?|\((?=\?(?!#|<[\w$]+>)))+|(\()(?:\?(?:(#)[^)]*\)|<([$\w]+)>))?|\\(?:k<([\w$]+)>|[pP]{([^}]+)})|(\[\^?)|([\S\s])/g,
- replaceVar: /(?:[^$]+|\$(?![1-9$&`']|{[$\w]+}))+|\$(?:([1-9]\d*|[$&`'])|{([$\w]+)})/g,
- extended: /^(?:\s+|#.*)+/,
- quantifier: /^(?:[?*+]|{\d+(?:,\d*)?})/,
- classLeft: /&&\[\^?/g,
- classRight: /]/g
- },
- indexOf = function (array, item, from) {
- for (var i = from || 0; i < array.length; i++)
- if (array[i] === item) return i;
- return -1;
- },
- brokenExecUndef = /()??/.exec("")[1] !== undefined,
- plugins = {};
-
-/*** XRegExp
- accepts a pattern and flags, returns a new, extended RegExp object.
- differs from a native regex in that additional flags and syntax are
- supported and browser inconsistencies are ameliorated.
-*/
-XRegExp = function (pattern, flags) {
- if (pattern instanceof RegExp) {
- if (flags !== undefined)
- throw TypeError("can't supply flags when constructing one RegExp from another");
- return pattern.addFlags(); // new copy
- }
-
- var flags = flags || "",
- singleline = flags.indexOf("s") > -1,
- extended = flags.indexOf("x") > -1,
- hasNamedCapture = false,
- captureNames = [],
- output = [],
- part = lib.part,
- match, cc, len, index, regex;
-
- part.lastIndex = 0; // in case the last XRegExp compilation threw an error (unbalanced character class)
-
- while (match = real.exec.call(part, pattern)) {
- // comment pattern. this check must come before the capturing group check,
- // because both match[1] and match[2] will be non-empty.
- if (match[2]) {
- // keep tokens separated unless the following token is a quantifier
- if (!lib.quantifier.test(pattern.slice(part.lastIndex)))
- output.push("(?:)");
- // capturing group
- } else if (match[1]) {
- captureNames.push(match[3] || null);
- if (match[3])
- hasNamedCapture = true;
- output.push("(");
- // named backreference
- } else if (match[4]) {
- index = indexOf(captureNames, match[4]);
- // keep backreferences separate from subsequent literal numbers
- // preserve backreferences to named groups that are undefined at this point as literal strings
- output.push(index > -1 ?
- "\\" + (index + 1) + (isNaN(pattern.charAt(part.lastIndex)) ? "" : "(?:)") :
- match[0]
- );
- // unicode element (requires plugin)
- } else if (match[5]) {
- output.push(plugins.unicode ?
- plugins.unicode.get(match[5], match[0].charAt(1) === "P") :
- match[0]
- );
- // character class opening delimiter ("[" or "[^")
- // (non-native unicode elements are not supported within character classes)
- } else if (match[6]) {
- if (pattern.charAt(part.lastIndex) === "]") {
- // for cross-browser compatibility with ECMA-262 v3 behavior,
- // convert [] to (?!) and [^] to [\S\s].
- output.push(match[6] === "[" ? "(?!)" : "[\\S\\s]");
- part.lastIndex++;
- } else {
- // parse the character class with support for inner escapes and
- // ES4's infinitely nesting intersection syntax ([&&[^&&[]]]).
- cc = XRegExp.matchRecursive("&&" + pattern.slice(match.index), lib.classLeft, lib.classRight, "", {escapeChar: "\\"})[0];
- output.push(match[6] + cc + "]");
- part.lastIndex += cc.length + 1;
- }
- // dot ("."), pound sign ("#"), or whitespace character
- } else if (match[7]) {
- if (singleline && match[7] === ".") {
- output.push("[\\S\\s]");
- } else if (extended && lib.extended.test(match[7])) {
- len = real.exec.call(lib.extended, pattern.slice(part.lastIndex - 1))[0].length;
- // keep tokens separated unless the following token is a quantifier
- if (!lib.quantifier.test(pattern.slice(part.lastIndex - 1 + len)))
- output.push("(?:)");
- part.lastIndex += len - 1;
- } else {
- output.push(match[7]);
- }
- } else {
- output.push(match[0]);
- }
- }
-
- regex = RegExp(output.join(""), real.replace.call(flags, /[sx]+/g, ""));
- regex._x = {
- source: pattern,
- captureNames: hasNamedCapture ? captureNames : null
- };
- return regex;
-};
-
-// barebones plugin support for now (intentionally undocumented)
-XRegExp.addPlugin = function (name, o) {
- plugins[name] = o;
-};
-
-/*** RegExp.prototype.exec
- adds named capture support, with values returned as ``result.name``.
- also fixes two cross-browser issues, following the ECMA-262 v3 spec:
- - captured values for non-participating capturing groups should be returned
- as ``undefined``, rather than the empty string.
- - the regex's ``lastIndex`` should not be incremented after zero-length
- matches.
-*/
-RegExp.prototype.exec = function (str) {
- var match = real.exec.call(this, str),
- name, i, r2;
- if (match) {
- // fix browsers whose exec methods don't consistently return
- // undefined for non-participating capturing groups
- if (brokenExecUndef && match.length > 1) {
- // r2 doesn't need /g or /y, but they shouldn't hurt
- r2 = new RegExp("^" + this.source + "$(?!\\s)", this.getNativeFlags());
- real.replace.call(match[0], r2, function () {
- for (i = 1; i < arguments.length - 2; i++) {
- if (arguments[i] === undefined) match[i] = undefined;
- }
- });
- }
- // attach named capture properties
- if (this._x && this._x.captureNames) {
- for (i = 1; i < match.length; i++) {
- name = this._x.captureNames[i - 1];
- if (name) match[name] = match[i];
- }
- }
- // fix browsers that increment lastIndex after zero-length matches
- if (this.global && this.lastIndex > (match.index + match[0].length))
- this.lastIndex--;
- }
- return match;
-};
-
-/*** String.prototype.match
- run the altered ``exec`` when called with a non-global regex.
-*/
-String.prototype.match = function (regex) {
- if (!(regex instanceof RegExp))
- regex = new XRegExp(regex);
- if (regex.global)
- return real.match.call(this, regex);
- return regex.exec(this); // run the altered exec
-};
-
-/*** String.prototype.replace
- add named capture support to replacement strings using the syntax
- ``${name}``, and to replacement functions as ``arguments[0].name``.
-*/
-String.prototype.replace = function (search, replacement) {
- var captureNames = (search._x || {}).captureNames;
-
- // if search is not a regex which uses named capture, use the native replace method
- if (!(search instanceof RegExp && captureNames))
- return real.replace.apply(this, arguments);
-
- if (typeof replacement === "function") {
- return real.replace.call(this, search, function () {
- // change the arguments[0] string primitive to a String object which can store properties
- arguments[0] = new String(arguments[0]);
- // store named backreferences on arguments[0] before calling replacement
- for (var i = 0; i < captureNames.length; i++) {
- if (captureNames[i])
- arguments[0][captureNames[i]] = arguments[i + 1];
- }
- return replacement.apply(window, arguments);
- });
- } else {
- return real.replace.call(this, search, function () {
- var args = arguments;
- return real.replace.call(replacement, lib.replaceVar, function ($0, $1, $2) {
- // numbered backreference or special variable
- if ($1) {
- switch ($1) {
- case "$": return "$";
- case "&": return args[0];
- case "`": return args[args.length - 1].slice(0, args[args.length - 2]);
- case "'": return args[args.length - 1].slice(args[args.length - 2] + args[0].length);
- // numbered backreference
- default:
- /* what does "$10" mean?
- - backreference 10, if 10 or more capturing groups exist
- - backreference 1 followed by "0", if 1-9 capturing groups exist
- - otherwise, it's the string "$10"
- */
- var literalNumbers = "";
- $1 = +$1; // type-convert
- while ($1 > captureNames.length) {
- literalNumbers = real.split.call($1, "").pop() + literalNumbers;
- $1 = Math.floor($1 / 10); // drop the last digit
- }
- return ($1 ? args[$1] : "$") + literalNumbers;
- }
- // named backreference
- } else if ($2) {
- /* what does "${name}" mean?
- - backreference to named capture "name", if it exists
- - otherwise, it's the string "${name}"
- */
- var index = indexOf(captureNames, $2);
- return index > -1 ? args[index + 1] : $0;
- } else {
- return $0;
- }
- });
- });
- }
-};
-
-/*** String.prototype.split
- a consistent cross-browser, ECMA-262 v3 compliant split method
-*/
-String.prototype.split = function (s /* separator */, limit) {
- // if separator is not a regex, use the native split method
- if (!(s instanceof RegExp))
- return real.split.apply(this, arguments);
-
- var output = [],
- origLastIndex = s.lastIndex,
- lastLastIndex = 0,
- i = 0, match, lastLength;
-
- /* behavior for limit: if it's...
- - undefined: no limit
- - NaN or zero: return an empty array
- - a positive number: use limit after dropping any decimal
- - a negative number: no limit
- - other: type-convert, then use the above rules
- */
- if (limit === undefined || +limit < 0) {
- limit = false;
- } else {
- limit = Math.floor(+limit);
- if (!limit)
- return [];
- }
-
- if (s.global)
- s.lastIndex = 0;
- else
- s = s.addFlags("g");
-
- while ((!limit || i++ <= limit) && (match = s.exec(this))) { // run the altered exec!
- if (s.lastIndex > lastLastIndex) {
- output = output.concat(this.slice(lastLastIndex, match.index));
- if (1 < match.length && match.index < this.length)
- output = output.concat(match.slice(1));
- lastLength = match[0].length; // only needed if s.lastIndex === this.length
- lastLastIndex = s.lastIndex;
- }
- if (!match[0].length)
- s.lastIndex++; // avoid an infinite loop
- }
-
- // since this uses test(), output must be generated before restoring lastIndex
- output = lastLastIndex === this.length ?
- (s.test("") && !lastLength ? output : output.concat("")) :
- (limit ? output : output.concat(this.slice(lastLastIndex)));
- s.lastIndex = origLastIndex; // only needed if s.global, else we're working with a copy of the regex
- return output;
-};
-
-// intentionally undocumented
-RegExp.prototype.getNativeFlags = function () {
- return (this.global ? "g" : "") +
- (this.ignoreCase ? "i" : "") +
- (this.multiline ? "m" : "") +
- (this.extended ? "x" : "") +
- (this.sticky ? "y" : "");
-};
-
-/*** RegExp.prototype.addFlags
- accepts flags; returns a new XRegExp object generated by recompiling
- the regex with the additional flags (may include non-native flags).
- the original regex object is not altered.
-*/
-RegExp.prototype.addFlags = function (flags) {
- var regex = new XRegExp(this.source, (flags || "") + this.getNativeFlags());
- if (this._x) {
- regex._x = {
- source: this._x.source,
- captureNames: this._x.captureNames ? this._x.captureNames.slice(0) : null
- };
- }
- return regex;
-};
-
-/*** RegExp.prototype.call
- accepts a context object and string; returns the result of calling
- ``exec`` with the provided string. the context is ignored but is
- accepted for congruity with ``Function.prototype.call``.
-*/
-RegExp.prototype.call = function (context, str) {
- return this.exec(str);
-};
-
-/*** RegExp.prototype.apply
- accepts a context object and arguments array; returns the result of
- calling ``exec`` with the first value in the arguments array. the context
- is ignored but is accepted for congruity with ``Function.prototype.apply``.
-*/
-RegExp.prototype.apply = function (context, args) {
- return this.exec(args[0]);
-};
-
-/*** XRegExp.cache
- accepts a pattern and flags; returns an XRegExp object. if the pattern
- and flag combination has previously been cached, the cached copy is
- returned, otherwise the new object is cached.
-*/
-XRegExp.cache = function (pattern, flags) {
- var key = "/" + pattern + "/" + (flags || "");
- return XRegExp.cache[key] || (XRegExp.cache[key] = new XRegExp(pattern, flags));
-};
-
-/*** XRegExp.escape
- accepts a string; returns the string with regex metacharacters escaped.
- the returned string can safely be used within a regex to match a literal
- string. escaped characters are [, ], {, }, (, ), -, *, +, ?, ., \, ^, $,
- |, #, [comma], and whitespace.
-*/
-XRegExp.escape = function (str) {
- return str.replace(/[-[\]{}()*+?.\\^$|,#\s]/g, "\\$&");
-};
-
-/*** XRegExp.matchRecursive
- accepts a string to search, left and right delimiters as regex pattern
- strings, optional regex flags (may include non-native s, x, and y flags),
- and an options object which allows setting an escape character and changing
- the return format from an array of matches to a two-dimensional array of
- string parts with extended position data. returns an array of matches
- (optionally with extended data), allowing nested instances of left and right
- delimiters. use the g flag to return all matches, otherwise only the first
- is returned. if delimiters are unbalanced within the subject data, an error
- is thrown.
-
- this function admittedly pushes the boundaries of what can be accomplished
- sensibly without a "real" parser. however, by doing so it provides flexible
- and powerful recursive parsing capabilities with minimal code weight.
-
- warning: the ``escapeChar`` option is considered experimental and might be
- changed or removed in future versions of XRegExp.
-
- unsupported features:
- - backreferences within delimiter patterns when using ``escapeChar``.
- - although providing delimiters as regex objects adds the minor feature of
- independent delimiter flags, it introduces other limitations and is only
- intended to be done by the ``XRegExp`` constructor (which can't call
- itself while building a regex).
-*/
-XRegExp.matchRecursive = function (str, left, right, flags, options) {
- var options = options || {},
- escapeChar = options.escapeChar,
- vN = options.valueNames,
- flags = flags || "",
- global = flags.indexOf("g") > -1,
- ignoreCase = flags.indexOf("i") > -1,
- multiline = flags.indexOf("m") > -1,
- sticky = flags.indexOf("y") > -1,
- /* sticky mode has its own handling in this function, which means you
- can use flag "y" even in browsers which don't support it natively */
- flags = flags.replace(/y/g, ""),
- left = left instanceof RegExp ? (left.global ? left : left.addFlags("g")) : new XRegExp(left, "g" + flags),
- right = right instanceof RegExp ? (right.global ? right : right.addFlags("g")) : new XRegExp(right, "g" + flags),
- output = [],
- openTokens = 0,
- delimStart = 0,
- delimEnd = 0,
- lastOuterEnd = 0,
- outerStart, innerStart, leftMatch, rightMatch, escaped, esc;
-
- if (escapeChar) {
- if (escapeChar.length > 1) throw SyntaxError("can't supply more than one escape character");
- if (multiline) throw TypeError("can't supply escape character when using the multiline flag");
- escaped = XRegExp.escape(escapeChar);
- /* Escape pattern modifiers:
- /g - not needed here
- /i - included
- /m - **unsupported**, throws error
- /s - handled by XRegExp when delimiters are provided as strings
- /x - handled by XRegExp when delimiters are provided as strings
- /y - not needed here; supported by other handling in this function
- */
- esc = new RegExp(
- "^(?:" + escaped + "[\\S\\s]|(?:(?!" + left.source + "|" + right.source + ")[^" + escaped + "])+)+",
- ignoreCase ? "i" : ""
- );
- }
-
- while (true) {
- /* advance the starting search position to the end of the last delimiter match.
- a couple special cases are also covered:
- - if using an escape character, advance to the next delimiter's starting position,
- skipping any escaped characters
- - first time through, reset lastIndex in case delimiters were provided as regexes
- */
- left.lastIndex = right.lastIndex = delimEnd +
- (escapeChar ? (esc.exec(str.slice(delimEnd)) || [""])[0].length : 0);
-
- leftMatch = left.exec(str);
- rightMatch = right.exec(str);
-
- // only keep the result which matched earlier in the string
- if (leftMatch && rightMatch) {
- if (leftMatch.index <= rightMatch.index)
- rightMatch = null;
- else leftMatch = null;
- }
-
- /* paths*:
- leftMatch | rightMatch | openTokens | result
- 1 | 0 | 1 | ...
- 1 | 0 | 0 | ...
- 0 | 1 | 1 | ...
- 0 | 1 | 0 | throw
- 0 | 0 | 1 | throw
- 0 | 0 | 0 | break
- * - does not include the sticky mode special case
- - the loop ends after the first completed match if not in global mode
- */
-
- if (leftMatch || rightMatch) {
- delimStart = (leftMatch || rightMatch).index;
- delimEnd = (leftMatch ? left : right).lastIndex;
- } else if (!openTokens) {
- break;
- }
-
- if (sticky && !openTokens && delimStart > lastOuterEnd)
- break;
-
- if (leftMatch) {
- if (!openTokens++) {
- outerStart = delimStart;
- innerStart = delimEnd;
- }
- } else if (rightMatch && openTokens) {
- if (!--openTokens) {
- if (vN) {
- if (vN[0] && outerStart > lastOuterEnd)
- output.push([vN[0], str.slice(lastOuterEnd, outerStart), lastOuterEnd, outerStart]);
- if (vN[1]) output.push([vN[1], str.slice(outerStart, innerStart), outerStart, innerStart]);
- if (vN[2]) output.push([vN[2], str.slice(innerStart, delimStart), innerStart, delimStart]);
- if (vN[3]) output.push([vN[3], str.slice(delimStart, delimEnd), delimStart, delimEnd]);
- } else {
- output.push(str.slice(innerStart, delimStart));
- }
- lastOuterEnd = delimEnd;
- if (!global)
- break;
- }
- } else {
- // reset lastIndex in case delimiters were provided as regexes
- left.lastIndex = right.lastIndex = 0;
- throw Error("subject data contains unbalanced delimiters");
- }
-
- // if the delimiter matched an empty string, advance delimEnd to avoid an infinite loop
- if (delimStart === delimEnd)
- delimEnd++;
- }
-
- if (global && !sticky && vN && vN[0] && str.length > lastOuterEnd)
- output.push([vN[0], str.slice(lastOuterEnd), lastOuterEnd, str.length]);
-
- // reset lastIndex in case delimiters were provided as regexes
- left.lastIndex = right.lastIndex = 0;
-
- return output;
-};
-
diff --git a/utils/local.json.template b/utils/local.json.template
deleted file mode 100755
index 2b0d0ae..0000000
--- a/utils/local.json.template
+++ /dev/null
@@ -1 +0,0 @@
-{"packages": ["packages", ".."]}
diff --git a/utils/narwhal.conf.template b/utils/narwhal.conf.template
deleted file mode 100755
index 0d42bb9..0000000
--- a/utils/narwhal.conf.template
+++ /dev/null
@@ -1,9 +0,0 @@
-
-# Rhino
-NARWHAL_DEFAULT_PLATFORM="rhino"
-
-# k7
-#NARWHAL_DEFAULT_PLATFORM="k7"
-
-#NARWHAL_PLATFORM_HOME="."
-
diff --git a/utils/narwhal.gemspec b/utils/narwhal.gemspec
deleted file mode 100755
index 25ed8ba..0000000
--- a/utils/narwhal.gemspec
+++ /dev/null
@@ -1,105 +0,0 @@
-# -*- encoding: utf-8 -*-
-Gem::Specification.new do |s|
- s.name = %q{Narwhal}
- s.version = "0.0.1"
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
- s.authors = ["Tom Robinson", "Kris Kowal", "George Moschovitis", "Kevin Dangoor", "Hannes Wallnöfer"]
- s.date = %q{2009-05-30}
- s.description = %q{An implementation of the ServerJS standard library}
- s.email = %q{jack-js@googlegroups.com}
- s.homepage = %q{http://narwhaljs.org}
- s.executables = ["narwhal"]
- s.files = [
- "bin",
- "bin/js",
- "bin/narwhal",
- "bin/sea",
- "bin/tusk",
- "lib",
- "lib/args.js",
- "lib/codec",
- "lib/codec/base64.js",
- "lib/file.js",
- "lib/hash.js",
- "lib/hashp.js",
- "lib/http.js",
- "lib/io.js",
- "lib/json.js",
- "lib/logger.js",
- "lib/mime.js",
- "lib/narwhal",
- "lib/narwhal/repl.js",
- "lib/narwhal/tusk-init.js",
- "lib/narwhal/tusk.js",
- "lib/narwhal.js",
- "lib/packages.js",
- "lib/ref_send.js",
- "lib/regexp.js",
- "lib/sandbox.js",
- "lib/string.js",
- "lib/test",
- "lib/test/assert.js",
- "lib/test/equiv.js",
- "lib/test/jsdump.js",
- "lib/test/runner.js",
- "lib/unload.js",
- "lib/uri.js",
- "lib/util.js",
- "lib/xregexp.js",
- "platforms",
- "platforms/browser",
- "platforms/browser/lib",
- "platforms/browser/lib/reactor.js",
- "platforms/default",
- "platforms/default/lib",
- "platforms/default/lib/array.js",
- "platforms/default/lib/file-platform.js",
- "platforms/default/lib/function.js",
- "platforms/default/lib/global.js",
- "platforms/default/lib/io-platform.js",
- "platforms/default/lib/object.js",
- "platforms/default/lib/reactor.js",
- "platforms/default/lib/system.js",
- "platforms/k7",
- "platforms/k7/bin",
- "platforms/k7/bin/narwhal-k7",
- "platforms/k7/bootstrap.js",
- "platforms/k7/lib",
- "platforms/k7/lib/file-platform.js",
- "platforms/k7/lib/system.js",
- "platforms/rhino",
- "platforms/rhino/bin",
- "platforms/rhino/bin/narwhal-rhino",
- "platforms/rhino/bootstrap.js",
- "platforms/rhino/jars",
- "platforms/rhino/jars/jline.jar",
- "platforms/rhino/jars/js.jar",
- "platforms/rhino/lib",
- "platforms/rhino/lib/binary.js",
- "platforms/rhino/lib/file-platform.js",
- "platforms/rhino/lib/http-platform.js",
- "platforms/rhino/lib/io-platform.js",
- "platforms/rhino/lib/os.js",
- "platforms/rhino/lib/packages-platform.js",
- "platforms/rhino/lib/process.js",
- "platforms/rhino/lib/sandbox-platform.js",
- "platforms/rhino/lib/system.js",
- "platforms/rhino/lib/zip.js",
- "platforms/secure",
- "platforms/secure/lib",
- "platforms/secure/lib/file.js",
- "platforms/secure/lib/system.js",
- "platforms/template",
- "platforms/template/bin",
- "platforms/template/bin/narwhal-platform-name",
- "platforms/template/bootstrap.js",
- "platforms/template/lib",
- "platforms/template/lib/file-platform.js",
- "platforms/template/lib/system.js",
- "platforms/v8cgi",
- "platforms/v8cgi/bootstrap.js"
- ]
- s.require_paths = ["lib"]
- s.rubygems_version = %q{1.3.3}
- s.summary = %q{Implementation of the ServerJS standard library}
-end
diff --git a/utils/narwhal.js b/utils/narwhal.js
deleted file mode 100755
index 4967afb..0000000
--- a/utils/narwhal.js
+++ /dev/null
@@ -1,208 +0,0 @@
-(function (system) {
-
-// global reference
-global = system.global;
-global.global = global;
-global.system = system;
-global.print = system.print;
-
-// logger shim
-var logFake = function () {
- if (system.debug) {
- system.print(Array.prototype.join.apply(arguments, [" "]));
- }
-};
-var log = {fatal:logFake, error:logFake, warn:logFake, info:logFake, debug:logFake};
-system.log = log;
-
-// this only works for modules with no dependencies and a known absolute path
-var requireFake = function(id, path, modules) {
- modules = modules || {};
- var exports = {};
- var module = {id: id, path: path};
-
- var factory = system.evaluate(system.fs.read(path), path, 1);
- factory(
- function(id) { return modules[id]; }, // require
- exports, // exports
- module, // module
- system, // system
- system.print // print
- );
-
- return exports;
-}
-
-// bootstrap sandbox module
-var sandbox = requireFake("sandbox", system.prefix + "/lib/sandbox.js");
-
-// bootstrap file module
-var fs = {};
-requireFake("sandbox", system.prefix + "/lib/file-bootstrap.js", { "file" : fs });
-for (var name in system.fs) {
- if (Object.prototype.hasOwnProperty.call(system.fs, name)) {
- fs[name] = system.fs[name];
- }
-}
-system.fs = fs;
-
-// construct the initial paths
-var paths = [];
-for (var i = 0; i < system.platforms.length; i++) {
- var platform = system.platforms[i];
- paths.push(system.prefix + '/platforms/' + platform + '/lib');
-}
-paths.push(system.prefix + '/lib');
-
-// create the primary Loader and Sandbox:
-var loader = sandbox.MultiLoader({
- paths: paths,
- debug: system.verbose
-});
-if (system.loaders) {
- loader.loaders.unshift.apply(loader.loaders, system.loaders);
- delete system.loaders;
-}
-var modules = {system: system, sandbox: sandbox};
-global.require = sandbox.Sandbox({
- loader: loader,
- modules: modules,
- debug: system.verbose
-});
-
-// patch the primordials (or: save the whales)
-// to bring them up to at least the neighborhood of ES5 compliance.
-try {
- require("global");
-} catch (e) {
- system.log.error("Couldn't load global/primordial patches ("+e+")");
-}
-
-// load the complete system module
-global.require.force("system");
-
-// augment the path search array with those provided in
-// environment variables
-paths.push([
- system.env.JS_PATH || '',
- system.env.NARWHAL_PATH || ''
-].join(':').split(':').filter(function (path) {
- return !!path;
-}));
-
-// parse command line options
-var parser = require("narwhal").parser;
-var options = parser.parse(system.args);
-system.packagePrefixes = system.packagePrefixes ||
- [system.prefix];
-if (options.debug !== undefined)
- system.debug = options.debug;
-var wasVerbose = system.verbose;
-if (options.verbose !== undefined) {
- system.verbose = options.verbose;
- require.verbose = system.verbose;
-}
-
-// enable loader tracing
-global.require.debug = options.verbose;
-// in verbose mode, list all the modules that are
-// already loaded
-if (!wasVerbose && system.verbose) {
- Object.keys(modules).forEach(function (name) {
- print('@ ' + name);
- });
-}
-
-// find the program module and its prefix
-var program;
-if (system.args.length && !options.interactive && !options.main) {
- if (!program)
- program = system.fs.path(system.args[0]).canonical();
-
- // add package prefixes for all of the packages
- // containing the program, from specific to general
- var parts = system.fs.split(program);
- for (var i = 0; i < parts.length; i++) {
- var path = system.fs.join.apply(null, parts.slice(0, i));
- var packageJson = system.fs.join(path, 'package.json');
- if (system.fs.isFile(packageJson))
- system.packagePrefixes.unshift(path);
- }
-
- if (program.isDirectory()) {
- if (!program.join('package.json').isFile())
- throw new Error("Program directory does not contain a package.json");
- system.packagePrefixes.unshift(program);
- }
-}
-
-// user package prefixes
-if (system.env.PACKAGE_HOME)
- system.packagePrefixes.unshift(system.env.PACKAGE_HOME);
-system.packagePrefixes.unshift.apply(system.packagePrefixes, options.packagePrefixes);
-
-// load packages
-var packages;
-if (!options.noPackages) {
- try {
- packages = require("packages");
- packages.main();
- } catch (e) {
- system.log.error("Warning: Couldn't load packages. Packages won't be available. ("+e+")");
- }
-} else {
- packages = {
- catalog: {},
- packageOrder: []
- }
-}
-
-// run command options
-// -I, --include lib
-// -r, --require module
-// -e, -c , --command command
-// -:, --path delimiter
-options.todo.forEach(function (item) {
- var action = item[0];
- var value = item[1];
- if (action == "include") {
- require.paths.unshift(value);
- } else if (action == "require") {
- require(value);
- } else if (action == "eval") {
- system.evalGlobal(value);
- } else if (action == "path") {
- var paths = packages.packageOrder.map(function (pkg) {
- return pkg.directory.join('bin');
- }).filter(function (path) {
- return path.isDirectory();
- });
- var oldPaths = system.env.PATH.split(value);
- while (oldPaths.length) {
- var path = oldPaths.shift();
- if (paths.indexOf(path) < 0)
- paths.push(path);
- }
- print(paths.join(value));
- }
-});
-
-// load the program module
-if (options.interactive) {
- require('narwhal/repl');
-} else if (options.main) {
- require.main(options.main);
-} else if (program) {
- if (program.isDirectory()) {
- require.main(packages.root.directory.resolve(packages.root.main || 'main').toString());
- } else {
- require.main(program.toString());
- }
-}
-
-// send an unload event if that module has been required
-if (require.loader.isLoaded('unload')) {
- require('unload').send();
-}
-
-})
diff --git a/utils/package.json b/utils/package.json
deleted file mode 100755
index ea4c58c..0000000
--- a/utils/package.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "name": "narwhal",
- "author": "Tom Robinson",
- "contributors": [
- "Kris Kowal",
- "George Mosochovitis",
- "Kevin Dangoor",
- "Hannes Wallnöfer"
- ],
- "main": "examples/narwhal",
- "lib": ["lib"]
-}
diff --git a/utils/platforms/browser/inline.js b/utils/platforms/browser/inline.js
deleted file mode 100755
index 16d8b11..0000000
--- a/utils/platforms/browser/inline.js
+++ /dev/null
@@ -1,56 +0,0 @@
-(function (ids, id, path) {
-
- var factories = {};
- var pending;
-
- var require = this.require = function (id, baseId) {
- // defer to require set later from the sandbox module
- require(id, baseId);
- };
-
- require.register = function (id, factory) {
- factories[id] = factory;
- if (!--pending)
- main();
- };
-
- var pending = ids.length;
- var head = document.getElementsByTagName('head')[0];
- for (var i = 0; i < pending; i++) {
- var script = document.createElement('script');
- script.src = path + ids[i] + '.js';
- head.appendChild(script);
- };
-
- function main() {
-
- var system = {};
- system.print = function () {
- if (typeof console != "undefined") {
- console.log(Array.prototype.join.call(arguments, ' '));
- }
- };
-
- var loader = {};
- loader.reload = function (topId) {
- return factories[topId];
- };
- loader.load = function (topId) {
- return loader.reload(topId);
- };
-
- var sandbox = {};
- loader.load('sandbox')(
- null,
- sandbox,
- {},
- system,
- system.print
- );
- require = sandbox.Sandbox({loader: loader});
- loader.resolve = sandbox.resolve;
- require(id);
-
- }
-
-})
diff --git a/utils/platforms/browser/lib/binary.js b/utils/platforms/browser/lib/binary.js
deleted file mode 100755
index 23b5104..0000000
--- a/utils/platforms/browser/lib/binary.js
+++ /dev/null
@@ -1,2 +0,0 @@
-exports.ByteString = String;
-exports.ByteArray = Array;
diff --git a/utils/platforms/browser/lib/modules.js b/utils/platforms/browser/lib/modules.js
deleted file mode 100755
index db89b93..0000000
--- a/utils/platforms/browser/lib/modules.js
+++ /dev/null
@@ -1,1449 +0,0 @@
-/*preamble-kriskowal
- Copyright (c) 2002-2009 Kris Kowal <http://cixar.com/~kris.kowal>
- MIT License
-*/
-
-/*
- isolate the module loader in an enclosure by creating an
- annonymous function and then--at the end of this file--
- calling it.
-
- also, take the evalGlobal function as an argument so that it can be
- declared in global scope. this prevents the eval function
- from inheriting variables from the modulesjs enclosure scope.
-*/
-(function (evalGlobal) {
-
- /*
- kernel module factory functions. this module bootstrapper script
- can also be used as a module, since it contains module
- factory functions that can be used to bootstrap platform-specific
- modules. to that end, we export the module factory functions if
- there is an ambient "exports" object
- */
- var factories = typeof exports == "undefined" ? {} : exports;
- /* kernel module instances */
- var modules = {};
-
- /*
- a rudimentary require function to jumpstart
- the module system
- */
- var require = function (id) {
- if (!Object.prototype.hasOwnProperty.call(modules, id)) {
- var exports = {};
- modules[id] = exports;
- factories[id](require, exports, system);
- }
- return modules[id];
- };
-
- /* a permissive system for kernel modules */
- var system = {
- window: window,
- evalGlobal: evalGlobal
- };
-
- factories.main = function (require, exports, system) {
-
- var FILE = 'modules'; /* used to find the corresponding <script> */
-
- var urls = require('urls');
- var browser = require('browser');
- var console = require('console');
-
- var window = system.window;
- var document = window.document;
- system.print = console.print;
- system.messages = console.messages;
-
- /* grab the URL of modules.js relative to the containing page,
- and remove the <script> tag that invoked this module loader
- from the DOM for maximum stealth.
- */
- var PATH = urls.resolve(function () { /* enclosure */
- var scripts = document.getElementsByTagName("script");
- for (var i = 0; i < scripts.length; i++) {
- var script = scripts[i];
- if (browser.hasAttr(script, "src")) {
- var src = script.getAttribute("src");
- src = urls.parse(src);
- if (src.file == FILE) {
- script.parentNode.removeChild(script);
- return urls.resolve(src, window.location.href);
- }
- }
- }
- throw new Error("could not find '" + FILE + "' <script>");
- }());
-
- /* wait for the DOM to be fully loaded */
- browser.observeDomReady(function () {
-
- var sandbox = require('sandbox');
- sandbox.execUrl(PATH, PATH, system);
-
- /* note for CSS that JavaScript is enabled, and ready */
- document.body.className = document.body.className + ' javascript';
-
- });
-
- };
-
- factories.sandbox = function (require, exports, system) {
-
- var http = require('http');
- var urls = require('urls');
- var evalGlobal = system.evalGlobal;
-
- exports.Loader = function (options) {
- options = options || {};
- var factories = options.factories || {};
- var path = options.path;
- var exportsLocal = options.exportsLocal;
- var importsLocal = options.importsLocal;
-
- var loader = {};
-
- loader.fetch = function (id) {
- var url = urls.resolve(id, path) + '.js';
- return http.requestContent(url);
- };
-
- loader.evaluate = function (text, id) {
- var iojs = /"use iojs";/.test(text);
- /* optionally bring imports into scope with include */
- if (importsLocal && !iojs)
- text = "with (imports||{}) {" + text + "}";
- /* optional bring exports into scope when assigned to exports */
- if (exportsLocal && !iojs)
- text = "with (exports) {" + text + "}";
- /* safeguard "var" declarations from being
- * applied to the "with" object in ES3-non-conformant browsers
- * (really only Safari < 3) */
- if ((importsLocal || exportsLocal) && !iojs)
- text = "(function () {" + text + "}).apply(this, arguments)";
- if (iojs)
- text = "include = undefined; " + text;
- text = (
- "(function (require, exports, module, system, print, include, imports) {" +
- text +
- "})"
- );
- /* annotate with the module id */
- if (id)
- text = '/* ' + id + ' */ ' + text;
- return evalGlobal(text);
- };
-
- loader.resolve = function (id, baseId) {
- if (typeof id != "string")
- throw new Error("module id '" + id + "' is not a String");
- if (!baseId) {
- baseId = path;
- }
- if (id.charAt(0) != ".") {
- baseId = path;
- }
- return urls.resolve(id, baseId);
- };
-
- loader.load = function (id) {
- if (!Object.prototype.hasOwnProperty.call(factories, id)) {
- factories[id] = loader.evaluate(loader.fetch(id), id);
- }
- return factories[id];
- };
-
- loader.getPath = function () {
- return path;
- };
-
- return loader;
- };
-
- exports.Sandbox = function (options) {
- options = options || {};
- var loader = options.loader || exports.Loader(options);
- var sandboxSystem = options.system || system;
- var modules = options.modules || {};
- var debug = options.debug === true;
- var main;
-
- var debugDepth = 0;
-
- var sandbox = function (id, baseId) {
-
- id = loader.resolve(id, baseId);
-
- /* populate memo with module instance */
- if (!Object.prototype.hasOwnProperty.call(modules, id)) {
-
-
- if (debug) {
- debugDepth++;
- var debugAcc = "";
- for (var i = 0; i < debugDepth; i++) debugAcc += "+";
- system.print(debugAcc + " " + id, 'module');
- }
-
- var exports = modules[id] = new Module();
- var factory = loader.load(id);
- var require = Require(id);
- var module = {id: id};
- var imports = {};
- var include = Include(require, imports);
- try {
- factory.call(
- exports,
- require,
- exports,
- module,
- sandboxSystem,
- sandboxSystem.print,
- include,
- imports
- );
- } catch (exception) {
- delete modules[id];
- throw exception;
- }
-
- if (debug) {
- var debugAcc = "";
- for (var i = 0; i < debugDepth; i++) debugAcc += "-";
- system.print(debugAcc + " " + id, 'module');
- debugDepth--;
- }
-
-
- }
-
- /* snapshot exports with requested bound methods */
- var exports = modules[id];
- var imports = new Module();
- var importsUsed = false;
- for (var name in exports) {
- if (
- exports[name] !== undefined &&
- exports[name] !== null &&
- exports[name].xChironCurryId
- ) {
- importsUsed = true;
- imports[name] = (function (callback) {
- var curried = function () {
- return callback.apply(
- this,
- [baseId].concat(Array.prototype.slice.call(arguments, 0))
- );
- };
- curried.xChironCurryId = callback;
- return curried;
- })(exports[name].xChironCurryId);
- } else {
- imports[name] = exports[name];
- }
- }
-
- if (!importsUsed)
- imports = exports;
-
- return imports;
- };
-
- var Require = function (baseId) {
- var require = function (id) {
- try {
- return sandbox(id, baseId);
- } catch (exception) {
- if (exception && !exception.message)
- exception.message = 'Error';
- try {
- try {
- eval("throw new Error()");
- } catch (deliberate) {
- if (deliberate.lineNumber !== undefined)
- exception.message += ' at ' + (exception.lineNumber - deliberate.lineNumber + 1);
- }
- exception.message += ' in ' + baseId;
- } catch (ignore) {
- }
- throw exception;
- }
- };
-
- require.loader = loader;
-
- /* extensions */
- require.xChironModule = Module;
- require.xChironId = baseId;
- require.main = main;
- require.xChironCurryId = function (callback) {
- var curried = function () {
- return callback.apply(
- this,
- [baseId].concat(Array.prototype.slice.call(arguments))
- );
- };
- curried.curryId = callback;
- return curried;
- };
- require.xChironIsLoaded = function (id) {
- return Object.prototype.hasOwnProperty.call(modules, urls.resolve(id, baseId));
- };
- return require;
- };
-
- var Include = function (require, imports) {
- return function (id) {
- var exports = require(id);
- for (var name in exports) {
- imports[name] = exports[name];
- };
- return exports;
- };
- };
-
- sandbox.main = function (id, baseId) {
- main = loader.resolve(id, baseId);
- return sandbox(main);
- };
-
- /* just for use as a base prototype */
- var Module = function () {};
-
- return sandbox;
- };
-
- /* execUrl is a utility method of this ipmlementation, not necessary
- * for the interoperable modules specification. */
- exports.execUrl = function (url, PATH, sandboxSystem) {
-
- /* populate a list of initial ids from the query string of the PATH */
- var mainIds = [];
- var url = urls.parse(url);
- if (url.query != "") {
- mainIds = url.query.split("&");
- if (/^path=(.*)/.test(mainIds[0])) {
- PATH = urls.resolve(/^path=(.*)/.exec(mainIds[0])[1], system.window.location.href);
- mainIds.shift();
- }
- }
-
- /* load main modules */
- sandboxSystem.moduleFactories = system.moduleFactories || {};
- var sandbox = exports.Sandbox({
- path: PATH,
- importsLocal: true,
- exportsLocal: true,
- system: sandboxSystem//,
- //factories: sandboxSystem.moduleFactories
- });
- for (var i = 0; i < mainIds.length; i++) {
- try {
- sandbox.main(mainIds[i], system.window.location.href);
- } catch (exception) {
- sandboxSystem.print('' + exception, 'error');
- throw exception;
- }
- }
-
- /* notify the user that all main modules have finished loading */
- sandboxSystem.print('ready', 'info');
-
- };
-
- };
-
- factories.environment = function (require, exports, system) {
-
- if (system.window) {
- var window = system.window;
- var navigator = window.navigator;
-
- exports.isIE = navigator.appVersion.indexOf("MSIE") >= 0;
- exports.isSafari = navigator.appVersion.indexOf("Safari") >= 0;
- exports.isOpera = !!window.opera;
- }
-
- };
-
- factories.console = function (require, exports, system) {
-
- var window = system.window;
- var console = system.console || window.console;
-
- /*** exports
- */
- exports.messages = [];
-
- /*** print
-
- accepts:
- - a ``message`` and
- - an optional ``label``.
-
- The label, by convention, is one of `"log"``, ``"info"``,
- ``"warn"``, or ``"error"``. Custom loggers treat labels like
- ``"module"``, ``"pass"``, or ``"fail"``. Attempts to write
- the message to `window.console`, progressively handling
- `console` implementations that provide a function for the
- given ``label``, or defaulting to `log` depending on
- availability.
-
- Also adds a ``[message, label]`` array to the end
- of `messages`. ``label`` is one of ``"log"``,
- ``"warn"``, ``"info"``, or ``"error"`` by convention.
- In Safari, `log` writes to the Javascript debug console, which
- is only available if you set the preference::
-
- defaults write com.apple.Safari IncludeDebugMenu 1
-
- Or in Safari 3::
-
- defaults write com.apple.Safari IncludeDevelopMenu 1
-
- And in Safari 4, the preference has been exposed
- in the Advanced tab; check "Show Develop Menu".
-
- In Firefox, you can get a debug console with Firebug,
- http://getfirebug.com.
-
- You can override the behavior of `log` by assigning
- a different function to ``require('environment').log``
- in any module.
-
- Chiron can create a debug console for the purpose of
- unit testing or page debugging. To debug a web page,
- use `modules.js` to include `debug.js` on a page.
- To run a unit test, view `run.html`, `lite.html`,
- or `edit.html` with the `moduleId` of the unit test
- as a query string.
-
- */
- exports.print = function (message, label) {
-
- label = label || 'log';
-
- /*
- buffer messages so that console overrides
- can retrieve and display them later.
- */
- exports.messages.push([message, label]);
-
- /*
- attempt to send the message to window.console if it
- exists, progressively handling the availability
- of a logging function crafted especially for the
- requested label, or defaulting to 'log'.
- */
-
- if (console) {
- if (console.print) {
- console.print(message, label);
- } else if (console[label]) {
- console[label](message);
- } else if (console.log) {
- console.log(message);
- }
- }
-
- };
-
- };
-
- factories.browser = function (require, exports, system) {
-
- var environment = require('environment');
- var window = system.window;
- var document = window.document;
- var top = window.top;
-
- exports.hasAttr = function (element, key) {
- if (element.hasAttribute) {
- exports.hasAttr = function (element, key) {
- return element.hasAttribute(key);
- };
- return exports.hasAttr(element, key);
- } else {
- exports.hasAttr = function (element, key) {
- var node = element.getAttributeNode(key);
- return node && node.specified;
- };
- return exports.hasAttr(element, key);
- }
- };
-
- var isDomReady = false;
- exports.observeDomReady = function (callback) {
-
- /* call immediately if we've already noted a DOM
- * ready event */
- if (isDomReady)
- return callback();
-
- /* arrange to call back exactly once, even if multiple
- * methods of detecting dom completion call "ready" */
- var hasCalledBack = false;
- var ready = function () {
- if (hasCalledBack)
- return;
- hasCalledBack = true;
- isDomReady = true;
- callback();
- };
-
- /*
- wait for the DOM and CSS to be ready, but don't wait
- for images unless they're absolutely necessary.
-
- ported from jQuery's event.js, with previous implementations
- taking from similar sources, including Dean Edwards
- and PPK.
- */
-
- /*
- Opera uses DOMContentLoaded but has special code for
- pending style sheets.
- */
- if (environment.isOpera)
- document.addEventListener("DOMContentLoaded", function () {
- if (isDomReady) return;
- for (var i = 0; i < document.styleSheets.length; i++)
- if (document.styleSheets[i].disabled) {
- window.setTimeout(arguments.callee, 0);
- return;
- }
- // and execute any waiting functions
- ready();
- }, false);
-
- /* Mozilla and WebKit nightlies currently support this event */
- if (document.addEventListener)
- /* Use the handy event callback */
- document.addEventListener("DOMContentLoaded", ready, false);
-
- /*
- If IE is used and is not in a frame,
- continually check to see whether the document is ready.
- */
- if (environment.isIE && window == top) (function () {
- if (isDomReady) return;
- try {
- /*
- If IE is used, use the trick by Diego Perini
- http://javascript.nwbox.com/IEContentLoaded/
- */
- document.documentElement.doScroll("left");
- } catch (error) {
- /*
- using setTimeout with a 0 milisecond dellay
- is effectively the equivalent of a "yield"
- in a cooperative multi-task language.
- This permits the browser to breathe before
- we check whether we're ready again.
- */
- window.setTimeout(arguments.callee, 0);
- return;
- }
- ready();
- })();
-
- if (environment.isSafari) {
- (function () {
- if (isDomReady) return;
- if (
- document.readyState != "loaded" &&
- document.readyState != "complete"
- ) {
- window.setTimeout(arguments.callee, 0);
- return;
- }
- var numStyles = document.getElementsByTagName('style').length;
- var links = document.getElementsByTagName('link');
- for (var i = 0; i < links.length; i++) {
- var link = links[i];
- numStyles += (
- link.hasAttribute('rel') &&
- link.getAttribute('rel').toLowerCase() ==
- 'stylesheet'
- );
- }
- if (document.styleSheets.length != numStyles) {
- window.setTimeout(arguments.callee, 0);
- return;
- }
- ready();
- })();
- }
-
- /*
- for other browsers, give up on the time saving
- techniques and wait for all the images to load.
- also, do this in other browsers just in case they missed
- the boat.
- */
- if (window.onload) {
- /* if there's already an onload listener, call ready after it,
- preserving first-come-first-serve event observation */
- window.onload = (function (onload) {
- return function () {
- onload.call(this);
- ready();
- };
- })(window.onload);
- } else {
- window.onload = ready;
- }
-
- };
-
- };
-
- factories.urls = function (require, exports, system) {
-
- /**** keys
- members of a parsed URI object.
- */
- exports.keys = [
- "url",
- "protocol",
- "authorityRoot",
- "authority",
- "userInfo",
- "user",
- "password",
- "domain",
- "domains",
- "port",
- "path",
- "root",
- "directory",
- "directories",
- "file",
- "query",
- "anchor"
- ];
-
- /**** expressionKeys
- members of a parsed URI object that you get
- from evaluting the strict regular expression.
- */
- exports.expressionKeys = [
- "url",
- "protocol",
- "authorityRoot",
- "authority",
- "userInfo",
- "user",
- "password",
- "domain",
- "port",
- "path",
- "root",
- "directory",
- "file",
- "query",
- "anchor"
- ];
-
- /**** strictExpression
- */
- exports.strictExpression = new RegExp( /* url */
- "^" +
- "(?:" +
- "([^:/?#]+):" + /* protocol */
- ")?" +
- "(?:" +
- "(//)" + /* authorityRoot */
- "(" + /* authority */
- "(?:" +
- "(" + /* userInfo */
- "([^:@]*)" + /* user */
- ":?" +
- "([^:@]*)" + /* password */
- ")?" +
- "@" +
- ")?" +
- "([^:/?#]*)" + /* domain */
- "(?::(\\d*))?" + /* port */
- ")" +
- ")?" +
- "(" + /* path */
- "(/?)" + /* root */
- "((?:[^?#/]*/)*)" +
- "([^?#]*)" + /* file */
- ")" +
- "(?:\\?([^#]*))?" + /* query */
- "(?:#(.*))?" /*anchor */
- );
-
- /**** Parser
- returns a URI parser function given
- a regular expression that renders
- `expressionKeys` and returns an `Object`
- mapping all `keys` to values.
- */
- exports.Parser = function (expression) {
- return function (url) {
- if (typeof url == "undefined")
- throw new Error("HttpError: URL is undefined");
- if (typeof url != "string") return new Object(url);
-
- var items = {};
- var parts = expression.exec(url);
-
- for (var i = 0; i < parts.length; i++) {
- items[exports.expressionKeys[i]] = parts[i] ? parts[i] : "";
- }
-
- items.root = (items.root || items.authorityRoot) ? '/' : '';
-
- items.directories = items.directory.split("/");
- if (items.directories[items.directories.length - 1] == "") {
- items.directories.pop();
- }
-
- /* normalize */
- var directories = [];
- for (var i = 0; i < items.directories.length; i++) {
- var directory = items.directories[i];
- if (directory == '.') {
- } else if (directory == '..') {
- if (directories.length && directories[directories.length - 1] != '..')
- directories.pop();
- else
- directories.push('..');
- } else {
- directories.push(directory);
- }
- }
- items.directories = directories;
-
- items.domains = items.domain.split(".");
-
- return items;
- };
- };
-
- /**** parse
- a strict URI parser.
- */
- exports.parse = exports.Parser(exports.strictExpression);
-
- /**** format
- accepts a parsed URI object and returns
- the corresponding string.
- */
- exports.format = function (object) {
- if (typeof(object) == 'undefined')
- throw new Error("UrlError: URL undefined for urls#format");
- if (object instanceof String || typeof(object) == 'string')
- return object;
- var domain =
- object.domains ?
- object.domains.join(".") :
- object.domain;
- var userInfo = (
- object.user ||
- object.password
- ) ?
- (
- (object.user || "") +
- (object.password ? ":" + object.password : "")
- ) :
- object.userInfo;
- var authority = (
- userInfo ||
- domain ||
- object.port
- ) ? (
- (userInfo ? userInfo + "@" : "") +
- (domain || "") +
- (object.port ? ":" + object.port : "")
- ) :
- object.authority;
- var directory =
- object.directories ?
- object.directories.join("/") :
- object.directory;
- var path =
- directory || object.file ?
- (
- (directory ? directory + "/" : "") +
- (object.file || "")
- ) :
- object.path;
- return (
- (object.protocol ? object.protocol + ":" : "") +
- (authority ? "//" + authority : "") +
- (object.root || (authority && path) ? "/" : "") +
- (path ? path : "") +
- (object.query ? "?" + object.query : "") +
- (object.anchor ? "#" + object.anchor : "")
- ) || object.url || "";
- };
-
- /**** resolveObject
- returns an object representing a URL resolved from
- a relative location and a base location.
- */
- exports.resolveObject = function (relative, base) {
- if (!base)
- return relative;
-
- base = exports.parse(base);
- relative = exports.parse(relative);
-
- if (relative.url == "")
- return base;
-
- delete base.url;
- delete base.authority;
- delete base.domain;
- delete base.userInfo;
- delete base.path;
- delete base.directory;
-
- if (
- relative.protocol && relative.protocol != base.protocol ||
- relative.authority && relative.authority != base.authority
- ) {
- base = relative;
- } else {
- if (relative.root) {
- base.directories = relative.directories;
- } else {
-
- var directories = relative.directories;
- for (var i = 0; i < directories.length; i++) {
- var directory = directories[i];
- if (directory == ".") {
- } else if (directory == "..") {
- if (base.directories.length) {
- base.directories.pop();
- } else {
- base.directories.push('..');
- }
- } else {
- base.directories.push(directory);
- }
- }
-
- if (relative.file == ".") {
- relative.file = "";
- } else if (relative.file == "..") {
- base.directories.pop();
- relative.file = "";
- }
- }
- }
-
- if (relative.root)
- base.root = relative.root;
- if (relative.protcol)
- base.protocol = relative.protocol;
- if (!(!relative.path && relative.anchor))
- base.file = relative.file;
- base.query = relative.query;
- base.anchor = relative.anchor;
-
- return base;
- };
-
- /**** relativeObject
- returns an object representing a relative URL to
- a given target URL from a source URL.
- */
- exports.relativeObject = function (target, base) {
- target = exports.parse(target);
- base = exports.parse(base);
-
- delete target.url;
-
- if (
- target.protocol == base.protocol &&
- target.authority == base.authority
- ) {
- delete target.protocol;
- delete target.authority;
- delete target.userInfo;
- delete target.user;
- delete target.password;
- delete target.domain;
- delete target.domains;
- delete target.port;
- if (
- !!target.root == !!base.root && !(
- target.root &&
- target.directories[0] != base.directories[0]
- )
- ) {
- delete target.path;
- delete target.root;
- delete target.directory;
- while (
- base.directories.length &&
- target.directories.length &&
- target.directories[0] == base.directories[0]
- ) {
- target.directories.shift();
- base.directories.shift();
- }
- while (base.directories.length) {
- base.directories.shift();
- target.directories.unshift('..');
- }
-
- if (!target.root && !target.directories.length && !target.file && base.file)
- target.directories.push('.');
-
- if (base.file == target.file)
- delete target.file;
- if (base.query == target.query)
- delete target.query;
- if (base.anchor == target.anchor)
- delete target.anchor;
- }
- }
-
- return target;
- };
-
- /**** resolve
- returns a URL resovled to a relative URL from a base URL.
- */
- exports.resolve = function (relative, base) {
- return exports.format(exports.resolveObject(relative, base));
- };
-
- /**** relative
- returns a relative URL to a target from a source.
- */
- exports.relative = function (target, base) {
- return exports.format(exports.relativeObject(target, base));
- };
-
- };
-
- factories.http = function (require, exports, system) {
-
- var urls = require('urls');
- var environment = require('environment');
- var window = system.window;
-
- /**** requestContent
- returns the text at a given URL using an HTTP
- request.
- supports continuation passing form for asynchronous
- requests.
- */
- exports.requestContent = function (url, observer) {
- if (observer !== undefined) {
- return exports.request(url, function (response) {
- if (response.isOk())
- observer(response.getContent());
- });
- } else {
- var response = exports.request(url);
- if (response.isError())
- throw new Error("HttpError: " + url + " status " + response.getStatus());
- return response.getContent();
- }
- };
-
- /**** request
- sends an HTTP request to a given URL and returns
- the response.
- supports continuation passing form for asynchronous
- requests.
- */
- exports.request = function (url, observer) {
- var request = exports.Request();
- var response = request.getResponse();
-
- url = urls.resolve(url, system.window.location.href);
-
- if (observer)
- request.observe("ok", observer);
-
- request.open("GET", url, !!observer);
-
- try {
- request.send();
- } catch (exception) {
- request.abort();
- throw new Error('HttpError: "' + url + '": ' + exception);
- }
-
- if (observer !== undefined) {
- return request;
- } else {
- return response;
- }
-
- };
-
- /*todo
- Look deeper into dojo/src/hostenv_browser.js for
- _blockAsync lock to prevent eternal hanging in KHTML
- */
-
- /**** Request
- returns a wrapped HTTP Request object.
- */
- exports.Request = function () {
- /* this line permits the user to create a request with
- * either new Request() or Request(). internally,
- * we just use the Request() so that Request can be
- * overloaded later in HTTP to be a type constructor
- * function instead of a prototype constructor */
- if (this == exports) return new exports.Request();
-
- var self = this;
- var method, url, asynchronous, user, password;
- var realRequest = exports.NativeRequest();
- var response = exports.Response(realRequest);
- var isOpen;
- var readyStateChanged;
- var timeout;
- var timeoutHandle;
- var aborted;
-
- var readyObservers = [];
- var okObservers = [];
- var errorObservers = [];
- var warnObservers = [];
- var timeoutObservers = [];
-
- /***** toString
- */
- self.toString = function () {return "[object HttpRequest]"};
-
- /***** getResponse
- */
- self.getResponse = function () {
- return response;
- };
-
- var signal = function (response, observers) {
- while (observers.length) {
- var observer = observers.shift();
- observer(response);
- }
- };
-
- /***** pogress
- an event function that the Request calls when it
- receives a chunk of content.
- */
- self.progress = function () {
- /* necessary: this function becomes an observable signal */
- };
-
- /***** ready
- an event function that the Request calls when
- the Reponse is ready.
- */
- self.ready = function () {
- signal(response, readyObservers);
- };
-
- /***** ok
- an event function that the Request calls when a Response
- is ready and all went well. Note that Safari and FireFox, at least,
- will fire this event even when the connection is abruptly
- terminated by the server, reporting a 200 status and
- an empty response content.
- */
- self.ok = function () {
- signal(response, okObservers);
- };
-
- /***** error
- an event function that the Request calls when a Reponse
- is completed but failed to retrieve the requested content.
- */
- self.error = function () {
- signal(response, errorObservers);
- };
-
- /***** warn
- an event function that the Request calls when
- something is amiss with message.
- */
- self.warn = function (message) {
- warn(message);
- signal(response, warnObservers);
- };
-
- /***** timeout
- an event function that Request calls when a request
- times out. The default behavior is to invoke an error.
- */
- self.timeout = function () {
- signal(response, timeoutObservers);
- };
-
- /***** observe
- permits a user to observe `ready`, `ok`,
- `error`, and `warn` events with a handler
- function. Observing any event on a `Request`
- causes the `open` and `send` to implicitly become
- asynchronous.
- */
- self.observe = function (eventName, observer) {
- asynchronous = true;
- if (eventName == "ready") readyObservers.push(observer);
- else if (eventName == "ok") okObservers.push(observer);
- else if (eventName == "error") errorObservers.push(observer);
- else if (eventName == "warn") warnObservers.push(observer);
- else if (eventName == "timeout") timeoutObservers.push(observer);
- else throw new Error(
- "HttpError: event name '" + eventName + "' " +
- "is not recognized"
- );
- };
-
- /***** setHeader
- */
- self.setHeader = function (key, value) {
- realRequest.setRequestHeader(key, value);
- };
-
- /***** isOpen
- */
- self.isOpen = function () {
- return isOpen;
- };
-
- /***** isSent
- */
- self.isSent = function () {
- return realRequest.readyState > 0;
- };
-
- /***** getTimeout
- */
- self.getTimeout = function () {
- return timeout;
- };
-
- /***** setTimeout
- */
- self.setTimeout = function (value) {
- timeout = value;
- };
-
- /***** open
-
- Accepts
-
- - ``method``, an HTTP request method, for example,
- ``GET``, ``POST``, ``PROPFIND`` and others.
- - ``url``, a web location string
- - ``synchronous``, whether ``send`` will block until completed,
- for example, ``synchronous``, ``asynchronous``.
- - ``user``, an optional HTTP user name.
- - ``password``, an optional HTTP password.
-
- */
- self.open = function (_method, _url, _asynchronous, _user, _password) {
- try {
- return realRequest.open(
- method = _method,
- url = _url,
- asynchronous = _asynchronous,
- user = _user,
- password = _password
- );
- } finally {
- isOpen = true;
- }
- };
-
- /***** send
- Accepts an optional ``content`` argument for requests like ``POST`` method.
- */
- self.send = function (content) {
-
- realRequest.setRequestHeader("X-Requested-With", "XMLHttpRequest");
-
- if (!content) {
- content = "";
- }
-
- if (timeout !== undefined) {
- timeoutHandle = window.setTimeout(function () {
- timeoutHandle = undefined;
- var status = response.getStatus();
- if (status != 200 || status === undefined) {
- self.timeout();
- self.abort();
- }
- }, timeout);
- }
-
- return realRequest.send(content);
- };
-
- /***** abort
- */
- self.abort = function () {
- if (timeoutHandle !== undefined)
- window.clearTimeout(timeoutHandle);
- aborted = true;
- return realRequest.abort();
- };
-
- realRequest.onreadystatechange = function () {
- readyStateChanged = true;
-
- self.progress();
-
- if (aborted) {
- free();
- } else if (realRequest.readyState == 4) {
- try {
-
- self.ready(response);
-
- if (response.isOk()) {
- self.ok(response);
- } else {
- self.error(response);
- }
-
- } catch (exception) {
- system.print(exception.message || exception, 'error');
- }
- free();
- }
- };
-
- var free = function () {
- delete realRequest['onreadystatechange'];
- realRequest.onreadystatechange = undefined;
- };
-
- return self;
- };
-
- /**** Response
- returns a wrapped HTTP Response object.
- */
- exports.Response = function (realRequest) {
- /* this line permits the user to create a request with
- * either new Respones() or Response(). internally,
- * we just use the Response() so that Response can be
- * overloaded later in HTTP to be a type constructor
- * function instead of a prototype constructor */
- if (this == exports) return new exports.Response(realRequest);
-
- var self = this;
-
- /* this init function doesn't get invoked until Response becomes
- * a type in HTTP. so, this method is merely for the future. */
- self.init = function (realRequestValue) {
- realRequest = realRequestValue;
- };
-
- /***** isReady
- whether the request is finished. This indicates
- whether you can call `getStatus`
- */
- self.isReady = function () {
- return realRequest.readyState == 4;
- };
-
- /***** getStatus
- returns the HTTP response code. Local files
- return 0. Returns ``undefined`` if the
- underlying XML HTTP request throws an exception,
- `getStatus` returns ``undefined``.
- */
- self.getStatus = function () {
- /* one wouldn't think this were necessary.
- * one would be wrong. */
- try {
- return realRequest.status;
- } catch (exception) {
- return undefined;
- }
- };
-
- /***** isOk
- returns whether a request had a valid response.
- This usually is indicative of a 200 HTTP response
- code, but there are variations among browsers.
-
- HTTP Status codes in the interval [200, 300] are all legal
- HTTP Ok responses.
-
- In Firefox and Safari 3, local files acquired with an HTTP request
- have a status code of 0.
-
- In Safari 2, local files acquired with an asynchronous HTTP
- request have a status of undefined.
-
- In Safari, a response with no content causes a status
- of `undefined`.
-
- Konqueror requires acceptance of 304, "using cache",
- according to dojo/src/hostenv_browser.js
-
- According to jQuery issue #1450, IE sometimes 1223
- instead of 204.
- */
- self.isOk = function () {
- var status = self.getStatus();
- return (
- /* usually */
- status >= 200 && status < 300 ||
- /* Firefox and Safari 3 file:// */
- status == 0 ||
- /* Konqueror using cache */
- status == 304 ||
- /* IE bug 1223 */
- status == 1223 ||
- /* Safari 2 asynchronous file:// and
- all Safari for no file content */
- (environment.isSafari && status == undefined && (
- /^file:\/\//.test(url) ||
- realRequest.responseText == ""
- ))
- );
- };
-
- /***** isError
- */
- self.isError = function () {
- return !self.isOk();
- };
-
- /***** getContent
- */
- self.getContent = function () {
- return realRequest.responseText;
- };
-
- /***** getDocument
- */
- self.getDocument = function () {
- return self.getXml().documentElement;
- };
-
- /***** getHeader
- */
- self.getHeader = function (key) {
- return realRequest.getResponseHeader(key);
- };
-
- /***** hasHeader
- */
- self.hasHeader = function (key) {
- return realRequest.getResponseHeader(key) != undefined;
- };
-
- /***** getHeaders
- */
- self.getHeaders = function () {
- var headers = realRequest.getAllResponseHeaders();
- if (!headers) return {};
- return headers;
- };
-
- /***** len
- */
- self.len = function () {
- return realRequest.responseText.length;
- };
-
- };
-
- /*** NativeRequest
- returns an XMLHttpRequest in most browsers.
- */
- /* Based on dojo/src/hostenv_browser.js */
-
- exports.NativeRequest = function () {
- /*
-
- subscribes to the lazy function definition pattern, since it
- redefines itself as the first method that works on the first
- call.
-
- Some other AJAX implementations check
- - Msxml2.XMLHTTP.6.0
- - Msxml2.XMLHTTP.5.0
- - Msxml2.XMLHTTP.4.0
- - Msxml2.XMLHTTP.3.0
- - Microsoft.XMLHTTP
-
- Microsoft.XMLHTTP is an older name-space, but is equivalent to
- the more lucid Msxml2.XMLHTTP.3.0 and only available when the
- latter is available too.
-
- Msxml2.XMLHTTP.4.0 has been superseded and is currently only
- intended to support legacy applications.
-
- Msxml2.XMLHTTP.5.0 was shipped with MS Office 2003 and was
- intended for Office applications. IE7 has this component off
- by default in the Internet zone, leading to canary-yellow
- verification dialogs.
-
- Msxml2.XMLHTTP.6.0 is currently the standard MS is pushing.
- I originally left out 6.0 since it would increase the burden
- of testing for functionality that cannot be trusted to work
- in all browsers.
- However, I've taken Jonathan Snook's advice to check for
- Microsoft's latest and greatest.
-
- see: http://snook.ca/archives/javascript/xmlhttprequest_activex_ie/
-
- Msxml2.XMLHTTP.3.0 is the most widely deployed version and is
- serviced regularly with the OS for security and other reasons.
- It is MS's preferred alternative to MSXML6.
-
- see: http://blogs.msdn.com/xmlteam/archive/2006/10/23/using-the-right-version-of-msxml-in-internet-explorer.aspx
-
- see: http://www.telerik.com/documents/AJAX%20Page/Ajax-Part1.pdf page 3
-
- */
-
- var trials = [
- function () {return new window.XMLHttpRequest()},
- function () {return new window.ActiveXObject("Msxml2.XMLHTTP.6.0")},
- function () {return new window.ActiveXObject("Msxml2.XMLHTTP.3.0")},
- function () {throw new Error("No HTTP Request object available for your system.")}
- ];
-
- var trial, result, exception;
- for (var i = 0; i < trials.length; i++) {
- exception = undefined;
- /* redeclare for posterity */
- exports.NativeRequest = trial = trials[i];
- try {
- result = trial();
- } catch (trialException) {
- exception = trialException;
- continue;
- }
- break;
- }
-
- if (exception) throw exception;
- else return result;
- };
-
- };
-
- if (typeof exports == "undefined") {
- require('main');
- }
-
-/* end of module enclosure */
-})(function () {
- return eval(arguments[0]);
-});
-
diff --git a/utils/platforms/browser/lib/reactor.js b/utils/platforms/browser/lib/reactor.js
deleted file mode 100755
index bd0f10c..0000000
--- a/utils/platforms/browser/lib/reactor.js
+++ /dev/null
@@ -1,21 +0,0 @@
-
-var active = false;
-var pending = [];
-var run = function () {
- var task = pending.shift();
- if (0 === pending.length) {
- active = false;
- } else {
- setTimeout(run, 0);
- }
- task();
-};
-
-exports.enqueue = function enqueue(task) {
- pending.push(task);
- if (!active) {
- setTimeout(run, 0);
- active = true;
- }
-};
-
diff --git a/utils/platforms/browser/lib/system.js b/utils/platforms/browser/lib/system.js
deleted file mode 100755
index d50a5cf..0000000
--- a/utils/platforms/browser/lib/system.js
+++ /dev/null
@@ -1,3 +0,0 @@
-exports.print = function () {
- system.print.apply(system, arguments);
-};
diff --git a/utils/platforms/default/lib/array.js b/utils/platforms/default/lib/array.js
deleted file mode 100755
index 445f4ac..0000000
--- a/utils/platforms/default/lib/array.js
+++ /dev/null
@@ -1,160 +0,0 @@
-// Array additions.
-
-// ES5 draft:
-// http://www.ecma-international.org/publications/files/drafts/tc39-2009-025.pdf
-
-// ES5 15.4.3.2
-if (!Array.isArray) {
- Array.isArray = function(obj) {
- return obj && typeof obj === "object" && obj.constructor === Array;
- };
-}
-
-// ES5 15.4.4.18
-if (!Array.prototype.forEach) {
- Array.prototype.forEach = function(block) {
- for (var i = 0; i < this.length; i++)
- block(this[i]);
- };
-}
-
-// ES5 15.4.4.19
-// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/map
-if (!Array.prototype.map) {
- Array.prototype.map = function(fun /*, thisp*/) {
- var len = this.length >>> 0;
- if (typeof fun != "function")
- throw new TypeError();
-
- var res = new Array(len);
- var thisp = arguments[1];
- for (var i = 0; i < len; i++) {
- if (i in this)
- res[i] = fun.call(thisp, this[i], i, this);
- }
-
- return res;
- };
-}
-
-// filter
-if (!Array.prototype.filter) {
- Array.prototype.filter = function (block /*, thisp */) {
- var values = [];
- var thisp = arguments[1];
- for (var i = 0; i < this.length; i++)
- if (block.call(thisp, this[i]))
- values.push(this[i]);
- return values;
- };
-}
-
-// every
-if (!Array.prototype.every) {
- Array.prototype.every = function (block /*, thisp */) {
- var thisp = arguments[1];
- for (var i = 0; i < this.length; i++)
- if (!block.call(thisp, this[i]))
- return false;
- return true;
- };
-}
-
-// some
-if (!Array.prototype.some) {
- Array.prototype.some = function (block /*, thisp */) {
- var thisp = arguments[1];
- for (var i = 0; i < this.length; i++)
- if (block.call(thisp, this[i]))
- return true;
- return false;
- };
-}
-
-// reduce
-// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduce
-if (!Array.prototype.reduce) {
- Array.prototype.reduce = function(fun /*, initial*/) {
- var len = this.length >>> 0;
- if (typeof fun != "function")
- throw new TypeError();
-
- // no value to return if no initial value and an empty array
- if (len == 0 && arguments.length == 1)
- throw new TypeError();
-
- var i = 0;
- if (arguments.length >= 2) {
- var rv = arguments[1];
- } else {
- do {
- if (i in this) {
- rv = this[i++];
- break;
- }
-
- // if array contains no values, no initial value to return
- if (++i >= len)
- throw new TypeError();
- } while (true);
- }
-
- for (; i < len; i++) {
- if (i in this)
- rv = fun.call(null, rv, this[i], i, this);
- }
-
- return rv;
- };
-}
-
-// reduceRight
-// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduceRight
-if (!Array.prototype.reduceRight) {
- Array.prototype.reduceRight = function(fun /*, initial*/) {
- var len = this.length >>> 0;
- if (typeof fun != "function")
- throw new TypeError();
-
- // no value to return if no initial value, empty array
- if (len == 0 && arguments.length == 1)
- throw new TypeError();
-
- var i = len - 1;
- if (arguments.length >= 2) {
- var rv = arguments[1];
- } else {
- do {
- if (i in this) {
- rv = this[i--];
- break;
- }
-
- // if array contains no values, no initial value to return
- if (--i < 0)
- throw new TypeError();
- } while (true);
- }
-
- for (; i >= 0; i--) {
- if (i in this)
- rv = fun.call(null, rv, this[i], i, this);
- }
-
- return rv;
- };
-}
-
-/* binary */
-
-// https://wiki.mozilla.org/ServerJS/Binary/B
-if (!Array.prototype.toByteString)
- Array.prototype.toByteString = function(charset) {
- return new ByteString(this);
- };
-
-if (!Array.prototype.toByteArray)
- Array.prototype.toByteArray = function(charset) {
- return new ByteArray(this);
- };
-
diff --git a/utils/platforms/default/lib/binary-platform.js b/utils/platforms/default/lib/binary-platform.js
deleted file mode 100755
index 3bc2425..0000000
--- a/utils/platforms/default/lib/binary-platform.js
+++ /dev/null
@@ -1,53 +0,0 @@
-exports.B_LENGTH = function(bytes) {
- return bytes.length;
-}
-
-exports.B_ALLOC = function(length) {
- var bytes = new Array(length);
- for (var i = 0; i < length; i++)
- bytes[i] = 0;
- return bytes;
-}
-
-exports.B_FILL = function(bytes, from, to, value) {
- for (var i = from; i < to; i++)
- bytes[i] = value;
-}
-
-exports.B_COPY = function(src, srcOffset, dst, dstOffset, length) {
- for (var i = 0; i < length; i++)
- dst[dstOffset+i] = src[srcOffset+i];
-}
-
-exports.B_GET = function(bytes, index) {
- return bytes[index];
-}
-
-exports.B_SET = function(bytes, index, value) {
- return bytes[index] = value;
-}
-
-var DEFAULT_ENCODING = "UTF-8";
-
-exports.B_DECODE = function(bytes, offset, length, codec) {
- var newBytes = exports.B_TRANSCODE(bytes, offset, length, codec, DEFAULT_ENCODING);
- return exports.B_DECODE_DEFAULT(newBytes, 0, exports.B_LENGTH(newBytes));
-}
-
-exports.B_DECODE_DEFAULT = function(bytes, offset, length) {
- throw "NYI";
-}
-
-exports.B_ENCODE = function(string, codec) {
- var bytes = exports.B_ENCODE_DEFAULT(string);
- return exports.B_TRANSCODE(bytes, 0, exports.B_LENGTH(bytes), DEFAULT_ENCODING, codec);
-}
-
-exports.B_ENCODE_DEFAULT = function(string) {
- throw "NYI";
-}
-
-exports.B_TRANSCODE = function(bytes, offset, length, sourceCodec, targetCodec) {
- throw "NYI";
-}
-
diff --git a/utils/platforms/default/lib/binary.js b/utils/platforms/default/lib/binary.js
deleted file mode 100755
index 7c19b80..0000000
--- a/utils/platforms/default/lib/binary.js
+++ /dev/null
@@ -1,719 +0,0 @@
-/* Binary */
-
-var B_ALLOC = require("binary-platform").B_ALLOC,
- B_LENGTH = require("binary-platform").B_LENGTH,
- B_GET = require("binary-platform").B_GET,
- B_SET = require("binary-platform").B_SET,
- B_FILL = require("binary-platform").B_FILL,
- B_COPY = require("binary-platform").B_COPY,
- B_DECODE = require("binary-platform").B_DECODE,
- B_ENCODE = require("binary-platform").B_ENCODE,
- B_DECODE_DEFAULT = require("binary-platform").B_DECODE_DEFAULT,
- B_ENCODE_DEFAULT = require("binary-platform").B_ENCODE_DEFAULT,
- B_TRANSCODE = require("binary-platform").B_TRANSCODE;
-
-var Binary = exports.Binary = function() {
- // this._bytes
- // this._offset
- // this._length
-};
-
-Binary.prototype.__defineGetter__("length", function() { return this._length; });
-Binary.prototype.__defineSetter__("length", function(length) { print("x trying to set length: " + length); });
-
-// toArray() - n array of the byte values
-// toArray(charset) - an array of the code points, decoded
-Binary.prototype.toArray = function(codec) {
- if (arguments.length === 0) {
- var array = new Array(this._length);
-
- for (var i = 0; i < this.length; i++)
- array[i] = this.get(i);
-
- return array;
- }
- else if (arguments.length === 1) {
- var string = new java.lang.String(this._bytes, this._offset, this._length, codec),
- length = string.length(),
- array = new Array(length);
-
- for (var i = 0; i < length; i++)
- array[i] = string.codePointAt(i);
-
- return array;
- }
- else
- throw new Error("Illegal arguments to toArray()");
-};
-
-// toByteArray() - just a copy
-// toByteArray(sourceCharset, targetCharset) - transcoded
-Binary.prototype.toByteArray = function(sourceCodec, targetCodec) {
- if (arguments.length < 2)
- return new ByteArray(this);
- else if (arguments.length === 2 && typeof sourceCodec === "string" && typeof targetCodec === "string") {
- var bytes = B_TRANSCODE(this._bytes, this._offset, this._length, sourceCodec, targetCodec);
- return new ByteArray(bytes, 0, B_LENGTH(bytes));
- }
-
- throw new Error("Illegal arguments to ByteArray toByteArray");
-};
-
-// toByteString() - byte for byte copy
-// toByteString(sourceCharset, targetCharset) - transcoded
-Binary.prototype.toByteString = function(sourceCodec, targetCodec) {
- if (arguments.length < 2)
- return new ByteString(this);
- else if (arguments.length === 2 && typeof sourceCodec === "string" && typeof targetCodec === "string") {
- var bytes = B_TRANSCODE(this._bytes, this._offset, this._length, sourceCodec, targetCodec);
- return new ByteString(bytes, 0, B_LENGTH(bytes));
- }
-
- throw new Error("Illegal arguments to ByteArray toByteString");
-};
-
-// decodeToString()
-// decodeToString(charset) - returns a String from its decoded bytes in a given charset. If no charset is provided, or if the charset is "undefined", assumes the default system encoding.
-// decodeToString(number) - returns a String from its decoded bytes in a given base, like 64, 32, 16, 8, 2
-Binary.prototype.decodeToString = function(charset) {
- if (charset) {
- if (typeof charset == "number")
- return require("base" + charset).encode(this);
- else if (charset.begins("base"))
- return require(charset).encode(this);
- else
- return B_DECODE(this._bytes, this._offset, this._length, charset);
- }
- return B_DECODE_DEFAULT(this._bytes, this._offset, this._length);
-};
-
-// get(offset) - Return the byte at offset as a Number.
-Binary.prototype.get = function(offset) {
- if (offset < 0 || offset >= this._length)
- return NaN;
-
- //var b = this._bytes[this._offset + offset];
- //return (b >= 0) ? b : -1 * ((b ^ 0xFF) + 1);
- return B_GET(this._bytes, this._offset + offset)
-};
-
-Binary.prototype.indexOf = function(byteValue, start, stop) {
- // HACK: use ByteString's slice since we know we won't be modifying result
- var array = ByteString.prototype.slice.apply(this, [start, stop]).toArray(),
- result = array.indexOf(byteValue);
- return (result < 0) ? -1 : result + (start || 0);
-};
-
-Binary.prototype.lastIndexOf = function(byteValue, start, stop) {
- // HACK: use ByteString's slice since we know we won't be modifying result
- var array = ByteString.prototype.slice.apply(this, [start, stop]).toArray(),
- result = array.lastIndexOf(byteValue);
- return (result < 0) ? -1 : result + (start || 0);
-};
-
-// valueOf()
-Binary.prototype.valueOf = function() {
- return this;
-};
-
-/* ByteString */
-
-var ByteString = exports.ByteString = function() {
- if (!(this instanceof ByteString)) {
- if (arguments.length == 0)
- return new ByteString();
- if (arguments.length == 1)
- return new ByteString(arguments[0]);
- if (arguments.length == 2)
- return new ByteString(arguments[0], arguments[1]);
- if (arguments.length == 3)
- return new ByteString(arguments[0], arguments[1], arguments[2]);
- }
-
- // ByteString() - Construct an empty byte string.
- if (arguments.length === 0) {
- this._bytes = B_ALLOC(0); // null;
- this._offset = 0;
- this._length = 0;
- }
- // ByteString(byteString) - Copies byteString.
- else if (arguments.length === 1 && arguments[0] instanceof ByteString) {
- return arguments[0];
- }
- // ByteString(byteArray) - Use the contents of byteArray.
- else if (arguments.length === 1 && arguments[0] instanceof ByteArray) {
- var copy = arguments[0].toByteArray();
- this._bytes = copy._bytes;
- this._offset = copy._offset;
- this._length = copy._length;
- }
- // ByteString(arrayOfNumbers) - Use the numbers in arrayOfNumbers as the bytes.
- else if (arguments.length === 1 && Array.isArray(arguments[0])) {
- var array = arguments[0];
- this._bytes = B_ALLOC(array.length);
- for (var i = 0; i < array.length; i++) {
- var b = array[i];
- // If any element is outside the range 0...255, an exception (TODO) is thrown.
- if (b < -0x80 || b > 0xFF)
- throw new Error("ByteString constructor argument Array of integers must be -128 - 255 ("+b+")");
- // Java "bytes" are interpreted as 2's complement
- //this._bytes[i] = (b < 128) ? b : -1 * ((b ^ 0xFF) + 1);
- B_SET(this._bytes, i, b);
- }
- this._offset = 0;
- this._length = B_LENGTH(this._bytes);
- }
- // ByteString(string, charset) - Convert a string. The ByteString will contain string encoded with charset.
- else if ((arguments.length === 1 || (arguments.length === 2 && arguments[1] === undefined)) && typeof arguments[0] === "string") {
- this._bytes = B_ENCODE_DEFAULT(arguments[0]);
- this._offset = 0;
- this._length = B_LENGTH(this._bytes);
- }
- else if (arguments.length === 2 && typeof arguments[0] === "string" && typeof arguments[1] === "string") {
- this._bytes = B_ENCODE(arguments[0], arguments[1]);
- this._offset = 0;
- this._length = B_LENGTH(this._bytes);
- }
- // private: ByteString(bytes, offset, length)
- else if (arguments.length === 3 && typeof arguments[1] === "number" && typeof arguments[2] === "number") {
- this._bytes = arguments[0];
- this._offset = arguments[1];
- this._length = arguments[2];
- }
- else
- throw new Error("Illegal arguments to ByteString constructor: [" +
- Array.prototype.join.apply(arguments, [","]) + "] ("+arguments.length+")");
-
- //seal(this);
-};
-
-ByteString.prototype = new Binary();
-
-ByteString.prototype.__defineGetter__("length", function() { return this._length; });
-ByteString.prototype.__defineSetter__("length", function(length) {});
-
-// toByteArray() - Returns a byte for byte copy in a ByteArray.
-// toByteArray(sourceCharset, targetCharset) - Returns a transcoded copy in a ByteArray.
-// - implemented on Binary
-
-// toByteString() - Returns itself, since there's no need to copy an immutable ByteString.
-// toByteString(sourceCharset, targetCharset) - Returns a transcoded copy.
-// - implemented on Binary
-
-// toArray() - Returns an array containing the bytes as numbers.
-// toArray(charset) - Returns an array containing the decoded Unicode code points.
-// - implemented on Binary
-
-// toString()
-ByteString.prototype.toString = function(charset) {
- if (charset)
- return this.decodeToString(charset);
-
- return "[ByteString "+this.length+"]";
-};
-
-// decodeToString(charset) - Returns the decoded ByteArray as a string.
-// - implemented on Binary
-
-ByteString.prototype.byteAt =
-ByteString.prototype.charAt = function(offset) {
- var byteValue = this.get(offset);
-
- if (isNaN(byteValue))
- return new ByteString();
-
- return new ByteString([byteValue]);
-};
-
-// indexOf() - implemented on Binary
-// lastIndexOf() - implemented on Binary
-
-// charCodeAt(offset)
-ByteString.prototype.charCodeAt = Binary.prototype.get;
-
-// get(offset) - implemented on Binary
-
-// byteAt(offset) ByteString - implemented on Binary
-// charAt(offset) ByteString - implemented on Binary
-
-// split(delimiter, [options])
-ByteString.prototype.split = function(delimiters, options) {
- var options = options || {},
- count = options.count === undefined ? -1 : options.count,
- includeDelimiter = options.includeDelimiter || false;
-
- // standardize delimiters into an array of ByteStrings:
- if (!Array.isArray(delimiters))
- delimiters = [delimiters];
-
- delimiters = delimiters.map(function(delimiter) {
- if (typeof delimiter === "number")
- delimiter = [delimiter];
- return new ByteString(delimiter);
- });
-
- var components = [],
- startOffset = this._offset,
- currentOffset = this._offset;
-
- // loop until there's no more bytes to consume
- bytes_loop :
- while (currentOffset < this._offset + this._length) {
-
- // try each delimiter until we find a match
- delimiters_loop :
- for (var i = 0; i < delimiters.length; i++) {
- var d = delimiters[i];
-
- for (var j = 0; j < d._length; j++) {
- // reached the end of the bytes, OR bytes not equal
- if (currentOffset + j > this._offset + this._length ||
- B_GET(this._bytes, currentOffset + j) !== B_GET(d._bytes, d._offset + j)) {
- continue delimiters_loop;
- }
- }
-
- // push the part before the delimiter
- components.push(new ByteString(this._bytes, startOffset, currentOffset - startOffset));
-
- // optionally push the delimiter
- if (includeDelimiter)
- components.push(new ByteString(this._bytes, currentOffset, d._length))
-
- // reset the offsets
- startOffset = currentOffset = currentOffset + d._length;
-
- continue bytes_loop;
- }
-
- // if there was no match, increment currentOffset to try the next one
- currentOffset++;
- }
-
- // push the remaining part, if any
- if (currentOffset > startOffset)
- components.push(new ByteString(this._bytes, startOffset, currentOffset - startOffset));
-
- return components;
-};
-
-// slice()
-// slice(begin)
-// slice(begin, end)
-ByteString.prototype.slice = function(begin, end) {
- if (begin === undefined)
- begin = 0;
- else if (begin < 0)
- begin = this._length + begin;
-
- if (end === undefined)
- end = this._length;
- else if (end < 0)
- end = this._length + end;
-
- begin = Math.min(this._length, Math.max(0, begin));
- end = Math.min(this._length, Math.max(0, end));
-
- return new ByteString(this._bytes, this._offset + begin, end - begin);
-};
-
-// substr(start)
-// substr(start, length)
-ByteString.prototype.substr = function(start, length) {
- if (start !== undefined) {
- if (length !== undefined)
- return this.slice(start);
- else
- return this.slice(start, start + length);
- }
- return this.slice();
-};
-
-// substring(first)
-// substring(first, last)
-ByteString.prototype.substring = function(from, to) {
- if (from !== undefined) {
- if (to !== undefined)
- return this.slice(Math.max(Math.min(begin, this._length), 0));
- else
- return this.slice(Math.max(Math.min(begin, this._length), 0),
- Math.max(Math.min(end, this._length), 0));
- }
- return this.slice();
-};
-
-// [] ByteString - TODO
-
-// toSource()
-ByteString.prototype.toSource = function() {
- return "ByteString(["+this.toArray().join(",")+"])";
-};
-
-/* ByteArray */
-
-// ByteArray() - New, empty ByteArray.
-// ByteArray(length) - New ByteArray filled with length zero bytes.
-// ByteArray(byteArray) - Copy byteArray.
-// ByteArray(byteString) - Copy contents of byteString.
-// ByteArray(arrayOfBytes) - Use numbers in arrayOfBytes as contents.
-// Throws an exception if any element is outside the range 0...255 (TODO).
-// ByteArray(string, charset) - Create a ByteArray from a Javascript string, the result being encoded with charset.
-var ByteArray = exports.ByteArray = function() {
- if (!this instanceof ByteArray) {
- if (arguments.length == 0)
- return new ByteArray();
- if (arguments.length == 1)
- return new ByteArray(arguments[0]);
- if (arguments.length == 2)
- return new ByteArray(arguments[0], arguments[1]);
- if (arguments.length == 3)
- return new ByteArray(arguments[0], arguments[1], arguments[2]);
- }
-
- // ByteArray() - New, empty ByteArray.
- if (arguments.length === 0) {
- this._bytes = B_ALLOC(0); // null;
- this._offset = 0;
- this._length = 0;
- }
- // ByteArray(length) - New ByteArray filled with length zero bytes.
- else if (arguments.length === 1 && typeof arguments[0] === "number") {
- this._bytes = B_ALLOC(arguments[0]); // null;
- this._offset = 0;
- this._length = B_LENGTH(this._bytes);
- }
- // ByteArray(byteArray) - Copy byteArray.
- // ByteArray(byteString) - Copy contents of byteString.
- else if (arguments.length === 1 && (arguments[0] instanceof ByteArray || arguments[0] instanceof ByteString)) {
- var byteArray = new ByteArray(arguments[0]._length);
- B_COPY(arguments[0]._bytes, arguments[0]._offset, byteArray._bytes, byteArray._offset, byteArray._length);
- return byteArray;
- }
- // ByteArray(arrayOfBytes) - Use numbers in arrayOfBytes as contents.
- // Throws an exception if any element is outside the range 0...255 (TODO).
- else if (arguments.length === 1 && Array.isArray(arguments[0])) {
- var array = arguments[0];
- this._bytes = B_ALLOC(array.length);
- for (var i = 0; i < array.length; i++) {
- var b = array[i];
- // If any element is outside the range 0...255, an exception (TODO) is thrown.
- if (b < 0 || b > 0xFF)
- throw new Error("ByteString constructor argument Array of integers must be 0 - 255 ("+b+")");
- // Java "bytes" are interpreted as 2's complement
- //this._bytes[i] = (b < 128) ? b : -1 * ((b ^ 0xFF) + 1);
- B_SET(this._bytes, i, b);
- }
- this._offset = 0;
- this._length = B_LENGTH(this._bytes);
- }
- // ByteArray(string, charset) - Create a ByteArray from a Javascript string, the result being encoded with charset.
- else if ((arguments.length === 1 || (arguments.length === 2 && arguments[1] === undefined)) && typeof arguments[0] === "string") {
- this._bytes = B_ENCODE_DEFAULT(arguments[0]);
- this._offset = 0;
- this._length = B_LENGTH(this._bytes);
- }
- else if (arguments.length === 2 && typeof arguments[0] === "string" && typeof arguments[1] === "string") {
- this._bytes = B_ENCODE(arguments[0], arguments[1]);
- this._offset = 0;
- this._length = B_LENGTH(this._bytes);
- }
- // private: ByteArray(bytes, offset, length)
- else if (arguments.length === 3 && typeof arguments[1] === "number" && typeof arguments[2] === "number") {
- this._bytes = arguments[0];
- this._offset = arguments[1];
- this._length = arguments[2];
- }
- else
- throw new Error("Illegal arguments to ByteString constructor: [" +
- Array.prototype.join.apply(arguments, [","]) + "] ("+arguments.length+")");
-};
-
-ByteArray.prototype = new Binary();
-
-ByteArray.prototype.__defineGetter__("length", function() { return this._length; });
-ByteArray.prototype.__defineSetter__("length", function(length) {
- if (typeof length !== "number")
- return;
-
- // same length
- if (length === this.length) {
- return;
- }
- // new length is less, truncate
- else if (length < this._length) {
- this._length = length;
- }
- // new length is more, but fits without moving, just clear new bytes
- else if (this._offset + length <= B_LENGTH(this._bytes)) {
- B_FILL(this._bytes, this._length, this._offset + length - 1, 0);
- this._length = length;
- }
- // new length is more, but fits if we shift to bottom, so do that.
- else if (length <= B_LENGTH(this._bytes)) {
- B_COPY(this._bytes, this._offset, this._bytes, 0, this._length);
- this._offset = 0;
- B_FILL(this._bytes, this._length, this._offset + length - 1, 0);
- this._length = length;
- }
- // new length is more than the allocated bytes array, allocate a new one and copy the data
- else {
- var newBytes = B_ALLOC(length);
- B_COPY(this._bytes, this._offset, newBytes, 0, this._length);
- this._bytes = newBytes;
- this._offset = 0;
- this._length = length;
- }
-});
-
-// FIXME: array notation for set and get
-ByteArray.prototype.set = function(index, b) {
- // If any element is outside the range 0...255, an exception (TODO) is thrown.
- if (b < 0 || b > 0xFF)
- throw new Error("ByteString constructor argument Array of integers must be 0 - 255 ("+b+")");
-
- if (index < 0 || index >= this._length)
- throw new Error("Out of range");
-
- // Java "bytes" are interpreted as 2's complement
- //this._bytes[this._offset + index] = (b < 128) ? b : -1 * ((b ^ 0xFF) + 1);
- B_SET(this._bytes, this._offset + index, b);
-};
-
-// toArray()
-// toArray(charset)
-// - implemented on Binary
-
-// toByteArray() - just a copy
-// toByteArray(sourceCharset, targetCharset) - transcoded
-// - implemented on Binary
-
-// toByteString() - byte for byte copy
-// toByteString(sourceCharset, targetCharset) - transcoded
-// - implemented on Binary
-
-// toString() - a string representation like "[ByteArray 10]"
-// toString(charset) - an alias for decodeToString(charset)
-ByteArray.prototype.toString = function(charset) {
- if (charset)
- return this.decodeToString(charset);
-
- return "[ByteArray "+this.length+"]";
-};
-
-// decodeToString(charset) - implemented on Binary
-
-// byteAt(offset) ByteString - Return the byte at offset as a ByteString.
-// - implemented on Binary
-
-// get(offset) Number - Return the byte at offset as a Number.
-// - implemented on Binary
-
-// concat(other ByteArray|ByteString|Array)
-// TODO: I'm assuming Array means an array of ByteStrings/ByteArrays, not an array of integers.
-ByteArray.prototype.concat = function() {
- var components = [this],
- totalLength = this.length;
-
- for (var i = 0; i < arguments.length; i++) {
- var component = Array.isArray(component) ? arguments[i] : [component];
-
- for (var j = 0; j < component.length; j++) {
- var subcomponent = component[j];
- if (!(subcomponent instanceof ByteString) && !(subcomponent instanceof ByteArray))
- throw "Arguments to ByteArray.concat() must be ByteStrings, ByteArrays, or Arrays of those.";
-
- components.push(subcomponent);
- totalLength += subcomponent.length;
- }
- }
-
- var result = new ByteArray(totalLength),
- offset = 0;
-
- components.forEach(function(component) {
- B_COPY(component._bytes, component._offset, result._byte, offset, component._length);
- offset += component._length;
- });
-
- return result;
-};
-
-// pop() -> byte Number
-ByteArray.prototype.pop = function() {
- if (this._length === 0)
- return undefined;
-
- this._length--;
-
- return B_GET(this._bytes, this._offset + this._length);
-};
-
-// push(...variadic Numbers...)-> count Number
-ByteArray.prototype.push = function() {
- throw "NYI";
-};
-
-// extendRight(...variadic Numbers / Arrays / ByteArrays / ByteStrings ...)
-ByteArray.prototype.extendRight = function() {
- throw "NYI";
-};
-
-// shift() -> byte Number
-ByteArray.prototype.shift = function() {
- if (this._length === 0)
- return undefined;
-
- this._length--;
- this._offset++;
-
- return B_GET(this._bytes, this._offset - 1);
-};
-
-// unshift(...variadic Numbers...) -> count Number
-ByteArray.prototype.unshift = function() {
- throw "NYI";
-};
-
-// extendLeft(...variadic Numbers / Arrays / ByteArrays / ByteStrings ...)
-ByteArray.prototype.extendLeft = function() {
- throw "NYI";
-};
-
-// reverse() in place reversal
-ByteArray.prototype.reverse = function() {
- // "limit" is halfway, rounded down. "top" is the last index.
- var limit = Math.floor(this._length/2) + this._offset,
- top = this._length - 1;
-
- // swap each pair of bytes, up to the halfway point
- for (var i = this._offset; i < limit; i++) {
- var tmp = B_GET(this._bytes, i);
- B_SET(this._bytes, i, B_GET(this._bytes, top - i));
- B_SET(this._bytes, top - i, tmp);
- }
-
- return this;
-};
-
-// slice()
-ByteArray.prototype.slice = function() {
- return new ByteArray(ByteString.prototype.apply.slice(this, arguments));
-};
-
-var numericCompareFunction = function(o1, o2) { return o1 - o2; };
-
-// sort([compareFunction])
-ByteArray.prototype.sort = function(compareFunction) {
- // FIXME: inefficient?
-
- var array = this.toArray();
-
- if (arguments.length)
- array.sort(compareFunction);
- else
- array.sort(numericCompareFunction);
-
- for (var i = 0; i < array.length; i++)
- this.set(i, array[i]);
-};
-
-// splice()
-ByteArray.prototype.splice = function() {
- throw "NYI";
-};
-
-// indexOf() - implemented on Binary
-// lastIndexOf() - implemented on Binary
-
-// split() Returns an array of ByteArrays instead of ByteStrings.
-ByteArray.prototype.split = function() {
- var components = ByteString.prototype.split.apply(this.toByteString(), arguments);
-
- // convert ByteStrings to ByteArrays
- for (var i = 0; i < components.length; i++) {
- // we know we can use these byte buffers directly since we copied them above
- components[i] = new ByteArray(components[i]._bytes, components[i]._offset, components[i]._length);
- }
-
- return components;
-};
-
-// filter(callback[, thisObject])
-ByteArray.prototype.filter = function(callback, thisObject) {
- var result = new ByteArray(this.length);
- for (var i = 0, length = this.length; i < length; i++) {
- var value = this.get(i);
- if (callback.apply(thisObject, [value, i, this]))
- result.push(value);
- }
- return result;
-};
-
-// forEach(callback[, thisObject]);
-ByteArray.prototype.forEach = function(callback) {
- for (var i = 0, length = this.length; i < length; i++)
- callback.apply(thisObject, [this.get(i), i, this]);
-};
-
-// every(callback[, thisObject])
-ByteArray.prototype.every = function(callback, thisObject) {
- for (var i = 0, length = this.length; i < length; i++)
- if (!callback.apply(thisObject, [this.get(i), i, this]))
- return false;
- return true;
-};
-
-// some(callback[, thisObject])
-ByteArray.prototype.some = function(callback, thisObject) {
- for (var i = 0, length = this.length; i < length; i++)
- if (callback.apply(thisObject, [this.get(i), i, this]))
- return true;
- return false;
-};
-
-// map(callback[, thisObject]);
-ByteArray.prototype.map = function(callback, thisObject) {
- var result = new ByteArray(this.length);
- for (var i = 0, length = this.length; i < length; i++)
- result.set(i, callback.apply(thisObject, [this.get(i), i, this]));
- return result;
-};
-
-// reduce(callback[, initialValue])
-ByteArray.prototype.reduce = function(callback, initialValue) {
- var value = initialValue;
- for (var i = 0, length = this.length; i < length; i++)
- value = callback(value, this.get(i), i, this);
- return value;
-};
-
-// reduceRight(callback[, initialValue])
-ByteArray.prototype.reduceRight = function(callback, initialValue) {
- var value = initialValue;
- for (var i = this.length-1; i > 0; i--)
- value = callback(value, this.get(i), i, this);
- return value;
-};
-
-// displace(begin, end, values/ByteStrings/ByteArrays/Arrays...) -> length
-// begin/end are specified like for slice. Can be used like splice but does not return the removed elements.
-ByteArray.prototype.displace = function(begin, end) {
- throw "NYI";
-};
-
-// toSource() returns a string like "ByteArray([])" for a null byte-array.
-ByteArray.prototype.toSource = function() {
- return "ByteArray(["+this.toArray().join(",")+"])";
-};
-
-/* BinaryIO */
-
-exports.BinaryIO = function(binary) {
- if (!binary)
- throw "NYI";
-
- var stream = new (require("io").IO)(new java.io.ByteArrayInputStream(binary._bytes, binary._offset, binary._length), null);
- stream.length = binary.length;
- return stream;
-};
-
diff --git a/utils/platforms/default/lib/date.js b/utils/platforms/default/lib/date.js
deleted file mode 100755
index 4136d11..0000000
--- a/utils/platforms/default/lib/date.js
+++ /dev/null
@@ -1,8 +0,0 @@
-// Format a Date object as a string according to a subset of the ISO-8601 standard.
-// Useful in Atom.
-if (!Date.prototype.toISOString) {
- Date.prototype.toISOString = function() {
- return (this.getFullYear() + "-" + this.getMonth() + "-" + this.getDate() + "T" + this.getHours() + ":" + this.getMinutes() + ":" + this.getSeconds() + "Z");
- }
-}
-
diff --git a/utils/platforms/default/lib/file-platform.js b/utils/platforms/default/lib/file-platform.js
deleted file mode 100755
index 04a6387..0000000
--- a/utils/platforms/default/lib/file-platform.js
+++ /dev/null
@@ -1,119 +0,0 @@
-
-// HACK: use "fs.read" and "fs.isFile" until properly implemented.
-// save "fs" here since it will be replaced in "system" later.
-var fs = system.fs;
-
-var exports = require('./file');
-
-exports.SEPARATOR = '/';
-exports.ALT_SEPARATOR = undefined;
-exports.ROOT = '/';
-
-exports.cwd = function () {
- return system.env['PWD'] || '.';
-};
-
-// TODO necessary for package loading
-exports.list = function (path) {
- throw Error("list not yet implemented.");
-};
-
-// TODO necessary for package loading
-exports.canonical = function (path) {
- // does not resolve symlinks
- return exports.normal(exports.join(exports.cwd(), path));
-};
-
-exports.exists = function (path) {
- throw Error("exists not yet implemented.");
-};
-
-// TODO necessary for lazy module reloading in sandboxes
-exports.mtime = function (path) {
- return Date();
-};
-
-exports.size = function (path) {
- throw Error("size not yet implemented.");
-};
-
-exports.stat = function (path) {
- return {
- mtime: exports.mtime(path),
- size: exports.size(path)
- }
-};
-
-// TODO necessary for package loading
-exports.isDirectory = function (path) {
- //throw Error("isDirectory not yet implemented.");
- system.log.warn("isDirectory not yet implemented. ("+path+")");
- return false;
-};
-
-// TODO necessary for module loading
-exports.isFile = function (path) {
- return fs.isFile(path);
-};
-
-exports.isLink = function (path) {
- throw Error("isLink not yet implemented.");
-};
-
-exports.isReadable = function (path) {
- throw Error("isReadable not yet implemented.");
-};
-
-exports.isWritable = function (path) {
- throw Error("isWritable not yet implemented.");
-};
-
-exports.rename = function (source, target) {
- throw Error("rename not yet implemented.");
-};
-
-exports.move = function (source, target) {
- throw Error("move not yet implemented.");
-};
-
-exports.remove = function (path) {
- throw Error("remove not yet implemented.");
-};
-
-exports.mkdir = function (path) {
- throw Error("mkdir not yet implemented.");
-};
-
-exports.rmdir = function(path) {
- throw Error("rmdir not yet implemented.");
-};
-
-exports.touch = function (path, mtime) {
- throw Error("touch not yet implemented.");
-};
-
-exports.FileIO = function (path, mode, permissions) {
- mode = exports.mode(mode);
- var read = mode.read,
- write = mode.write,
- append = mode.append,
- update = mode.update;
-
- if (update) {
- throw new Error("Updating IO not yet implemented.");
- } else if (write || append) {
- throw new Error("Writing IO not yet implemented.");
- } else if (read) {
- // FIXME temporary hack
- return {
- 'read': function () {
- return fs.read(path);
- },
- 'close': function () {
- }
- };
- } else {
- throw new Error("Files must be opened either for read, write, or update mode.");
- }
-};
-
diff --git a/utils/platforms/default/lib/function.js b/utils/platforms/default/lib/function.js
deleted file mode 100755
index 2622359..0000000
--- a/utils/platforms/default/lib/function.js
+++ /dev/null
@@ -1,19 +0,0 @@
-
-Function.prototype.bind = function () {
- var args = Array.prototype.slice.call(arguments);
- var self = this;
- var bound = function () {
- return self.call.apply(
- self,
- args.concat(
- Array.prototype.slice.call(arguments)
- )
- );
- };
- bound.name = this.name;
- bound.displayName = this.displayName;
- bound.length = this.length;
- bound.unbound = self;
- return bound;
-};
-
diff --git a/utils/platforms/default/lib/global.js b/utils/platforms/default/lib/global.js
deleted file mode 100755
index bef936e..0000000
--- a/utils/platforms/default/lib/global.js
+++ /dev/null
@@ -1,11 +0,0 @@
-// extend the prototypes of builtin objects
-
-require("array");
-require("object");
-require("string");
-require("regexp");
-require("date");
-require("binary");
-require("function");
-require("json");
-
diff --git a/utils/platforms/default/lib/io-platform.js b/utils/platforms/default/lib/io-platform.js
deleted file mode 100755
index 4c9c65c..0000000
--- a/utils/platforms/default/lib/io-platform.js
+++ /dev/null
@@ -1,26 +0,0 @@
-// IO: default
-
-var IO = exports.IO = function(inputStream, outputStream) {
- this.inputStream = inputStream;
- this.outputStream = outputStream;
-}
-
-IO.prototype.read = function(length) {
- return this.inputStream(length);
-}
-
-IO.prototype.write = function(object) {
- this.outputStream(object);
- return this;
-}
-
-IO.prototype.flush = function() {
- return this;
-}
-
-IO.prototype.close = function() {
-}
-
-exports.TextIOWrapper = function (raw, mode, lineBuffering, buffering, charset, options) {
- return raw;
-}
diff --git a/utils/platforms/default/lib/json.js b/utils/platforms/default/lib/json.js
deleted file mode 100755
index f5061cc..0000000
--- a/utils/platforms/default/lib/json.js
+++ /dev/null
@@ -1,487 +0,0 @@
-/*
- http://www.JSON.org/json2.js
- 2008-11-19
-
- Public Domain.
-
- NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
-
- See http://www.JSON.org/js.html
-
- This file creates a global JSON object containing two methods: stringify
- and parse.
-
- JSON.stringify(value, replacer, space)
- value any JavaScript value, usually an object or array.
-
- replacer an optional parameter that determines how object
- values are stringified for objects. It can be a
- function or an array of strings.
-
- space an optional parameter that specifies the indentation
- of nested structures. If it is omitted, the text will
- be packed without extra whitespace. If it is a number,
- it will specify the number of spaces to indent at each
- level. If it is a string (such as '\t' or '&nbsp;'),
- it contains the characters used to indent at each level.
-
- This method produces a JSON text from a JavaScript value.
-
- When an object value is found, if the object contains a toJSON
- method, its toJSON method will be called and the result will be
- stringified. A toJSON method does not serialize: it returns the
- value represented by the name/value pair that should be serialized,
- or undefined if nothing should be serialized. The toJSON method
- will be passed the key associated with the value, and this will be
- bound to the object holding the key.
-
- For example, this would serialize Dates as ISO strings.
-
- Date.prototype.toJSON = function (key) {
- function f(n) {
- // Format integers to have at least two digits.
- return n < 10 ? '0' + n : n;
- }
-
- return this.getUTCFullYear() + '-' +
- f(this.getUTCMonth() + 1) + '-' +
- f(this.getUTCDate()) + 'T' +
- f(this.getUTCHours()) + ':' +
- f(this.getUTCMinutes()) + ':' +
- f(this.getUTCSeconds()) + 'Z';
- };
-
- You can provide an optional replacer method. It will be passed the
- key and value of each member, with this bound to the containing
- object. The value that is returned from your method will be
- serialized. If your method returns undefined, then the member will
- be excluded from the serialization.
-
- If the replacer parameter is an array of strings, then it will be
- used to select the members to be serialized. It filters the results
- such that only members with keys listed in the replacer array are
- stringified.
-
- Values that do not have JSON representations, such as undefined or
- functions, will not be serialized. Such values in objects will be
- dropped; in arrays they will be replaced with null. You can use
- a replacer function to replace those with JSON values.
- JSON.stringify(undefined) returns undefined.
-
- The optional space parameter produces a stringification of the
- value that is filled with line breaks and indentation to make it
- easier to read.
-
- If the space parameter is a non-empty string, then that string will
- be used for indentation. If the space parameter is a number, then
- the indentation will be that many spaces.
-
- Example:
-
- text = JSON.stringify(['e', {pluribus: 'unum'}]);
- // text is '["e",{"pluribus":"unum"}]'
-
-
- text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
- // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
-
- text = JSON.stringify([new Date()], function (key, value) {
- return this[key] instanceof Date ?
- 'Date(' + this[key] + ')' : value;
- });
- // text is '["Date(---current time---)"]'
-
-
- JSON.parse(text, reviver)
- This method parses a JSON text to produce an object or array.
- It can throw a SyntaxError exception.
-
- The optional reviver parameter is a function that can filter and
- transform the results. It receives each of the keys and values,
- and its return value is used instead of the original value.
- If it returns what it received, then the structure is not modified.
- If it returns undefined then the member is deleted.
-
- Example:
-
- // Parse the text. Values that look like ISO date strings will
- // be converted to Date objects.
-
- myData = JSON.parse(text, function (key, value) {
- var a;
- if (typeof value === 'string') {
- a =
-/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
- if (a) {
- return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
- +a[5], +a[6]));
- }
- }
- return value;
- });
-
- myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
- var d;
- if (typeof value === 'string' &&
- value.slice(0, 5) === 'Date(' &&
- value.slice(-1) === ')') {
- d = new Date(value.slice(5, -1));
- if (d) {
- return d;
- }
- }
- return value;
- });
-
-
- This is a reference implementation. You are free to copy, modify, or
- redistribute.
-
- This code should be minified before deployment.
- See http://javascript.crockford.com/jsmin.html
-
- USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
- NOT CONTROL.
-*/
-
-/*jslint evil: true */
-
-/*global JSON */
-
-/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
- call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
- getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
- lastIndex, length, parse, prototype, push, replace, slice, stringify,
- test, toJSON, toString, valueOf
-*/
-
-// Create a JSON object only if one does not already exist. We create the
-// methods in a closure to avoid creating global variables.
-
-var JSON = this.JSON = typeof exports == "undefined" ? {} : exports;
-
-(function () {
-
- function f(n) {
- // Format integers to have at least two digits.
- return n < 10 ? '0' + n : n;
- }
-
- if (typeof Date.prototype.toJSON !== 'function') {
-
- Date.prototype.toJSON = function (key) {
-
- return this.getUTCFullYear() + '-' +
- f(this.getUTCMonth() + 1) + '-' +
- f(this.getUTCDate()) + 'T' +
- f(this.getUTCHours()) + ':' +
- f(this.getUTCMinutes()) + ':' +
- f(this.getUTCSeconds()) + 'Z';
- };
-
- String.prototype.toJSON =
- Number.prototype.toJSON =
- Boolean.prototype.toJSON = function (key) {
- return this.valueOf();
- };
- }
-
- var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
- escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
- gap,
- indent,
- meta = { // table of character substitutions
- '\b': '\\b',
- '\t': '\\t',
- '\n': '\\n',
- '\f': '\\f',
- '\r': '\\r',
- '"' : '\\"',
- '\\': '\\\\'
- },
- rep;
-
-
- function quote(string) {
-
-// If the string contains no control characters, no quote characters, and no
-// backslash characters, then we can safely slap some quotes around it.
-// Otherwise we must also replace the offending characters with safe escape
-// sequences.
-
- escapable.lastIndex = 0;
- return escapable.test(string) ?
- '"' + string.replace(escapable, function (a) {
- var c = meta[a];
- return typeof c === 'string' ? c :
- '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
- }) + '"' :
- '"' + string + '"';
- }
-
-
- function str(key, holder) {
-
-// Produce a string from holder[key].
-
- var i, // The loop counter.
- k, // The member key.
- v, // The member value.
- length,
- mind = gap,
- partial,
- value = holder[key];
-
-// If the value has a toJSON method, call it to obtain a replacement value.
-
- if (value && typeof value === 'object' &&
- typeof value.toJSON === 'function') {
- value = value.toJSON(key);
- }
-
-// If we were called with a replacer function, then call the replacer to
-// obtain a replacement value.
-
- if (typeof rep === 'function') {
- value = rep.call(holder, key, value);
- }
-
-// What happens next depends on the value's type.
-
- switch (typeof value) {
- case 'string':
- return quote(value);
-
- case 'number':
-
-// JSON numbers must be finite. Encode non-finite numbers as null.
-
- return isFinite(value) ? String(value) : 'null';
-
- case 'boolean':
- case 'null':
-
-// If the value is a boolean or null, convert it to a string. Note:
-// typeof null does not produce 'null'. The case is included here in
-// the remote chance that this gets fixed someday.
-
- return String(value);
-
-// If the type is 'object', we might be dealing with an object or an array or
-// null.
-
- case 'object':
-
-// Due to a specification blunder in ECMAScript, typeof null is 'object',
-// so watch out for that case.
-
- if (!value) {
- return 'null';
- }
-
-// Make an array to hold the partial results of stringifying this object value.
-
- gap += indent;
- partial = [];
-
-// Is the value an array?
-
- if (Object.prototype.toString.apply(value) === '[object Array]') {
-
-// The value is an array. Stringify every element. Use null as a placeholder
-// for non-JSON values.
-
- length = value.length;
- for (i = 0; i < length; i += 1) {
- partial[i] = str(i, value) || 'null';
- }
-
-// Join all of the elements together, separated with commas, and wrap them in
-// brackets.
-
- v = partial.length === 0 ? '[]' :
- gap ? '[\n' + gap +
- partial.join(',\n' + gap) + '\n' +
- mind + ']' :
- '[' + partial.join(',') + ']';
- gap = mind;
- return v;
- }
-
-// If the replacer is an array, use it to select the members to be stringified.
-
- if (rep && typeof rep === 'object') {
- length = rep.length;
- for (i = 0; i < length; i += 1) {
- k = rep[i];
- if (typeof k === 'string') {
- v = str(k, value);
- if (v) {
- partial.push(quote(k) + (gap ? ': ' : ':') + v);
- }
- }
- }
- } else {
-
-// Otherwise, iterate through all of the keys in the object.
-
- for (k in value) {
- if (Object.hasOwnProperty.call(value, k)) {
- v = str(k, value);
- if (v) {
- partial.push(quote(k) + (gap ? ': ' : ':') + v);
- }
- }
- }
- }
-
-// Join all of the member texts together, separated with commas,
-// and wrap them in braces.
-
- v = partial.length === 0 ? '{}' :
- gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +
- mind + '}' : '{' + partial.join(',') + '}';
- gap = mind;
- return v;
- }
- }
-
-// If the JSON object does not yet have a stringify method, give it one.
-
- if (typeof JSON.stringify !== 'function') {
- JSON.stringify = function (value, replacer, space) {
-
-// The stringify method takes a value and an optional replacer, and an optional
-// space parameter, and returns a JSON text. The replacer can be a function
-// that can replace values, or an array of strings that will select the keys.
-// A default replacer method can be provided. Use of the space parameter can
-// produce text that is more easily readable.
-
- var i;
- gap = '';
- indent = '';
-
-// If the space parameter is a number, make an indent string containing that
-// many spaces.
-
- if (typeof space === 'number') {
- for (i = 0; i < space; i += 1) {
- indent += ' ';
- }
-
-// If the space parameter is a string, it will be used as the indent string.
-
- } else if (typeof space === 'string') {
- indent = space;
- }
-
-// If there is a replacer, it must be a function or an array.
-// Otherwise, throw an error.
-
- rep = replacer;
- if (replacer && typeof replacer !== 'function' &&
- (typeof replacer !== 'object' ||
- typeof replacer.length !== 'number')) {
- throw new Error('JSON.stringify');
- }
-
-// Make a fake root object containing our value under the key of ''.
-// Return the result of stringifying the value.
-
- return str('', {'': value});
- };
- }
-
-
-// If the JSON object does not yet have a parse method, give it one.
-
- if (typeof JSON.parse !== 'function') {
- JSON.parse = function (text, reviver) {
-
-// The parse method takes a text and an optional reviver function, and returns
-// a JavaScript value if the text is a valid JSON text.
-
- var j;
-
- function walk(holder, key) {
-
-// The walk method is used to recursively walk the resulting structure so
-// that modifications can be made.
-
- var k, v, value = holder[key];
- if (value && typeof value === 'object') {
- for (k in value) {
- if (Object.hasOwnProperty.call(value, k)) {
- v = walk(value, k);
- if (v !== undefined) {
- value[k] = v;
- } else {
- delete value[k];
- }
- }
- }
- }
- return reviver.call(holder, key, value);
- }
-
-
-// Parsing happens in four stages. In the first stage, we replace certain
-// Unicode characters with escape sequences. JavaScript handles many characters
-// incorrectly, either silently deleting them, or treating them as line endings.
-
- cx.lastIndex = 0;
- if (cx.test(text)) {
- text = text.replace(cx, function (a) {
- return '\\u' +
- ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
- });
- }
-
-// In the second stage, we run the text against regular expressions that look
-// for non-JSON patterns. We are especially concerned with '()' and 'new'
-// because they can cause invocation, and '=' because it can cause mutation.
-// But just to be safe, we want to reject all unexpected forms.
-
-// We split the second stage into 4 regexp operations in order to work around
-// crippling inefficiencies in IE's and Safari's regexp engines. First we
-// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
-// replace all simple value tokens with ']' characters. Third, we delete all
-// open brackets that follow a colon or comma or that begin the text. Finally,
-// we look to see that the remaining characters are only whitespace or ']' or
-// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
-
- if (/^[\],:{}\s]*$/.
-test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').
-replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
-replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
-
-// In the third stage we use the eval function to compile the text into a
-// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
-// in JavaScript: it can begin a block or an object literal. We wrap the text
-// in parens to eliminate the ambiguity.
-
- j = eval('(' + text + ')');
-
-// In the optional fourth stage, we recursively walk the new structure, passing
-// each name/value pair to a reviver function for possible transformation.
-
- return typeof reviver === 'function' ?
- walk({'': j}, '') : j;
- }
-
-// If the text is not JSON parseable, then a SyntaxError is thrown.
-
- throw new SyntaxError('JSON.parse');
- };
- }
-})();
-
-/**
- * Serialize an object to a JSON string.
- */
-JSON.encode = JSON.stringify;
-
-/**
- * Deserialize an object from a JSON string.
- */
-JSON.decode = JSON.parse;
diff --git a/utils/platforms/default/lib/object.js b/utils/platforms/default/lib/object.js
deleted file mode 100755
index 4e30ca8..0000000
--- a/utils/platforms/default/lib/object.js
+++ /dev/null
@@ -1,27 +0,0 @@
-
-if (!Object.keys) {
- Object.keys = function (object) {
- var keys = [];
- for (var name in object) {
- if (Object.prototype.hasOwnProperty.call(object, name)) {
- keys.push(name);
- }
- }
- return keys;
- };
-}
-
-if (!Object.create) {
- Object.create = function (prototype) {
- var Type = function () {};
- Type.prototype = prototype;
- return new Type();
- };
-}
-
-if (!Object.freeze) {
- Object.freeze = function (object) {
- return object;
- };
-}
-
diff --git a/utils/platforms/default/lib/os-platform.js b/utils/platforms/default/lib/os-platform.js
deleted file mode 100755
index 9d3a6f8..0000000
--- a/utils/platforms/default/lib/os-platform.js
+++ /dev/null
@@ -1,3 +0,0 @@
-exports.exit = function(status) {
- throw new Error("Exiting with status="+status);
-}
diff --git a/utils/platforms/default/lib/reactor.js b/utils/platforms/default/lib/reactor.js
deleted file mode 100755
index 9e8541a..0000000
--- a/utils/platforms/default/lib/reactor.js
+++ /dev/null
@@ -1,12 +0,0 @@
-
-var tasks = [];
-
-require('unload').when(function () {
- while (tasks.length)
- tasks.shift()();
-});
-
-exports.enqueue = function (task) {
- tasks.push(task);
-};
-
diff --git a/utils/platforms/default/lib/string.js b/utils/platforms/default/lib/string.js
deleted file mode 100755
index 849d71d..0000000
--- a/utils/platforms/default/lib/string.js
+++ /dev/null
@@ -1,89 +0,0 @@
-// String additions
-
-String.prototype.forEach = function(block, separator) {
- system.print("WARNING: String.prototype.forEach deprecated");
- block(String(this)); // RHINO bug: it thinks "this" is a Java string (?!)
-};
-
-String.prototype.squeeze = function() {
- var set = arguments.length > 0 ? "["+Array.prototype.join.apply(arguments, ["]|["])+"]" : ".|\\n",
- regex = new RegExp("("+set+")\\1+", "g");
-
- return this.replace(regex, "$1");
-};
-
-String.prototype.chomp = function(separator) {
- var extra = separator ? separator + "|" : "";
- return this.replace(new RegExp("("+extra+"\\r|\\n|\\r\\n)*$"), "");
-};
-
-// Check if the string starts with the given prefix string.
-String.prototype.begins = function(str) {
- return this.indexOf(str) === 0;
-};
-
-// Check if the string ends with the given postfix string.
-String.prototype.ends = function(str) {
- var offset = this.length - str.length;
- return offset >= 0 && this.lastIndexOf(str) === offset;
-};
-
-// Trim the string, left/right.
-//
-// Faster version: http://blog.stevenlevithan.com/archives/faster-trim-javascript
-//
-// function trim (str) {
-// var str = str.replace(/^\s\s*/, ''),
-// ws = /\s/,
-// i = str.length;
-// while (ws.test(str.charAt(--i)));
-// return str.slice(0, i + 1);
-// }
-//Trim the string, left.
-var trimBeginExpression = /^\s\s*/g;
-String.prototype.trimBegin = function() {
- return this.replace(trimBeginExpression, "");
-};
-
-// Trim the string, right.
-var trimEndExpression = /\s\s*$/g;
-String.prototype.trimEnd = function() {
- return this.replace(trimEndExpression, "");
-};
-
-String.prototype.trim = function() {
- return this.replace(trimBeginExpression, "").replace(trimEndExpression, "");
-};
-
-/* binary */
-
-// https://wiki.mozilla.org/ServerJS/Binary/B
-if (!String.prototype.toByteString)
- String.prototype.toByteString = function(charset) {
- // RHINO bug: it thinks "this" is a Java string (?!)
- var binary = require("binary");
- return new binary.ByteString(String(this), charset);
- };
-
-// https://wiki.mozilla.org/ServerJS/Binary/B
-if (!String.prototype.toByteArray)
- String.prototype.toByteArray = function(charset) {
- // RHINO bug: it thinks "this" is a Java string (?!)
- var binary = require("binary");
- return new binary.ByteArray(String(this), charset);
- };
-
-// https://wiki.mozilla.org/ServerJS/Binary/B
-if (!String.prototype.charCodes)
- String.prototype.charCodes = function() {
- return Array.prototype.map.call(this, function (c) {
- return c.charCodeAt();
- });
- };
-
-// https://wiki.mozilla.org/ServerJS/Binary/B
-if (!String.prototype.fromCharCodes)
- String.fromCharCodes = function (codes) {
- return codes.map(String.fromCharCode).join('');
- };
-
diff --git a/utils/platforms/default/lib/system.js b/utils/platforms/default/lib/system.js
deleted file mode 100755
index fc60af0..0000000
--- a/utils/platforms/default/lib/system.js
+++ /dev/null
@@ -1,16 +0,0 @@
-
-var IO = require("./io").IO;
-
-exports.stdin = new IO(function(){}, null);
-exports.stdout = new IO(null, function(string) { print(String(string).replace(/\n$/,"")); });
-exports.stderr = new IO(null, function(string) { print(String(string).replace(/\n$/,"")); });
-
-exports.args = global.arguments || [];
-
-exports.env = {};
-
-exports.fs = require('./file');
-
-// default logger
-var Logger = require("logger").Logger;
-exports.log = new Logger(exports.stdout);
diff --git a/utils/platforms/k7/bin/narwhal-k7 b/utils/platforms/k7/bin/narwhal-k7
deleted file mode 100755
index 495c9d8..0000000
--- a/utils/platforms/k7/bin/narwhal-k7
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/bash
-
-# get the absolute path of the executable
-SELF_PATH=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && SELF_PATH=$SELF_PATH/$(basename -- "$0")
-
-# resolve symlinks
-while [ -h $SELF_PATH ]; do
- DIR=$(dirname -- "$SELF_PATH")
- SYM=$(readlink $SELF_PATH)
- SELF_PATH=$(cd $DIR && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
-done
-
-NARWHAL_PLATFORM_HOME=$(dirname $(dirname $SELF_PATH))
-BOOTSTRAP="$NARWHAL_PLATFORM_HOME/bootstrap.js"
-
-if [ ! "$NARWHAL_HOME" ]; then
- NARWHAL_HOME=$(dirname $(dirname $NARWHAL_PLATFORM_HOME))
-fi
-
-export NARWHAL_HOME
-
-# uses rlwrap (readline wrapper) if present
-K7="$(which rlwrap) k7"
-
-# drop into shell if there are no additional arguments
-if [ $# -lt 1 ]; then
- # FIXME: no way to explicitly drop into shell
- $K7 $BOOTSTRAP "$@"
-else
- MAIN=$(cd -P -- "$(dirname -- "$1")" && pwd -P) && MAIN=$MAIN/$(basename -- "$1" .js)
- $K7 $BOOTSTRAP $MAIN "$0" "$@"
-fi
diff --git a/utils/platforms/k7/bootstrap.js b/utils/platforms/k7/bootstrap.js
deleted file mode 100755
index 4fc18f5..0000000
--- a/utils/platforms/k7/bootstrap.js
+++ /dev/null
@@ -1,78 +0,0 @@
-(function (evalGlobal) {
-
- // NOTE: Newer version of K7 (>May 2009) does not but anything
- // else than modules in the global namespace
- if (typeof(ENV) == "undefined") {
- GLOBAL = system.GLOBAL
- ENV = system.ENV;
- print = system.shell.print;
- }
-
- var prefix = ENV["NARWHAL_HOME"];
- var debug = false;
-
- _system = system;
-
- var fopen = _system.posix.fopen,
- fread = _system.posix.fread,
- fclose = _system.posix.fclose;
-
- var isFile = function (path) {
- try { read(path); } catch(e) { return false; }
- return true;
- };
-
- var read = function(path) {
- var result = "",
- fd = fopen(path, "r");
- if (!fd)
- throw new Error("File not found: " + path);
- try {
- var length = 1024,
- data;
- do {
- length *= 2;
- data = fread(1, length, fd);
- result += data;
- } while (data.length === length);
- } finally {
- fclose(fd);
- }
- if (result.length === 0)
- throw new Error("File not found (length=0): " + path);
- return result;
- };
-
- var isFile = function(path) {
- return _system.posix.isFile(path);
- }
-
- var _print = print;
- delete print;
-
- eval(read(prefix + "/narwhal.js"))({
- global: GLOBAL,
- evalGlobal: evalGlobal,
- platform: 'k7',
- platforms: ['k7', 'v8', 'c', 'default'],
- debug: debug,
- print: function (string) {
- _print("" + string);
- },
- evaluate: function (text) {
- return eval("(function(require,exports,module,system,print){" + text + "/**/\n})");
- },
- fs: {
- read: read,
- isFile: isFile
- },
- prefix: prefix,
- complianceStage: "system"
- });
-
-})(function () {
- return eval(arguments[0]);
-});
-
-//throw "Exiting. (FIXME: this exception does not mean an actual error occurred, we just need a better way to exit)";
-// EOF - vim: ts=4 sw=4 et
diff --git a/utils/platforms/k7/lib/binary.js b/utils/platforms/k7/lib/binary.js
deleted file mode 100755
index 139597f..0000000
--- a/utils/platforms/k7/lib/binary.js
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
diff --git a/utils/platforms/k7/lib/file-platform.js b/utils/platforms/k7/lib/file-platform.js
deleted file mode 100755
index 89680cc..0000000
--- a/utils/platforms/k7/lib/file-platform.js
+++ /dev/null
@@ -1,116 +0,0 @@
-
-var exports = require('./file');
-
-exports.SEPARATOR = '/';
-
-exports.cwd = function () {
- throw Error("cwd not yet implemented.");
-};
-
-// TODO necessary for package loading
-exports.list = function (path) {
- throw Error("list not yet implemented.");
-};
-
-// TODO necessary for package loading
-exports.canonical = function (path) {
- throw Error("canonical not yet implemented.");
-};
-
-exports.exists = function (path) {
- throw Error("exists not yet implemented.");
-};
-
-// TODO necessary for lazy module reloading in sandboxes
-exports.mtime = function (path) {
- return exports.stat(path).mtime;
-};
-
-exports.size = function (path) {
- throw Error("size not yet implemented.");
-};
-
-exports.stat = function (path) {
- return _system.posix.stat(path);
-};
-
-// TODO necessary for package loading
-exports.isDirectory = function (path) {
- throw Error("isDirectory not yet implemented.");
-};
-
-// TODO necessary for module loading
-exports.isFile = function (path) {
- throw Error("isFile not yet implemented.");
-};
-
-exports.isFile = system.fs.isFile; // TEMPORARY HACK
-
-exports.isLink = function (path) {
- throw Error("isLink not yet implemented.");
-};
-
-exports.isReadable = function (path) {
- throw Error("isReadable not yet implemented.");
-};
-
-exports.isWritable = function (path) {
- throw Error("isWritable not yet implemented.");
-};
-
-exports.rename = function (source, target) {
- throw Error("rename not yet implemented.");
-};
-
-exports.move = function (source, target) {
- throw Error("move not yet implemented.");
-};
-
-exports.remove = function (path) {
- throw Error("remove not yet implemented.");
-};
-
-exports.mkdir = function (path) {
- throw Error("mkdir not yet implemented.");
-};
-
-exports.rmdir = function(path) {
- throw Error("rmdir not yet implemented.");
-};
-
-exports.touch = function (path, mtime) {
- throw Error("touch not yet implemented.");
-};
-
-// FIXME temporary hack
-var read = system.fs.read; // from k7 bootstrap fixtures
-
-exports.FileIO = function (path, mode, permissions) {
- mode = exports.mode(mode);
- var read = mode.read,
- write = mode.write,
- append = mode.append,
- update = mode.update;
-
- if (update) {
- throw new Error("Updating IO not yet implemented.");
- } else if (write || append) {
- throw new Error("Writing IO not yet implemented.");
- } else if (read) {
- // FIXME temporary hack
- return {
- 'read': function () {
- return read(path);
- },
- 'close': function () {
- },
- 'isatty': function () {
- return false;
- }
- };
- } else {
- throw new Error("Files must be opened either for read, write, or update mode.");
- }
-};
-
-// vim: ts=4 sw=4 et
diff --git a/utils/platforms/k7/lib/io-platform.js b/utils/platforms/k7/lib/io-platform.js
deleted file mode 100755
index 363544f..0000000
--- a/utils/platforms/k7/lib/io-platform.js
+++ /dev/null
@@ -1,8 +0,0 @@
-
-exports.IO = function () {
-};
-
-exports.TextIOWrapper = function (raw, mode, lineBuffering, buffering, charset, options) {
- return raw;
-};
-
diff --git a/utils/platforms/k7/lib/system.js b/utils/platforms/k7/lib/system.js
deleted file mode 100755
index a92b8dd..0000000
--- a/utils/platforms/k7/lib/system.js
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
-var IO = require("./io").IO;
-
-exports.stdin = new IO(function(){}, null);
-exports.stdout = new IO(null, function(string) { print(String(string).replace(/\n$/,"")); });
-exports.stderr = new IO(null, function(string) { print(String(string).replace(/\n$/,"")); });
-*/
-
-exports.args = ENV["argv"].slice(2);
-
-exports.env = {};
-
-for (var key in ENV)
- if (key !== "argc" && key !== "argv")
- exports.env[key] = ENV[key];
-
-delete ENV;
-
-exports.fs = require('./file');
-
-/*
-// default logger
-var Logger = require("logger").Logger;
-exports.log = new Logger(exports.stdout);
-*/
diff --git a/utils/platforms/rhino/bin/narwhal-rhino b/utils/platforms/rhino/bin/narwhal-rhino
deleted file mode 100755
index 488362a..0000000
--- a/utils/platforms/rhino/bin/narwhal-rhino
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/bash
-
-# get the absolute path of the executable
-SELF_PATH=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && SELF_PATH="$SELF_PATH/$(basename -- "$0")"
-
-# resolve symlinks
-while [ -h "$SELF_PATH" ]; do
- DIR=$(dirname -- "$SELF_PATH")
- SYM=$(readlink -- "$SELF_PATH")
- SELF_PATH=$(cd -- "$DIR" && cd -- $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
-done
-
-# NARWHAL_PLATFORM_HOME is the 2nd ancestor directory of this shell script
-export NARWHAL_PLATFORM_HOME=$(dirname -- "$(dirname -- "$SELF_PATH")")
-
-BOOTSTRAP=$NARWHAL_PLATFORM_HOME/bootstrap.js
-
-if [ -z "$NARWHAL_HOME" ]; then
- NARWHAL_HOME=$(dirname -- "$(dirname -- "$NARWHAL_PLATFORM_HOME")")
-fi
-
-CLASSPATH=$NARWHAL_PLATFORM_HOME/jars/js.jar:$NARWHAL_PLATFORM_HOME/jars/jline.jar
-if [ -z "$NARWHAL_CLASSPATH" ]; then
- CLASSPATH=$NARWHAL_CLASSPATH:$CLASSPATH
-fi
-
-if [ "$(which cygpath 2>/dev/null)" ]; then
- CLASSPATH=$(cygpath -wp -- "$CLASSPATH")
- BOOTSTRAP=$(cygpath -wa -- "$BOOTSTRAP")
- export NARWHAL_HOME=$(cygpath -wa -- "$NARWHAL_HOME")
- export NARWHAL_PLATFORM_HOME=$(cygpath -wa -- "$NARWHAL_PLATFORM_HOME")
-fi
-
-JAVA_MAIN=org.mozilla.javascript.tools.shell.Main
-
-# drop into shell if there are no additional arguments
-if [ $# -lt 1 ]; then
- java -cp "$CLASSPATH" "$JAVA_MAIN" -f "$BOOTSTRAP" -f -
-else
- java -cp "$CLASSPATH" "$JAVA_MAIN" "$BOOTSTRAP" "$0" "$@"
-fi
-
diff --git a/utils/platforms/rhino/bin/narwhal-rhino.cmd b/utils/platforms/rhino/bin/narwhal-rhino.cmd
deleted file mode 100755
index 646675a..0000000
--- a/utils/platforms/rhino/bin/narwhal-rhino.cmd
+++ /dev/null
@@ -1,25 +0,0 @@
-@echo off
-setlocal
-
-:: NARWHAL_PLATFORM_HOME is the parent the bin directory
-set NARWHAL_PLATFORM_HOME=%~dp0..
-
-set BOOTSTRAP=%NARWHAL_PLATFORM_HOME%\bootstrap.js
-
-if "%NARWHAL_HOME%" == "" (
- set NARWHAL_HOME=%NARWHAL_PLATFORM_HOME%\..\..
-)
-
-set CLASSPATH=%NARWHAL_PLATFORM_HOME%\jars\js.jar;%NARWHAL_PLATFORM_HOME%\jars\jline.jar
-if not "%NARWHAL_CLASSPATH%" == "" (
- set CLASSPATH=%NARWHAL_CLASSPATH%;%CLASSPATH%
-)
-
-set JAVA_MAIN=org.mozilla.javascript.tools.shell.Main
-
-:: drop into shell if there are no additional arguments
-if "%1" == "" (
- java -cp "%CLASSPATH%" "%JAVA_MAIN%" -f "%BOOTSTRAP%" -f -
-) else (
- java -cp "%CLASSPATH%" "%JAVA_MAIN%" "%BOOTSTRAP%" "%0" %*
-)
diff --git a/utils/platforms/rhino/bootstrap.js b/utils/platforms/rhino/bootstrap.js
deleted file mode 100755
index 4c19cb6..0000000
--- a/utils/platforms/rhino/bootstrap.js
+++ /dev/null
@@ -1,105 +0,0 @@
-(function(global, evalGlobal) {
-
- /*
- this is a minimal platform-specific thunk for narwhal.js
- that brings the NARWHAL_PATH environment variable into the global
- scope using Rhino's special access to Java.
- */
-
- var moduleScopingEnabled = false;
-
- /* this gets used for several fixtures */
- var context = Packages.org.mozilla.javascript.Context.getCurrentContext();
-
- var prefix = "";
- if (typeof NARWHAL_HOME != "undefined") {
- prefix = NARWHAL_HOME;
- delete NARWHAL_HOME;
- } else {
- prefix = String(Packages.java.lang.System.getenv("NARWHAL_HOME") || "");
- }
-
- var packagePrefixes = [prefix];
-
- if (typeof SEA != "undefined") {
- packagePrefixes.push(SEA);
- }
-
- // TODO: enable this via a command line switch
- context.setOptimizationLevel(-1);
-
- var isFile = function (path) {
- try { return new java.io.File(path).isFile(); } catch (e) {}
- return false;
- };
-
- var read = function (path) {
- var path = new java.io.File(path),
- stream = new java.io.FileInputStream(path);
- try {
- var buffer = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, path.length());
- stream.read(buffer);
- return String(new java.lang.String(buffer, "UTF-8"));
- } finally {
- stream.close();
- }
- };
-
- var evaluate = function (text, name, lineNo) {
- var scope;
-
- if (moduleScopingEnabled) {
- scope = new Object();
- scope.__parent__ = null;
- scope.__proto__ = global;
- } else {
- scope = global;
- }
-
- return context.compileFunction(
- scope,
- "function(require,exports,module,system,print){"+text+"\n// */\n}",
- name,
- lineNo,
- null
- );
- };
-
- delete global.print;
- var print = function (string) {
- Packages.java.lang.System.out.println(String(string));
- };
-
- var narwhal = context.evaluateReader(
- global,
- new Packages.java.io.FileReader(prefix + "/narwhal.js"),
- "narwhal.js",
- 1,
- null
- );
-
- var debug = +String(Packages.java.lang.System.getenv("NARWHAL_DEBUG"));
- var verbose = +String(Packages.java.lang.System.getenv("NARWHAL_VERBOSE"));
- var os = String(Packages.java.lang.System.getProperty("os.name"));
-
- narwhal({
- global: global,
- evalGlobal: evalGlobal,
- platform: 'rhino',
- platforms: ['rhino', 'default'],
- os: os,
- print: print,
- fs: {
- read: read,
- isFile: isFile
- },
- prefix: prefix,
- packagePrefixes: packagePrefixes,
- evaluate: evaluate,
- debug: debug,
- verbose: verbose
- });
-
-})(this, function () {
- return eval(arguments[0]);
-});
diff --git a/utils/platforms/rhino/jars/jline.jar b/utils/platforms/rhino/jars/jline.jar
deleted file mode 100755
index dafca7c..0000000
--- a/utils/platforms/rhino/jars/jline.jar
+++ /dev/null
Binary files differ
diff --git a/utils/platforms/rhino/jars/js.jar b/utils/platforms/rhino/jars/js.jar
deleted file mode 100755
index 3f4628a..0000000
--- a/utils/platforms/rhino/jars/js.jar
+++ /dev/null
Binary files differ
diff --git a/utils/platforms/rhino/lib/binary-platform.js b/utils/platforms/rhino/lib/binary-platform.js
deleted file mode 100755
index fda53fa..0000000
--- a/utils/platforms/rhino/lib/binary-platform.js
+++ /dev/null
@@ -1,44 +0,0 @@
-exports.B_LENGTH = function(bytes) {
- return bytes.length;
-}
-
-exports.B_ALLOC = function(length) {
- return java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, length);
-}
-
-exports.B_FILL = function(bytes, length, offset, value) {
- java.util.Arrays.fill(bytes, length, offset, value);
-}
-
-exports.B_COPY = function(src, srcOffset, dst, dstOffset, length) {
- java.lang.System.arraycopy(src, srcOffset, dst, dstOffset, length);
-}
-
-exports.B_GET = function(bytes, index) {
- var b = bytes[index];
- return (b >= 0) ? b : -1 * ((b ^ 0xFF) + 1);
-}
-
-exports.B_SET = function(bytes, index, value) {
- return bytes[index] = (value < 128) ? value : -1 * ((value ^ 0xFF) + 1);
-}
-
-exports.B_DECODE = function(bytes, offset, length, codec) {
- return String(new java.lang.String(bytes, offset, length, codec));
-}
-
-exports.B_DECODE_DEFAULT = function(bytes, offset, length) {
- return String(new java.lang.String(bytes, offset, length));
-}
-
-exports.B_ENCODE = function(string, codec) {
- return new java.lang.String(string).getBytes(codec);
-}
-
-exports.B_ENCODE_DEFAULT = function(string) {
- return new java.lang.String(string).getBytes();
-}
-
-exports.B_TRANSCODE = function(bytes, offset, length, sourceCodec, targetCodec) {
- return new java.lang.String(bytes, offset, length, sourceCodec).getBytes(targetCodec);
-}
diff --git a/utils/platforms/rhino/lib/binary.js b/utils/platforms/rhino/lib/binary.js
deleted file mode 100755
index 6a26ab4..0000000
--- a/utils/platforms/rhino/lib/binary.js
+++ /dev/null
@@ -1,435 +0,0 @@
-/* Binary */
-
-var Binary = exports.Binary = function() {
- // this._bytes
- // this._offset
- // this._length
-}
-
-Binary.prototype.__defineGetter__("length", function() { return this._length; });
-Binary.prototype.__defineSetter__("length", function(length) { print("x trying to set length: " + length); });
-
-// toArray() - n array of the byte values
-// toArray(charset) - an array of the code points, decoded
-Binary.prototype.toArray = function(codec) {
- if (arguments.length === 0) {
- var bytes = new Array(this._length);
-
- for (var i = 0; i < this._length; i++) {
- var b = this._bytes[i + this._offset];
- // Java "bytes" are interpreted as 2's complement
- bytes[i] = (b >= 0) ? b : -1 * ((b ^ 0xFF) + 1);
- }
-
- return bytes;
- }
- else if (arguments.length === 1) {
- var string = new java.lang.String(this._bytes, this._offset, this._length, codec),
- length = string.length(),
- array = new Array(length);
-
- for (var i = 0; i < length; i++)
- array[i] = string.codePointAt(i);
-
- return array;
- }
- else
- throw new Error("Illegal arguments to toArray()");
-};
-
-// toByteArray() - just a copy
-// toByteArray(sourceCharset, targetCharset) - transcoded
-Binary.prototype.toByteArray = function(sourceCodec, targetCodec) {
- if (arguments.length < 2)
- return new ByteArray(this);
- else if (arguments.length === 2 && typeof sourceCodec === "string" && typeof targetCodec === "string") {
- var bytes = new java.lang.String(this._bytes, this._offset, this._length, sourceCodec).getBytes(targetCodec);
- return new ByteArray(bytes, 0, bytes.length);
- }
-
- throw new Error("Illegal arguments to ByteArray toByteArray");
-};
-
-// toByteString() - byte for byte copy
-// toByteString(sourceCharset, targetCharset) - transcoded
-Binary.prototype.toByteString = function(sourceCodec, targetCodec) {
- if (arguments.length < 2)
- return new ByteString(this);
- else if (arguments.length === 2 && typeof sourceCodec === "string" && typeof targetCodec === "string") {
- var bytes = new java.lang.String(this._bytes, this._offset, this._length, sourceCodec).getBytes(targetCodec);
- return new ByteString(bytes, 0, bytes.length);
- }
-
- throw new Error("Illegal arguments to ByteArray toByteString");
-};
-
-// decodeToString()
-// decodeToString(charset) - returns a String from its decoded bytes in a given charset. If no charset is provided, or if the charset is "undefined", assumes the default system encoding.
-// decodeToString(number) - returns a String from its decoded bytes in a given base, like 64, 32, 16, 8, 2
-Binary.prototype.decodeToString = function(charset) {
- if (charset) {
- if (typeof charset == "number")
- return require("base" + charset).encode(this);
- else if (charset.begins("base"))
- return require(charset).encode(this);
- else
- return String(new java.lang.String(this._bytes, this._offset, this._length, charset));
- }
- return String(new java.lang.String(this._bytes, this._offset, this._length));
-};
-
-// byteAt(offset) - Return the byte at offset as a Number.
-Binary.prototype.byteAt = function(offset) {
- if (offset < 0 || offset >= this._length)
- return NaN;
-
- return this._bytes[this._offset + offset];
-};
-
-// valueOf()
-Binary.prototype.valueOf = function() {
- return this;
-};
-
-/* ByteString */
-
-var ByteString = exports.ByteString = function() {
- if (!(this instanceof ByteString)) {
- if (arguments.length == 0)
- return new ByteString();
- if (arguments.length == 1)
- return new ByteString(arguments[0]);
- if (arguments.length == 2)
- return new ByteString(arguments[0], arguments[1]);
- if (arguments.length == 3)
- return new ByteString(arguments[0], arguments[1], arguments[2]);
- }
-
- // ByteString() - Construct an empty byte string.
- if (arguments.length === 0) {
- this._bytes = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 0); // null;
- this._offset = 0;
- this._length = 0;
- }
- // ByteString(byteString) - Copies byteString.
- else if (arguments.length === 1 && arguments[0] instanceof ByteString) {
- return arguments[0];
- }
- // ByteString(byteArray) - Use the contents of byteArray.
- else if (arguments.length === 1 && arguments[0] instanceof ByteArray) {
- var copy = arguments[0].toByteArray();
- this._bytes = copy._bytes;
- this._offset = copy._offset;
- this._length = copy._length;
- }
- // ByteString(arrayOfNumbers) - Use the numbers in arrayOfNumbers as the bytes.
- else if (arguments.length === 1 && Array.isArray(arguments[0])) {
- var bytes = arguments[0];
- this._bytes = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, bytes.length);
- for (var i = 0; i < bytes.length; i++) {
- var b = bytes[i];
- // If any element is outside the range 0...255, an exception (TODO) is thrown.
- if (b < -0x80 || b > 0xFF)
- throw new Error("ByteString constructor argument Array of integers must be -128 - 255 ("+b+")");
- // Java "bytes" are interpreted as 2's complement
- this._bytes[i] = (b < 128) ? b : -1 * ((b ^ 0xFF) + 1);
- }
- this._offset = 0;
- this._length = this._bytes.length;
- }
- // ByteString(string, charset) - Convert a string. The ByteString will contain string encoded with charset.
- else if ((arguments.length === 1 || (arguments.length === 2 && arguments[1] === undefined)) && typeof arguments[0] === "string") {
- this._bytes = new java.lang.String(arguments[0]).getBytes();
- this._offset = 0;
- this._length = this._bytes.length;
- }
- else if (arguments.length === 2 && typeof arguments[0] === "string" && typeof arguments[1] === "string") {
- this._bytes = new java.lang.String(arguments[0]).getBytes(arguments[1]);
- this._offset = 0;
- this._length = this._bytes.length;
- }
- // private: ByteString(bytes, offset, length)
- else if (arguments.length === 3 && Array.isArray(arguments[0]) && typeof arguments[1] === "number" && typeof arguments[2] === "number") {
- this._bytes = arguments[0];
- this._offset = arguments[1];
- this._length = arguments[2];
- }
- else
- throw new Error("Illegal arguments to ByteString constructor: [" +
- Array.prototype.join.apply(arguments, [","]) + "] ("+arguments.length+")");
-
- //seal(this);
-};
-
-ByteString.prototype = new Binary();
-
-ByteString.prototype.__defineGetter__("length", function() { return this._length; });
-ByteString.prototype.__defineSetter__("length", function(length) {});
-
-ByteString.prototype.toString = function(charset) {
- if (charset)
- return this.decodeToString(charset);
-
- return "[ByteString "+this.length+"]";
-}
-
-ByteString.prototype.indexOf = function(byteValue, start, stop) {
- var array = this.slice(start, stop).toArray(),
- result = array.indexOf(byteValue);
- return (result < 0) ? -1 : result + (start || 0);
-};
-
-ByteString.prototype.lastIndexOf = function(byteValue, start, stop) {
- var array = this.slice(start, stop).toArray(),
- result = array.lastIndexOf(byteValue);
- return (result < 0) ? -1 : result + (start || 0);
-};
-
-ByteString.prototype.charCodeAt = Binary.prototype.byteAt;
-
-ByteString.prototype.charAt = function(offset) {
- var byteValue = this.charCodeAt(offset);
-
- if (isNaN(byteValue))
- return new ByteString();
-
- return new ByteString([byteValue]);
-};
-
-ByteString.prototype.split = function(delimiter, options) {
- throw "NYI";
-};
-
-ByteString.prototype.slice = function(begin, end) {
- if (begin === undefined)
- begin = 0;
- else if (begin < 0)
- begin = this._length + begin;
-
- if (end === undefined)
- end = this._length;
- else if (end < 0)
- end = this._length + end;
-
- begin = Math.min(this._length, Math.max(0, begin));
- end = Math.min(this._length, Math.max(0, end));
-
- return new ByteString(this._bytes, this._offset + begin, end - begin);
-};
-
-ByteString.prototype.substr = function(start, length) {
- if (start !== undefined) {
- if (length !== undefined)
- return this.slice(start);
- else
- return this.slice(start, start + length);
- }
- return this.slice();
-};
-
-ByteString.prototype.substring = function(from, to) {
- if (from !== undefined) {
- if (to !== undefined)
- return this.slice(Math.max(Math.min(begin, this._length), 0));
- else
- return this.slice(Math.max(Math.min(begin, this._length), 0),
- Math.max(Math.min(end, this._length), 0));
- }
- return this.slice();
-};
-
-ByteString.prototype.toSource = function() {
- return "ByteString(["+this.toArray().join(",")+"])";
-}
-
-/* ByteArray */
-
-var ByteArray = exports.ByteArray = function() {
- if (!this instanceof ByteArray) {
- if (arguments.length == 0)
- return new ByteArray();
- if (arguments.length == 1)
- return new ByteArray(arguments[0]);
- if (arguments.length == 2)
- return new ByteArray(arguments[0], arguments[1]);
- if (arguments.length == 3)
- return new ByteArray(arguments[0], arguments[1], arguments[2]);
- }
-
- // ByteArray() - New, empty ByteArray.
- if (arguments.length === 0) {
- this._bytes = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 0); // null;
- this._offset = 0;
- this._length = 0;
- }
- // ByteArray(length) - New ByteArray filled with length zero bytes.
- else if (arguments.length === 1 && typeof arguments[0] === "number") {
- this._bytes = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, arguments[0]); // null;
- this._offset = 0;
- this._length = this._bytes.length;
- }
- // ByteArray(byteArray) - Copy byteArray.
- // ByteArray(byteString) - Copy contents of byteString.
- else if (arguments.length === 1 && (arguments[0] instanceof ByteArray || arguments[0] instanceof ByteString)) {
- var byteArray = new ByteArray(arguments[0]._length);
- java.lang.System.arraycopy(arguments[0]._bytes, arguments[0]._offset, byteArray._bytes, byteArray._offset, byteArray._length);
- return byteArray;
- }
- // ByteArray(arrayOfBytes) - Use numbers in arrayOfBytes as contents.
- // Throws an exception if any element is outside the range 0...255 (TODO).
- else if (arguments.length === 1 && Array.isArray(arguments[0])) {
- var bytes = arguments[0];
- this._bytes = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, bytes.length);
- for (var i = 0; i < bytes.length; i++) {
- var b = bytes[i];
- // If any element is outside the range 0...255, an exception (TODO) is thrown.
- if (b < 0 || b > 0xFF)
- throw new Error("ByteString constructor argument Array of integers must be 0 - 255 ("+b+")");
- // Java "bytes" are interpreted as 2's complement
- this._bytes[i] = (b < 128) ? b : -1 * ((b ^ 0xFF) + 1);
- }
- this._offset = 0;
- this._length = this._bytes.length;
- }
- // ByteArray(string, charset) - Create a ByteArray from a Javascript string, the result being encoded with charset.
- else if ((arguments.length === 1 || (arguments.length === 2 && arguments[1] === undefined)) && typeof arguments[0] === "string") {
- this._bytes = new java.lang.String(arguments[0]).getBytes();
- this._offset = 0;
- this._length = this._bytes.length;
- }
- else if (arguments.length === 2 && typeof arguments[0] === "string" && typeof arguments[1] === "string") {
- this._bytes = new java.lang.String(arguments[0]).getBytes(arguments[1]);
- this._offset = 0;
- this._length = this._bytes.length;
- }
- // private: ByteArray(bytes, offset, length)
- else if (arguments.length === 3 && Array.isArray(arguments[0]) && typeof arguments[1] === "number" && typeof arguments[2] === "number") {
- this._bytes = arguments[0];
- this._offset = arguments[1];
- this._length = arguments[2];
- }
- else
- throw new Error("Illegal arguments to ByteString constructor: [" +
- Array.prototype.join.apply(arguments, [","]) + "] ("+arguments.length+")");
-}
-
-ByteArray.prototype = new Binary();
-
-ByteArray.prototype.__defineGetter__("length", function() { return this._length; });
-ByteArray.prototype.__defineSetter__("length", function(length) {
- if (typeof length !== "number")
- return;
-
- // same length
- if (length === this.length) {
- return;
- }
- // new length is less, truncate
- else if (length < this._length) {
- this._length = length;
- }
- // new length is more, but fits without moving, just clear new bytes
- else if (this._offset + length <= this._bytes.length) {
- java.util.Arrays.fill(this._bytes, this._length, this._offset + length - 1, 0);
- this._length = length;
- }
- // new length is more, but fits if we shift to bottom, so do that.
- else if (length <= this._bytes.length) {
- java.lang.System.arraycopy(this._bytes, this._offset, this._bytes, 0, this._length);
- this._offset = 0;
- java.util.Arrays.fill(this._bytes, this._length, this._offset + length - 1, 0);
- this._length = length;
- }
- // new length is more than the allocated bytes array, allocate a new one and copy the data
- else {
- var newBytes = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, length);
- java.lang.System.arraycopy(this._bytes, this._offset, newBytes, 0, this._length);
- this._bytes = newBytes;
- this._offset = 0;
- this._length = length;
- }
-});
-
-// toString() - a string representation like "[ByteArray 10]"
-// toString(charset) - an alias for decodeToString(charset)
-ByteArray.prototype.toString = function(charset) {
- if (charset)
- return this.decodeToString(charset);
-
- return "[ByteArray "+this.length+"]";
-}
-
-// concat(other ByteArray|ByteString|Array)
-ByteArray.prototype.concat = function() {
- throw "NYI";
-}
-
-// pop() -> byte Number
-ByteArray.prototype.pop = function() {
- if (this._length === 0)
- return undefined;
-
- this._length--;
-
- return this._bytes[this._offset + this._length];
-}
-
-// push(...variadic Numbers...)-> count Number
-ByteArray.prototype.push = function() {
- throw "NYI";
-}
-
-// shift() -> byte Number
-ByteArray.prototype.shift = function() {
- if (this._length === 0)
- return undefined;
-
- this._length--;
- this._offset++;
-
- return this._bytes[this._offset - 1];
-}
-
-// unshift(...variadic Numbers...) -> count Number
-ByteArray.prototype.unshift = function() {
- throw "NYI";
-}
-
-// reverse() in place reversal
-ByteArray.prototype.reverse = function() {
- throw "NYI";
-}
-
-// slice()
-ByteArray.prototype.slice = function() {
- return new ByteArray(ByteString.prototype.apply.slice(this, arguments));
-}
-
-// sort()
-ByteArray.prototype.sort = function() {
- // FIXME: inefficient
- var array = this.toArray()
- return new ByteArray(array.sort.apply(array, arguments));
-}
-
-// splice()
-ByteArray.prototype.splice = function() {
- throw "NYI";
-}
-
-// toSource() returns a string like "ByteArray([])" for a null byte-array.
-ByteArray.prototype.toSource = function() {
- return "ByteArray(["+this.toArray().join(",")+"])";
-}
-
-/* BinaryIO */
-
-exports.BinaryIO = function(binary) {
- if (!binary)
- throw "NYI";
-
- var stream = new (require("io").IO)(new java.io.ByteArrayInputStream(binary._bytes, binary._offset, binary._length), null);
- stream.length = binary.length;
- return stream;
-};
-
diff --git a/utils/platforms/rhino/lib/file-platform.js b/utils/platforms/rhino/lib/file-platform.js
deleted file mode 100755
index 99819b1..0000000
--- a/utils/platforms/rhino/lib/file-platform.js
+++ /dev/null
@@ -1,224 +0,0 @@
-
-// use the "file" module as the exports object.
-var exports = require('./file');
-
-// File: Rhino
-
-var IO = require("./io").IO;
-var os = require('./os');
-
-var javaRuntime = function () {
- return Packages.java.lang.Runtime.getRuntime();
-};
-
-var javaPopen = function (command) {
- return javaRuntime().exec(command);
-};
-
-/* streams */
-
-exports.FileIO = function (path, mode, permissions) {
- path = JavaPath(path);
-
- var {
- read: read,
- write: write,
- append: append,
- update: update
- } = exports.mode(mode);
-
- if (update) {
- throw new Error("Updating IO not yet implemented.");
- } else if (write || append) {
- return new IO(null, new Packages.java.io.FileOutputStream(path, append));
- } else if (read) {
- return new IO(new Packages.java.io.FileInputStream(path), null);
- } else {
- throw new Error("Files must be opened either for read, write, or update mode.");
- }
-};
-
-/* paths */
-
-exports.cwd = function () {
- return String(Packages.java.lang.System.getProperty("user.dir"));
-};
-
-var JavaPath = function (path) {
- return new java.io.File(String(path));
-};
-
-exports.canonical = function (path) {
- return String(JavaPath(path).getCanonicalPath());
-};
-
-exports.mtime = function (path) {
- path = JavaPath(path);
- var lastModified = path.lastModified();
- if (lastModified === 0) return undefined;
- else return new Date(lastModified);
-};
-
-exports.size = function (path) {
- path = JavaPath(path);
- return path.length();
-};
-
-exports.stat = function (path) {
- path = JavaPath(path);
- return {
- mtime: exports.mtime(path),
- size: exports.size(path)
- }
-};
-
-exports.exists = function (path) {
- return JavaPath(path).exists();
-};
-
-exports.linkExists = function (path) {
- return exports.isLink(path) || exports.exists(path);
-};
-
-exports.isDirectory = function (path) {
- try { return JavaPath(path).isDirectory(); } catch (e) {}
- return false;
-};
-
-exports.isFile = function (path) {
- try { return JavaPath(path).isFile(); } catch (e) {}
- return false;
-};
-
-// XXX not standard
-exports.isAbsolute = function (path) {
- return new java.io.File(path).isAbsolute();
-};
-
-/* java doesn't provide isLink, but File.getCanonical leaks
- information about whether a file is a link, so we use the canonical
- file name of a path and the canonical file name of the
- containing directory to infer whether the file is a link.
-*/
-exports.isLink = function (path) {
- path = exports.path(path);
- var canonical = path.canonical().toString();
- var container = path.resolve('.').canonical();
- if (path.isDirectory()) {
- return container.toString() != canonical;
- } else {
- return container.join('').resolve(path.basename()).toString() != canonical;
- }
-};
-
-exports.isReadable = function (path) {
- return JavaPath(path).canRead();
-};
-
-exports.isWritable = function (path) {
- return JavaPath(path).canWrite();
-};
-
-exports.chmod = function (path, mode) {
- os.command(['chmod', mode.toString(8), path]);
-};
-
-exports.chown = function (path, owner, group) {
-
- if (!owner)
- owner = "";
- else
- owner = String(owner);
-
- if (group)
- group = String(group);
-
- if (/:/.test(owner))
- throw new Error("Invalid owner name");
- if (/:/.test(group))
- throw new Error("Invalid group name");
-
- if (group)
- owner = owner + ":" + String(group);
-
- os.command(['chown', owner, path]);
-};
-
-exports.link = function (source, target) {
- os.command(['ln', source, target]);
-};
-
-exports.symlink = function (source, target) {
- // XXX this behavior of resolving the source
- // path from the target path when the source
- // path is relative ought to be discussed
- // on ServerJS
- if (exports.isRelative(source))
- source = exports.relative(target, source);
- os.command(['ln', '-s', source, target]);
-};
-
-exports.rename = function (source, target) {
- source = exports.path(source);
- target = source.resolve(target);
- source = JavaPath(source);
- target = JavaPath(target);
- if (!source.renameTo(target))
- throw new Error("failed to rename " + source + " to " + target);
-};
-
-exports.move = function (source, target) {
- source = exports.path(source);
- target = exports.path(target);
- source = JavaPath(source);
- target = JavaPath(target);
- if (!source.renameTo(target))
- throw new Error("failed to rename " + source + " to " + target);
-};
-
-exports.remove = function (path) {
- if (!JavaPath(path)['delete']())
- throw new Error("failed to delete " + path);
-};
-
-exports.mkdir = function (path) {
- if (!JavaPath(path).mkdir())
- throw new Error("failed to make directory " + path);
-};
-
-exports.mkdirs = function(path) {
- JavaPath(path).mkdirs();
- if (!exports.isDirectory(path))
- throw new Error("failed to make directories leading to " + path);
-};
-
-exports.rmdir = function(path) {
- if (!JavaPath(String(path))['delete']())
- throw new Error("failed to remove the directory " + path);
-};
-
-exports.list = function (path) {
- path = JavaPath(String(path));
- var listing = path.list();
-
- if (!(listing instanceof Array)) {
- throw new Error("no such directory: " + path);
- }
-
- var paths = [];
- for (var i = 0; i < listing.length; i++) {
- paths[i] = String(listing[i]);
- }
-
- return paths;
-};
-
-exports.touch = function (path, mtime) {
- if (mtime === undefined || mtime === null)
- mtime = new Date();
- path = JavaPath(path);
- path.createNewFile();
- if (!path.setLastModified(mtime.getTime()))
- throw new Error("unable to set mtime of " + path + " to " + mtime);
-};
-
diff --git a/utils/platforms/rhino/lib/http-platform.js b/utils/platforms/rhino/lib/http-platform.js
deleted file mode 100755
index 2b3f5b8..0000000
--- a/utils/platforms/rhino/lib/http-platform.js
+++ /dev/null
@@ -1,10 +0,0 @@
-
-var IO = require('./io').IO;
-
-exports.IO = function (url) {
- return new IO(
- new java.net.URL(url).openStream(),
- null
- );
-};
-
diff --git a/utils/platforms/rhino/lib/io-platform.js b/utils/platforms/rhino/lib/io-platform.js
deleted file mode 100755
index 616a332..0000000
--- a/utils/platforms/rhino/lib/io-platform.js
+++ /dev/null
@@ -1,358 +0,0 @@
-// IO: Rhino
-
-var ByteString = require("./binary").ByteString;
-
-var IO = exports.IO = function(inputStream, outputStream) {
- this.inputStream = inputStream;
- this.outputStream = outputStream;
-};
-
-IO.prototype.read = function(length) {
- var readAll = false,
- buffer = null,
- bytes = null,
- total = 0,
- index = 0,
- read = 0;
-
- if (arguments.length == 0) {
- readAll = true;
- }
- if (typeof length !== "number") {
- length = 1024;
- }
-
- buffer = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, length);
-
- do {
- read = this.inputStream.read(buffer, index, length - index);
-
- if (read < 0)
- break;
-
- if (bytes) {
- bytes.write(buffer, index, read);
- index = 0;
- } else {
- index += read;
- if (index === buffer.length && readAll) {
- bytes = new java.io.ByteArrayOutputStream(length * 2);
- bytes.write(buffer, 0, length);
- index = 0;
- }
- }
- total += read;
-
-
- } while ((readAll || total < length) && read > -1);
-
- var resultBuffer, resultLength;
-
- if (bytes) {
- resultBuffer = bytes.toByteArray();
- } else if (total < buffer.length) {
- resultBuffer = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, total);
- java.lang.System.arraycopy(buffer, 0, resultBuffer, 0, total);
- } else {
- resultBuffer = buffer;
- }
-
- resultLength = resultBuffer.length;
-
- if (total != resultLength || total !== resultBuffer.length)
- throw new Error("IO.read sanity check failed: total="+total+" resultLength="+resultLength+" resultBuffer.length="+resultBuffer.length);
-
- return new ByteString(resultBuffer, 0, resultBuffer.length);
-};
-
-IO.prototype.copy = function (output, mode, options) {
- while (true) {
- var buffer = this.read(null);
- if (!buffer.length)
- break;
- output.write(buffer);
- }
- output.flush();
- return this;
-};
-
-IO.prototype.write = function(object, charset) {
- if (object === null || object === undefined || typeof object.toByteString !== "function")
- throw new Error("Argument to IO.write must have toByteString() method");
-
- var binary = object.toByteString(charset);
- this.outputStream.write(binary._bytes, binary._offset, binary.length);
- return this;
-};
-
-IO.prototype.flush = function() {
- this.outputStream.flush();
- return this;
-};
-
-IO.prototype.close = function() {
- if (this.inputStream)
- this.inputStream.close();
- if (this.outputStream)
- this.outputStream.close();
-};
-
-IO.prototype.isatty = function () {
- return false;
-};
-
-exports.TextInputStream = function (raw, lineBuffering, buffering, charset, options) {
- var stream;
-
- if (charset === undefined)
- stream = new Packages.java.io.InputStreamReader(raw.inputStream);
- else
- stream = new Packages.java.io.InputStreamReader(raw.inputStream, charset);
-
- if (buffering === undefined)
- stream = new Packages.java.io.BufferedReader(stream);
- else
- stream = new Packages.java.io.BufferedReader(stream, buffering);
-
- var self = this;
-
- self.raw = raw;
-
- self.readLine = function () {
- var line = stream.readLine();
- if (line === null)
- return '';
- return String(line) + "\n";
- };
-
- self.itertor = function () {
- return self;
- };
-
- self.next = function () {
- var line = stream.readLine();
- if (line === null)
- throw StopIteration;
- return String(line);
- };
-
- self.iterator = function () {
- return self;
- };
-
- self.forEach = function (block, context) {
- var line;
- while (true) {
- try {
- line = self.next();
- } catch (exception) {
- break;
- }
- block.call(context, line);
- }
- };
-
- self.input = function () {
- throw "NYI";
- };
-
- self.readLines = function () {
- var lines = [];
- do {
- var line = self.readLine();
- if (line.length)
- lines.push(line);
- } while (line.length);
- return lines;
- };
-
- self.read = function () {
- return self.readLines().join('');
- };
-
- self.readInto = function (buffer) {
- throw "NYI";
- };
-
- self.copy = function (output, mode, options) {
- do {
- var line = self.readLine();
- output.write(line);
- } while (line.length);
- output.flush();
- return self;
- };
-
- self.close = function () {
- stream.close();
- };
-
-};
-
-exports.TextOutputStream = function (raw, lineBuffering, buffering, charset, options) {
- var stream;
-
- if (charset === undefined)
- stream = new Packages.java.io.OutputStreamWriter(raw.outputStream);
- else
- stream = new Packages.java.io.OutputStreamWriter(raw.outputStream, charset);
-
- if (buffering === undefined)
- stream = new Packages.java.io.BufferedWriter(stream);
- else
- stream = new Packages.java.io.BufferedWriter(stream, buffering);
-
- var self = this;
-
- self.raw = raw;
-
- self.write = function () {
- stream.write.apply(stream, arguments);
- return self;
- };
-
- self.writeLine = function (line) {
- self.write(line + "\n"); // todo recordSeparator
- return self;
- };
-
- self.writeLines = function (lines) {
- lines.forEach(self.writeLine);
- return self;
- };
-
- self.print = function () {
- self.write(Array.prototype.join.call(arguments, " ") + "\n");
- self.flush();
- // todo recordSeparator, fieldSeparator
- return self;
- };
-
- self.flush = function () {
- stream.flush();
- return self;
- };
-
- self.close = function () {
- stream.close();
- return self;
- };
-
-};
-
-exports.TextIOWrapper = function (raw, mode, lineBuffering, buffering, charset, options) {
- if (mode.update) {
- return new exports.TextIOStream(raw, lineBuffering, buffering, charset, options);
- } else if (mode.write || mode.append) {
- return new exports.TextOutputStream(raw, lineBuffering, buffering, charset, options);
- } else if (mode.read) {
- return new exports.TextInputStream(raw, lineBuffering, buffering, charset, options);
- } else {
- throw new Error("file must be opened for read, write, or append mode.");
- }
-};
-
-var ByteIO = exports.ByteIO = function (initial) {
-};
-
-var StringIO = exports.StringIO = function (initial) {
- var buffer = new java.lang.StringBuffer();
- if (initial)
- buffer.append(initial);
-
- function length() {
- return buffer.length();
- }
-
- function read(length) {
- if (arguments.length == 0) {
- var result = String(buffer);
- buffer['delete'](0, buffer.length());
- return result;
- } else {
- if (!length || length < 1)
- length = 1024;
- length = Math.min(buffer.length(), length);
- var result = String(buffer.substring(0, length));
- buffer['delete'](0, length);
- return result;
- }
- }
-
- function write(text) {
- buffer.append(text);
- return self;
- }
-
- function copy(output) {
- output.write(read()).flush();
- return self;
- }
-
- function next() {
- if (buffer.length() == 0)
- throw StopIteration;
- var pos = buffer.indexOf("\n");
- if (pos == -1)
- pos = buffer.length();
- var result = read(pos);
- read(1);
- return result;
- }
-
- var self = {
- get length() {
- return length();
- },
- read: read,
- write: write,
- copy: copy,
- close: function () {
- return self;
- },
- flush: function () {
- return self;
- },
- iterator: function () {
- return self;
- },
- forEach: function (block) {
- while (true) {
- try {
- block.call(this, next());
- } catch (exception) {
- if (exception instanceof StopIteration)
- break;
- throw exception;
- }
- }
- },
- readLine: function () {
- var pos = buffer.indexOf("\n");
- if (pos == -1)
- pos = buffer.length();
- return read(pos + 1);
- },
- next: next,
- print: function (line) {
- return write(line + "\n").flush();
- },
- toString: function() {
- return String(buffer);
- },
- substring: function () {
- var string = String(buffer);
- return string.substring.apply(string, arguments);
- },
- slice: function () {
- var string = String(buffer);
- return string.slice.apply(string, arguments);
- },
- substr: function () {
- var string = String(buffer);
- return string.substr.apply(string, arguments);
- }
- };
- return self;
-};
-
diff --git a/utils/platforms/rhino/lib/md5.js b/utils/platforms/rhino/lib/md5.js
deleted file mode 100755
index 265df51..0000000
--- a/utils/platforms/rhino/lib/md5.js
+++ /dev/null
@@ -1,40 +0,0 @@
-
-var binary = require("./binary");
-
-var JString = Packages.java.lang.String,
- JInteger = Packages.java.lang.Integer,
- JStringBuffer = Packages.java.lang.StringBuffer,
- JMessageDigest = Packages.java.security.MessageDigest;
-
-exports.hash = function (str) {
- var jstr = new JString(str);
- var algorithm = JMessageDigest.getInstance("MD5");
- algorithm.reset();
- algorithm.update(jstr.getBytes());
- var bytes = algorithm.digest();
- return binary.ByteString(bytes);
-};
-
-// deprecated
-//
-
-var MD5 = exports.MD5 = {};
-
-MD5.hexdigest = function(str) {
- system.log.warn('hexdigest is depreacted, use md5.hash().toString(16)');
- var jstr = new JString(str);
- var algorithm = JMessageDigest.getInstance("MD5");
-
- algorithm.reset();
- algorithm.update(jstr.getBytes());
-
- var messageDigest = algorithm.digest();
-
- var hexString = new JStringBuffer();
- for (var i = 0; i < messageDigest.length; i++) {
- hexString.append(JInteger.toHexString(0xFF & messageDigest[i]));
- }
-
- return String(hexString.toString());
-};
-
diff --git a/utils/platforms/rhino/lib/os-platform.js b/utils/platforms/rhino/lib/os-platform.js
deleted file mode 100755
index c186b28..0000000
--- a/utils/platforms/rhino/lib/os-platform.js
+++ /dev/null
@@ -1,114 +0,0 @@
-
-var io = require('io');
-
-exports.exit = function (status) {
- Packages.java.lang.System.exit(status << 0);
-};
-
-exports.sleep = function (seconds) {
- Packages.java.lang.Thread.sleep((seconds * 1000) >>> 0);
-};
-
-exports.fork = function () {
-};
-
-exports.exec = function () {
-};
-
-exports.dup = function () {
-};
-
-exports.dup2 = function () {
-};
-
-exports.setsid = function () {
-};
-
-exports.getpid = function () {
-};
-
-var javaRuntime = function () {
- return Packages.java.lang.Runtime.getRuntime();
-};
-
-var javaPopen = function (command) {
- return javaRuntime().exec(command);
-};
-
-exports.popen = function (command, options) {
- // todo options: "b", {charset, shell}
- if (!options)
- options = {};
- if (typeof command == "string")
- command = ["sh", "-c", command];
-
- var process = javaPopen(command);
-
- var stdin = new io.TextOutputStream(new io.IO(null, process.getOutputStream()));
- var stdout = new io.TextInputStream(new io.IO(process.getInputStream()));
- var stderr = new io.TextInputStream(new io.IO(process.getErrorStream()));
-
- return {
- wait: function () {
- return process.waitFor();
- },
- stdin: stdin,
- stdout: stdout,
- stderr: stderr,
- communicate: function (input, output, errput) {
-
- if (typeof stdin == "string")
- stdin = new io.StringIO(input);
- else if (!stdin)
- stdin = new io.StringIO();
-
- if (!input)
- input = new io.StringIO();
- if (!output)
- output = new io.StringIO();
- if (!errput)
- errput = new io.StringIO();
-
- var inThread = new JavaAdapter(Packages.java.lang.Thread, {
- "run": function () {
- input.copy(stdin);
- stdin.close();
- }
- });
-
- var outThread = new JavaAdapter(Packages.java.lang.Thread, {
- "run": function () {
- stdout.copy(output);
- stdout.close();
- }
- });
-
- var errThread = new JavaAdapter(Packages.java.lang.Thread, {
- "run": function () {
- stderr.copy(errput);
- stderr.close();
- }
- });
-
- inThread.setDaemon(true);
- inThread.start();
- errThread.setDaemon(true);
- errThread.start();
- outThread.setDaemon(true);
- outThread.start();
-
- inThread.join();
- outThread.join();
- errThread.join();
-
- var code = process.waitFor();
-
- return {
- code: code,
- stdout: output,
- stderr: errput
- };
- }
- }
-};
-
diff --git a/utils/platforms/rhino/lib/packages-platform.js b/utils/platforms/rhino/lib/packages-platform.js
deleted file mode 100755
index 3ed74ac..0000000
--- a/utils/platforms/rhino/lib/packages-platform.js
+++ /dev/null
@@ -1,71 +0,0 @@
-
-var fs = require('./file');
-var system = require('./system');
-
-/*** analyze
-*/
-exports.analyze = function (analysis, sortedPackages) {
- var javaPaths = analysis.javaPaths = []
- sortedPackages.forEach(function (packageData) {
- /* migration */
- if (packageData.jars)
- packageData.java = packageData.jars;
- /* /migration */
- if (typeof packageData.java == 'string')
- packageData.java = [packageData.java];
- if (!packageData.java)
- packageData.java = [];
- for (var i = 0; i < packageData.java.length; i++)
- packageData.java[i] = packageData.directory.resolve(packageData.java[i]);
- /* new approach */
- var jarsDirectory = packageData.directory.join('jars');
- if (jarsDirectory.isDirectory()) {
- jarsDirectory.listPaths().forEach(function (jarDirectory) {
- packageData.java.push(jarDirectory);
- });
- }
- javaPaths.unshift.apply(javaPaths, packageData.java);
- });
-};
-
-/*** synthesize
-*/
-exports.synthesize = function (analysis) {
- exports.addJavaPaths(analysis.javaPaths);
-};
-
-var loader = Packages.java.lang.ClassLoader.getSystemClassLoader();
-// so that replacing Packages does not implicitly dispose of the
-// only means of creating new Packages objects.
-
-/*** addJavaPaths
-*/
-exports.addJavaPaths = function addJavaPaths(javaPaths) {
- if (!javaPaths || javaPaths.length === 0)
- return;
- // after reinstalling Packages once, the Packages object
- // is no longer a Packages constructor function.
- // If that's the case, abandone hope.
- if (typeof Packages == "object")
- return;
-
- /* set up jar loader */
- var urls = Packages.java.lang.reflect.Array.newInstance(java.net.URL, javaPaths.length);
- for (var i = 0; i < javaPaths.length; i++) {
- urls[i] = new Packages.java.net.URL('file://' + javaPaths[i]);
- };
- loader = new Packages.java.net.URLClassLoader(urls, loader);
-
- try {
- /* intall jar loader */
- //Packages.java.lang.Thread.currentThread().setContextClassLoader(loader);
- var context = Packages.org.mozilla.javascript.Context.getCurrentContext();
- context.setApplicationClassLoader(loader);
- // must explicitly be made global when each module has it's own scope
- global.Packages = new Packages(loader);
- installed = true;
- } catch (e) {
- print("warning: couldn't install jar loader: " + e);
- }
-};
-
diff --git a/utils/platforms/rhino/lib/process.js b/utils/platforms/rhino/lib/process.js
deleted file mode 100755
index 1545032..0000000
--- a/utils/platforms/rhino/lib/process.js
+++ /dev/null
@@ -1,5 +0,0 @@
-var Process = exports.Process = {};
-
-Process.exec = function(cmd) {
- return java.lang.Runtime.getRuntime().exec(cmd);
-} \ No newline at end of file
diff --git a/utils/platforms/rhino/lib/sandbox-platform.js b/utils/platforms/rhino/lib/sandbox-platform.js
deleted file mode 100755
index 552853f..0000000
--- a/utils/platforms/rhino/lib/sandbox-platform.js
+++ /dev/null
@@ -1,70 +0,0 @@
-
-/* shared, sealed global context */
-
-var blacklist = [
- 'Packages',
- 'java',
- 'javax',
- 'org',
- 'net',
- 'com',
- 'edu',
- 'JavaAdapter',
- 'JavaImporter',
- 'getClass'
-];
-
-var whitelist = [
- 'Array',
- 'Boolean',
- 'Date',
- 'Error',
- 'EvalError',
- 'Function',
- 'Math',
- 'Number',
- 'Object',
- 'RangeError',
- 'ReferenceError',
- 'InternalError',
- 'RegExp',
- 'String',
- 'SyntaxError',
- 'TypeError',
- 'URIError',
- 'Infinity',
- 'NaN',
- 'undefined',
- 'decodeURI',
- 'decodeURIComponent',
- 'encodeURI',
- 'encodeURIComponent',
- 'eval',
- 'isFinite',
- 'isNaN',
- 'parseFloat',
- 'parseInt'
-];
-
-var context = new Packages.org.mozilla.javascript.Context();
-var global = context.initStandardObjects(null, true);
-for (var i = 0; i < blacklist.length; i++)
- delete global[blacklist[i]];
-seal(global);
-
-
-/* create module factories */
-
-exports.evaluate = function (text, id) {
- // verify that the script is a program by compiling it as such
- context.compileString(text, id, 1, null);
- // return a module factory function instead though.
- return context.compileFunction(
- global,
- "function(require,exports,module,system,print){"+text+"}",
- id,
- 1,
- null
- );
-};
-
diff --git a/utils/platforms/rhino/lib/system.js b/utils/platforms/rhino/lib/system.js
deleted file mode 100755
index eb83625..0000000
--- a/utils/platforms/rhino/lib/system.js
+++ /dev/null
@@ -1,24 +0,0 @@
-
-var io = require("./io");
-
-exports.stdin = new io.TextInputStream(new io.IO(Packages.java.lang.System['in'], null));
-exports.stdout = new io.TextOutputStream(new io.IO(null, Packages.java.lang.System.out));
-exports.stderr = new io.TextOutputStream(new io.IO(null, Packages.java.lang.System.err));
-
-exports.args = global.arguments || [];
-
-exports.env = {};
-
-var env = Packages.java.lang.System.getenv(),
- keyIterator = env.keySet().iterator();
-while (keyIterator.hasNext()) {
- var key = keyIterator.next();
- exports.env[String(key)] = String(env.get(key));
-}
-
-exports.fs = require('./file');
-
-// default logger
-var Logger = require("./logger").Logger;
-exports.log = new Logger(exports.stderr);
-
diff --git a/utils/platforms/rhino/lib/zip.js b/utils/platforms/rhino/lib/zip.js
deleted file mode 100755
index f8e2323..0000000
--- a/utils/platforms/rhino/lib/zip.js
+++ /dev/null
@@ -1,78 +0,0 @@
-
-var io = require('io');
-
-var javaZip = Packages.java.util.zip;
-var JavaZipFile = javaZip.ZipFile;
-var JavaZipEntry = javaZip.ZipEntry;
-
-exports.unzip = function (source, target) {
- if (!target)
- target = system.fs.path(source).absolute().dirname();
- target = system.fs.path(target);
- return new exports.Unzip(source).forEach(function (entry) {
- var targetPath = target.join(entry.getName());
- if (entry.isDirectory())
- return;
- targetPath.dirname().mkdirs();
- targetPath.write(entry.read('b'), 'b');
- });
-};
-
-exports.Unzip = function (path) {
- this._javaZipFile = JavaZipFile(path);
-};
-
-exports.Unzip.prototype.iterator = function () {
- var self = this;
- var enumeration = this._javaZipFile.entries();
- return {
- next: function () {
- if (!enumeration.hasMoreElements())
- throw new StopIteration();
- return new exports.Entry(
- self._javaZipFile,
- enumeration.nextElement()
- );
- }
- };
-};
-
-exports.Unzip.prototype.forEach = function (block, context) {
- var iterator = this.iterator();
- var next;
- while (true) {
- try {
- next = iterator.next();
- } catch (exception) {
- break;
- }
- block.call(context, next);
- }
-};
-
-exports.Entry = function (javaZipFile, javaZipEntry) {
- this._javaZipFile = javaZipFile;
- this._javaZipEntry = javaZipEntry;
-};
-
-exports.Entry.prototype.getName = function () {
- return String(this._javaZipEntry.getName());
-};
-
-exports.Entry.prototype.isDirectory = function () {
- return Boolean(this._javaZipEntry.isDirectory());
-};
-
-exports.Entry.prototype.open = function (mode, options) {
- // TODO mode and options negotiation
- return new io.IO(this._javaZipFile.getInputStream(this._javaZipEntry));
-};
-
-exports.Entry.prototype.read = function () {
- return this.open().read();
-};
-
-exports.Entry.prototype.copy = function (output, mode, options) {
- return this.open().copy(output);
-};
-
diff --git a/utils/platforms/secure/lib/file.js b/utils/platforms/secure/lib/file.js
deleted file mode 100755
index 6707660..0000000
--- a/utils/platforms/secure/lib/file.js
+++ /dev/null
@@ -1,6 +0,0 @@
-
-for (var name in system.fs) {
- if (Object.prototype.hasOwnProperty.call(system.fs, name))
- exports[name] = system.fs[name];
-}
-
diff --git a/utils/platforms/secure/lib/system.js b/utils/platforms/secure/lib/system.js
deleted file mode 100755
index 9e3272a..0000000
--- a/utils/platforms/secure/lib/system.js
+++ /dev/null
@@ -1,6 +0,0 @@
-
-for (var name in system) {
- if (Object.prototype.hasOwnProperty.call(system, name)) {
- exports[name] = system[name];
- }
-}
diff --git a/utils/platforms/template/bin/narwhal-platform-name b/utils/platforms/template/bin/narwhal-platform-name
deleted file mode 100755
index 9b04263..0000000
--- a/utils/platforms/template/bin/narwhal-platform-name
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/bash
-
-# get the absolute path of the executable
-SELF_PATH=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && SELF_PATH=$SELF_PATH/$(basename -- "$0")
-
-# resolve symlinks
-while [ -h $SELF_PATH ]; do
- DIR=$(dirname -- "$SELF_PATH")
- SYM=$(readlink $SELF_PATH)
- SELF_PATH=$(cd $DIR && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
-done
-
-NARWHAL_PLATFORM_HOME=$(dirname $(dirname $SELF_PATH))
-BOOTSTRAP="$NARWHAL_PLATFORM_HOME/bootstrap.js"
-
-if [ ! "$NARWHAL_HOME" ]; then
- NARWHAL_HOME=$(dirname $(dirname $NARWHAL_PLATFORM_HOME))
-fi
-
-export NARWHAL_HOME
-
-# uses rlwrap (readline wrapper) if present
-NARWHAL="$(which rlwrap) narwhal-platform" # TODO replace narwhal-platform with js bin
-
-# drop into shell if there are no additional arguments
-if [ $# -lt 1 ]; then
- # FIXME: no way to explicitly drop into shell
- $NARWHAL $BOOTSTRAP "$@"
-else
- MAIN=$(cd -P -- "$(dirname -- "$1")" && pwd -P) && MAIN=$MAIN/$(basename -- "$1" .js)
- $NARWHAL $BOOTSTRAP $MAIN "$0" "$@"
-fi
diff --git a/utils/platforms/template/bootstrap.js b/utils/platforms/template/bootstrap.js
deleted file mode 100755
index df03512..0000000
--- a/utils/platforms/template/bootstrap.js
+++ /dev/null
@@ -1,38 +0,0 @@
-(function (evalGlobal) {
-
- var read = /*TODO*/; // function(path:string):string
-
- var isFile = /*TODO*/; // function(path:string):boolean
-
- var prefix = "/path/to/narwhal"; /*TODO*/
-
- eval(read(prefix + "/narwhal.js"))({
- global: this,
- evalGlobal: evalGlobal,
- platform: '<<<name>>>', /*TODO*/
- platforms: ['<<<name>>>', 'default'], /*TODO*/
- os: "", /* TODO /\bwindows\b/i for Windows FS support */
- // XXX platforms may include any number of
- // prioritized generic platforms like:
- // rhino, java, c, v8, default
- print: print,
- evaluate: function (text) {
- // TODO maybe something better here:
- return eval(
- "(function(require,exports,module,system,print){" +
- text +
- "/**/\n})"
- );
- },
- fs: {
- read: read,
- isFile: isFile
- },
- prefix: prefix,
- debug: false,
- verbose: false
- });
-
-}).call(this, function () {
- return eval(arguments[0]);
-});
diff --git a/utils/platforms/template/lib/file-platform.js b/utils/platforms/template/lib/file-platform.js
deleted file mode 100755
index 5249fb3..0000000
--- a/utils/platforms/template/lib/file-platform.js
+++ /dev/null
@@ -1,118 +0,0 @@
-
-var exports = require('./file');
-
-exports.SEPARATOR = '/';
-
-exports.cwd = function () {
- throw Error("cwd not yet implemented.");
-};
-
-// TODO necessary for package loading
-exports.list = function (path) {
- throw Error("list not yet implemented.");
-};
-
-// TODO necessary for package loading
-exports.canonical = function (path) {
- throw Error("canonical not yet implemented.");
-};
-
-exports.exists = function (path) {
- throw Error("exists not yet implemented.");
-};
-
-// TODO necessary for lazy module reloading in sandboxes
-exports.mtime = function (path) {
- throw Error("mtime not yet implemented.");
-};
-
-exports.size = function (path) {
- throw Error("size not yet implemented.");
-};
-
-exports.stat = function (path) {
- return {
- mtime: exports.mtime(path),
- size: exports.size(path)
- }
-};
-
-// TODO necessary for package loading
-exports.isDirectory = function (path) {
- throw Error("isDirectory not yet implemented.");
-};
-
-// TODO necessary for module loading
-exports.isFile = function (path) {
- throw Error("isFile not yet implemented.");
-};
-// XXX remove this if you implement isFile here
-// from bootstrap system object:
-exports.isFile = system.fs.isFile;
-
-exports.isFile = system.fs.isFile; // TEMPORARY HACK
-
-exports.isLink = function (path) {
- throw Error("isLink not yet implemented.");
-};
-
-exports.isReadable = function (path) {
- throw Error("isReadable not yet implemented.");
-};
-
-exports.isWritable = function (path) {
- throw Error("isWritable not yet implemented.");
-};
-
-exports.rename = function (source, target) {
- throw Error("rename not yet implemented.");
-};
-
-exports.move = function (source, target) {
- throw Error("move not yet implemented.");
-};
-
-exports.remove = function (path) {
- throw Error("remove not yet implemented.");
-};
-
-exports.mkdir = function (path) {
- throw Error("mkdir not yet implemented.");
-};
-
-exports.rmdir = function(path) {
- throw Error("rmdir not yet implemented.");
-};
-
-exports.touch = function (path, mtime) {
- throw Error("touch not yet implemented.");
-};
-
-// FIXME temporary hack
-var read = system.fs.read; // from bootstrap system object
-
-exports.FileIO = function (path, mode, permissions) {
- mode = exports.mode(mode);
- var read = mode.read,
- write = mode.write,
- append = mode.append,
- update = mode.update;
-
- if (update) {
- throw new Error("Updating IO not yet implemented.");
- } else if (write || append) {
- throw new Error("Writing IO not yet implemented.");
- } else if (read) {
- // FIXME temporary hack
- return {
- 'read': function () {
- return read(path);
- },
- 'close': function () {
- }
- };
- } else {
- throw new Error("Files must be opened either for read, write, or update mode.");
- }
-};
-
diff --git a/utils/platforms/template/lib/system.js b/utils/platforms/template/lib/system.js
deleted file mode 100755
index a4df800..0000000
--- a/utils/platforms/template/lib/system.js
+++ /dev/null
@@ -1,17 +0,0 @@
-
-var IO = require("./io").IO;
-
-exports.stdin = /*TODO*/
-exports.stdout = /*TODO*/
-exports.stderr = /*TODO*/
-
-exports.args = [/*TODO*/];
-
-exports.env = {}; /*TODO*/
-
-exports.fs = require('./file');
-
-// default logger
-var Logger = require("./logger").Logger;
-exports.log = new Logger(exports.stdout);
-
diff --git a/utils/platforms/v8cgi/bootstrap.js b/utils/platforms/v8cgi/bootstrap.js
deleted file mode 100755
index d4b3098..0000000
--- a/utils/platforms/v8cgi/bootstrap.js
+++ /dev/null
@@ -1,41 +0,0 @@
-(function (evalGlobal) {
-
- var prefix = ".";
-
- var isFile = function (path) {
- return new File(path).exists();
- };
-
- var read = function(path) {
- var result = "",
- f = new File(path);
- try {
- if (!f.exists())
- throw new Error();
-
- f.open("r");
- result = f.read();
-
- } finally {
- f.close();
- }
- return result;
- };
-
- eval(read(prefix + "/narwhal.js"))({
- global: this,
- evalGlobal: evalGlobal,
- platform: 'v8cgi',
- platforms: ['v8cgi', 'v8', 'c', 'default'],
- debug: false,
- print: print,
- fs: {
- read: read,
- isFile: isFile
- },
- prefix: prefix
- });
-
-}).call(this, function () {
- return eval(arguments[0]);
-});
diff --git a/utils/platforms/xulrunner/.gitignore b/utils/platforms/xulrunner/.gitignore
deleted file mode 100755
index 378a962..0000000
--- a/utils/platforms/xulrunner/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-extensions/builds \ No newline at end of file
diff --git a/utils/platforms/xulrunner/LICENSE b/utils/platforms/xulrunner/LICENSE
deleted file mode 100755
index 810b245..0000000
--- a/utils/platforms/xulrunner/LICENSE
+++ /dev/null
@@ -1,33 +0,0 @@
-Version: MPL 1.1/GPL 2.0/LGPL 2.1
-
-The contents of this file are subject to the Mozilla Public License Version
-1.1 (the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-http://www.mozilla.org/MPL/
-
-Software distributed under the License is distributed on an "AS IS" basis,
-WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-for the specific language governing rights and limitations under the
-License.
-
-The Original Code is nsINarwhal.
-
-The Initial Developer of the Original Code is
-Irakli Gozalishvili <rfobic@gmail.com>.
-Portions created by the Initial Developer are Copyright (C) 2009
-the Initial Developer. All Rights Reserved.
-
-Contributor(s):
-Irakli Gozalishvili <rfobic@gmail.com>
-
-Alternatively, the contents of this file may be used under the terms of
-either the GNU General Public License Version 2 or later (the "GPL"), or
-the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-in which case the provisions of the GPL or the LGPL are applicable instead
-of those above. If you wish to allow use of your version of this file only
-under the terms of either the GPL or the LGPL, and not to allow others to
-use your version of this file under the terms of the MPL, indicate your
-decision by deleting the provisions above and replace them with the notice
-and other provisions required by the GPL or the LGPL. If you do not delete
-the provisions above, a recipient may use your version of this file under
-the terms of any one of the MPL, the GPL or the LGPL.
diff --git a/utils/platforms/xulrunner/README.md b/utils/platforms/xulrunner/README.md
deleted file mode 100755
index 2b55737..0000000
--- a/utils/platforms/xulrunner/README.md
+++ /dev/null
@@ -1,16 +0,0 @@
-
-Narwhal Platform: Prototype implementation
-===========================================================
-
-<pre>
-<code>
-export NARWHAL_PLATFORM='xulrunner'
-narhwal
-</code>
-</pre>
-
--------------------------
-
-In order to get narwhal shell you need to put mozrepl extension into
-<code>narwhal/platforms/xulrunner/apps/firenarwhal/extensions</code>
-
diff --git a/utils/platforms/xulrunner/apps/firenarwhal/application.ini b/utils/platforms/xulrunner/apps/firenarwhal/application.ini
deleted file mode 100755
index 0c8bf55..0000000
--- a/utils/platforms/xulrunner/apps/firenarwhal/application.ini
+++ /dev/null
@@ -1,14 +0,0 @@
-[App]
-Vendor=narwhaljs
-Name=firenarwhal
-Version=0.1
-BuildID=20090618
-Copyright=Copyright (c) 2009 Irakli Gozalishvili
-ID=firenarwhal@narwhaljs.org
-
-[Gecko]
-MinVersion=1.9
-MaxVersion=1.9.*
-
-[XRE]
-EnableExtensionManager=true
diff --git a/utils/platforms/xulrunner/apps/firenarwhal/chrome/branding/about.png b/utils/platforms/xulrunner/apps/firenarwhal/chrome/branding/about.png
deleted file mode 100755
index 317d4f5..0000000
--- a/utils/platforms/xulrunner/apps/firenarwhal/chrome/branding/about.png
+++ /dev/null
Binary files differ
diff --git a/utils/platforms/xulrunner/apps/firenarwhal/chrome/branding/aboutCredits.png b/utils/platforms/xulrunner/apps/firenarwhal/chrome/branding/aboutCredits.png
deleted file mode 100755
index cf41883..0000000
--- a/utils/platforms/xulrunner/apps/firenarwhal/chrome/branding/aboutCredits.png
+++ /dev/null
Binary files differ
diff --git a/utils/platforms/xulrunner/apps/firenarwhal/chrome/branding/aboutFooter.png b/utils/platforms/xulrunner/apps/firenarwhal/chrome/branding/aboutFooter.png
deleted file mode 100755
index 94d9124..0000000
--- a/utils/platforms/xulrunner/apps/firenarwhal/chrome/branding/aboutFooter.png
+++ /dev/null
Binary files differ
diff --git a/utils/platforms/xulrunner/apps/firenarwhal/chrome/branding/icon48.png b/utils/platforms/xulrunner/apps/firenarwhal/chrome/branding/icon48.png
deleted file mode 100755
index 4e5c2c8..0000000
--- a/utils/platforms/xulrunner/apps/firenarwhal/chrome/branding/icon48.png
+++ /dev/null
Binary files differ
diff --git a/utils/platforms/xulrunner/apps/firenarwhal/chrome/branding/icon64.png b/utils/platforms/xulrunner/apps/firenarwhal/chrome/branding/icon64.png
deleted file mode 100755
index 5038499..0000000
--- a/utils/platforms/xulrunner/apps/firenarwhal/chrome/branding/icon64.png
+++ /dev/null
Binary files differ
diff --git a/utils/platforms/xulrunner/apps/firenarwhal/chrome/chrome.manifest b/utils/platforms/xulrunner/apps/firenarwhal/chrome/chrome.manifest
deleted file mode 100755
index 91885c3..0000000
--- a/utils/platforms/xulrunner/apps/firenarwhal/chrome/chrome.manifest
+++ /dev/null
@@ -1,3 +0,0 @@
-content firenarwhal file:content/
-content branding file:branding/
-locale branding en-US file:locale/branding/
diff --git a/utils/platforms/xulrunner/apps/firenarwhal/chrome/content/main.xul b/utils/platforms/xulrunner/apps/firenarwhal/chrome/content/main.xul
deleted file mode 100755
index 2761102..0000000
--- a/utils/platforms/xulrunner/apps/firenarwhal/chrome/content/main.xul
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
-<window id="main" title="narwhal"
- width="800" height="600"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- xmlns:html="http://www.w3.org/1999/xhtml"
- hidechrome="true">
- <script src="chrome://narwhal/content/narwhal.js" type="application/x-javascript"/>
-</window>
-
diff --git a/utils/platforms/xulrunner/apps/firenarwhal/chrome/locale/branding/brand.dtd b/utils/platforms/xulrunner/apps/firenarwhal/chrome/locale/branding/brand.dtd
deleted file mode 100755
index f4217bb..0000000
--- a/utils/platforms/xulrunner/apps/firenarwhal/chrome/locale/branding/brand.dtd
+++ /dev/null
@@ -1,7 +0,0 @@
-<!ENTITY brandShortName "firenarwhal">
-<!ENTITY brandFullName "narwhal runtime for xulrunner">
-<!ENTITY vendorShortName "narwhaljs.org">
-<!ENTITY logoCopyright " ">
-
-<!-- LOCALIZATION NOTE (releaseBaseURL): The about: page appends __MOZ_APP_VERSION__.html, e.g. 2.0.html -->
-<!ENTITY releaseBaseURL "http://gozala.github.com/narwhal/firenarwhal/releases/">
diff --git a/utils/platforms/xulrunner/apps/firenarwhal/chrome/locale/branding/brand.properties b/utils/platforms/xulrunner/apps/firenarwhal/chrome/locale/branding/brand.properties
deleted file mode 100755
index 8338316..0000000
--- a/utils/platforms/xulrunner/apps/firenarwhal/chrome/locale/branding/brand.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-brandShortName=Player
-brandFullName=Player
-vendorShortName=hyperstruct.net
diff --git a/utils/platforms/xulrunner/apps/firenarwhal/defaults/preferences/prefs.js b/utils/platforms/xulrunner/apps/firenarwhal/defaults/preferences/prefs.js
deleted file mode 100755
index 21c8863..0000000
--- a/utils/platforms/xulrunner/apps/firenarwhal/defaults/preferences/prefs.js
+++ /dev/null
@@ -1,20 +0,0 @@
-pref("toolkit.defaultChromeURI", "chrome://firenarwhal/content/main.xul");
-pref("xpinstall.dialog.confirm", "chrome://mozapps/content/xpinstall/xpinstallConfirm.xul");
-pref("xpinstall.dialog.progress.skin", "chrome://mozapps/content/extensions/extensions.xul?type=themes");
-pref("xpinstall.dialog.progress.chrome", "chrome://mozapps/content/extensions/extensions.xul?type=extensions");
-pref("xpinstall.dialog.progress.type.skin", "Extension:Manager-themes");
-pref("xpinstall.dialog.progress.type.chrome", "Extension:Manager-extensions");
-pref("extensions.update.enabled", true);
-pref("extensions.update.interval", 86400);
-pref("extensions.dss.enabled", false);
-pref("extensions.dss.switchPending", false);
-pref("extensions.ignoreMTimeChanges", false);
-pref("extensions.logging.enabled", false);
-pref("general.skins.selectedSkin", "classic/1.0");
-// NB these point at AMO
-//pref("extensions.update.url", "chrome://mozapps/locale/extensions/extensions.properties");
-//pref("extensions.getMoreExtensionsURL", "chrome://mozapps/locale/extensions/extensions.properties");
-//pref("extensions.getMoreThemesURL", "chrome://mozapps/locale/extensions/extensions.properties");
-pref("javascript.options.showInConsole", true);
-pref("nglayout.debug.disable_xul_cache", true);
-pref("javascript.options.strict", true);
diff --git a/utils/platforms/xulrunner/apps/firenarwhal/extensions/mozrepl@hyperstruct.net b/utils/platforms/xulrunner/apps/firenarwhal/extensions/mozrepl@hyperstruct.net
deleted file mode 120000
index 3c30747..0000000
--- a/utils/platforms/xulrunner/apps/firenarwhal/extensions/mozrepl@hyperstruct.net
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../hyperstruct/mozrepl@hyperstruct.net \ No newline at end of file
diff --git a/utils/platforms/xulrunner/apps/firenarwhal/extensions/narwhal@narwhaljs.org b/utils/platforms/xulrunner/apps/firenarwhal/extensions/narwhal@narwhaljs.org
deleted file mode 120000
index c84fb35..0000000
--- a/utils/platforms/xulrunner/apps/firenarwhal/extensions/narwhal@narwhaljs.org
+++ /dev/null
@@ -1 +0,0 @@
-../../../extensions/narwhal@narwhaljs.org \ No newline at end of file
diff --git a/utils/platforms/xulrunner/apps/firenarwhal/firenarwhal b/utils/platforms/xulrunner/apps/firenarwhal/firenarwhal
deleted file mode 100755
index 206550b..0000000
--- a/utils/platforms/xulrunner/apps/firenarwhal/firenarwhal
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/bash
-
-# get the absolute path of the executable
-SELF_PATH=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && SELF_PATH=$SELF_PATH/$(basename -- "$0")
-
-# resolve symlinks
-while [ -h "$SELF_PATH" ]; do
- DIR=$(dirname -- "$SELF_PATH")
- SYM=$(readlink -- "$SELF_PATH")
- SELF_PATH=$(cd -- "$DIR" && cd -- $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
-done
-
-# Player folder
-FIRENARWHAL_HOME=$(dirname -- "$SELF_PATH")
-
-# get xulrunner
-XULRUNNER=$(which xulrunner)
-if [ ! $(which $XULRUNNER) ]; then XULRUNNER=$(which firefox); fi
-if [ ! $(which $XULRUNNER) ]; then XULRUNNER=$(which /Applications/Firefox.app/Contents/MacOS/firefox); fi
-
-# runner
-if [ $(which $XULRUNNER) ]; then
- RUNNER="$XULRUNNER -app $FIRENARWHAL_HOME/application.ini -repl $@"
- $RUNNER
-else
- echo "Can't find nor xulrunner nor firefox on your system !!"
-fi
diff --git a/utils/platforms/xulrunner/bin/narwhal-xulrunner b/utils/platforms/xulrunner/bin/narwhal-xulrunner
deleted file mode 100755
index ea85249..0000000
--- a/utils/platforms/xulrunner/bin/narwhal-xulrunner
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/bin/bash
-
-# Copyright (c) 2006 Irakli Gozalishvili <rfobic@gmail.com>
-# See the file LICENSE for licensing information.
-
-# get the absolute path of the executable
-SELF_PATH=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && SELF_PATH=$SELF_PATH/$(basename -- "$0")
-
-# resolve symlinks
-while [ -h $SELF_PATH ]; do
- DIR=$(dirname -- "$SELF_PATH")
- SYM=$(readlink $SELF_PATH)
- SELF_PATH=$(cd $DIR && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
-done
-
-NARWHAL_PLATFORM_HOME=$(dirname -- $(dirname -- "$SELF_PATH"))
-BOOTSTRAP="$NARWHAL_PLATFORM_HOME/bootstrap.js"
-
-if [ ! "$NARWHAL_HOME" ]; then
- NARWHAL_HOME=$(dirname -- $(dirname -- "$NARWHAL_PLATFORM_HOME"))
-fi
-
-NARWHAL_PATH="$NARWHAL_PLATFORM_HOME/lib:$NARWHAL_HOME/platforms/default/lib:$NARWHAL_HOME/lib"
-if [ "$JS_PATH" ]; then
- NARWHAL_PATH="$NARWHAL_PATH:$JS_PATH"
-fi
-
-export NARWHAL_PATH
-export NARWHAL_HOME
-export NARWHAL_PLATFORM_HOME
-
-FIREFOX=firefox
-if [ -e /Applications/Firefox.app ]; then
- FIREFOX="/Applications/Firefox.app/Contents/MacOS/firefox"
-fi
-
-# uses rlwrap (readline wrapper) if present
-RLWRAP=$(which rlwrap 2>/dev/null)
-NARWHAL="$NARWHAL_PLATFORM_HOME/apps/firenarwhal/firenarwhal -narwhal"
-REPL="telnet localhost 4242"
-
-# drop into shell if there are no additional arguments
-if [ $# -lt 1 ]; then
- # FIXME: no way to explicitly drop into shell
- $NARWHAL $BOOTSTRAP "-narwhal-args $@" &
- sleep 2;
- $RLWRAP $REPL
-else
- # TODO
- MAIN=$(cd -P -- "$(dirname -- "$1")" && pwd -P) && MAIN=$MAIN/$(basename -- "$1" .js)
- echo $NARWHAL $BOOTSTRAP "-narwhal-args $MAIN $0 $@"
- $NARWHAL $BOOTSTRAP "-narwhal-args $MAIN $0 $@"
-fi
diff --git a/utils/platforms/xulrunner/bootstrap.js b/utils/platforms/xulrunner/bootstrap.js
deleted file mode 100755
index d28e29f..0000000
--- a/utils/platforms/xulrunner/bootstrap.js
+++ /dev/null
@@ -1,109 +0,0 @@
-/* Copyright (c) 2006 Irakli Gozalishvili <rfobic@gmail.com>
- See the file LICENSE for licensing information. */
-
-/**
- * Bootstrap file for the mozilla platform.
- */
-(function(global, evalGlobal) {
- global.arguments = __narwhal_args__;
- const Cc = Components.classes;
- const Ci = Components.interfaces;
- const Cu = Components.utils;
- const Env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment);
-
- var moduleScopingEnabled = false;
- var debug = true;
- var NARWHAL_PATH = Env.exists('NARWHAL_PATH') ? Env.get('NARWHAL_PATH') : null,
- NARWHAL_HOME = Env.exists('NARWHAL_HOME') ? Env.get('NARWHAL_HOME') : null;
-
- function print (message) {
- dump(message + '\n')
- }
-
- function getFileUri(file) {
- return Cc['@mozilla.org/network/io-service;1'].getService(Ci.nsIIOService)
- .getProtocolHandler('file').QueryInterface(Ci.nsIFileProtocolHandler)
- .getURLSpecFromFile(file);
- }
-
- function getFile(path) {
- var file = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsILocalFile);
- file.initWithPath(path);
- for (var i=1; i < arguments.length; i++) file.append(arguments[i])
- return file;
- }
-
- function read(path) {
- const MODE_RDONLY = 0x01;
- const PERMS_FILE = 0644;
- var result = [];
- try {
- var fis = Cc["@mozilla.org/network/file-input-stream;1"].createInstance(Ci.nsIFileInputStream);
- fis.init(getFile(path), MODE_RDONLY, PERMS_FILE, false);
- var lis = fis.QueryInterface(Ci.nsILineInputStream);
- var line = { value: null };
- var haveMore;
- do {
- haveMore = lis.readLine(line)
- result.push(line.value);
- } while (haveMore)
- } catch(e) {
- print('Error:' + e.message);
- print('Stack:' + e.stack);
- } finally {
- fis.close();
- }
- return result.join('\n');
- }
-
- function isFile(path) {
- try {
- var file = getFile(path);
- return (file.exists() && file.isFile());
- } catch (e) {
- return false;
- }
- }
-
- function evaluateInSandbox(code, path, lineNo) {
- lineNo = lineNo || 0;
- path = path || "anonymus";
- var scope;
- if (moduleScopingEnabled) {
- scope = Cu.Sandbox(Cc["@mozilla.org/systemprincipal;1"].createInstance(Ci.nsIPrincipal));
- scope.__proto__ = global;
- } else {
- scope = global;
- }
- var source = "(function(require,exports,module,system,print){" + code +"/**/\n})";
- return Cu.evalInSandbox(source, scope, "1.8", path, lineNo);
- }
- function evaluateInGlobal(code, path, lineNo) {
- lineNo = lineNo || 0;
- path = path || "anonymus";
- var source = "(function(require,exports,module,system,print){" + code +"/**/\n})";
- return Cu.evalInSandbox(source, global, "1.8", path, lineNo);
- }
- var path = getFile(NARWHAL_HOME, 'narwhal.js').path;
- var narwhal = Cu.evalInSandbox(read(path), global, "1.8", path, 0)
- narwhal({
- global: global,
- evalGlobal: evalGlobal, //evaluateInGlobal,
- evaluate: evaluateInSandbox,
- platform: 'xulrunner',
- platforms: ['xulrunner', 'default'],
- debug: debug,
- print: print,
- fs: {
- read: read,
- isFile: isFile
- },
- prefix: NARWHAL_HOME,
- path: NARWHAL_PATH
- });
-
-})(this, function () {
- // no lexical arguments so they do not mask
- // variables by the same name in global scope.
- return eval(arguments[0]);
-});
diff --git a/utils/platforms/xulrunner/extensions/narwhal@narwhaljs.org/chrome.manifest b/utils/platforms/xulrunner/extensions/narwhal@narwhaljs.org/chrome.manifest
deleted file mode 100755
index 96e96da..0000000
--- a/utils/platforms/xulrunner/extensions/narwhal@narwhaljs.org/chrome.manifest
+++ /dev/null
@@ -1,5 +0,0 @@
-content narwhal chrome/content/
-resource narwhal narwhal/
-resource narwzilla modules/
-
-skin narwhal classic/1.0 chrome/skin/
diff --git a/utils/platforms/xulrunner/extensions/narwhal@narwhaljs.org/chrome/content/narwhal.js b/utils/platforms/xulrunner/extensions/narwhal@narwhaljs.org/chrome/content/narwhal.js
deleted file mode 120000
index 4bdd664..0000000
--- a/utils/platforms/xulrunner/extensions/narwhal@narwhaljs.org/chrome/content/narwhal.js
+++ /dev/null
@@ -1 +0,0 @@
-../../../narwzilla@narwhaljs.org/chrome/content/narwhal.js \ No newline at end of file
diff --git a/utils/platforms/xulrunner/extensions/narwhal@narwhaljs.org/components/nsINarwhal.idl b/utils/platforms/xulrunner/extensions/narwhal@narwhaljs.org/components/nsINarwhal.idl
deleted file mode 120000
index a7c0220..0000000
--- a/utils/platforms/xulrunner/extensions/narwhal@narwhaljs.org/components/nsINarwhal.idl
+++ /dev/null
@@ -1 +0,0 @@
-../../narwzilla@narwhaljs.org/components/nsINarwhal.idl \ No newline at end of file
diff --git a/utils/platforms/xulrunner/extensions/narwhal@narwhaljs.org/components/nsINarwhal.js b/utils/platforms/xulrunner/extensions/narwhal@narwhaljs.org/components/nsINarwhal.js
deleted file mode 120000
index 3ccb1e3..0000000
--- a/utils/platforms/xulrunner/extensions/narwhal@narwhaljs.org/components/nsINarwhal.js
+++ /dev/null
@@ -1 +0,0 @@
-../../narwzilla@narwhaljs.org/components/nsINarwhal.js \ No newline at end of file
diff --git a/utils/platforms/xulrunner/extensions/narwhal@narwhaljs.org/components/nsINarwhal.xpt b/utils/platforms/xulrunner/extensions/narwhal@narwhaljs.org/components/nsINarwhal.xpt
deleted file mode 120000
index 4282c8e..0000000
--- a/utils/platforms/xulrunner/extensions/narwhal@narwhaljs.org/components/nsINarwhal.xpt
+++ /dev/null
@@ -1 +0,0 @@
-../../narwzilla@narwhaljs.org/components/nsINarwhal.xpt \ No newline at end of file
diff --git a/utils/platforms/xulrunner/extensions/narwhal@narwhaljs.org/defaults/preferences/prefs.js b/utils/platforms/xulrunner/extensions/narwhal@narwhaljs.org/defaults/preferences/prefs.js
deleted file mode 100755
index ac07a61..0000000
--- a/utils/platforms/xulrunner/extensions/narwhal@narwhaljs.org/defaults/preferences/prefs.js
+++ /dev/null
@@ -1 +0,0 @@
-pref("extensions.narwzilla.port", "4242");
diff --git a/utils/platforms/xulrunner/extensions/narwhal@narwhaljs.org/install.rdf b/utils/platforms/xulrunner/extensions/narwhal@narwhaljs.org/install.rdf
deleted file mode 100755
index 4d9beac..0000000
--- a/utils/platforms/xulrunner/extensions/narwhal@narwhaljs.org/install.rdf
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0"?>
-<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:em="http://www.mozilla.org/2004/em-rdf#">
- <Description about="urn:mozilla:install-manifest">
- <em:id>narwhal@narwhaljs.org</em:id>
- <em:name>narwzilla platform</em:name>
- <em:version>0.1</em:version>
- <em:description>Narwhal xulrunner based platform</em:description>
- <em:creator>Irakli Gozalishvili</em:creator>
- <em:homepageURL>http://gozala.github.com/narwzilla</em:homepageURL>
- <em:type>2</em:type> <!-- type=extension -->
-
- <em:targetApplication>
- <Description>
- <!-- Mozilla toolkit's uuid -->
- <em:id>toolkit@mozilla.org</em:id>
- <em:minVersion>1.9*</em:minVersion>
- <em:maxVersion>1.9.*</em:maxVersion>
- </Description>
- </em:targetApplication>
- </Description>
-</RDF>
diff --git a/utils/platforms/xulrunner/extensions/narwhal@narwhaljs.org/modules/narwhal.js b/utils/platforms/xulrunner/extensions/narwhal@narwhaljs.org/modules/narwhal.js
deleted file mode 120000
index 273f5ba..0000000
--- a/utils/platforms/xulrunner/extensions/narwhal@narwhaljs.org/modules/narwhal.js
+++ /dev/null
@@ -1 +0,0 @@
-../../narwzilla@narwhaljs.org/modules/narwhal.js \ No newline at end of file
diff --git a/utils/platforms/xulrunner/extensions/narwhal@narwhaljs.org/narwhal b/utils/platforms/xulrunner/extensions/narwhal@narwhaljs.org/narwhal
deleted file mode 120000
index f4f3d1b..0000000
--- a/utils/platforms/xulrunner/extensions/narwhal@narwhaljs.org/narwhal
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../narwhal \ No newline at end of file
diff --git a/utils/platforms/xulrunner/lib/binary.js b/utils/platforms/xulrunner/lib/binary.js
deleted file mode 100755
index 60b5767..0000000
--- a/utils/platforms/xulrunner/lib/binary.js
+++ /dev/null
@@ -1,439 +0,0 @@
-/* Binary
-
-var Binary = exports.Binary = function() {
- // this._bytes
- // this._offset
- // this._length
-}
-
-Binary.prototype.__defineGetter__("length", function() { return this._length; });
-Binary.prototype.__defineSetter__("length", function(length) { print("x trying to set length: " + length); });
-
-// toArray() - n array of the byte values
-// toArray(charset) - an array of the code points, decoded
-Binary.prototype.toArray = function(codec) {
- if (arguments.length === 0) {
- var bytes = new Array(this._length);
-
- for (var i = 0; i < this._length; i++) {
- var b = this._bytes[i + this._offset];
- // Java "bytes" are interpreted as 2's complement
- bytes[i] = (b >= 0) ? b : -1 * ((b ^ 0xFF) + 1);
- }
-
- return bytes;
- }
- else if (arguments.length === 1) {
- var string = new java.lang.String(this._bytes, this._offset, this._length, codec),
- length = string.length(),
- array = new Array(length);
-
- for (var i = 0; i < length; i++)
- array[i] = string.codePointAt(i);
-
- return array;
- }
- else
- throw new Error("Illegal arguments to toArray()");
-};
-
-// toByteArray() - just a copy
-// toByteArray(sourceCharset, targetCharset) - transcoded
-Binary.prototype.toByteArray = function(sourceCodec, targetCodec) {
- if (arguments.length < 2)
- return new ByteArray(this);
- else if (arguments.length === 2 && typeof sourceCodec === "string" && typeof targetCodec === "string") {
- var bytes = new java.lang.String(this._bytes, this._offset, this._length, sourceCodec).getBytes(targetCodec);
- return new ByteArray(bytes, 0, bytes.length);
- }
-
- throw new Error("Illegal arguments to ByteArray toByteArray");
-};
-
-// toByteString() - byte for byte copy
-// toByteString(sourceCharset, targetCharset) - transcoded
-Binary.prototype.toByteString = function(sourceCodec, targetCodec) {
- if (arguments.length < 2)
- return new ByteString(this);
- else if (arguments.length === 2 && typeof sourceCodec === "string" && typeof targetCodec === "string") {
- var bytes = new java.lang.String(this._bytes, this._offset, this._length, sourceCodec).getBytes(targetCodec);
- return new ByteString(bytes, 0, bytes.length);
- }
-
- throw new Error("Illegal arguments to ByteArray toByteString");
-};
-
-// decodeToString()
-// decodeToString(charset) - returns a String from its decoded bytes in a given charset. If no charset is provided, or if the charset is "undefined", assumes the default system encoding.
-Binary.prototype.decodeToString = function(charset) {
- if (charset)
- return String(new java.lang.String(this._bytes, this._offset, this._length, charset));
-
- return String(new java.lang.String(this._bytes, this._offset, this._length));
-};
-
-// byteAt(offset) - Return the byte at offset as a Number.
-Binary.prototype.byteAt = function(offset) {
- if (offset < 0 || offset >= this._length)
- return NaN;
-
- return this._bytes[this._offset + offset];
-};
-
-// valueOf()
-Binary.prototype.valueOf = function() {
- return this;
-};
-
-// ByteString
-
-var ByteString = exports.ByteString = function() {
- // ByteString() - Construct an empty byte string.
- if (arguments.length === 0) {
- this._bytes = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 0); // null;
- this._offset = 0;
- this._length = 0;
- }
- // ByteString(byteString) - Copies byteString.
- else if (arguments.length === 1 && arguments[0] instanceof ByteString) {
- return arguments[0];
- }
- // ByteString(byteArray) - Use the contents of byteArray.
- else if (arguments.length === 1 && arguments[0] instanceof ByteArray) {
- var copy = arguments[0].toByteArray();
- this._bytes = copy._bytes;
- this._offset = copy._offset;
- this._length = copy._length;
- }
- // ByteString(arrayOfNumbers) - Use the numbers in arrayOfNumbers as the bytes.
- else if (arguments.length === 1 && Array.isArray(arguments[0])) {
- var bytes = arguments[0];
- this._bytes = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, bytes.length);
- for (var i = 0; i < bytes.length; i++) {
- var b = bytes[i];
- // If any element is outside the range 0...255, an exception (TODO) is thrown.
- if (b < 0 || b > 0xFF)
- throw new Error("ByteString constructor argument Array of integers must be 0 - 255 ("+b+")");
- // Java "bytes" are interpreted as 2's complement
- this._bytes[i] = (b < 128) ? b : -1 * ((b ^ 0xFF) + 1);
- }
- this._offset = 0;
- this._length = this._bytes.length;
- }
- // ByteString(string, charset) - Convert a string. The ByteString will contain string encoded with charset.
- else if ((arguments.length === 1 || (arguments.length === 2 && arguments[1] === undefined)) && typeof arguments[0] === "string") {
- this._bytes = new java.lang.String(arguments[0]).getBytes();
- this._offset = 0;
- this._length = this._bytes.length;
- }
- else if (arguments.length === 2 && typeof arguments[0] === "string" && typeof arguments[1] === "string") {
- this._bytes = new java.lang.String(arguments[0]).getBytes(arguments[1]);
- this._offset = 0;
- this._length = this._bytes.length;
- }
- // private: ByteString(bytes, offset, length)
- else if (arguments.length === 3 && Array.isArray(arguments[0]) && typeof arguments[1] === "number" && typeof arguments[2] === "number") {
- this._bytes = arguments[0];
- this._offset = arguments[1];
- this._length = arguments[2];
- }
- else
- throw new Error("Illegal arguments to ByteString constructor: [" +
- Array.prototype.join.apply(arguments, [","]) + "] ("+arguments.length+")");
-
- //seal(this);
-};
-
-ByteString.prototype = new Binary();
-
-ByteString.prototype.__defineGetter__("length", function() { return this._length; });
-ByteString.prototype.__defineSetter__("length", function(length) {});
-
-ByteString.prototype.toString = function(charset) {
- if (charset)
- return this.decodeToString(charset);
-
- return "[ByteString "+this.length+"]";
-}
-
-ByteString.prototype.indexOf = function(byteValue, start, stop) {
- var array = this.slice(start, stop).toArray(),
- result = array.indexOf(byteValue);
- return (result < 0) ? -1 : result + (start || 0);
-};
-
-ByteString.prototype.lastIndexOf = function(byteValue, start, stop) {
- var array = this.slice(start, stop).toArray(),
- result = array.lastIndexOf(byteValue);
- return (result < 0) ? -1 : result + (start || 0);
-};
-
-ByteString.prototype.charCodeAt = Binary.prototype.byteAt;
-
-ByteString.prototype.charAt = function(offset) {
- var byteValue = this.charCodeAt(offset);
-
- if (isNaN(byteValue))
- return new ByteString();
-
- return new ByteString([byteValue]);
-};
-
-ByteString.prototype.split = function(delimiter, options) {
- throw "NYI";
-};
-
-ByteString.prototype.slice = function(begin, end) {
- if (begin === undefined)
- begin = 0;
- else if (begin < 0)
- begin = this._length + begin;
-
- if (end === undefined)
- end = this._length;
- else if (end < 0)
- end = this._length + end;
-
- begin = Math.min(this._length, Math.max(0, begin));
- end = Math.min(this._length, Math.max(0, end));
-
- return new ByteString(this._bytes, this._offset + begin, end - begin);
-};
-
-ByteString.prototype.substr = function(start, length) {
- if (start !== undefined) {
- if (length !== undefined)
- return this.slice(start);
- else
- return this.slice(start, start + length);
- }
- return this.slice();
-};
-
-ByteString.prototype.substring = function(from, to) {
- if (from !== undefined) {
- if (to !== undefined)
- return this.slice(Math.max(Math.min(begin, this._length), 0));
- else
- return this.slice(Math.max(Math.min(begin, this._length), 0),
- Math.max(Math.min(end, this._length), 0));
- }
- return this.slice();
-};
-
-ByteString.prototype.toSource = function() {
- return "ByteString(["+this.toArray().join(",")+"])";
-}
-
-// ByteArray
-
-var ByteArray = exports.ByteArray = function() {
- // ByteArray() - New, empty ByteArray.
- if (arguments.length === 0) {
- this._bytes = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 0); // null;
- this._offset = 0;
- this._length = 0;
- }
- // ByteArray(length) - New ByteArray filled with length zero bytes.
- else if (arguments.length === 1 && typeof arguments[0] === "number") {
- this._bytes = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, arguments[0]); // null;
- this._offset = 0;
- this._length = this._bytes.length;
- }
- // ByteArray(byteArray) - Copy byteArray.
- // ByteArray(byteString) - Copy contents of byteString.
- else if (arguments.length === 1 && (arguments[0] instanceof ByteArray || arguments[0] instanceof ByteString)) {
- var byteArray = new ByteArray(arguments[0]._length);
- java.lang.System.arraycopy(arguments[0]._bytes, arguments[0]._offset, byteArray._bytes, byteArray._offset, byteArray._length);
- return byteArray;
- }
- // ByteArray(arrayOfBytes) - Use numbers in arrayOfBytes as contents.
- // Throws an exception if any element is outside the range 0...255 (TODO).
- else if (arguments.length === 1 && Array.isArray(arguments[0])) {
- var bytes = arguments[0];
- this._bytes = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, bytes.length);
- for (var i = 0; i < bytes.length; i++) {
- var b = bytes[i];
- // If any element is outside the range 0...255, an exception (TODO) is thrown.
- if (b < 0 || b > 0xFF)
- throw new Error("ByteString constructor argument Array of integers must be 0 - 255 ("+b+")");
- // Java "bytes" are interpreted as 2's complement
- this._bytes[i] = (b < 128) ? b : -1 * ((b ^ 0xFF) + 1);
- }
- this._offset = 0;
- this._length = this._bytes.length;
- }
- // ByteArray(string, charset) - Create a ByteArray from a Javascript string, the result being encoded with charset.
- else if ((arguments.length === 1 || (arguments.length === 2 && arguments[1] === undefined)) && typeof arguments[0] === "string") {
- this._bytes = new java.lang.String(arguments[0]).getBytes();
- this._offset = 0;
- this._length = this._bytes.length;
- }
- else if (arguments.length === 2 && typeof arguments[0] === "string" && typeof arguments[1] === "string") {
- this._bytes = new java.lang.String(arguments[0]).getBytes(arguments[1]);
- this._offset = 0;
- this._length = this._bytes.length;
- }
- // private: ByteArray(bytes, offset, length)
- else if (arguments.length === 3 && Array.isArray(arguments[0]) && typeof arguments[1] === "number" && typeof arguments[2] === "number") {
- this._bytes = arguments[0];
- this._offset = arguments[1];
- this._length = arguments[2];
- }
- else
- throw new Error("Illegal arguments to ByteString constructor: [" +
- Array.prototype.join.apply(arguments, [","]) + "] ("+arguments.length+")");
-}
-
-ByteArray.prototype = new Binary();
-
-ByteArray.prototype.__defineGetter__("length", function() { return this._length; });
-ByteArray.prototype.__defineSetter__("length", function(length) {
- if (typeof length !== "number")
- return;
-
- // same length
- if (length === this.length) {
- return;
- }
- // new length is less, truncate
- else if (length < this._length) {
- this._length = length;
- }
- // new length is more, but fits without moving, just clear new bytes
- else if (this._offset + length <= this._bytes.length) {
- java.util.Arrays.fill(this._bytes, this._length, this._offset + length - 1, 0);
- this._length = length;
- }
- // new length is more, but fits if we shift to bottom, so do that.
- else if (length <= this._bytes.length) {
- java.lang.System.arraycopy(this._bytes, this._offset, this._bytes, 0, this._length);
- this._offset = 0;
- java.util.Arrays.fill(this._bytes, this._length, this._offset + length - 1, 0);
- this._length = length;
- }
- // new length is more than the allocated bytes array, allocate a new one and copy the data
- else {
- var newBytes = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, length);
- java.lang.System.arraycopy(this._bytes, this._offset, newBytes, 0, this._length);
- this._bytes = newBytes;
- this._offset = 0;
- this._length = length;
- }
-});
-
-// toString() - a string representation like "[ByteArray 10]"
-// toString(charset) - an alias for decodeToString(charset)
-ByteArray.prototype.toString = function(charset) {
- if (charset)
- return this.decodeToString(charset);
-
- return "[ByteArray "+this.length+"]";
-}
-
-// concat(other ByteArray|ByteString|Array)
-ByteArray.prototype.concat = function() {
- throw "NYI";
-}
-
-// pop() -> byte Number
-ByteArray.prototype.pop = function() {
- if (this._length === 0)
- return undefined;
-
- this._length--;
-
- return this._bytes[this._offset + this._length];
-}
-
-// push(...variadic Numbers...)-> count Number
-ByteArray.prototype.push = function() {
- throw "NYI";
-}
-
-// shift() -> byte Number
-ByteArray.prototype.shift = function() {
- if (this._length === 0)
- return undefined;
-
- this._length--;
- this._offset++;
-
- return this._bytes[this._offset - 1];
-}
-
-// unshift(...variadic Numbers...) -> count Number
-ByteArray.prototype.unshift = function() {
- throw "NYI";
-}
-
-// reverse() in place reversal
-ByteArray.prototype.reverse = function() {
- throw "NYI";
-}
-
-// slice()
-ByteArray.prototype.slice = function() {
- return new ByteArray(ByteString.prototype.apply.slice(this, arguments));
-}
-
-// sort()
-ByteArray.prototype.sort = function() {
- // FIXME: inefficient
- var array = this.toArray()
- return new ByteArray(array.sort.apply(array, arguments));
-}
-
-// splice()
-ByteArray.prototype.splice = function() {
- throw "NYI";
-}
-
-// toSource() returns a string like "ByteArray([])" for a null byte-array.
-ByteArray.prototype.toSource = function() {
- return "ByteArray(["+this.toArray().join(",")+"])";
-}
-
-// String
-
-String.prototype.toByteString = function(charset) {
- // RHINO bug: it thinks "this" is a Java string (?!)
- return new ByteString(String(this), charset);
-};
-
-String.prototype.toByteArray = function(charset) {
- // RHINO bug: it thinks "this" is a Java string (?!)
- return new ByteArray(String(this), charset);
-};
-
-String.prototype.charCodes = function() {
- return Array.prototype.map.call(this, function (c) {
- return c.charCodeAt();
- });
-};
-
-String.fromCharCodes = function (codes) {
- return codes.map(String.fromCharCode).join('');
-};
-
-// Array //
-
-Array.prototype.toByteString = function(charset) {
- return new ByteString(this);
-};
-
-Array.prototype.toByteArray = function(charset) {
- return new ByteArray(this);
-};
-
-// BinaryIO //
-
-exports.BinaryIO = function(binary) {
- if (!binary)
- throw "NYI";
-
- var stream = new (require("io").IO)(new java.io.ByteArrayInputStream(binary._bytes, binary._offset, binary._length), null);
- stream.length = binary.length;
- return stream;
-}
-*/
diff --git a/utils/platforms/xulrunner/lib/file-platform.js b/utils/platforms/xulrunner/lib/file-platform.js
deleted file mode 100755
index 2e554f3..0000000
--- a/utils/platforms/xulrunner/lib/file-platform.js
+++ /dev/null
@@ -1,159 +0,0 @@
-var exports = require('./file');
-var IO = require("./io").IO;
-
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const DirService = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties)
-
-function MozFile(path) {
- var file = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsILocalFile);
- try {
- file.initWithPath(path);
- } catch(e) {
- file.initWithPath(exports.cwd());
- path.split(exports.SEPARATOR).filter(function(part) part != '').
- forEach(function(part) file.append(part));
- }
- return file;
-}
-
-exports.cwd = function () DirService.get("CurWorkD", Ci.nsIFile).path;
-
-exports.SEPARATOR = (function() (exports.cwd().search(/\\/) != -1) ? "\\" : "/")();
-exports.ROOT = '/';
-
-
-exports.list = function (path) {
- var entries = MozFile(path).directoryEntries;
- var entryNames = [];
- while(entries.hasMoreElements()) {
- var entry = entries.getNext();
- entry.QueryInterface(Ci.nsIFile);
- entryNames.push(entry.leafName);
- }
- return entryNames;
-};
-
-exports.canonical = function (path) {
- var file = MozFile(path);
- try {
- file.normalize();
- } catch(e) {}
- return file.path;
-}
-
-exports.exists = function (path) MozFile(path).exists();
-
-exports.mtime = function (path) new Date(MozFile(path).lastModifiedTime);
-
-exports.size = function (path) MozFile(path).fileSize;
-
-exports.stat = function (path) {
- return {
- mtime: exports.mtime(path),
- size: exports.size(path)
- }
-};
-
-exports.isDirectory = function (path) {
- var file = MozFile(path);
- return file.exists() && file.isDirectory();
-}
-
-exports.isFile = function (path) {
- var file = MozFile(path);
- return file.exists() && file.isFile();
-}
-
-exports.isLink = function (path) MozFile(path).isSymlink();
-
-exports.isReadable = function (path) MozFile(path).isReadable();
-
-exports.isWritable = function (path) MozFile(path).isWritable();
-
-exports.rename = function (source, target) {
- source = file.path(source);
- target = source.resolve(target);
- source = MozFile(source);
- target = MozFile(target);
- try {
- source.moveTo(target.parent, target.leafName);
- } catch(e) {
- throw new Error("failed to rename " + source.path + " to " + target.path);
- }
-};
-
-exports.move = function (source, target) {
- source = file.path(source);
- target = source.resolve(target);
- source = MozFile(source);
- target = MozFile(target);
- try {
- source.moveTo(target.parent, target.leafName);
- } catch(e) {
- throw new Error("failed to move " + source.path + " to " + target.path);
- }
-};
-
-exports.remove = function (path) {
- try {
- MozFile(path).remove(false)
- } catch(e) {
- throw new Error("failed to delete " + path);
- }
-};
-
-exports.mkdir = function (path) MozFile(path).create(Ci.nsIFile.NORMAL_FILE_TYPE, 0777);
-
-exports.mkdirs = function (path) MozFile(path).create(Ci.nsIFile.NORMAL_FILE_TYPE, 0777);
-
-exports.rmdir = function(path) {
- try {
- MozFile(path).remove(false)
- } catch(e) {
- throw new Error("failed to delete " + path);
- }
-};
-
-exports.rmtree = function(path) {
- try {
- MozFile(path).remove(true)
- } catch(e) {
- throw new Error("failed to delete " + path);
- }
-};
-
-exports.touch = function (path, mtime) {
- var file = MozFile(path);
- if (!file.exists()) file.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0666);
- else file.lastModifiedTime = new Date().getTime().toString();
-};
-
-exports.symlink = function (path) {
- throw "NYI";
-};
-
-exports.FileIO = function (path, mode, permissions) {
- file = MozFile(path);
-
- var {
- read: read,
- write: write,
- append: append,
- update: update
- } = exports.mode(mode);
-
- if (update) {
- throw new Error("Updating IO not yet implemented.");
- } else if (write || append) {
- var stream = Cc["@mozilla.org/network/file-input-stream;1"].createInstance(Ci.nsIFileOutputStream);
- stream.init(file, -1, -1, 0);
- return new IO(stream, null);
- } else if (read) {
- var stream = Cc["@mozilla.org/network/file-input-stream;1"].createInstance(Ci.nsIFileInputStream);
- stream.init(file, -1, 0, 0);
- return new IO(stream, null);
- } else {
- throw new Error("Files must be opened either for read, write, or update mode.");
- }
-};
diff --git a/utils/platforms/xulrunner/lib/io-platform.js b/utils/platforms/xulrunner/lib/io-platform.js
deleted file mode 100755
index 60103e4..0000000
--- a/utils/platforms/xulrunner/lib/io-platform.js
+++ /dev/null
@@ -1,201 +0,0 @@
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-
-var IO = exports.IO = function(inputStream, outputStream) {
- this.inputStream = inputStream;
- this.outputStream = outputStream;
-};
-
-IO.prototype.read = function(length) {
- return this.inputStream(length);
-};
-
-IO.prototype.write = function(object) {
- this.outputStream(object);
-};
-
-IO.prototype.flush = function() {
-};
-
-IO.prototype.close = function() {
-};
-
-IO.prototype.isatty = function () {
- return false;
-};
-
-
-
-exports.TextInputStream = function (raw, lineBuffering, buffering, charset, options) {
- var stream;
-
-// if (charset === undefined) {
-// if (buffering === undefined)
-
- stream = raw.inputStream;
- stream.QueryInterface(Ci.nsILineInputStream);
-
- var self = this;
-
- self.readLine = function () {
-// var line = stream.readLine();
-// if (line === null)
-// return '';
-// return String(line) + "\n";
- };
-
- self.iter = function () {
- return self;
- };
-
- self.next = function () {
-// var line = stream.readLine();
-// if (line === null)
-// throw new Error("StopIteration");
-// return line;
- };
-
- self.input = function () {
- throw "NYI";
- };
-
- self.readLines = function () {
- var line = {},
- lines = [],
- hasmore;
- do {
- hasmore = stream.readLine(line);
- lines.push(line.value);
- } while(hasmore);
- return lines;
- };
-
- self.read = function () {
- return self.readLines().join("\n");
- };
-
- self.readInto = function (buffer) {
- throw "NYI";
- };
-
- self.close = function () {
- stream.close();
- };
-};
-
-exports.TextIOWrapper = function (raw, mode, lineBuffering, buffering, charset, options) {
- if (mode.update) {
- return new exports.TextIOStream(raw, lineBuffering, buffering, charset, options);
- } else if (mode.write || mode.append) {
- return new exports.TextOutputStream(raw, lineBuffering, buffering, charset, options);
- } else if (mode.read) {
- return new exports.TextInputStream(raw, lineBuffering, buffering, charset, options);
- } else {
- throw new Error("file must be opened for read, write, or append mode.");
- }
-};
-
-
-
-var StringIO = exports.StringIO = function (initial) {
- var buffer = [];
- if (initial) {
- buffer = buffer.concat(initial.join(""));
- }
-
- function length() {
- return buffer.length;
- }
-
- function read(length) {
- var result;
-
- if (arguments.length == 0) {
- result = buffer.join("");
- buffer = [];
- return result;
- } else {
- if (!length || length < 1)
- length = 1024;
- length = Math.min(buffer.length, length);
- result = buffer.slice(0, length).join("");
- buffer = [];
- return result;
- }
- }
-
- function write(text) {
- buffer = buffer.concat(text.split(""));
- return self;
- }
-
- function copy(output) {
- output.write(read()).flush();
- return self;
- }
-
- function next() {
- var pos, result;
- if (buffer.length === 0) { throw StopIteration; }
- pos = buffer.indexOf("\n");
- if (pos === -1) { pos = buffer.length; }
- result = read(pos);
- read(1);
- return result;
- }
-
- var self = {
- get length() {
- return length();
- },
- read: read,
- write: write,
- copy: copy,
- close: function () {
- return self;
- },
- flush: function () {
- return self;
- },
- iterator: function () {
- return self;
- },
- forEach: function (block) {
- while (true) {
- try {
- block.call(this, next());
- } catch (exception) {
- if (exception instanceof StopIteration)
- break;
- throw exception;
- }
- }
- },
- readLine: function () {
- var pos = buffer.indexOf("\n");
- if (pos === -1) { pos = buffer.length; }
- return read(pos + 1);
- },
- next: next,
- print: function (line) {
- return write(line + "\n").flush();
- },
- toString: function() {
- return buffer.join("");
- },
- substring: function () {
- var string = buffer.join("");
- return string.substring.apply(string, arguments);
- },
- slice: function () {
- var string = buffer.join("");
- return string.slice.apply(string, arguments);
- },
- substr: function () {
- var string = buffer.join("");
- return string.substr.apply(string, arguments);
- }
- };
- return self;
-};
-
diff --git a/utils/platforms/xulrunner/lib/os-platform.js b/utils/platforms/xulrunner/lib/os-platform.js
deleted file mode 100755
index 174e76e..0000000
--- a/utils/platforms/xulrunner/lib/os-platform.js
+++ /dev/null
@@ -1,44 +0,0 @@
-
-var io = require('io');
-
-exports.exit = function (status) {
- throw "NYI";
-};
-
-exports.sleep = function (seconds) {
- throw "NYI";
-};
-
-exports.fork = function () {
- throw "NYI";
-};
-
-exports.exec = function () {
- throw "NYI";
-};
-
-exports.dup = function () {
- throw "NYI";
-};
-
-exports.dup2 = function () {
- throw "NYI";
-};
-
-exports.setsid = function () {
- throw "NYI";
-};
-
-exports.getpid = function () {
- throw "NYI";
-};
-
-
-exports.popen = function (command, options) {
- throw "NYI";
-};
-
-exports.system = function (command) {
- throw "NYI";
-};
-
diff --git a/utils/platforms/xulrunner/lib/system.js b/utils/platforms/xulrunner/lib/system.js
deleted file mode 100755
index a483c15..0000000
--- a/utils/platforms/xulrunner/lib/system.js
+++ /dev/null
@@ -1,40 +0,0 @@
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-
-const Env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment);
-const MozConsole = Cc['@mozilla.org/consoleservice;1'].getService(Ci.nsIConsoleService);
-
-var IO = require("./io").IO;
-exports.stdin = null;/*TODO*/
-exports.stdout = null;/*TODO*/
-exports.stderr = null;/*TODO*/
-
-exports.args = global.arguments || [];
-
-exports.env = {
- // Unfortunate hack to have a fallback mechanism like
- // var foo = system.env['bar'] || system.env['bar']();
- // try {system.env['bar']('foo')} finally {system.env['bar'] = 'foo'}
- __noSuchMethod__: function(name, args) {
- if (args) return Env.set(name, args[0])
- else return Env.exists(name) ? Env.get(name) : null;
- }
-};
-
-try { // Hack useing xpconnect to get env varibales from jvm
- var env = Packages.java.lang.System.getenv(),
- keyIterator = env.keySet().iterator();
- while (keyIterator.hasNext()) {
- var key = keyIterator.next();
- exports.env[String(key)] = String(env.get(key));
- }
-} catch(e) {}
-
-exports.fs = require('./file');
-
-// default logger
-var Logger = require("logger").Logger;
-exports.log = new Logger({ print: function(message) {
- print(message);
- MozConsole.logStringMessage(message);
-}});
diff --git a/utils/platforms/xulrunner/post-commit b/utils/platforms/xulrunner/post-commit
deleted file mode 100755
index 2774458..0000000
--- a/utils/platforms/xulrunner/post-commit
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/sh
-# set -x
-#
-# An example hook script that is called after a successful
-# commit is made.
-#
-# To enable this hook, make this file executable.
-
-# getting branch name
-ref=$(<.git/HEAD)
-branch=${ref##ref: refs/heads/}
-
-origin=$(pwd)
-root=$origin; while [ ! -d "$root/.git" ]; do root="$root/.."; done
-
-extensions="$root/platforms/xulrunner/extensions"
-builds="$extensions/builds"
-
-# making builds folder
-mkdir -p $builds
-
-# building narwzilla@narwhaljs.org
-extension="$extensions/narwzilla@narwhaljs.org"
-build="$builds/narwzilla@narwhaljs.org.xpi"
-rm -f $build
-cd $extension
-zip -r $build chrome components modules defaults chrome.manifest install.rdf >/dev/null
-
-# building narwzilla.platform@narwhaljs.org.xpi
-extension="$extensions/narwhal@narwhaljs.org"
-build="$builds/narwhal@narwhaljs.org.xpi"
-rm -f $build
-cd $extension
-zip -r $build *.* chrome components defaults modules narwhal/*.* narwhal/lib narwhal/packages/jack narwhal/platforms/default narwhal/platforms/narwzilla/lib/ narwhal/platforms/narwzilla/*.* -x *.git/* >/dev/null
-
-cd $origin
diff --git a/utils/sources.json b/utils/sources.json
deleted file mode 100755
index 993d045..0000000
--- a/utils/sources.json
+++ /dev/null
@@ -1,73 +0,0 @@
-{
- "version": 1,
- "packages": {
- "narwhal": {
- "type": "github",
- "user": "tlrobinson"
- },
- "jack": {
- "type": "github",
- "user": "tlrobinson"
- },
- "nitro": {
- "type": "github",
- "user": "gmosx"
- },
- "chiron": {
- "type": "github",
- "user": "kriskowal"
- },
- "narcissus": {
- "type": "github",
- "user": "kriskowal"
- },
- "creolejs": {
- "type": "github",
- "user": "kriskowal"
- },
- "browserjs": {
- "type": "github",
- "user": "tlrobinson"
- },
- "inspec": {
- "type": "github",
- "user": "aq1018"
- },
- "kupo": {
- "type": "github",
- "user": "janv"
- },
- "appengine": {
- "type": "github",
- "user": "gmosx"
- },
- "jack-servlet": {
- "type": "github",
- "user": "tlrobinson"
- },
- "appengine-java-sdk": {
- "type": "inline",
- "package.json": {
- "name": "gae",
- "title": "Google App Engine Java SDK",
- "description": "Java components necessary for deploying applications on Google's App Engine.",
- "author": "Google",
- "version": "1.2.2",
- "dependencies": ["jack-servlet", "jack", "narwhal"],
- "lib": [],
- "type": "zip",
- "location": "http://googleappengine.googlecode.com/files/appengine-java-sdk-1.2.2.zip"
- }
- },
- "env": {
- "type": "github",
- "name": "env-js",
- "user": "kriskowal",
- "package.json": {}
- },
- "template": {
- "type": "github",
- "user": "gmosx"
- }
- }
-}
diff --git a/utils/temp.txt b/utils/temp.txt
deleted file mode 100755
index 895c510..0000000
--- a/utils/temp.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-#: ../../yes_no/js/yes_no.js:72
-msgid "Not Hebrew"
-msgstr ""
diff --git a/utils/test.pot b/utils/test.pot
deleted file mode 100755
index 5f1321d..0000000
--- a/utils/test.pot
+++ /dev/null
@@ -1,65 +0,0 @@
-# SOME DESCRIPTIVE TITLE.
-# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same licenseas the PACKAGE package.
-# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
-msgid ""
-msgstr ""
-"Project-Id-Version: PACKAGE VERSION\n"
-"Report-Msgid-Bugs-To: bryan@olenepal.org \n"
-"POT-Creation-Date: Today\n"
-"PO-Revision-Date: 2009-07-15 HO:MI+ZONE\n"
-"Last-Translator: bryan berry <bryan@olenepal.org>\n"
-"Language-Team: LANGUAGE <LL@li.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-msgid "My First Karma Lesson!"
-msgstr ""
-
-msgid "Change Direction of Layout"
-msgstr ""
-
-msgid "English"
-msgstr ""
-
-msgid "Nepali"
-msgstr ""
-
-msgid "Hebrew"
-msgstr ""
-
-msgid "Spanish"
-msgstr ""
-
-msgid "The <big id="" >big</big> score is"
-msgstr ""
-
-msgid "0"
-msgstr ""
-
-msgid "Yes"
-msgstr ""
-
-msgid "No!"
-msgstr ""
-
-msgid "Restart"
-msgstr ""
-
-msgid "karma,javascript,html5,sugar,sugarlabs,gsoc,ole,nepal"
-msgstr ""
-
-msgid "This be a localized image"
-msgstr ""
-
-msgid "This is alternate Text for an image"
-msgstr ""
-
-msgid "Some more alternate Text"
-msgstr ""
-
-#: ../../yes_no/js/yes_no.js:72
-msgid "Not Hebrew"
-msgstr ""
-
diff --git a/utils/tests/all-tests.js b/utils/tests/all-tests.js
deleted file mode 100755
index 2486f64..0000000
--- a/utils/tests/all-tests.js
+++ /dev/null
@@ -1,12 +0,0 @@
-exports.testSandbox = require("./iojs/program");
-exports.testString = require("./string-tests");
-exports.testURI = require("./uri-tests");
-exports.testCodecs = require("./codecs");
-exports.testOS = require("./os/all-tests");
-exports.testFile = require("./file/all-tests");
-exports.testUtil = require("./util/all-tests");
-
-exports.testServerJS = require("./serverjs/all-tests");
-
-if (require.main === module.id)
- require("os").exit(require("test/runner").run(exports));
diff --git a/utils/tests/base64.js b/utils/tests/base64.js
deleted file mode 100755
index 09bcd34..0000000
--- a/utils/tests/base64.js
+++ /dev/null
@@ -1,23 +0,0 @@
-
-var base64 = require('base64.js');
-var binary = require('binary');
-var assert = require('test/assert.js');
-
-var raw = "Once upon a time, in a far away land.\n";
-var encoded = 'T25jZSB1cG9uIGEgdGltZSwgaW4gYSBmYXIgYXdheSBsYW5kLgo=';
-
-exports.testEncode = function () {
- assert.eq(base64.encode(raw), encoded, 'encoded');
-};
-
-exports.testDecode = function () {
- assert.eq(base64.decode(encoded), raw, 'decoded');
-};
-
-exports.testEncodeDecode = function () {
- assert.eq(base64.decode(base64.encode(raw)), raw, 'encode decode identity');
-};
-
-if (require.main === module.id)
- require("os").exit(require("test/runner").run(exports));
-
diff --git a/utils/tests/codecs.js b/utils/tests/codecs.js
deleted file mode 100755
index c43c723..0000000
--- a/utils/tests/codecs.js
+++ /dev/null
@@ -1,65 +0,0 @@
-
-var assert = require('test/assert');
-var struct = require('struct');
-
-var raw = "Hello, World!";
-var md4 = require('md4');
-var md5 = require('md5');
-var sha = require('sha');
-var sha256 = require('sha256');
-var crc32 = require('crc32');
-
-exports.testMd4 = function () {
- assert.eq(md4.hash("test hash").toString(16), "549089516e75bd13c41ff098fbb58d5e");
- assert.eq(md4.hash("abc").toString(16), "a448017aaf21d8525fc10ae87aa6729d");
-};
-
-exports.testMd5 = function () {
- assert.eq(md5.hash(raw).toString(16), "65a8e27d8879283831b664bd8b7f0ad4", 'md5');
- assert.eq(md5.hash("message digest").toString(16), "f96b697d7cb7938d525a2f31aaf161d0");
- assert.eq(md5.hash("abc").toString(16), "900150983cd24fb0d6963f7d28e17f72");
-};
-
-exports.testSha = function () {
- assert.eq(sha.hash(raw).toString(16), "0a0a9f2a6772942557ab5355d76af442f8f65e01", 'sha1');
- assert.eq(sha.hash("160-bit hash").toString(16), "90d925d853c3d35cd54070bb75280fefad9de9e7");
-};
-
-exports.testSha256 = function () {
- assert.eq(sha256.hash(raw).toString(16), "dffd6021bb2bd5b0af676290809ec3a53191dd81c7f70a4b28688a362182986f", 'sha256');
-};
-
-exports.testCrc32 = function () {
- assert.eq(crc32.hash(raw), -(parseInt("ec4ac3d0", 16) + 1) ^ -1, 'crc32');
-};
-
-/*
- http://pajhome.org.uk/crypt/md5/
-*/
-
-/*
-
- Original text Hello, World!
- Original bytes 48:65:6c:6c:6f:2c:20:57:6f:72:6c:64:21 (length=13)
- Adler32 1f9e046a
- CRC32 ec4ac3d0
- Haval 69329e93ccfd832bb1a4ee00d01344cf
- MD2 1c8f1e6a94aaa7145210bf90bb52871a
- MD4 94e3cb0fa9aa7a5ee3db74b79e915989
- MD5 65a8e27d8879283831b664bd8b7f0ad4
- RipeMD128 67f9fe75ca2886dc76ad00f7276bdeba
- RipeMD160 527a6a4b9a6da75607546842e0e00105350b1aaf
- SHA-1 0a0a9f2a6772942557ab5355d76af442f8f65e01
- SHA-256 dffd6021bb2bd5b0af676290809ec3a53191dd81c7f70a4b28688a362182986f
- SHA-384 5485cc9b3365b4305dfb4e8337e0a598a574f8242bf17289e0dd6c20a3cd44a089de16ab4ab308f63e44b1170eb5f515
- SHA-512 374d794a95cdcfd8b35993185fef9ba368f160d8daf432d08ba9f1ed1e5abe6cc69291e0fa2fe0006a52570ef18c19def4e617c33ce52ef0a6e5fbe318cb0387
- Tiger 252a5047009cd0710a1aa60525daf73ea55cb90319a39242
- Whirlpool 16c581089b6a6f356ae56e16a63a4c613eecd82a2a894b293f5ee45c37a31d09d7a8b60bfa7e414bd4a7166662cea882b5cf8c96b7d583fc610ad202591bcdb1
-
- http://www.fileformat.info/tool/hash.htm?text=Hello%2C+World%21
-
-*/
-
-if (require.main === module.id)
- require("os").exit(require("test/runner").run(exports));
-
diff --git a/utils/tests/file/all-tests.js b/utils/tests/file/all-tests.js
deleted file mode 100755
index 4730ec7..0000000
--- a/utils/tests/file/all-tests.js
+++ /dev/null
@@ -1,31 +0,0 @@
-var assert = require("test/assert");
-var fs = require("file");
-
-exports.testRmtreeDoesNotFollowSymlinks = function () {
- var here = fs.path(module.path).dirname();
- if (here.join('foo').exists())
- here.join('foo').rmtree();
- try {
- here.join('foo', 'bar').mkdirs();
- here.join('foo', 'bar').symlink(here.join('foo', 'baz'));
- here.join('foo', 'baz').rmtree();
- assert.isTrue(here.join('foo', 'bar').exists());
- } finally {
- here.join('foo').rmtree();
- }
-};
-
-exports.testGlobStar = function () {
-};
-
-exports.testGlobQuestion = function () {
-};
-
-exports.testGlobStarStar = function () {
-};
-
-exports.testGlobDotDotDot = function () {
-};
-
-if (require.main === module.id)
- require("os").exit(require("test/runner").run(exports));
diff --git a/utils/tests/iojs/absolute/b.js b/utils/tests/iojs/absolute/b.js
deleted file mode 100755
index da5bf4f..0000000
--- a/utils/tests/iojs/absolute/b.js
+++ /dev/null
@@ -1 +0,0 @@
-exports.foo = function() {};
diff --git a/utils/tests/iojs/absolute/program.js b/utils/tests/iojs/absolute/program.js
deleted file mode 100755
index 149d40f..0000000
--- a/utils/tests/iojs/absolute/program.js
+++ /dev/null
@@ -1,5 +0,0 @@
-var test = require('test');
-var a = require('submodule/a');
-var b = require('b');
-test.assert(a.foo().foo === b.foo, 'require works with absolute identifiers');
-print('DONE', 'info');
diff --git a/utils/tests/iojs/absolute/submodule/a.js b/utils/tests/iojs/absolute/submodule/a.js
deleted file mode 100755
index bc138b8..0000000
--- a/utils/tests/iojs/absolute/submodule/a.js
+++ /dev/null
@@ -1,3 +0,0 @@
-exports.foo = function () {
- return require('b');
-};
diff --git a/utils/tests/iojs/absolute/test.js b/utils/tests/iojs/absolute/test.js
deleted file mode 100755
index a690a2d..0000000
--- a/utils/tests/iojs/absolute/test.js
+++ /dev/null
@@ -1,9 +0,0 @@
-
-exports.assert = function (guard, message) {
- if (guard) {
- print('PASS ' + message, 'pass');
- } else {
- print('FAIL ' + message, 'fail');
- }
-};
-
diff --git a/utils/tests/iojs/config.js b/utils/tests/iojs/config.js
deleted file mode 100755
index e52293e..0000000
--- a/utils/tests/iojs/config.js
+++ /dev/null
@@ -1,11 +0,0 @@
-(function (env) {
- try {
- var sandbox = require('chiron/sandbox').sandbox;
- var base = require('chiron/base');
- var log = base.List();
- sandbox('test/iojs/program', {print: log.push});
- return [200, {'Content-type': 'text/plain'}, log.eachIter(base.add("\n"))];
- } catch (exception) {
- return [500, {'Content-type': 'text/plain'}, [''+(exception.message || exception)]];
- }
-});
diff --git a/utils/tests/iojs/cyclic/a.js b/utils/tests/iojs/cyclic/a.js
deleted file mode 100755
index e0188fa..0000000
--- a/utils/tests/iojs/cyclic/a.js
+++ /dev/null
@@ -1,4 +0,0 @@
-exports.a = function () {
- return b;
-};
-var b = require('b');
diff --git a/utils/tests/iojs/cyclic/b.js b/utils/tests/iojs/cyclic/b.js
deleted file mode 100755
index 873a305..0000000
--- a/utils/tests/iojs/cyclic/b.js
+++ /dev/null
@@ -1,4 +0,0 @@
-var a = require('a');
-exports.b = function () {
- return a;
-};
diff --git a/utils/tests/iojs/cyclic/program.js b/utils/tests/iojs/cyclic/program.js
deleted file mode 100755
index 93c0330..0000000
--- a/utils/tests/iojs/cyclic/program.js
+++ /dev/null
@@ -1,10 +0,0 @@
-var test = require('test');
-var a = require('a');
-var b = require('b');
-
-test.assert(a.a, 'a exists');
-test.assert(b.b, 'b exists')
-test.assert(a.a().b === b.b, 'a gets b');
-test.assert(b.b().a === a.a, 'b gets a');
-
-print('DONE', 'info');
diff --git a/utils/tests/iojs/cyclic/test.js b/utils/tests/iojs/cyclic/test.js
deleted file mode 100755
index a690a2d..0000000
--- a/utils/tests/iojs/cyclic/test.js
+++ /dev/null
@@ -1,9 +0,0 @@
-
-exports.assert = function (guard, message) {
- if (guard) {
- print('PASS ' + message, 'pass');
- } else {
- print('FAIL ' + message, 'fail');
- }
-};
-
diff --git a/utils/tests/iojs/determinism/program.js b/utils/tests/iojs/determinism/program.js
deleted file mode 100755
index 8ae9461..0000000
--- a/utils/tests/iojs/determinism/program.js
+++ /dev/null
@@ -1,3 +0,0 @@
-var test = require('test');
-require('submodule/a');
-print('DONE', 'info');
diff --git a/utils/tests/iojs/determinism/submodule/a.js b/utils/tests/iojs/determinism/submodule/a.js
deleted file mode 100755
index 0221574..0000000
--- a/utils/tests/iojs/determinism/submodule/a.js
+++ /dev/null
@@ -1,8 +0,0 @@
-var pass = false;
-var test = require('test');
-try {
- require('a');
-} catch (exception) {
- pass = true;
-}
-test.assert(pass, 'require does not fall back to relative modules when absolutes are not available.')
diff --git a/utils/tests/iojs/determinism/submodule/b.js b/utils/tests/iojs/determinism/submodule/b.js
deleted file mode 100755
index 139597f..0000000
--- a/utils/tests/iojs/determinism/submodule/b.js
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
diff --git a/utils/tests/iojs/determinism/test.js b/utils/tests/iojs/determinism/test.js
deleted file mode 100755
index a690a2d..0000000
--- a/utils/tests/iojs/determinism/test.js
+++ /dev/null
@@ -1,9 +0,0 @@
-
-exports.assert = function (guard, message) {
- if (guard) {
- print('PASS ' + message, 'pass');
- } else {
- print('FAIL ' + message, 'fail');
- }
-};
-
diff --git a/utils/tests/iojs/exactExports/a.js b/utils/tests/iojs/exactExports/a.js
deleted file mode 100755
index 99c929e..0000000
--- a/utils/tests/iojs/exactExports/a.js
+++ /dev/null
@@ -1,3 +0,0 @@
-exports.program = function () {
- return require('program');
-};
diff --git a/utils/tests/iojs/exactExports/program.js b/utils/tests/iojs/exactExports/program.js
deleted file mode 100755
index e678431..0000000
--- a/utils/tests/iojs/exactExports/program.js
+++ /dev/null
@@ -1,4 +0,0 @@
-var test = require('test');
-var a = require('a');
-test.assert(a.program() === exports, 'exact exports');
-print('DONE', 'info');
diff --git a/utils/tests/iojs/exactExports/test.js b/utils/tests/iojs/exactExports/test.js
deleted file mode 100755
index a690a2d..0000000
--- a/utils/tests/iojs/exactExports/test.js
+++ /dev/null
@@ -1,9 +0,0 @@
-
-exports.assert = function (guard, message) {
- if (guard) {
- print('PASS ' + message, 'pass');
- } else {
- print('FAIL ' + message, 'fail');
- }
-};
-
diff --git a/utils/tests/iojs/hasOwnProperty/hasOwnProperty.js b/utils/tests/iojs/hasOwnProperty/hasOwnProperty.js
deleted file mode 100755
index e69de29..0000000
--- a/utils/tests/iojs/hasOwnProperty/hasOwnProperty.js
+++ /dev/null
diff --git a/utils/tests/iojs/hasOwnProperty/program.js b/utils/tests/iojs/hasOwnProperty/program.js
deleted file mode 100755
index c574163..0000000
--- a/utils/tests/iojs/hasOwnProperty/program.js
+++ /dev/null
@@ -1,3 +0,0 @@
-var hasOwnProperty = require('hasOwnProperty');
-var toString = require('toString');
-print('DONE', 'info');
diff --git a/utils/tests/iojs/hasOwnProperty/test.js b/utils/tests/iojs/hasOwnProperty/test.js
deleted file mode 100755
index a690a2d..0000000
--- a/utils/tests/iojs/hasOwnProperty/test.js
+++ /dev/null
@@ -1,9 +0,0 @@
-
-exports.assert = function (guard, message) {
- if (guard) {
- print('PASS ' + message, 'pass');
- } else {
- print('FAIL ' + message, 'fail');
- }
-};
-
diff --git a/utils/tests/iojs/hasOwnProperty/toString.js b/utils/tests/iojs/hasOwnProperty/toString.js
deleted file mode 100755
index e69de29..0000000
--- a/utils/tests/iojs/hasOwnProperty/toString.js
+++ /dev/null
diff --git a/utils/tests/iojs/method/a.js b/utils/tests/iojs/method/a.js
deleted file mode 100755
index 69c48af..0000000
--- a/utils/tests/iojs/method/a.js
+++ /dev/null
@@ -1,12 +0,0 @@
-exports.foo = function () {
- return this;
-};
-exports.set = function (x) {
- this.x = x;
-};
-exports.get = function () {
- return this.x;
-};
-exports.getClosed = function () {
- return exports.x;
-};
diff --git a/utils/tests/iojs/method/program.js b/utils/tests/iojs/method/program.js
deleted file mode 100755
index 611a109..0000000
--- a/utils/tests/iojs/method/program.js
+++ /dev/null
@@ -1,8 +0,0 @@
-var test = require('test');
-var a = require('a');
-var foo = a.foo;
-test.assert(a.foo() == a, 'calling a module member');
-test.assert(foo() == (function (){return this})(), 'members not implicitly bound');
-a.set(10);
-test.assert(a.get() == 10, 'get and set')
-print('DONE', 'info');
diff --git a/utils/tests/iojs/method/test.js b/utils/tests/iojs/method/test.js
deleted file mode 100755
index a690a2d..0000000
--- a/utils/tests/iojs/method/test.js
+++ /dev/null
@@ -1,9 +0,0 @@
-
-exports.assert = function (guard, message) {
- if (guard) {
- print('PASS ' + message, 'pass');
- } else {
- print('FAIL ' + message, 'fail');
- }
-};
-
diff --git a/utils/tests/iojs/missing/program.js b/utils/tests/iojs/missing/program.js
deleted file mode 100755
index f8fd6f0..0000000
--- a/utils/tests/iojs/missing/program.js
+++ /dev/null
@@ -1,8 +0,0 @@
-var test = require('test');
-try {
- require('bogus');
- print('FAIL require throws error when module missing', 'fail');
-} catch (exception) {
- print('PASS require throws error when module missing', 'pass');
-}
-print('DONE', 'info');
diff --git a/utils/tests/iojs/missing/test.js b/utils/tests/iojs/missing/test.js
deleted file mode 100755
index a690a2d..0000000
--- a/utils/tests/iojs/missing/test.js
+++ /dev/null
@@ -1,9 +0,0 @@
-
-exports.assert = function (guard, message) {
- if (guard) {
- print('PASS ' + message, 'pass');
- } else {
- print('FAIL ' + message, 'fail');
- }
-};
-
diff --git a/utils/tests/iojs/monkeys/a.js b/utils/tests/iojs/monkeys/a.js
deleted file mode 100755
index a949e1d..0000000
--- a/utils/tests/iojs/monkeys/a.js
+++ /dev/null
@@ -1 +0,0 @@
-require('program').monkey = 10;
diff --git a/utils/tests/iojs/monkeys/program.js b/utils/tests/iojs/monkeys/program.js
deleted file mode 100755
index af50d47..0000000
--- a/utils/tests/iojs/monkeys/program.js
+++ /dev/null
@@ -1,4 +0,0 @@
-var a = require('a');
-var test = require('test');
-test.assert(exports.monkey == 10, 'monkeys permitted');
-print('DONE', 'info');
diff --git a/utils/tests/iojs/monkeys/test.js b/utils/tests/iojs/monkeys/test.js
deleted file mode 100755
index a690a2d..0000000
--- a/utils/tests/iojs/monkeys/test.js
+++ /dev/null
@@ -1,9 +0,0 @@
-
-exports.assert = function (guard, message) {
- if (guard) {
- print('PASS ' + message, 'pass');
- } else {
- print('FAIL ' + message, 'fail');
- }
-};
-
diff --git a/utils/tests/iojs/nested/a/b/c/d.js b/utils/tests/iojs/nested/a/b/c/d.js
deleted file mode 100755
index 69fd282..0000000
--- a/utils/tests/iojs/nested/a/b/c/d.js
+++ /dev/null
@@ -1,3 +0,0 @@
-exports.foo = function () {
- return 1;
-};
diff --git a/utils/tests/iojs/nested/program.js b/utils/tests/iojs/nested/program.js
deleted file mode 100755
index 54bfbe7..0000000
--- a/utils/tests/iojs/nested/program.js
+++ /dev/null
@@ -1,3 +0,0 @@
-var test = require('test');
-test.assert(require('a/b/c/d').foo() == 1, 'nested module identifier');
-print('DONE', 'info');
diff --git a/utils/tests/iojs/nested/test.js b/utils/tests/iojs/nested/test.js
deleted file mode 100755
index a690a2d..0000000
--- a/utils/tests/iojs/nested/test.js
+++ /dev/null
@@ -1,9 +0,0 @@
-
-exports.assert = function (guard, message) {
- if (guard) {
- print('PASS ' + message, 'pass');
- } else {
- print('FAIL ' + message, 'fail');
- }
-};
-
diff --git a/utils/tests/iojs/program.js b/utils/tests/iojs/program.js
deleted file mode 100755
index 7e64b91..0000000
--- a/utils/tests/iojs/program.js
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/usr/bin/env narwhal
-
-var assert = require('test/assert');
-var sandbox = require('sandbox').sandbox;
-var fs = require('file');
-
-[
- 'absolute',
- 'cyclic',
- 'exactExports',
- 'hasOwnProperty',
- 'method',
- 'missing',
- 'monkeys',
- 'nested',
- 'relative',
- 'transitive',
- 'determinism'
-].forEach(function (testName) {
- exports['test ' + testName] = function () {
- var prefix = fs.path(module.id).resolve(testName).join('');
- var done;
-
- var print = function (message) {
- assert.isFalse(/^FAIL/.test(message));
- if (/^ERROR/.test(message))
- throw new Error(message);
- if (/^DONE/.test(message))
- done = true;
- };
-
- sandbox(
- 'program',
- system,
- {
- prefix: prefix,
- loader: require.loader,
- print: print
- }
- );
- assert.isTrue(done, 'done');
- };
-});
-
-if (module.id == require.main)
- require('os').exit(require('test/runner').run(exports));
-
diff --git a/utils/tests/iojs/relative/program.js b/utils/tests/iojs/relative/program.js
deleted file mode 100755
index c7ed6e9..0000000
--- a/utils/tests/iojs/relative/program.js
+++ /dev/null
@@ -1,5 +0,0 @@
-var test = require('test');
-var a = require('submodule/a');
-var b = require('submodule/b');
-test.assert(a.foo == b.foo, 'a and b share foo through a relative require');
-print('DONE', 'info');
diff --git a/utils/tests/iojs/relative/submodule/a.js b/utils/tests/iojs/relative/submodule/a.js
deleted file mode 100755
index 42e4ca0..0000000
--- a/utils/tests/iojs/relative/submodule/a.js
+++ /dev/null
@@ -1 +0,0 @@
-exports.foo = require('./b').foo;
diff --git a/utils/tests/iojs/relative/submodule/b.js b/utils/tests/iojs/relative/submodule/b.js
deleted file mode 100755
index 9042c16..0000000
--- a/utils/tests/iojs/relative/submodule/b.js
+++ /dev/null
@@ -1,2 +0,0 @@
-exports.foo = function () {
-};
diff --git a/utils/tests/iojs/relative/test.js b/utils/tests/iojs/relative/test.js
deleted file mode 100755
index a690a2d..0000000
--- a/utils/tests/iojs/relative/test.js
+++ /dev/null
@@ -1,9 +0,0 @@
-
-exports.assert = function (guard, message) {
- if (guard) {
- print('PASS ' + message, 'pass');
- } else {
- print('FAIL ' + message, 'fail');
- }
-};
-
diff --git a/utils/tests/iojs/transitive/a.js b/utils/tests/iojs/transitive/a.js
deleted file mode 100755
index 4df7bb8..0000000
--- a/utils/tests/iojs/transitive/a.js
+++ /dev/null
@@ -1 +0,0 @@
-exports.foo = require('b').foo;
diff --git a/utils/tests/iojs/transitive/b.js b/utils/tests/iojs/transitive/b.js
deleted file mode 100755
index 30ea70d..0000000
--- a/utils/tests/iojs/transitive/b.js
+++ /dev/null
@@ -1 +0,0 @@
-exports.foo = require('c').foo;
diff --git a/utils/tests/iojs/transitive/c.js b/utils/tests/iojs/transitive/c.js
deleted file mode 100755
index 69fd282..0000000
--- a/utils/tests/iojs/transitive/c.js
+++ /dev/null
@@ -1,3 +0,0 @@
-exports.foo = function () {
- return 1;
-};
diff --git a/utils/tests/iojs/transitive/program.js b/utils/tests/iojs/transitive/program.js
deleted file mode 100755
index 165f7ad..0000000
--- a/utils/tests/iojs/transitive/program.js
+++ /dev/null
@@ -1,3 +0,0 @@
-var test = require('test');
-test.assert(require('a').foo() == 1, 'transitive');
-print('DONE', 'info');
diff --git a/utils/tests/iojs/transitive/test.js b/utils/tests/iojs/transitive/test.js
deleted file mode 100755
index a690a2d..0000000
--- a/utils/tests/iojs/transitive/test.js
+++ /dev/null
@@ -1,9 +0,0 @@
-
-exports.assert = function (guard, message) {
- if (guard) {
- print('PASS ' + message, 'pass');
- } else {
- print('FAIL ' + message, 'fail');
- }
-};
-
diff --git a/utils/tests/os/all-tests.js b/utils/tests/os/all-tests.js
deleted file mode 100755
index f99df4b..0000000
--- a/utils/tests/os/all-tests.js
+++ /dev/null
@@ -1,3 +0,0 @@
-exports.testPopen = require("./popen");
-if (require.main === module.id)
- require("os").exit(require("test/runner").run(exports));
diff --git a/utils/tests/os/popen.js b/utils/tests/os/popen.js
deleted file mode 100755
index d9c08f0..0000000
--- a/utils/tests/os/popen.js
+++ /dev/null
@@ -1,23 +0,0 @@
-var assert = require("test/assert");
-var os = require("os");
-var io = require("io");
-
-exports.testArrayCommunicateStdout = function () {
- var list = io.StringIO();
- list.print("30");
- list.print("4");
- list.print("1000");
- list.print("200");
-
- var process = os.popen(["sort", "-n", "-"]);
- var lines = [];
- process.communicate(list).stdout.forEach(function (line) {
- lines.push(line);
- });
-
- assert.isSame(lines, ["4", "30", "200", "1000"]);
-};
-
-if (require.main === module.id)
- os.exit(require("test/runner").run(exports));
-
diff --git a/utils/tests/sandbox/byte-io.js b/utils/tests/sandbox/byte-io.js
deleted file mode 100755
index dc22fec..0000000
--- a/utils/tests/sandbox/byte-io.js
+++ /dev/null
@@ -1,20 +0,0 @@
-
-var fs = require('file');
-var file = fs.open(fs.resolve(module.path, 'utf-8.js'), 'rb');
-var content = file.read();
-print(typeof content);
-print(content.length);
-print('');
-
-var file = fs.open(fs.resolve(module.path, 'utf-8.js'), 'rt', {'charset': 'utf-8'});
-var content = file.read();
-print(typeof content);
-print(content.length);
-print('');
-
-var file = fs.open(fs.resolve(module.path, 'utf-8.js'), 'r');
-var content = file.read();
-print(typeof content);
-print(content.length);
-print('');
-
diff --git a/utils/tests/sandbox/fileName.js b/utils/tests/sandbox/fileName.js
deleted file mode 100755
index 452bb2f..0000000
--- a/utils/tests/sandbox/fileName.js
+++ /dev/null
@@ -1,3 +0,0 @@
-
-print(module.path);
-
diff --git a/utils/tests/serverjs/all-tests.js b/utils/tests/serverjs/all-tests.js
deleted file mode 100755
index 789f47e..0000000
--- a/utils/tests/serverjs/all-tests.js
+++ /dev/null
@@ -1,9 +0,0 @@
-exports.testFile = require("./file-tests");
-exports.testModules = require("./module-tests");
-exports.testByteArray = require("./bytearray-tests");
-exports.testByteString = require("./bytestring-tests");
-exports.testByteArrayEncodings = require("./bytearray-encodings-tests");
-exports.testByteStringEncodings = require("./bytestring-encodings-tests");
-
-if (require.main === module.id)
- require("os").exit(require("test/runner").run(exports));
diff --git a/utils/tests/serverjs/bytearray-tests.js b/utils/tests/serverjs/bytearray-tests.js
deleted file mode 100755
index 6d165d0..0000000
--- a/utils/tests/serverjs/bytearray-tests.js
+++ /dev/null
@@ -1,273 +0,0 @@
-var assert = require("test/assert");
-
-var Binary = require("binary").Binary,
- ByteString = require("binary").ByteString,
- ByteArray = require("binary").ByteArray;
-
-exports.testByteArrayConstructor = function() {
- var testArray = [1,2,3,4],
- b;
-
- // ByteArray()
- // New, empty ByteArray.
- b = new ByteArray();
- //assert.isTrue(b instanceof Binary, "not instanceof Binary");
- assert.isTrue(b instanceof ByteArray, "not instanceof ByteArray");
- assert.isEqual(0, b.length);
- b.length = 123;
- assert.isEqual(123, b.length);
- assert.isEqual(0, b.get(4));
-
- // ByteArray(length)
- // New ByteArray filled with length zero bytes.
- b = new ByteArray(10);
- assert.isEqual(10, b.length);
- for (var i = 0; i < 10; i++)
- assert.isEqual(0, b.get(i));
- assert.isNaN(b.get(10));
- b.length = 234;
- assert.isEqual(234, b.length);
- assert.isEqual(0, b.get(10));
- assert.isEqual(0, b.get(233));
- assert.isNaN(b.get(234));
-
- // ByteArray(byteString)
- // Copy contents of byteString.
- b = new ByteArray(new ByteString(testArray));
- assert.isEqual(testArray.length, b.length);
- b.length = 345;
- assert.isEqual(345, b.length);
- assert.isEqual(1, b.get(0));
- assert.isEqual(4, b.get(3));
- assert.isEqual(0, b.get(4));
-
- // ByteArray(byteArray)
- // Copy byteArray.
- b = new ByteArray(new ByteArray(testArray));
- assert.isEqual(testArray.length, b.length);
- b.length = 456;
- assert.isEqual(456, b.length);
- assert.isEqual(1, b.get(0));
- assert.isEqual(4, b.get(3));
- assert.isEqual(0, b.get(4));
-
- // ByteArray(arrayOfBytes)
- // Use numbers in arrayOfBytes as contents.
- // Throws an exception if any element is outside the range 0...255 (TODO).
- b = new ByteArray(testArray);
- assert.isEqual(testArray.length, b.length);
- b.length = 567;
- assert.isEqual(567, b.length);
- assert.isEqual(1, b.get(0));
- assert.isEqual(4, b.get(3));
- assert.isEqual(0, b.get(4));
-};
-
-exports.testByteArrayResizing = function() {
- var b1 = new ByteArray([0,1,2,3,4,5,6]);
- assert.isEqual(7, b1.length);
- assert.isNaN(b1.get(7));
-
- b1.length = 10;
- assert.isEqual(10, b1.length, "Length should change to 10");
- assert.isEqual(5, b1.get(5));
- assert.isEqual(0, b1.get(7));
-
- b1.length = 3;
- assert.isEqual(3, b1.length, "Length should change to 10");
- assert.isEqual(0, b1.get(0));
- assert.isNaN(b1.get(4));
-
- b1.length = 9;
- assert.isEqual(9, b1.length, "Length should change to 9");
- assert.isEqual(0, b1.get(0));
- assert.isEqual(0, b1.get(4));
-};
-
-exports.testToByteArray = function() {
- var b1 = new ByteArray([1,2,3]),
- b2 = b1.toByteArray();
-
- assert.isTrue(b2 instanceof ByteArray, "not instanceof ByteArray");
- assert.isEqual(b1.length, b2.length);
- assert.isEqual(b1.get(0), b2.get(0));
- assert.isEqual(b1.get(2), b2.get(2));
-
- assert.isEqual(1, b1.get(0));
- assert.isEqual(1, b2.get(0));
-
- b1.set(0, 10);
-
- assert.isEqual(10, b1.get(0));
- assert.isEqual(1, b2.get(0));
-};
-
-exports.testToByteString = function() {
- var b1 = new ByteArray([1,2,3]),
- b2 = b1.toByteString();
-
- assert.isEqual(b1.length, b2.length);
- assert.isEqual(b1.get(0), b2.get(0));
- assert.isEqual(b1.get(2), b2.get(2));
-
- assert.isEqual(1, b1.get(0));
- assert.isEqual(1, b2.get(0));
-
- b1.set(0, 10);
-
- assert.isEqual(10, b1.get(0));
- assert.isEqual(1, b2.get(0));
-};
-
-exports.testToArray = function() {
- var testArray = [0,1,254,255],
- b1 = new ByteArray(testArray),
- a1 = b1.toArray();
-
- assert.isEqual(testArray.length, a1.length);
- for (var i = 0; i < testArray.length; i++)
- assert.isEqual(testArray[i], a1[i]);
-};
-
-exports.testToString = function() {
- // the format of the resulting string isn't specified, but it shouldn't be the decoded string
- // TODO: is this an ok test?
-
- var testString = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"+
- "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
- testArray = [];
- for (var i = 0; i < 128; i++) testArray.push(65);
-
- var resultString = new ByteArray(testArray).toString();
-
- assert.isTrue(resultString.length < 100);
- assert.isTrue(resultString !== testString);
-};
-
-exports.testIndexOf = function() {
- var b1 = new ByteArray([0,1,2,3,4,5,0,1,2,3,4,5]);
-
- assert.isEqual(-1, b1.indexOf(-1));
-
- assert.isEqual(0, b1.indexOf(0));
- assert.isEqual(5, b1.indexOf(5));
- assert.isEqual(-1, b1.indexOf(12));
-
- assert.isEqual(6, b1.indexOf(0, 6));
- assert.isEqual(11, b1.indexOf(5, 6));
- assert.isEqual(-1, b1.indexOf(12, 6));
-
- assert.isEqual(0, b1.indexOf(0, 0, 3));
- assert.isEqual(-1, b1.indexOf(5, 0, 3));
- assert.isEqual(-1, b1.indexOf(12, 0, 3));
-};
-
-exports.testLastIndexOf = function() {
- var b1 = new ByteArray([0,1,2,3,4,5,0,1,2,3,4,5]);
-
- assert.isEqual(-1, b1.lastIndexOf(-1));
-
- assert.isEqual(6, b1.lastIndexOf(0));
- assert.isEqual(11, b1.lastIndexOf(5));
- assert.isEqual(-1, b1.lastIndexOf(12));
-
- assert.isEqual(0, b1.lastIndexOf(0, 0, 6));
- assert.isEqual(5, b1.lastIndexOf(5, 0, 6));
- assert.isEqual(-1, b1.lastIndexOf(12, 0, 6));
-
- assert.isEqual(6, b1.lastIndexOf(0, 6, 9));
- assert.isEqual(-1, b1.lastIndexOf(5, 6, 9));
- assert.isEqual(-1, b1.lastIndexOf(12, 6, 9));
-};
-
-exports.testByteArrayReverse = function() {
- var testArray = [0,1,2,3,4,5,6];
-
- var b1 = new ByteArray(testArray),
- b2 = b1.reverse();
-
- assert.isEqual(b1, b2);
- assert.isEqual(b1.length, b2.length);
- for (var i = 0; i < testArray.length; i++)
- assert.isEqual(testArray[i], b2.get(testArray.length-i-1));
-
- testArray = [0,1,2,3,4,5,6,7];
-
- b1 = new ByteArray(testArray);
- b2 = b1.reverse();
-
- assert.isEqual(b1, b2);
- assert.isEqual(b1.length, b2.length);
- for (var i = 0; i < testArray.length; i++)
- assert.isEqual(testArray[i], b2.get(testArray.length-i-1));
-};
-
-exports.testByteArraySort = function() {
- var testArray = [];
- for (var i = 0; i < 1000; i++)
- testArray.push(Math.floor(Math.random()*256));
-
- var a = new ByteArray(testArray);
- a.sort();
-
- for (var i = 1; i < a.length; i++)
- assert.isTrue(a.get(i-1) <= a.get(i), "index="+i+"("+a.get(i-1)+","+a.get(i)+")");
-};
-
-exports.testByteArraySortCustom = function() {
- var testArray = [];
- for (var i = 0; i < 1000; i++)
- testArray.push(Math.floor(Math.random()*256));
-
- var a = new ByteArray(testArray);
- a.sort(function(o1, o2) { return o2-o1; });
-
- for (var i = 1; i < a.length; i++)
- assert.isTrue(a.get(i-1) >= a.get(i), "index="+i+"("+a.get(i-1)+","+a.get(i)+")");
-};
-
-exports.testSplit = function() {
- var b1 = new ByteArray([0,1,2,3,4,5]), a1;
-
- a1 = b1.split([]);
- assert.isEqual(1, a1.length);
- assert.isTrue(a1[0] instanceof ByteArray);
- assert.isEqual(6, a1[0].length);
- assert.isEqual(0, a1[0].get(0));
- assert.isEqual(5, a1[0].get(5));
-
- a1 = b1.split([2]);
- assert.isEqual(2, a1.length);
- assert.isTrue(a1[0] instanceof ByteArray);
- assert.isEqual(2, a1[0].length);
- assert.isEqual(0, a1[0].get(0));
- assert.isEqual(1, a1[0].get(1));
- assert.isEqual(3, a1[1].length);
- assert.isEqual(3, a1[1].get(0));
- assert.isEqual(5, a1[1].get(2));
-
- a1 = b1.split([2], { includeDelimiter : true });
- assert.isEqual(3, a1.length);
- assert.isTrue(a1[0] instanceof ByteArray);
- assert.isEqual(2, a1[0].length);
- assert.isEqual(0, a1[0].get(0));
- assert.isEqual(1, a1[0].get(1));
- assert.isEqual(1, a1[1].length);
- assert.isEqual(2, a1[1].get(0));
- assert.isEqual(3, a1[2].length);
- assert.isEqual(3, a1[2].get(0));
- assert.isEqual(5, a1[2].get(2));
-
- a1 = b1.split(new ByteString([2,3]));
- assert.isEqual(2, a1.length);
- assert.isTrue(a1[0] instanceof ByteArray);
- assert.isEqual(2, a1[0].length);
- assert.isEqual(0, a1[0].get(0));
- assert.isEqual(1, a1[0].get(1));
- assert.isEqual(2, a1[1].length);
- assert.isEqual(4, a1[1].get(0));
- assert.isEqual(5, a1[1].get(1));
-};
-
-if (require.main === module.id)
- require("os").exit(require("test/runner").run(exports));
diff --git a/utils/tests/serverjs/bytestring-tests.js b/utils/tests/serverjs/bytestring-tests.js
deleted file mode 100755
index b62db2c..0000000
--- a/utils/tests/serverjs/bytestring-tests.js
+++ /dev/null
@@ -1,263 +0,0 @@
-var assert = require("test/assert");
-
-var Binary = require("binary").Binary,
- ByteString = require("binary").ByteString,
- ByteArray = require("binary").ByteArray;
-
-exports.testByteStringConstructor = function() {
- var testArray = [1,2,3,4];
-
- // ByteString()
- // Construct an empty byte string.
- var b1 = new ByteString();
- //assert.isTrue(b1 instanceof Binary, "not instanceof Binary");
- assert.isTrue(b1 instanceof ByteString, "not instanceof ByteString");
- assert.isEqual(0, b1.length);
- b1.length = 123;
- assert.isEqual(0, b1.length);
-
- // ByteString(byteString)
- // Copies byteString.
- var b2 = new ByteString(new ByteString(testArray));
- assert.isEqual(testArray.length, b2.length);
- b2.length = 123;
- assert.isEqual(testArray.length, b2.length);
- assert.isEqual(1, b2.get(0));
- assert.isEqual(4, b2.get(3));
-
- // ByteString(byteArray)
- // Use the contents of byteArray.
- var b2 = new ByteString(new ByteArray(testArray));
- assert.isEqual(testArray.length, b2.length);
- b2.length = 123;
- assert.isEqual(testArray.length, b2.length);
- assert.isEqual(1, b2.get(0));
- assert.isEqual(4, b2.get(3));
-
- // ByteString(arrayOfNumbers)
- // Use the numbers in arrayOfNumbers as the bytes.
- // If any element is outside the range 0...255, an exception (TODO) is thrown.
- var b3 = new ByteString(testArray);
- assert.isEqual(testArray.length, b3.length);
- b3.length = 123;
- assert.isEqual(testArray.length, b3.length);
- assert.isEqual(1, b3.get(0));
- assert.isEqual(4, b3.get(3));
-};
-
-//exports.testByteStringJoin = function() {
-//}
-
-exports.testToByteArray = function() {
- var b1 = new ByteString([1,2,3]),
- b2 = b1.toByteArray();
-
- assert.isTrue(b2 instanceof ByteArray, "not instanceof ByteArray");
- assert.isEqual(b1.length, b2.length);
- assert.isEqual(b1.get(0), b2.get(0));
- assert.isEqual(b1.get(2), b2.get(2));
-};
-
-exports.testToByteString = function() {
- var b1 = new ByteString([1,2,3]),
- b2 = b1.toByteString();
-
- assert.isEqual(b1.length, b2.length);
- assert.isEqual(b1.get(0), b2.get(0));
- assert.isEqual(b1.get(2), b2.get(2));
-};
-
-exports.testToArray = function() {
- var testArray = [0,1,254,255],
- b1 = new ByteString(testArray),
- a1 = b1.toArray();
-
- assert.isEqual(testArray.length, a1.length);
- for (var i = 0; i < testArray.length; i++)
- assert.isEqual(testArray[i], a1[i]);
-};
-
-exports.testToString = function() {
- // the format of the resulting string isn't specified, but it shouldn't be the decoded string
- // TODO: is this an ok test?
-
- var testString = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"+
- "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
- testArray = [];
- for (var i = 0; i < 128; i++) testArray.push(65);
-
- var resultString = new ByteString(testArray).toString();
-
- assert.isTrue(resultString.length < 100);
- assert.isTrue(resultString !== testString);
-};
-
-exports.testIndexOf = function() {
- var b1 = new ByteString([0,1,2,3,4,5,0,1,2,3,4,5]);
-
- assert.isEqual(-1, b1.indexOf(-1));
-
- assert.isEqual(0, b1.indexOf(0));
- assert.isEqual(5, b1.indexOf(5));
- assert.isEqual(-1, b1.indexOf(12));
-
- assert.isEqual(6, b1.indexOf(0, 6));
- assert.isEqual(11, b1.indexOf(5, 6));
- assert.isEqual(-1, b1.indexOf(12, 6));
-
- assert.isEqual(0, b1.indexOf(0, 0, 3));
- assert.isEqual(-1, b1.indexOf(5, 0, 3));
- assert.isEqual(-1, b1.indexOf(12, 0, 3));
-};
-
-exports.testLastIndexOf = function() {
- var b1 = new ByteString([0,1,2,3,4,5,0,1,2,3,4,5]);
-
- assert.isEqual(-1, b1.lastIndexOf(-1));
-
- assert.isEqual(6, b1.lastIndexOf(0));
- assert.isEqual(11, b1.lastIndexOf(5));
- assert.isEqual(-1, b1.lastIndexOf(12));
-
- assert.isEqual(0, b1.lastIndexOf(0, 0, 6));
- assert.isEqual(5, b1.lastIndexOf(5, 0, 6));
- assert.isEqual(-1, b1.lastIndexOf(12, 0, 6));
-
- assert.isEqual(6, b1.lastIndexOf(0, 6, 9));
- assert.isEqual(-1, b1.lastIndexOf(5, 6, 9));
- assert.isEqual(-1, b1.lastIndexOf(12, 6, 9));
-};
-
-exports.testCharCodeAt = function() {
- var b1 = new ByteString([0,1,2,3,4,255]);
-
- assert.isTrue(isNaN(b1.charCodeAt(-1)));
- assert.isEqual(0, b1.charCodeAt(0));
- assert.isEqual(255, b1.charCodeAt(5));
- assert.isTrue(isNaN(b1.charCodeAt(6)));
-};
-
-// identical to charCodeAt, test anyway?
-exports.testGet = function() {
- var b1 = new ByteString([0,1,2,3,4,255]);
-
- assert.isTrue(isNaN(b1.get(-1)));
- assert.isEqual(0, b1.get(0));
- assert.isEqual(255, b1.get(5));
- assert.isTrue(isNaN(b1.get(6)));
-};
-
-exports.testByteAt = function() {
- var b1 = new ByteString([0,1,2,3,4,255]), b2;
-
- b2 = b1.byteAt(-1);
- assert.isEqual(0, b2.length);
- b2 = b1.byteAt(0);
- assert.isEqual(1, b2.length);
- assert.isEqual(0, b2.get(0));
- b2 = b1.byteAt(5);
- assert.isEqual(1, b2.length);
- assert.isEqual(255, b2.get(0));
- b2 = b1.byteAt(6);
- assert.isEqual(0, b2.length);
-};
-
-// identical to byteAt, test anyway?
-exports.testCharAt = function() {
- var b1 = new ByteString([0,1,2,3,4,255]), b2;
-
- b2 = b1.charAt(-1);
- assert.isEqual(0, b2.length);
- b2 = b1.charAt(0);
- assert.isEqual(1, b2.length);
- assert.isEqual(0, b2.get(0));
- b2 = b1.charAt(5);
- assert.isEqual(1, b2.length);
- assert.isEqual(255, b2.get(0));
- b2 = b1.charAt(6);
- assert.isEqual(0, b2.length);
-};
-
-exports.testSplit = function() {
- var b1 = new ByteString([0,1,2,3,4,5]), a1;
-
- a1 = b1.split([]);
- assert.isEqual(1, a1.length);
- assert.isTrue(a1[0] instanceof ByteString);
- assert.isEqual(6, a1[0].length);
- assert.isEqual(0, a1[0].get(0));
- assert.isEqual(5, a1[0].get(5));
-
- a1 = b1.split([2]);
- assert.isEqual(2, a1.length);
- assert.isTrue(a1[0] instanceof ByteString);
- assert.isEqual(2, a1[0].length);
- assert.isEqual(0, a1[0].get(0));
- assert.isEqual(1, a1[0].get(1));
- assert.isEqual(3, a1[1].length);
- assert.isEqual(3, a1[1].get(0));
- assert.isEqual(5, a1[1].get(2));
-
- a1 = b1.split([2], { includeDelimiter : true });
- assert.isEqual(3, a1.length);
- assert.isTrue(a1[0] instanceof ByteString);
- assert.isEqual(2, a1[0].length);
- assert.isEqual(0, a1[0].get(0));
- assert.isEqual(1, a1[0].get(1));
- assert.isEqual(1, a1[1].length);
- assert.isEqual(2, a1[1].get(0));
- assert.isEqual(3, a1[2].length);
- assert.isEqual(3, a1[2].get(0));
- assert.isEqual(5, a1[2].get(2));
-
- a1 = b1.split(new ByteString([2,3]));
- assert.isEqual(2, a1.length);
- assert.isTrue(a1[0] instanceof ByteString);
- assert.isEqual(2, a1[0].length);
- assert.isEqual(0, a1[0].get(0));
- assert.isEqual(1, a1[0].get(1));
- assert.isEqual(2, a1[1].length);
- assert.isEqual(4, a1[1].get(0));
- assert.isEqual(5, a1[1].get(1));
-};
-
-exports.testSlice = function() {
- var b1 = new ByteString([0,1,2,3,4,5]), b2;
-
- b2 = b1.slice();
- assert.isEqual(6, b2.length);
- assert.isEqual(0, b2.get(0));
- assert.isEqual(5, b2.get(5));
-
- b2 = b1.slice(0);
- assert.isEqual(6, b2.length);
- assert.isEqual(0, b2.get(0));
- assert.isEqual(5, b2.get(5));
-
- b2 = b1.slice(1, 4);
- assert.isEqual(3, b2.length);
- assert.isEqual(1, b2.get(0));
- assert.isEqual(3, b2.get(2));
-
- b2 = b1.slice(0, -1);
- assert.isEqual(5, b2.length);
- assert.isEqual(0, b2.get(0));
- assert.isEqual(4, b2.get(4));
-
- b2 = b1.slice(-3, -1);
- assert.isEqual(2, b2.length);
- assert.isEqual(3, b2.get(0));
- assert.isEqual(4, b2.get(1));
-
- b2 = b1.slice(9, 10);
- assert.isEqual(0, b2.length);
-};
-
-exports.testByteStringNewless = function () {
- assert.isEqual(1, ByteString([0]).length);
- assert.isEqual(2, ByteString([0, 1], 0, 2).length);
-};
-
-if (require.main === module.id)
- require("os").exit(require("test/runner").run(exports));
-
diff --git a/utils/tests/serverjs/file-tests.js b/utils/tests/serverjs/file-tests.js
deleted file mode 100755
index 0db6ac2..0000000
--- a/utils/tests/serverjs/file-tests.js
+++ /dev/null
@@ -1,237 +0,0 @@
-
-var assert = require("test/assert");
-var fs = require("file");
-var binary = require('binary');
-
-exports.testWriteRead = function() {
- try {
- var path = "testWriteRead.txt";
- var content = "testWriteRead.txt\n";
- fs.write(path, content);
- assert.is(content, fs.read(path));
- } finally {
- fs.remove(path);
- }
-};
-
-exports.testOpenWriteReadWrongMode = function () {
- var path = "testOpenWriteReadWrongMode.txt";
- var content = "testOpenWriteReadWrongMode.txt\n";
- assert.throwsError(function () {
- fs.open(path).write(content).flush().close();
- fs.remove(path);
- });
-};
-
-exports.testOpenWriteFlushRead = function () {
- try {
- var path = "testOpenWriteRead.txt";
- var content = "testOpenWriteRead.txt\n";
- fs.open(path, 'w').write(content).flush().close();
- assert.is(content, fs.open(path).read());
- } finally {
- fs.remove(path);
- }
-};
-
-exports.testOpenWriteRead = function () {
- try {
- var path = "testOpenWriteRead.txt";
- var content = "testOpenWriteRead.txt\n";
- fs.open(path, 'w').write(content);
- assert.is("", fs.open(path).read());
- } finally {
- fs.remove(path);
- }
-};
-
-exports.testOpenWriteReadFlushOnClose = function () {
- try {
- var path = "testOpenWriteRead.txt";
- var content = "testOpenWriteRead.txt\n";
- fs.open(path, 'w').write(content).close();
- assert.is(content, fs.open(path).read());
- } finally {
- fs.remove(path);
- }
-};
-
-exports.testPathWriteRead = function () {
- try {
- var path = "testOpenWriteRead.txt";
- var content = "testOpenWriteRead.txt\n";
- fs.path(path).write(content);
- assert.is(content, fs.path(path).read());
- } finally {
- fs.remove(path);
- }
-};
-
-exports.testNewPathWriteRead = function () {
- try {
- var path = "testNewPathWriteRead.txt";
- var content = "testNewPathWriteRead.txt\n";
- new fs.Path(path).write(content);
- assert.is(content, new fs.Path(path).read());
- } finally {
- fs.remove(path);
- }
-};
-
-exports.testBigPathOpenWriteRead = function () {
- try {
- var path = "testBigPathWriteRead.txt";
- var content = "testBigPathWriteRead.txt\n";
- fs.Path(path).write(content);
- assert.is(content, fs.Path(path).read());
- } finally {
- fs.remove(path);
- }
-};
-
-exports.testLittlePathOpenWriteRead = function () {
- var path = "testLittlePathWriteRead.txt";
- var content = "testLittlePathWriteRead.txt\n";
- assert.throwsError(function () {
- fs.path(path).open().write(content).flush().close();
- fs.remove(path);
- });
-};
-
-exports.testLittlePathOpenWriteRead = function () {
- try {
- var path = "testLittlePathOpenWriteRead.txt";
- var content = "testLittlePathOpenWriteRead.txt\n";
- fs.path(path).open('w').write(content).flush().close();
- assert.is(content, fs.path(path).open().read());
- } finally {
- fs.remove(path);
- }
-};
-
-exports.testWriteReadNewlineEnforced = function() {
- try {
- var path = "testWriteReadNewlineEnforced.txt";
- var content = "testWriteReadNewlineEnforced.txt";
- fs.write(path, content);
- assert.is(content + "\n", fs.read(path));
- } finally {
- fs.remove(path);
- }
-};
-
-exports.testWriteReadBinaryWrongMode = function () {
- var path = "testWriteReadBinaryModeWrongMode.txt";
- var content = "\0\0\0".toByteString("ascii");
- assert.throwsError(function () {
- fs.path(path).open('b').write(content).flush().close();
- fs.remove(path);
- });
-};
-
-exports.testWriteReadBinary = function () {
- try {
- var path = "testWriteReadBinary.txt";
- var content = "aaa".toByteString("ascii");
- fs.path(path).open('wb').write(content).flush().close();
- assert.eq(content, fs.path(path).open('b').read());
- } finally {
- fs.remove(path);
- }
-};
-
-exports.testWriteReadBinaryNulls = function () {
- try {
- var path = "testWriteReadBinaryNulls.txt";
- var content = "\0\0\0".toByteString("ascii");
- fs.path(path).open('wb').write(content).flush().close();
- assert.eq(content, fs.path(path).open('b').read());
- } finally {
- fs.remove(path);
- }
-};
-
-exports.testPrintRead = function () {
- try {
- var path = "testPrintRead.txt";
- fs.path(path).open('w').print("hello").print("world");
- assert.is("hello\nworld\n", fs.path(path).open().read());
- } finally {
- fs.remove(path);
- }
-};
-
-exports.testCopy = function () {
- try {
- fs.path("testCopyA.txt").write("testCopy").copy("testCopyB.txt");
- assert.is("testCopy\n", fs.read("testCopyB.txt"));
- } finally {
- fs.remove("testCopyA.txt");
- fs.remove("testCopyB.txt");
- }
-};
-
-exports.testCopyChain = function () {
- try {
- fs.path("testCopyA.txt").write("testCopy").copy("testCopyB.txt").copy("testCopyC.txt");
- assert.is("testCopy\n", fs.read("testCopyC.txt"));
- } finally {
- fs.remove("testCopyA.txt");
- fs.remove("testCopyB.txt");
- fs.remove("testCopyC.txt");
- }
-};
-
-exports.testMoveExists = function () {
- try {
- fs.path("testCopyA.txt").write("testCopy").move("testCopyB.txt");
- assert.isFalse(fs.exists("testCopyA.txt"));
- assert.isTrue(fs.exists("testCopyB.txt"));
- } finally {
- if (fs.exists("testCopyA.txt"))
- fs.remove("testCopyA.txt");
- if (fs.exists("testCopyB.txt"))
- fs.remove("testCopyB.txt");
- }
-};
-
-exports.testsExists = function () {
- assert.isTrue(fs.exists(module.path));
- assert.isTrue(fs.path(module.path).exists());
-};
-
-exports.testsIsFile = function () {
- assert.isTrue(fs.isFile(module.path));
- assert.isTrue(fs.path(module.path).isFile());
-};
-
-exports.testsIsDirectoryDirname = function () {
- assert.isTrue(fs.path(module.path).dirname().isDirectory());
-};
-
-exports.testsIsDirectoryResolve = function () {
- assert.isTrue(fs.path(module.path).resolve('.').isDirectory());
-};
-
-exports.testsRenameList = function () {
- try {
- fs.mkdir('testsRename');
- fs.path('testsRename', 'A.txt').touch();
- assert.eq(fs.path('testsRename').list(), ['A.txt']);
- fs.path('testsRename', 'A.txt').rename('B.txt');
- assert.eq(fs.path('testsRename').list(), ['B.txt']);
- } finally {
- fs.rmtree('testsRename');
- }
-};
-
-exports.testIterator = require('./file/iterator');
-exports.testExtension = require('./file/extension');
-exports.testResolve = require('./file/resolve');
-exports.testNormal = require('./file/normal');
-exports.testDirname = require('./file/dirname');
-exports.testIsAbsolute = require('./file/is-absolute');
-
-if (require.main === module.id)
- require("os").exit(require("test/runner").run(exports));
-
diff --git a/utils/tests/serverjs/file/extension.js b/utils/tests/serverjs/file/extension.js
deleted file mode 100755
index 00e5959..0000000
--- a/utils/tests/serverjs/file/extension.js
+++ /dev/null
@@ -1,45 +0,0 @@
-
-var util = require('util');
-var assert = require('test/assert');
-var fs = require('file');
-
-util.forEachApply([
- ['', ''],
- ['.', ''],
- ['..', ''],
- ['.a', ''],
- ['..a', ''],
- ['.a.b', '.b'],
- ['a.b', '.b'],
- ['a.b.c', '.c'],
- ['/', ''],
- ['/.', ''],
- ['/..', ''],
- ['/..a', ''],
- ['/.a.b', '.b'],
- ['/a.b', '.b'],
- ['/a.b.c', '.c'],
- ['foo/', ''],
- ['foo/.', ''],
- ['foo/..', ''],
- ['foo/..a', ''],
- ['foo/.a.b', '.b'],
- ['foo/a.b', '.b'],
- ['foo/a.b.c', '.c'],
- ['/foo/', ''],
- ['/foo/.', ''],
- ['/foo/..', ''],
- ['/foo/..a', ''],
- ['/foo/.a.b', '.b'],
- ['/foo/a.b', '.b'],
- ['/foo/a.b.c', '.c']
-], function (path, expected) {
- exports['test ' + util.repr(path)] = function () {
- var actual = fs.extension(path);
- assert.eq(expected, actual, util.repr(path));
- };
-});
-
-if (require.main === module.id)
- require("os").exit(require("test/runner").run(exports));
-
diff --git a/utils/tests/serverjs/file/iterator.js b/utils/tests/serverjs/file/iterator.js
deleted file mode 100755
index 603bb51..0000000
--- a/utils/tests/serverjs/file/iterator.js
+++ /dev/null
@@ -1,101 +0,0 @@
-
-var assert = require("test/assert");
-var fs = require("file");
-
-/* a decorator that passes a path object corresponding
- to the test name and removes any files created
- therein afterward */
-var Test = function (block) {
- var args = arguments;
- var exported = function () {
- for (var name in exports) {
- if (exports[name] === exported) {
- try {
- var path = fs.path(
- fs.resolve(module.path, '.'),
- name
- );
- block(path);
- } finally {
- if (path.exists())
- path.rmtree();
- }
- }
- }
- };
- return exported;
-};
-
-exports.testPrintReadLine = Test(function (path) {
- var stream = path.open('w');
- stream.print('hello');
- stream.print('world');
- stream.close();
- stream = path.open('r');
- assert.is('hello\n', stream.readLine());
- assert.is('world\n', stream.readLine());
- assert.is('', stream.readLine());
-});
-
-exports.testPrintReadLineChain = Test(function (path) {
- var stream = path.open('w');
- stream.print('hello').print('world');
- stream.close();
- stream = path.open('r');
- assert.is('hello\n', stream.readLine());
- assert.is('world\n', stream.readLine());
- assert.is('', stream.readLine());
-});
-
-exports.testReadLines = Test(function (path) {
- var stream = path.open('w');
- stream.print('hello').print('world');
- stream.close();
- stream = path.open('r');
- assert.eq(['hello\n', 'world\n'], stream.readLines());
-});
-
-exports.testForEach = Test(function (path) {
- var output = path.open('w');
- var input = path.open('r');
- output.print('1');
- output.print('1');
- var count = 0;
- input.forEach(function (line) {
- assert.eq('1', line);
- count++;
- });
- assert.eq(2, count);
- output.print('2').print('2');
- input.forEach(function (line) {
- assert.eq('2', line);
- count++;
- });
- assert.eq(4, count);
- output.close();
- input.close();
-});
-
-exports.testNext = Test(function (path) {
- path.open('w').print('1').print('2').close();
- var iterator = path.open();
- assert.is('1', iterator.next());
- assert.is('2', iterator.next());
- assert.throwsError(function () {
- iterator.next();
- });
-});
-
-exports.testIterator = Test(function (path) {
- path.open('w').print('1').print('2').close();
- var iterator = path.open().iterator();
- assert.is('1', iterator.next());
- assert.is('2', iterator.next());
- assert.throwsError(function () {
- iterator.next();
- });
-});
-
-if (require.main === module.id)
- require("os").exit(require("test/runner").run(exports));
-
diff --git a/utils/tests/serverjs/file/normal.js b/utils/tests/serverjs/file/normal.js
deleted file mode 100755
index 8314b1d..0000000
--- a/utils/tests/serverjs/file/normal.js
+++ /dev/null
@@ -1,27 +0,0 @@
-
-var util = require('util');
-var assert = require('test/assert');
-var fs = require('file');
-
-util.forEachApply([
- ['', ''],
- ['.', ''],
- ['./', ''],
- ['../', '../'],
- ['../a', '../a'],
- ['../a/', '../a/'],
- ['a/..', ''],
- ['a/../', ''],
- ['a/../b', 'b'],
- ['a/../b/', 'b/'],
-], function (path, expected) {
- exports['test ' + util.repr(path)] = function () {
- var result = '';
- var actual = fs.normal(path);
- assert.eq(expected, actual, util.repr(path));
- };
-});
-
-if (require.main === module.id)
- require("os").exit(require("test/runner").run(exports));
-
diff --git a/utils/tests/serverjs/file/resolve.js b/utils/tests/serverjs/file/resolve.js
deleted file mode 100755
index dbd33f0..0000000
--- a/utils/tests/serverjs/file/resolve.js
+++ /dev/null
@@ -1,44 +0,0 @@
-
-var system = require('system');
-var util = require('util');
-var assert = require('test/assert');
-var fs = require('file');
-
-util.forEachApply([
- [['/'], '/'],
- [['/a'], '/a'],
- [['/a/'], '/a/'],
- [['/a', '/b'], '/b'],
- [['/a', '/b/'], '/b/'],
- [['/', 'a'], '/a'],
- [['/', 'a/'], '/a/'],
- [['/a', 'a'], '/a'],
- [['/a', 'a/'], '/a/'],
- [['/a/', 'a'], '/a/a'],
- [['/a/', 'a/'], '/a/a/'],
- [['..'], '../'],
- [['..', 'a'], '../a'],
- [['..', 'a/'], '../a/'],
- [['.'], ''],
- [['.', 'a'], 'a'],
- [['.', 'a/'], 'a/'],
- [['a', '.'], ''],
- [['a', '.', 'a'], 'a'],
- [['a', '.', 'a/'], 'a/'],
- [['a', '..'], '../'],
- [['a', '..', 'a'], '../a'],
- [['a', '..', 'a/'], '../a/'],
- [['a/', '..'], ''],
- [['a/', '..', 'a'], 'a'],
- [['a/', '..', 'a/'], 'a/'],
- [['a/b', ''], 'a/b'],
-], function (parts, expected) {
- exports['test ' + util.repr(parts)] = function () {
- var result = '';
- var actual = fs.resolve.apply(null, parts);
- assert.eq(expected, actual, util.repr(parts));
- };
-});
-
-if (require.main === module.id)
- require("os").exit(require("test/runner").run(exports));
diff --git a/utils/tests/serverjs/module-tests.js b/utils/tests/serverjs/module-tests.js
deleted file mode 100755
index 449351b..0000000
--- a/utils/tests/serverjs/module-tests.js
+++ /dev/null
@@ -1,9 +0,0 @@
-var assert = require("test/assert");
-
-exports.testModuleCharsetIsUtf8 = function () {
- assert.isEqual(
- 1, "♥".length,
- 'unicode characters should have length of 1'
- );
-};
-
diff --git a/utils/tests/string-tests.js b/utils/tests/string-tests.js
deleted file mode 100755
index d337f07..0000000
--- a/utils/tests/string-tests.js
+++ /dev/null
@@ -1,34 +0,0 @@
-var assert = require("test/assert");
-
-exports.testSqueze = function() {
- assert.isEqual("", "".squeeze());
- assert.isEqual("ok", "ok".squeeze());
- assert.isEqual("it works", "it works".squeeze());
- assert.isEqual("start", "ssstart".squeeze());
- assert.isEqual("end\n", "end\n\n\n".squeeze());
-};
-
-exports.testChomp = function() {
- assert.isEqual("hello", "hello".chomp());
- assert.isEqual("hello", "hello\n".chomp());
- assert.isEqual("hello", "hello\r\n".chomp());
- assert.isEqual("hello", "hello\n\r".chomp()); // FIXME: should fail!!! (== hello\n)
- assert.isEqual("hello", "hello\r".chomp());
- assert.isEqual("hello \n there", "hello \n there".chomp());
- assert.isEqual("he", "hello".chomp("llo"));
-};
-
-exports.testBegins = function() {
- assert.isTrue("Hello".begins("H"));
- assert.isTrue("Hello".begins("Hell"));
- assert.isTrue("Hello".begins("Hello"));
-};
-
-exports.testEnds = function() {
- assert.isTrue("Hello".ends("o"));
- assert.isTrue("Hello".ends("llo"));
- assert.isTrue("Hello".ends("Hello"));
-};
-
-if (require.main === module.id)
- require("os").exit(require("test/runner").run(exports));
diff --git a/utils/tests/uri-tests.js b/utils/tests/uri-tests.js
deleted file mode 100755
index b8f9978..0000000
--- a/utils/tests/uri-tests.js
+++ /dev/null
@@ -1,18 +0,0 @@
-var assert = require("test/assert");
-
-var URI = require("uri").URI;
-
-exports.testConstructor = function() {
- var uri = new URI("http://www.narwhaljs.org/blog/categories?id=news");
-
- assert.isEqual("http", uri.scheme);
- assert.isEqual("www.narwhaljs.org", uri.authority);
- assert.isEqual("/blog/categories", uri.path);
- assert.isEqual("id=news", uri.query);
- assert.isNull(uri.fragment);
-}
-
-exports.testToString = function() {
- var uri = new URI("http://www.narwhaljs.org/blog/categories?id=news");
- assert.isEqual("http://www.narwhaljs.org/blog/categories?id=news", uri.toString());
-}