From 1b42ed61470159f8b430a21019479283716aa2f6 Mon Sep 17 00:00:00 2001 From: Ryan Voots Date: Thu, 11 Mar 2010 17:15:13 -0500 Subject: [PATCH] cleaning some stuff up, i don't need the deps stuff, i also cleaned up some warnings in almost all the plugins, and removed a few plugins i don't want --- deps/IMDB/.svn/entries | 170 - deps/IMDB/.svn/text-base/Changes.svn-base | 6 - deps/IMDB/.svn/text-base/MANIFEST.svn-base | 6 - deps/IMDB/.svn/text-base/Makefile.PL.svn-base | 12 - deps/IMDB/.svn/text-base/README.svn-base | 40 - deps/IMDB/Changes | 6 - deps/IMDB/MANIFEST | 6 - deps/IMDB/Makefile.PL | 12 - deps/IMDB/README | 40 - deps/IMDB/lib/.svn/entries | 62 - deps/IMDB/lib/.svn/text-base/IMDB.pm.svn-base | 241 - deps/IMDB/lib/IMDB.pm | 241 - deps/IMDB/t/.svn/entries | 62 - deps/IMDB/t/.svn/text-base/IMDB.t.svn-base | 17 - deps/IMDB/t/IMDB.t | 17 - .../.svn/entries | 408 - .../.svn/text-base/Changes.svn-base | 94 - .../.svn/text-base/INSTALL.svn-base | 33 - .../.svn/text-base/MANIFEST.SKIP.svn-base | 11 - .../.svn/text-base/MANIFEST.svn-base | 35 - .../.svn/text-base/META.yml.svn-base | 15 - .../.svn/text-base/Makefile.PL.svn-base | 166 - .../.svn/text-base/README.svn-base | 211 - .../.svn/text-base/SpiderMonkey.h.svn-base | 12 - .../.svn/text-base/SpiderMonkey.pm.svn-base | 707 -- .../.svn/text-base/SpiderMonkey.xs.svn-base | 824 -- .../.svn/text-base/typemap.svn-base | 17 - .../Changes | 94 - .../INSTALL | 33 - .../MANIFEST | 35 - .../MANIFEST.SKIP | 11 - .../META.yml | 15 - .../Makefile.PL | 166 - .../README | 211 - .../SpiderMonkey.h | 12 - .../SpiderMonkey.pm | 707 -- .../SpiderMonkey.xs | 824 -- .../t/.svn/entries | 810 -- .../t/.svn/prop-base/000readme.t.svn-base | 5 - .../t/.svn/prop-base/001properties.t.svn-base | 5 - .../t/.svn/prop-base/004setget.t.svn-base | 5 - .../t/.svn/prop-base/005error.t.svn-base | 5 - .../t/.svn/prop-base/006objmeth.t.svn-base | 5 - .../t/.svn/prop-base/007funcret.t.svn-base | 5 - .../t/.svn/prop-base/00array.t.svn-base | 5 - .../t/.svn/prop-base/01doc-href.t.svn-base | 5 - .../t/.svn/prop-base/02nav-appv.t.svn-base | 5 - .../t/.svn/prop-base/03doc-write.t.svn-base | 5 - .../t/.svn/prop-base/04loop.t.svn-base | 5 - .../t/.svn/prop-base/05form.t.svn-base | 5 - .../t/.svn/prop-base/06form2.t.svn-base | 5 - .../t/.svn/text-base/000readme.t.svn-base | 33 - .../t/.svn/text-base/001properties.t.svn-base | 63 - .../t/.svn/text-base/002functions.t.svn-base | 60 - .../t/.svn/text-base/003properties.t.svn-base | 25 - .../t/.svn/text-base/004setget.t.svn-base | 119 - .../t/.svn/text-base/005error.t.svn-base | 30 - .../t/.svn/text-base/006objmeth.t.svn-base | 44 - .../t/.svn/text-base/007funcret.t.svn-base | 47 - .../t/.svn/text-base/00array.t.svn-base | 23 - .../t/.svn/text-base/01doc-href.t.svn-base | 24 - .../t/.svn/text-base/02nav-appv.t.svn-base | 21 - .../t/.svn/text-base/03doc-write.t.svn-base | 21 - .../t/.svn/text-base/04loop.t.svn-base | 31 - .../t/.svn/text-base/05form.t.svn-base | 31 - .../t/.svn/text-base/06form2.t.svn-base | 35 - .../t/.svn/text-base/07func.t.svn-base | 27 - .../t/.svn/text-base/08func2.t.svn-base | 29 - .../t/.svn/text-base/09meth.t.svn-base | 30 - .../t/.svn/text-base/10elobj.t.svn-base | 33 - .../t/.svn/text-base/11intret.t.svn-base | 29 - .../t/.svn/text-base/12dblret.t.svn-base | 25 - .../t/.svn/text-base/13strret.t.svn-base | 25 - .../t/.svn/text-base/init.pl.svn-base | 28 - .../t/000readme.t | 33 - .../t/001properties.t | 63 - .../t/002functions.t | 60 - .../t/003properties.t | 25 - .../t/004setget.t | 119 - .../t/005error.t | 30 - .../t/006objmeth.t | 44 - .../t/007funcret.t | 47 - .../t/00array.t | 23 - .../t/01doc-href.t | 24 - .../t/02nav-appv.t | 21 - .../t/03doc-write.t | 21 - .../t/04loop.t | 31 - .../t/05form.t | 31 - .../t/06form2.t | 35 - .../t/07func.t | 27 - .../t/08func2.t | 29 - .../t/09meth.t | 30 - .../t/10elobj.t | 33 - .../t/11intret.t | 29 - .../t/12dblret.t | 25 - .../t/13strret.t | 25 - .../t/init.pl | 28 - .../typemap | 17 - .../util/.svn/entries | 62 - .../util/.svn/prop-base/download.pl.svn-base | 5 - .../util/.svn/text-base/download.pl.svn-base | 30 - .../util/download.pl | 30 - deps/Jplugin/.svn/entries | 238 - deps/Jplugin/.svn/text-base/Changes.svn-base | 6 - .../.svn/text-base/Jplugin.xs.svn-base | 89 - deps/Jplugin/.svn/text-base/MANIFEST.svn-base | 8 - .../.svn/text-base/Makefile.PL.svn-base | 21 - deps/Jplugin/.svn/text-base/README.svn-base | 40 - deps/Jplugin/.svn/text-base/ppport.h.svn-base | 4954 ------------ deps/Jplugin/Changes | 6 - deps/Jplugin/Jplugin.xs | 89 - deps/Jplugin/MANIFEST | 8 - deps/Jplugin/Makefile.PL | 21 - deps/Jplugin/README | 40 - deps/Jplugin/lib/.svn/entries | 62 - .../lib/.svn/text-base/Jplugin.pm.svn-base | 78 - deps/Jplugin/lib/Jplugin.pm | 78 - deps/Jplugin/ppport.h | 4954 ------------ deps/Jplugin/t/.svn/entries | 62 - .../t/.svn/text-base/Jplugin.t.svn-base | 15 - deps/Jplugin/t/Jplugin.t | 15 - deps/Language-K20/.svn/entries | 445 -- .../.svn/text-base/Changes.svn-base | 6 - .../.svn/text-base/K20.xs.svn-base | 36 - .../.svn/text-base/MANIFEST.svn-base | 10 - .../.svn/text-base/Makefile.PL.svn-base | 41 - .../.svn/text-base/Makefile.old.svn-base | 969 --- .../.svn/text-base/README.svn-base | 40 - .../.svn/text-base/const-c.inc.svn-base | 55 - .../.svn/text-base/const-xs.inc.svn-base | 89 - .../.svn/text-base/k20.h.svn-base | 69 - .../.svn/text-base/ppport.h.svn-base | 6984 ----------------- .../.svn/text-base/stubs_dl.c.svn-base | 3 - .../.svn/text-base/stubs_xs.c.svn-base | 47 - deps/Language-K20/Changes | 6 - deps/Language-K20/K20.xs | 36 - deps/Language-K20/MANIFEST | 10 - deps/Language-K20/Makefile.PL | 41 - deps/Language-K20/Makefile.old | 969 --- deps/Language-K20/README | 40 - deps/Language-K20/const-c.inc | 55 - deps/Language-K20/const-xs.inc | 89 - deps/Language-K20/fallback/.svn/entries | 96 - .../.svn/text-base/const-c.inc.svn-base | 55 - .../.svn/text-base/const-xs.inc.svn-base | 89 - deps/Language-K20/fallback/const-c.inc | 55 - deps/Language-K20/fallback/const-xs.inc | 89 - deps/Language-K20/k20.h | 69 - deps/Language-K20/lib/.svn/entries | 31 - deps/Language-K20/lib/Language/.svn/entries | 62 - .../Language/.svn/text-base/K20.pm.svn-base | 113 - deps/Language-K20/lib/Language/K20.pm | 113 - deps/Language-K20/ppport.h | 6984 ----------------- deps/Language-K20/stubs_dl.c | 3 - deps/Language-K20/stubs_xs.c | 47 - deps/Language-K20/t/.svn/entries | 62 - .../t/.svn/text-base/Language-K20.t.svn-base | 17 - deps/Language-K20/t/Language-K20.t | 17 - deps/Math/.svn/entries | 65 - .../.svn/text-base/Farnsworth.pm.svn-base | 251 - deps/Math/Farnsworth.pm | 251 - deps/Math/Farnsworth/.svn/entries | 380 - .../.svn/text-base/Dimension.pm.svn-base | 138 - .../.svn/text-base/Error.pm.svn-base | 41 - .../.svn/text-base/Evaluate.pm.svn-base | 759 -- .../text-base/FunctionDispatch.pm.svn-base | 301 - .../.svn/text-base/Output.pm.svn-base | 660 -- .../.svn/text-base/Parser.pm.svn-base | 3693 --------- .../.svn/text-base/Units.pm.svn-base | 134 - .../.svn/text-base/Value.pm.svn-base | 142 - .../.svn/text-base/Value_old.pm.svn-base | 430 - .../.svn/text-base/Variables.pm.svn-base | 133 - deps/Math/Farnsworth/Dimension.pm | 138 - deps/Math/Farnsworth/Docs/.svn/entries | 96 - .../Docs/.svn/text-base/Functions.pm.svn-base | 276 - .../Docs/.svn/text-base/Syntax.pm.svn-base | 405 - deps/Math/Farnsworth/Docs/Functions.pm | 276 - deps/Math/Farnsworth/Docs/Syntax.pm | 405 - deps/Math/Farnsworth/Error.pm | 41 - deps/Math/Farnsworth/Evaluate.pm | 759 -- deps/Math/Farnsworth/FunctionDispatch.pm | 301 - deps/Math/Farnsworth/Functions/.svn/entries | 130 - .../text-base/GoogleTranslate.pm.svn-base | 198 - .../.svn/text-base/Standard.pm.svn-base | 458 -- .../.svn/text-base/StdMath.pm.svn-base | 453 -- .../Farnsworth/Functions/GoogleTranslate.pm | 198 - deps/Math/Farnsworth/Functions/Standard.pm | 458 -- deps/Math/Farnsworth/Functions/StdMath.pm | 453 -- deps/Math/Farnsworth/Output.pm | 660 -- deps/Math/Farnsworth/Parser.pm | 3693 --------- deps/Math/Farnsworth/Units.pm | 134 - deps/Math/Farnsworth/Units/.svn/entries | 164 - .../Units/.svn/text-base/Currency.pm.svn-base | 79 - .../Units/.svn/text-base/Pi10-6.html.svn-base | 1 - .../Units/.svn/text-base/Standard.pm.svn-base | 4124 ---------- .../Units/.svn/text-base/e.2mil.svn-base | 1 - deps/Math/Farnsworth/Units/Currency.pm | 79 - deps/Math/Farnsworth/Units/Pi10-6.html | 1 - deps/Math/Farnsworth/Units/Standard.pm | 4124 ---------- deps/Math/Farnsworth/Units/e.2mil | 1 - deps/Math/Farnsworth/Value.pm | 142 - deps/Math/Farnsworth/Value/.svn/entries | 300 - .../Value/.svn/text-base/Array.pm.svn-base | 227 - .../Value/.svn/text-base/Boolean.pm.svn-base | 198 - .../Value/.svn/text-base/Date.pm.svn-base | 260 - .../Value/.svn/text-base/Lambda.pm.svn-base | 230 - .../Value/.svn/text-base/NewValue.pm.svn-base | 84 - .../Value/.svn/text-base/Pari.pm.svn-base | 271 - .../Value/.svn/text-base/String.pm.svn-base | 232 - .../Value/.svn/text-base/Undef.pm.svn-base | 192 - deps/Math/Farnsworth/Value/Array.pm | 227 - deps/Math/Farnsworth/Value/Boolean.pm | 198 - deps/Math/Farnsworth/Value/Date.pm | 260 - deps/Math/Farnsworth/Value/Lambda.pm | 230 - deps/Math/Farnsworth/Value/NewValue.pm | 84 - deps/Math/Farnsworth/Value/Pari.pm | 271 - deps/Math/Farnsworth/Value/String.pm | 232 - deps/Math/Farnsworth/Value/Undef.pm | 192 - deps/Math/Farnsworth/Value_old.pm | 430 - deps/Math/Farnsworth/Variables.pm | 133 - lib/Bot/BB3.pm | 8 +- lib/Bot/BB3/Roles/Console.pm | 2 +- lib/Bot/BB3/Roles/IRC.pm | 8 +- lib/EvalServer.pm | 2 +- lib/eval.pl | 2 + plugins/arg.pm | 5 +- plugins/cache_check.pm | 2 +- plugins/compose.pm | 2 +- plugins/conf.pm | 4 +- plugins/conf_dump.pm | 11 +- plugins/core.pm | 3 +- plugins/echo.pm | 3 +- plugins/eval.pm | 2 +- plugins/factoids.pm | 9 +- plugins/geoip.pm | 4 +- plugins/head.pm | 4 +- plugins/help.pm | 4 +- plugins/host.pm | 1 + plugins/host_lookup.pm | 4 +- plugins/join.pm | 3 +- plugins/karma.pm | 4 +- plugins/karma_modify.pm | 2 +- plugins/karmatop.pm | 6 +- plugins/more.pm | 2 +- plugins/nick_lookup.pm | 4 +- plugins/part.pm | 1 + plugins/plugins.pm | 2 +- plugins/quote.pm | 1 + plugins/reload_plugins.pm | 2 +- plugins/restart.pm | 1 + plugins/rss.pm | 1 + plugins/rss_title.pm | 1 + plugins/rt.pm | 27 - plugins/save_config.pm | 1 + plugins/seen.pm | 2 +- plugins/shorten.pm | 2 +- plugins/spell.pm | 67 - plugins/title.pm | 2 +- plugins/unicode.pm | 1 + plugins/weather.pm | 62 - 260 files changed, 76 insertions(+), 67065 deletions(-) delete mode 100644 deps/IMDB/.svn/entries delete mode 100644 deps/IMDB/.svn/text-base/Changes.svn-base delete mode 100644 deps/IMDB/.svn/text-base/MANIFEST.svn-base delete mode 100644 deps/IMDB/.svn/text-base/Makefile.PL.svn-base delete mode 100644 deps/IMDB/.svn/text-base/README.svn-base delete mode 100644 deps/IMDB/Changes delete mode 100644 deps/IMDB/MANIFEST delete mode 100644 deps/IMDB/Makefile.PL delete mode 100644 deps/IMDB/README delete mode 100644 deps/IMDB/lib/.svn/entries delete mode 100644 deps/IMDB/lib/.svn/text-base/IMDB.pm.svn-base delete mode 100644 deps/IMDB/lib/IMDB.pm delete mode 100644 deps/IMDB/t/.svn/entries delete mode 100644 deps/IMDB/t/.svn/text-base/IMDB.t.svn-base delete mode 100644 deps/IMDB/t/IMDB.t delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/.svn/entries delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/Changes.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/INSTALL.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/MANIFEST.SKIP.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/MANIFEST.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/META.yml.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/Makefile.PL.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/README.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/SpiderMonkey.h.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/SpiderMonkey.pm.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/SpiderMonkey.xs.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/typemap.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/Changes delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/INSTALL delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/MANIFEST delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/MANIFEST.SKIP delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/META.yml delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/Makefile.PL delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/README delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/SpiderMonkey.h delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/SpiderMonkey.pm delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/SpiderMonkey.xs delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/entries delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/000readme.t.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/001properties.t.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/004setget.t.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/005error.t.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/006objmeth.t.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/007funcret.t.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/00array.t.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/01doc-href.t.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/02nav-appv.t.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/03doc-write.t.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/04loop.t.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/05form.t.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/06form2.t.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/000readme.t.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/001properties.t.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/002functions.t.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/003properties.t.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/004setget.t.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/005error.t.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/006objmeth.t.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/007funcret.t.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/00array.t.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/01doc-href.t.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/02nav-appv.t.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/03doc-write.t.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/04loop.t.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/05form.t.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/06form2.t.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/07func.t.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/08func2.t.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/09meth.t.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/10elobj.t.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/11intret.t.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/12dblret.t.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/13strret.t.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/init.pl.svn-base delete mode 100755 deps/JavaScript-SpiderMonkey-0.19-patched/t/000readme.t delete mode 100755 deps/JavaScript-SpiderMonkey-0.19-patched/t/001properties.t delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/002functions.t delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/003properties.t delete mode 100755 deps/JavaScript-SpiderMonkey-0.19-patched/t/004setget.t delete mode 100755 deps/JavaScript-SpiderMonkey-0.19-patched/t/005error.t delete mode 100755 deps/JavaScript-SpiderMonkey-0.19-patched/t/006objmeth.t delete mode 100755 deps/JavaScript-SpiderMonkey-0.19-patched/t/007funcret.t delete mode 100755 deps/JavaScript-SpiderMonkey-0.19-patched/t/00array.t delete mode 100755 deps/JavaScript-SpiderMonkey-0.19-patched/t/01doc-href.t delete mode 100755 deps/JavaScript-SpiderMonkey-0.19-patched/t/02nav-appv.t delete mode 100755 deps/JavaScript-SpiderMonkey-0.19-patched/t/03doc-write.t delete mode 100755 deps/JavaScript-SpiderMonkey-0.19-patched/t/04loop.t delete mode 100755 deps/JavaScript-SpiderMonkey-0.19-patched/t/05form.t delete mode 100755 deps/JavaScript-SpiderMonkey-0.19-patched/t/06form2.t delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/07func.t delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/08func2.t delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/09meth.t delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/10elobj.t delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/11intret.t delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/12dblret.t delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/13strret.t delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/t/init.pl delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/typemap delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/util/.svn/entries delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/util/.svn/prop-base/download.pl.svn-base delete mode 100644 deps/JavaScript-SpiderMonkey-0.19-patched/util/.svn/text-base/download.pl.svn-base delete mode 100755 deps/JavaScript-SpiderMonkey-0.19-patched/util/download.pl delete mode 100644 deps/Jplugin/.svn/entries delete mode 100644 deps/Jplugin/.svn/text-base/Changes.svn-base delete mode 100644 deps/Jplugin/.svn/text-base/Jplugin.xs.svn-base delete mode 100644 deps/Jplugin/.svn/text-base/MANIFEST.svn-base delete mode 100644 deps/Jplugin/.svn/text-base/Makefile.PL.svn-base delete mode 100644 deps/Jplugin/.svn/text-base/README.svn-base delete mode 100644 deps/Jplugin/.svn/text-base/ppport.h.svn-base delete mode 100644 deps/Jplugin/Changes delete mode 100644 deps/Jplugin/Jplugin.xs delete mode 100644 deps/Jplugin/MANIFEST delete mode 100644 deps/Jplugin/Makefile.PL delete mode 100644 deps/Jplugin/README delete mode 100644 deps/Jplugin/lib/.svn/entries delete mode 100644 deps/Jplugin/lib/.svn/text-base/Jplugin.pm.svn-base delete mode 100644 deps/Jplugin/lib/Jplugin.pm delete mode 100644 deps/Jplugin/ppport.h delete mode 100644 deps/Jplugin/t/.svn/entries delete mode 100644 deps/Jplugin/t/.svn/text-base/Jplugin.t.svn-base delete mode 100644 deps/Jplugin/t/Jplugin.t delete mode 100644 deps/Language-K20/.svn/entries delete mode 100644 deps/Language-K20/.svn/text-base/Changes.svn-base delete mode 100644 deps/Language-K20/.svn/text-base/K20.xs.svn-base delete mode 100644 deps/Language-K20/.svn/text-base/MANIFEST.svn-base delete mode 100644 deps/Language-K20/.svn/text-base/Makefile.PL.svn-base delete mode 100644 deps/Language-K20/.svn/text-base/Makefile.old.svn-base delete mode 100644 deps/Language-K20/.svn/text-base/README.svn-base delete mode 100644 deps/Language-K20/.svn/text-base/const-c.inc.svn-base delete mode 100644 deps/Language-K20/.svn/text-base/const-xs.inc.svn-base delete mode 100644 deps/Language-K20/.svn/text-base/k20.h.svn-base delete mode 100644 deps/Language-K20/.svn/text-base/ppport.h.svn-base delete mode 100644 deps/Language-K20/.svn/text-base/stubs_dl.c.svn-base delete mode 100644 deps/Language-K20/.svn/text-base/stubs_xs.c.svn-base delete mode 100644 deps/Language-K20/Changes delete mode 100644 deps/Language-K20/K20.xs delete mode 100644 deps/Language-K20/MANIFEST delete mode 100644 deps/Language-K20/Makefile.PL delete mode 100644 deps/Language-K20/Makefile.old delete mode 100644 deps/Language-K20/README delete mode 100644 deps/Language-K20/const-c.inc delete mode 100644 deps/Language-K20/const-xs.inc delete mode 100644 deps/Language-K20/fallback/.svn/entries delete mode 100644 deps/Language-K20/fallback/.svn/text-base/const-c.inc.svn-base delete mode 100644 deps/Language-K20/fallback/.svn/text-base/const-xs.inc.svn-base delete mode 100644 deps/Language-K20/fallback/const-c.inc delete mode 100644 deps/Language-K20/fallback/const-xs.inc delete mode 100644 deps/Language-K20/k20.h delete mode 100644 deps/Language-K20/lib/.svn/entries delete mode 100644 deps/Language-K20/lib/Language/.svn/entries delete mode 100644 deps/Language-K20/lib/Language/.svn/text-base/K20.pm.svn-base delete mode 100644 deps/Language-K20/lib/Language/K20.pm delete mode 100644 deps/Language-K20/ppport.h delete mode 100644 deps/Language-K20/stubs_dl.c delete mode 100644 deps/Language-K20/stubs_xs.c delete mode 100644 deps/Language-K20/t/.svn/entries delete mode 100644 deps/Language-K20/t/.svn/text-base/Language-K20.t.svn-base delete mode 100644 deps/Language-K20/t/Language-K20.t delete mode 100644 deps/Math/.svn/entries delete mode 100644 deps/Math/.svn/text-base/Farnsworth.pm.svn-base delete mode 100644 deps/Math/Farnsworth.pm delete mode 100644 deps/Math/Farnsworth/.svn/entries delete mode 100644 deps/Math/Farnsworth/.svn/text-base/Dimension.pm.svn-base delete mode 100644 deps/Math/Farnsworth/.svn/text-base/Error.pm.svn-base delete mode 100644 deps/Math/Farnsworth/.svn/text-base/Evaluate.pm.svn-base delete mode 100644 deps/Math/Farnsworth/.svn/text-base/FunctionDispatch.pm.svn-base delete mode 100644 deps/Math/Farnsworth/.svn/text-base/Output.pm.svn-base delete mode 100644 deps/Math/Farnsworth/.svn/text-base/Parser.pm.svn-base delete mode 100644 deps/Math/Farnsworth/.svn/text-base/Units.pm.svn-base delete mode 100644 deps/Math/Farnsworth/.svn/text-base/Value.pm.svn-base delete mode 100644 deps/Math/Farnsworth/.svn/text-base/Value_old.pm.svn-base delete mode 100644 deps/Math/Farnsworth/.svn/text-base/Variables.pm.svn-base delete mode 100644 deps/Math/Farnsworth/Dimension.pm delete mode 100644 deps/Math/Farnsworth/Docs/.svn/entries delete mode 100644 deps/Math/Farnsworth/Docs/.svn/text-base/Functions.pm.svn-base delete mode 100644 deps/Math/Farnsworth/Docs/.svn/text-base/Syntax.pm.svn-base delete mode 100644 deps/Math/Farnsworth/Docs/Functions.pm delete mode 100644 deps/Math/Farnsworth/Docs/Syntax.pm delete mode 100644 deps/Math/Farnsworth/Error.pm delete mode 100644 deps/Math/Farnsworth/Evaluate.pm delete mode 100644 deps/Math/Farnsworth/FunctionDispatch.pm delete mode 100644 deps/Math/Farnsworth/Functions/.svn/entries delete mode 100644 deps/Math/Farnsworth/Functions/.svn/text-base/GoogleTranslate.pm.svn-base delete mode 100644 deps/Math/Farnsworth/Functions/.svn/text-base/Standard.pm.svn-base delete mode 100644 deps/Math/Farnsworth/Functions/.svn/text-base/StdMath.pm.svn-base delete mode 100644 deps/Math/Farnsworth/Functions/GoogleTranslate.pm delete mode 100644 deps/Math/Farnsworth/Functions/Standard.pm delete mode 100644 deps/Math/Farnsworth/Functions/StdMath.pm delete mode 100644 deps/Math/Farnsworth/Output.pm delete mode 100644 deps/Math/Farnsworth/Parser.pm delete mode 100644 deps/Math/Farnsworth/Units.pm delete mode 100644 deps/Math/Farnsworth/Units/.svn/entries delete mode 100644 deps/Math/Farnsworth/Units/.svn/text-base/Currency.pm.svn-base delete mode 100644 deps/Math/Farnsworth/Units/.svn/text-base/Pi10-6.html.svn-base delete mode 100644 deps/Math/Farnsworth/Units/.svn/text-base/Standard.pm.svn-base delete mode 100644 deps/Math/Farnsworth/Units/.svn/text-base/e.2mil.svn-base delete mode 100644 deps/Math/Farnsworth/Units/Currency.pm delete mode 100644 deps/Math/Farnsworth/Units/Pi10-6.html delete mode 100644 deps/Math/Farnsworth/Units/Standard.pm delete mode 100644 deps/Math/Farnsworth/Units/e.2mil delete mode 100644 deps/Math/Farnsworth/Value.pm delete mode 100644 deps/Math/Farnsworth/Value/.svn/entries delete mode 100644 deps/Math/Farnsworth/Value/.svn/text-base/Array.pm.svn-base delete mode 100644 deps/Math/Farnsworth/Value/.svn/text-base/Boolean.pm.svn-base delete mode 100644 deps/Math/Farnsworth/Value/.svn/text-base/Date.pm.svn-base delete mode 100644 deps/Math/Farnsworth/Value/.svn/text-base/Lambda.pm.svn-base delete mode 100644 deps/Math/Farnsworth/Value/.svn/text-base/NewValue.pm.svn-base delete mode 100644 deps/Math/Farnsworth/Value/.svn/text-base/Pari.pm.svn-base delete mode 100644 deps/Math/Farnsworth/Value/.svn/text-base/String.pm.svn-base delete mode 100644 deps/Math/Farnsworth/Value/.svn/text-base/Undef.pm.svn-base delete mode 100644 deps/Math/Farnsworth/Value/Array.pm delete mode 100644 deps/Math/Farnsworth/Value/Boolean.pm delete mode 100644 deps/Math/Farnsworth/Value/Date.pm delete mode 100644 deps/Math/Farnsworth/Value/Lambda.pm delete mode 100644 deps/Math/Farnsworth/Value/NewValue.pm delete mode 100644 deps/Math/Farnsworth/Value/Pari.pm delete mode 100644 deps/Math/Farnsworth/Value/String.pm delete mode 100644 deps/Math/Farnsworth/Value/Undef.pm delete mode 100644 deps/Math/Farnsworth/Value_old.pm delete mode 100644 deps/Math/Farnsworth/Variables.pm delete mode 100644 plugins/rt.pm delete mode 100644 plugins/spell.pm delete mode 100644 plugins/weather.pm diff --git a/deps/IMDB/.svn/entries b/deps/IMDB/.svn/entries deleted file mode 100644 index c460f1b..0000000 --- a/deps/IMDB/.svn/entries +++ /dev/null @@ -1,170 +0,0 @@ -10 - -dir -475 -svn://erxz.com/bb3/branches/perlbuut/deps/IMDB -svn://erxz.com/bb3 - - - -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - -dcb1cea6-7f7e-4c78-8a22-148ace8ce36e - -t -dir - -lib -dir - -MANIFEST -file - - - - -2009-10-03T22:54:20.000000Z -b2b4bb53f7628be730b9d4b603a754b8 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -57 - -Makefile.PL -file - - - - -2009-10-03T22:54:20.000000Z -a013e7f0b4a91e2d8970394935efdaea -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -509 - -Changes -file - - - - -2009-10-03T22:54:20.000000Z -440b02384d58aa9be2b95e1133736122 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -152 - -README -file - - - - -2009-10-03T22:54:20.000000Z -dee33c52c01d661c31f7948418d11118 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -1161 - diff --git a/deps/IMDB/.svn/text-base/Changes.svn-base b/deps/IMDB/.svn/text-base/Changes.svn-base deleted file mode 100644 index 70033ea..0000000 --- a/deps/IMDB/.svn/text-base/Changes.svn-base +++ /dev/null @@ -1,6 +0,0 @@ -Revision history for Perl extension IMDB. - -0.01 Sun Jun 7 19:27:43 2009 - - original version; created by h2xs 1.23 with options - -b 5.0.0 -X -n IMDB - diff --git a/deps/IMDB/.svn/text-base/MANIFEST.svn-base b/deps/IMDB/.svn/text-base/MANIFEST.svn-base deleted file mode 100644 index b909ea5..0000000 --- a/deps/IMDB/.svn/text-base/MANIFEST.svn-base +++ /dev/null @@ -1,6 +0,0 @@ -Changes -Makefile.PL -MANIFEST -README -t/IMDB.t -lib/IMDB.pm diff --git a/deps/IMDB/.svn/text-base/Makefile.PL.svn-base b/deps/IMDB/.svn/text-base/Makefile.PL.svn-base deleted file mode 100644 index 0870d7f..0000000 --- a/deps/IMDB/.svn/text-base/Makefile.PL.svn-base +++ /dev/null @@ -1,12 +0,0 @@ -use 5.000; -use ExtUtils::MakeMaker; -# See lib/ExtUtils/MakeMaker.pm for details of how to influence -# the contents of the Makefile that is written. -WriteMakefile( - NAME => 'IMDB', - VERSION_FROM => 'lib/IMDB.pm', # finds $VERSION - PREREQ_PM => {}, # e.g., Module::Name => 1.1 - ($] >= 5.005 ? ## Add these new keywords supported since 5.005 - (ABSTRACT_FROM => 'lib/IMDB.pm', # retrieve abstract from module - AUTHOR => 'A. U. Thor ') : ()), -); diff --git a/deps/IMDB/.svn/text-base/README.svn-base b/deps/IMDB/.svn/text-base/README.svn-base deleted file mode 100644 index 3782d58..0000000 --- a/deps/IMDB/.svn/text-base/README.svn-base +++ /dev/null @@ -1,40 +0,0 @@ -IMDB version 0.01 -================= - -The README is used to introduce the module and provide instructions on -how to install the module, any machine dependencies it may have (for -example C compilers and installed libraries) and any other information -that should be provided before the module is installed. - -A README file is required for CPAN modules since CPAN extracts the -README file from a module distribution so that people browsing the -archive can use it get an idea of the modules uses. It is usually a -good idea to provide version information here so that people can -decide whether fixes for the module are worth downloading. - -INSTALLATION - -To install this module type the following: - - perl Makefile.PL - make - make test - make install - -DEPENDENCIES - -This module requires these other modules and libraries: - - blah blah blah - -COPYRIGHT AND LICENCE - -Put the correct copyright and licence information here. - -Copyright (C) 2009 by A. U. Thor - -This library is free software; you can redistribute it and/or modify -it under the same terms as Perl itself, either Perl version 5.10.0 or, -at your option, any later version of Perl 5 you may have available. - - diff --git a/deps/IMDB/Changes b/deps/IMDB/Changes deleted file mode 100644 index 70033ea..0000000 --- a/deps/IMDB/Changes +++ /dev/null @@ -1,6 +0,0 @@ -Revision history for Perl extension IMDB. - -0.01 Sun Jun 7 19:27:43 2009 - - original version; created by h2xs 1.23 with options - -b 5.0.0 -X -n IMDB - diff --git a/deps/IMDB/MANIFEST b/deps/IMDB/MANIFEST deleted file mode 100644 index b909ea5..0000000 --- a/deps/IMDB/MANIFEST +++ /dev/null @@ -1,6 +0,0 @@ -Changes -Makefile.PL -MANIFEST -README -t/IMDB.t -lib/IMDB.pm diff --git a/deps/IMDB/Makefile.PL b/deps/IMDB/Makefile.PL deleted file mode 100644 index 0870d7f..0000000 --- a/deps/IMDB/Makefile.PL +++ /dev/null @@ -1,12 +0,0 @@ -use 5.000; -use ExtUtils::MakeMaker; -# See lib/ExtUtils/MakeMaker.pm for details of how to influence -# the contents of the Makefile that is written. -WriteMakefile( - NAME => 'IMDB', - VERSION_FROM => 'lib/IMDB.pm', # finds $VERSION - PREREQ_PM => {}, # e.g., Module::Name => 1.1 - ($] >= 5.005 ? ## Add these new keywords supported since 5.005 - (ABSTRACT_FROM => 'lib/IMDB.pm', # retrieve abstract from module - AUTHOR => 'A. U. Thor ') : ()), -); diff --git a/deps/IMDB/README b/deps/IMDB/README deleted file mode 100644 index 3782d58..0000000 --- a/deps/IMDB/README +++ /dev/null @@ -1,40 +0,0 @@ -IMDB version 0.01 -================= - -The README is used to introduce the module and provide instructions on -how to install the module, any machine dependencies it may have (for -example C compilers and installed libraries) and any other information -that should be provided before the module is installed. - -A README file is required for CPAN modules since CPAN extracts the -README file from a module distribution so that people browsing the -archive can use it get an idea of the modules uses. It is usually a -good idea to provide version information here so that people can -decide whether fixes for the module are worth downloading. - -INSTALLATION - -To install this module type the following: - - perl Makefile.PL - make - make test - make install - -DEPENDENCIES - -This module requires these other modules and libraries: - - blah blah blah - -COPYRIGHT AND LICENCE - -Put the correct copyright and licence information here. - -Copyright (C) 2009 by A. U. Thor - -This library is free software; you can redistribute it and/or modify -it under the same terms as Perl itself, either Perl version 5.10.0 or, -at your option, any later version of Perl 5 you may have available. - - diff --git a/deps/IMDB/lib/.svn/entries b/deps/IMDB/lib/.svn/entries deleted file mode 100644 index 8a3da52..0000000 --- a/deps/IMDB/lib/.svn/entries +++ /dev/null @@ -1,62 +0,0 @@ -10 - -dir -475 -svn://erxz.com/bb3/branches/perlbuut/deps/IMDB/lib -svn://erxz.com/bb3 - - - -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - -dcb1cea6-7f7e-4c78-8a22-148ace8ce36e - -IMDB.pm -file - - - - -2009-10-03T22:54:20.000000Z -50c116175e3d733ef0edbd95b2e4213c -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -4954 - diff --git a/deps/IMDB/lib/.svn/text-base/IMDB.pm.svn-base b/deps/IMDB/lib/.svn/text-base/IMDB.pm.svn-base deleted file mode 100644 index 559ac4c..0000000 --- a/deps/IMDB/lib/.svn/text-base/IMDB.pm.svn-base +++ /dev/null @@ -1,241 +0,0 @@ -package IMDB; -use HTML::TreeBuilder; -use URI; -use LWP::Simple qw/get/; -use URI::Escape qw/uri_escape/; -use strict; - - -sub normalize_title -{ - my( $self, $title ) = @_; - - $title =~ tr/'"[]//d; - $title =~ s/ +/ /g; - return $title; -} - -sub new -{ - my( $class, $title ) = @_; - my $self = bless {}, $class; - - my ($uri,$tree) = $self->search( $title ); - return unless defined $tree; - - $self->get_title($tree); - $self->get_basic_info($tree); - - for( qw/plotsummary fullcredits trivia quotes/ ) - { - warn "Fetching $uri$_\n"; - my $html = get( "$uri$_" ); - my $tree = HTML::TreeBuilder->new; - $tree->parse($html); - $tree->eof; - - my $method_name = "get_$_"; - $self->$method_name($tree); - } - - return $self; -} - -sub search -{ - my( $self, $title ) = @_; - my $search_uri = "http://www.imdb.com/find?s=all&q=" . uri_escape($self->normalize_title($title)); - warn "Fetching $search_uri\n"; - my $html = get($search_uri); - - my $tree = HTML::TreeBuilder->new; - $tree->parse($html); - $tree->eof; - - if( not $tree->look_down(_tag => "title")->as_text =~ /IMDb.*Search/ ) - { - my $link = $tree->look_down( _tag => 'a', href => qr#/title/tt# ); - $link->attr('href') =~ m'(/title/tt\d+)'; - return ( "http://www.imdb.com$1",$tree ); - } - - #This gets the initial header for the search results.

Popular Results

- my $top_ele = $tree->look_down( _tag => 'b', sub { $_[0]->as_text eq 'Popular Titles' } ); - - if( $top_ele and ($top_ele->parent->content_list)[2] ) - { - $top_ele = ($top_ele->parent->content_list)[2]; #Should be the opening tag for the follow list of links. - } - - else - { - $top_ele = $tree->look_down( _tag => 'b', sub { $_[0]->as_text eq 'Titles (Exact Matches)' } ); - - if( $top_ele ) - { - $top_ele = ($top_ele->right)[1]; - } - - else - { - $top_ele = $tree->look_down( _tag => 'b', sub { $_[0]->as_text eq 'Titles (Approx Matches)' } ); - - if( $top_ele ) - { - $top_ele = ($top_ele->right)[1]; - } - - else - { - $top_ele = $tree->look_down( _tag => 'b', sub { $_[0]->as_text eq 'Titles (Partial Matches)' } ); - - if( $top_ele ) - { - $top_ele = ($top_ele->right)[1]; - } - - else - { - warn "Error, could not find a useful result for term $title\n"; - return; - } - } - } - } - -# warn "Top ele -- ", $top_ele->as_HTML; - - my $first_link = $top_ele->look_down( _tag => 'a' ); #We only want the first link anyway. - - my $path = URI->new($first_link->attr('href'))->path; - my $uri = URI->new_abs( $path, "http://imdb.com"); - $self->{data}->{uri} = $uri; - - my $actual_html = get( $uri ); - my $new_tree = HTML::TreeBuilder->new; - $new_tree->parse($actual_html); - return ($uri,$new_tree); -} - - -sub get_title -{ - my( $self, $tree ) = @_; - - my $title = $tree->look_down(_tag => "title"); - $self->{data}->{title} = $title->as_text if $title; -} - -sub get_basic_info -{ - my( $self, $tree ) = @_; - - my $rdate = $tree->look_down( _tag => 'h5', sub { $_[0]->as_text eq 'Release Date:' } ); - $self->{data}->{release_date} = $rdate->right if $rdate; - my $genre_title = $tree->look_down( _tag => 'h5', sub { $_[0]->as_text eq 'Genre:' } ); - - if( $genre_title ) - { - my @genres = $genre_title->right; - pop @genres; #Remove the "more.." link. - - if( @genres ) - { - $self->{data}->{genre} .= (ref $_ ? $_->as_text : $_) for @genres; - } - } -} - -sub get_plotsummary -{ - my( $self, $tree ) = @_; - - my $first_summary = $tree->look_down( _tag => 'p', class => 'plotpar' ); - if( $first_summary ) - { - $self->{data}->{summary} = $first_summary->as_text; - } -} - -sub get_quotes -{ - my( $self, $tree ) = @_; - - my $first_link = $tree->look_down( _tag => "a", name => qr/qt\d+/ ); - return unless $first_link; - my @quote_eles = ($first_link,$first_link->right); - - my $quotes; - - for( my $i = 0; $i < $#quote_eles; $i++ ) - { - local $_ = $quote_eles[$i]; - - if( ref $_ and $_->tag eq 'a' and $_->attr('name') =~ /qt\d+/ ) - { - my @quote; - - my $start = $i; - for( $i; $i < @quote_eles; $i++ ) - { - local $_ = $quote_eles[$i]; - - if( ref $_ and ( $_->tag eq 'hr' or $_->tag eq 'div' ) ) - { - last; - } - - if( ref $_ and $_->tag eq 'i' ) - { - $quote[-1] .= $_->as_text; - $i++; - #Hrm, this should probably always be plain text.. - $quote[-1] .= ref $quote_eles[$i] ? $quote_eles[$i]->as_text : $quote_eles[$i]; - } - else - { - my $str = ref $_ ? $_->as_text : $_; - if( $str =~ /\S/ ) { push @quote, $str } - } - } - - for( my $j = 0; $j < @quote; $j++ ) - { - if( $quote[$j] =~ /:/ ) - { - $quote[$j-1].=$quote[$j]; - $quote[$j]=''; - } - } - - s/^\s+//,s/\s+$// for @quote; - @quote = grep length $_, @quote; - push @$quotes, \@quote; - } - } - - $self->{data}->{quotes} = $quotes; -} - -sub get_trivia -{ - my( $self, $tree ) = @_; - - my @trivia; - for my $ul ($tree->look_down( _tag => "ul", class => "trivia" ) ) - { - for( $ul->look_down( _tag => "li" ) ) - { - push @trivia, $_->as_text; - } - } - - $self->{data}->{trivia} = \@trivia; -} - -sub get_fullcredits -{ - my( $self, $tree ) = @_; -} - -1; diff --git a/deps/IMDB/lib/IMDB.pm b/deps/IMDB/lib/IMDB.pm deleted file mode 100644 index 559ac4c..0000000 --- a/deps/IMDB/lib/IMDB.pm +++ /dev/null @@ -1,241 +0,0 @@ -package IMDB; -use HTML::TreeBuilder; -use URI; -use LWP::Simple qw/get/; -use URI::Escape qw/uri_escape/; -use strict; - - -sub normalize_title -{ - my( $self, $title ) = @_; - - $title =~ tr/'"[]//d; - $title =~ s/ +/ /g; - return $title; -} - -sub new -{ - my( $class, $title ) = @_; - my $self = bless {}, $class; - - my ($uri,$tree) = $self->search( $title ); - return unless defined $tree; - - $self->get_title($tree); - $self->get_basic_info($tree); - - for( qw/plotsummary fullcredits trivia quotes/ ) - { - warn "Fetching $uri$_\n"; - my $html = get( "$uri$_" ); - my $tree = HTML::TreeBuilder->new; - $tree->parse($html); - $tree->eof; - - my $method_name = "get_$_"; - $self->$method_name($tree); - } - - return $self; -} - -sub search -{ - my( $self, $title ) = @_; - my $search_uri = "http://www.imdb.com/find?s=all&q=" . uri_escape($self->normalize_title($title)); - warn "Fetching $search_uri\n"; - my $html = get($search_uri); - - my $tree = HTML::TreeBuilder->new; - $tree->parse($html); - $tree->eof; - - if( not $tree->look_down(_tag => "title")->as_text =~ /IMDb.*Search/ ) - { - my $link = $tree->look_down( _tag => 'a', href => qr#/title/tt# ); - $link->attr('href') =~ m'(/title/tt\d+)'; - return ( "http://www.imdb.com$1",$tree ); - } - - #This gets the initial header for the search results.

Popular Results

- my $top_ele = $tree->look_down( _tag => 'b', sub { $_[0]->as_text eq 'Popular Titles' } ); - - if( $top_ele and ($top_ele->parent->content_list)[2] ) - { - $top_ele = ($top_ele->parent->content_list)[2]; #Should be the opening tag for the follow list of links. - } - - else - { - $top_ele = $tree->look_down( _tag => 'b', sub { $_[0]->as_text eq 'Titles (Exact Matches)' } ); - - if( $top_ele ) - { - $top_ele = ($top_ele->right)[1]; - } - - else - { - $top_ele = $tree->look_down( _tag => 'b', sub { $_[0]->as_text eq 'Titles (Approx Matches)' } ); - - if( $top_ele ) - { - $top_ele = ($top_ele->right)[1]; - } - - else - { - $top_ele = $tree->look_down( _tag => 'b', sub { $_[0]->as_text eq 'Titles (Partial Matches)' } ); - - if( $top_ele ) - { - $top_ele = ($top_ele->right)[1]; - } - - else - { - warn "Error, could not find a useful result for term $title\n"; - return; - } - } - } - } - -# warn "Top ele -- ", $top_ele->as_HTML; - - my $first_link = $top_ele->look_down( _tag => 'a' ); #We only want the first link anyway. - - my $path = URI->new($first_link->attr('href'))->path; - my $uri = URI->new_abs( $path, "http://imdb.com"); - $self->{data}->{uri} = $uri; - - my $actual_html = get( $uri ); - my $new_tree = HTML::TreeBuilder->new; - $new_tree->parse($actual_html); - return ($uri,$new_tree); -} - - -sub get_title -{ - my( $self, $tree ) = @_; - - my $title = $tree->look_down(_tag => "title"); - $self->{data}->{title} = $title->as_text if $title; -} - -sub get_basic_info -{ - my( $self, $tree ) = @_; - - my $rdate = $tree->look_down( _tag => 'h5', sub { $_[0]->as_text eq 'Release Date:' } ); - $self->{data}->{release_date} = $rdate->right if $rdate; - my $genre_title = $tree->look_down( _tag => 'h5', sub { $_[0]->as_text eq 'Genre:' } ); - - if( $genre_title ) - { - my @genres = $genre_title->right; - pop @genres; #Remove the "more.." link. - - if( @genres ) - { - $self->{data}->{genre} .= (ref $_ ? $_->as_text : $_) for @genres; - } - } -} - -sub get_plotsummary -{ - my( $self, $tree ) = @_; - - my $first_summary = $tree->look_down( _tag => 'p', class => 'plotpar' ); - if( $first_summary ) - { - $self->{data}->{summary} = $first_summary->as_text; - } -} - -sub get_quotes -{ - my( $self, $tree ) = @_; - - my $first_link = $tree->look_down( _tag => "a", name => qr/qt\d+/ ); - return unless $first_link; - my @quote_eles = ($first_link,$first_link->right); - - my $quotes; - - for( my $i = 0; $i < $#quote_eles; $i++ ) - { - local $_ = $quote_eles[$i]; - - if( ref $_ and $_->tag eq 'a' and $_->attr('name') =~ /qt\d+/ ) - { - my @quote; - - my $start = $i; - for( $i; $i < @quote_eles; $i++ ) - { - local $_ = $quote_eles[$i]; - - if( ref $_ and ( $_->tag eq 'hr' or $_->tag eq 'div' ) ) - { - last; - } - - if( ref $_ and $_->tag eq 'i' ) - { - $quote[-1] .= $_->as_text; - $i++; - #Hrm, this should probably always be plain text.. - $quote[-1] .= ref $quote_eles[$i] ? $quote_eles[$i]->as_text : $quote_eles[$i]; - } - else - { - my $str = ref $_ ? $_->as_text : $_; - if( $str =~ /\S/ ) { push @quote, $str } - } - } - - for( my $j = 0; $j < @quote; $j++ ) - { - if( $quote[$j] =~ /:/ ) - { - $quote[$j-1].=$quote[$j]; - $quote[$j]=''; - } - } - - s/^\s+//,s/\s+$// for @quote; - @quote = grep length $_, @quote; - push @$quotes, \@quote; - } - } - - $self->{data}->{quotes} = $quotes; -} - -sub get_trivia -{ - my( $self, $tree ) = @_; - - my @trivia; - for my $ul ($tree->look_down( _tag => "ul", class => "trivia" ) ) - { - for( $ul->look_down( _tag => "li" ) ) - { - push @trivia, $_->as_text; - } - } - - $self->{data}->{trivia} = \@trivia; -} - -sub get_fullcredits -{ - my( $self, $tree ) = @_; -} - -1; diff --git a/deps/IMDB/t/.svn/entries b/deps/IMDB/t/.svn/entries deleted file mode 100644 index 746a6e1..0000000 --- a/deps/IMDB/t/.svn/entries +++ /dev/null @@ -1,62 +0,0 @@ -10 - -dir -475 -svn://erxz.com/bb3/branches/perlbuut/deps/IMDB/t -svn://erxz.com/bb3 - - - -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - -dcb1cea6-7f7e-4c78-8a22-148ace8ce36e - -IMDB.t -file - - - - -2009-10-03T22:54:20.000000Z -5563f424f7940616770262ffdd161ce7 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -495 - diff --git a/deps/IMDB/t/.svn/text-base/IMDB.t.svn-base b/deps/IMDB/t/.svn/text-base/IMDB.t.svn-base deleted file mode 100644 index b8d9b11..0000000 --- a/deps/IMDB/t/.svn/text-base/IMDB.t.svn-base +++ /dev/null @@ -1,17 +0,0 @@ -# Before `make install' is performed this script should be runnable with -# `make test'. After `make install' it should work as `perl IMDB.t' - -######################### - -# change 'tests => 1' to 'tests => last_test_to_print'; - -use Test; -BEGIN { plan tests => 1 }; -use IMDB; -ok(1); # If we made it this far, we're ok. - -######################### - -# Insert your test code below, the Test::More module is use()ed here so read -# its man page ( perldoc Test::More ) for help writing this test script. - diff --git a/deps/IMDB/t/IMDB.t b/deps/IMDB/t/IMDB.t deleted file mode 100644 index b8d9b11..0000000 --- a/deps/IMDB/t/IMDB.t +++ /dev/null @@ -1,17 +0,0 @@ -# Before `make install' is performed this script should be runnable with -# `make test'. After `make install' it should work as `perl IMDB.t' - -######################### - -# change 'tests => 1' to 'tests => last_test_to_print'; - -use Test; -BEGIN { plan tests => 1 }; -use IMDB; -ok(1); # If we made it this far, we're ok. - -######################### - -# Insert your test code below, the Test::More module is use()ed here so read -# its man page ( perldoc Test::More ) for help writing this test script. - diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/.svn/entries b/deps/JavaScript-SpiderMonkey-0.19-patched/.svn/entries deleted file mode 100644 index 365649e..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/.svn/entries +++ /dev/null @@ -1,408 +0,0 @@ -10 - -dir -475 -svn://erxz.com/bb3/branches/perlbuut/deps/JavaScript-SpiderMonkey-0.19-patched -svn://erxz.com/bb3 - - - -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - -dcb1cea6-7f7e-4c78-8a22-148ace8ce36e - -SpiderMonkey.h -file - - - - -2009-10-03T22:54:20.000000Z -9f9edd285dd69ea755e8cf82d2895988 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -311 - -typemap -file - - - - -2009-10-03T22:54:20.000000Z -0b4b207f9bceddce222c490f7833f85c -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -580 - -SpiderMonkey.xs -file - - - - -2009-10-03T22:54:20.000000Z -3cdf4e44832e756fd6fd56caccfc34c1 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -22143 - -t -dir - -SpiderMonkey.pm -file - - - - -2009-10-03T22:54:20.000000Z -86c0e5aaf190279dbcccf8bca20fd853 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -20317 - -INSTALL -file - - - - -2009-10-03T22:54:20.000000Z -61bdc79780049dfac7ccb8e934494ca8 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -809 - -MANIFEST -file - - - - -2009-10-03T22:54:20.000000Z -91b8f16b9e54c3289a60d9dfb0de7f67 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -490 - -META.yml -file - - - - -2009-10-03T22:54:20.000000Z -e3947fa5d8ade1061c359b694a6dfa83 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -484 - -Makefile.PL -file - - - - -2009-10-03T22:54:20.000000Z -687a07196bd2f9d9a768fb57c9594ec9 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -4581 - -Changes -file - - - - -2009-10-03T22:54:20.000000Z -d7e46aa4fd49100848e5c27a0f8bcd06 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -3286 - -MANIFEST.SKIP -file - - - - -2009-10-03T22:54:20.000000Z -9110b82363ff8e3e369493cda15d5ca8 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -128 - -util -dir - -README -file - - - - -2009-10-03T22:54:20.000000Z -549447c180c59658f370b25d50a30666 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -7770 - diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/Changes.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/Changes.svn-base deleted file mode 100644 index 21e03dc..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/Changes.svn-base +++ /dev/null @@ -1,94 +0,0 @@ -Revision history for Perl extension JavaScript::SpiderMonkey. - -0.19 (05/09/2007) - (tb) Allocate correct amount of memory for scripts that contain UTF-8 - characters with internal UTF-8 flag on. - -0.18 (08/06/2007) - (tb) Added protection against infinite loops - (tb) Added support for JS_THREADSAFE - -0.17 (27/07/2006) - (tb) Made sure eval function doesn't produce warnings when script - variable is uninitialized. - [was supposed to be part of 0.16 but is actually part of 0.17] - (tb) Added support for E4X - -0.16 (13/06/2006) - (tb) Added patch initially proposed by marc [at] igneousconsulting.com - and subsequently modified by Agent Zhang that allows mapped perl - functions to return varied datatypes back to JavaScript - -0.15 (28/02/2006) - (tb) Rewrote Makefile.PL to work on more platforms - -0.14 (12/02/2006) - (tb) Removed remaining debug info - -0.13 (05/02/2006) - (tb) Removed debug info - (tb) Made sure Makefile.PL finds libjs if installed in /usr/lib or - /usr/local/lib - -0.12 (12/03/2005) - (ms) Makefile.PL prerequisite changed from undef to '0'. - (ms) Thomas Busch added a check to Makefile.PL to find an already - installed JS lib. - -0.11 (08/22/2004) - * (ms) Added Log::Log4perl dependency in Makefile.PL as suggested - by an anonymous posting on rt.cpan.org. - * (ms) Added #define for MSC compiler as suggested in - https://rt.cpan.org/Ticket/Display.html?id=6984 - * (ms) Roger Crew provided patches for - a clean Win32 compile plus README text on installing the dll/so. - -0.10 06/20/2004 - * Nikita Savin provided a patch to - set $@ instead of printing to STDERR in case of a JS error. - * Added patch by Chris Blaise : - - Different objects can have the same named function. If no - object is specified on function_set, it's global. - * Log4perl in for debugging - * Chris Blaise submitted a patch to have a perl callback return - an object to JS. Applied with modifications, longer term we need - a solution on how the perl callback tells the JS wrapper what's coming - back: A JS string, an object or an integer. - -0.09 02/20/2004 - * Max Maischein added Win32 installation steps in Makefile.PL - -0.08 09/19/2002 - * Doc bug fixed, reported by Yoz Grahame. - -0.07 09/14/2002 - * Release mgmt changed - -0.06 07/10/2002 - * Made M*PL smarter to detect the JS target platform - -0.05 06/23/2002 - * Added installation instructions to README. - -0.04 06/23/2002 - * Added test case for just setter or just getter - * Added documentation - * Updated todo list - -0.03 06/23/2002 - * Added setters and getters for properties - -0.02 01/20/2002 - * Fixed properties (get/set) - -0.01 01/03/2002 - * Where it all began. - -TODO: - * setters/getters for arrays - * Get rid of GLOBAL and the limitation to one instance - * getter/setter called every time, callback settings checked - at perl level only - * Make fixed constants in init() configurable (1000000) - * Allow for different contexts - * Rethink function names (by_path, function_set etc.) diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/INSTALL.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/INSTALL.svn-base deleted file mode 100644 index c382440..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/INSTALL.svn-base +++ /dev/null @@ -1,33 +0,0 @@ - -How to install JavaScript::SpiderMonkey - -Get the latest SpiderMonkey distribution from mozilla.org: -http://www.mozilla.org/js/spidermonkey shows which releases are available. -http://ftp.mozilla.org/pub/js/js-1.5-rc3a.tar.gz has been proven to work. - -Untar it at the same directory level as the distribution of the -JavaScript::SpiderMonkey perl module distribution whichs README -you're currently reading: - -cd .. -tar zxfv js-1.5-rc3a.tar.gz - -It's important that the js and JavaScript-SpiderMonkey-v.vv directories -are at the same level: - -$ls -JavaScript-SpiderMonkey-1.00 -js -js-1.5-rc3a.tar.gz - -Now, build JavaScript::SpiderMonkey in the standard way: - -cd JavaScript-SpiderMonkey-1.00 -perl Makefile.PL -gmake -gmake test -gmake install - --- and you're good to go! Have fun. - -Mike Schilli, m@perlmeister.com, 2002 diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/MANIFEST.SKIP.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/MANIFEST.SKIP.svn-base deleted file mode 100644 index 378ffef..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/MANIFEST.SKIP.svn-base +++ /dev/null @@ -1,11 +0,0 @@ -blib -^Makefile$ -^Makefile.old$ -CVS -.cvsignore -docs -MANIFEST.bak -adm/release -^SpiderMonkey.bs$ -^SpiderMonkey.c$ -^SpiderMonkey.o$ diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/MANIFEST.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/MANIFEST.svn-base deleted file mode 100644 index 4ac2f9d..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/MANIFEST.svn-base +++ /dev/null @@ -1,35 +0,0 @@ -Changes -INSTALL -Makefile.PL -MANIFEST -MANIFEST.SKIP -META.yml Module meta-data (added by MakeMaker) -README -SpiderMonkey.pm -SpiderMonkey.xs -SpiderMonkey.h -t/000readme.t -t/001properties.t -t/002functions.t -t/003properties.t -t/004setget.t -t/005error.t -t/006objmeth.t -t/007funcret.t -t/00array.t -t/01doc-href.t -t/02nav-appv.t -t/03doc-write.t -t/04loop.t -t/05form.t -t/06form2.t -t/07func.t -t/08func2.t -t/09meth.t -t/10elobj.t -t/11intret.t -t/12dblret.t -t/13strret.t -t/init.pl -typemap -util/download.pl diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/META.yml.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/META.yml.svn-base deleted file mode 100644 index ae4ed1f..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/META.yml.svn-base +++ /dev/null @@ -1,15 +0,0 @@ ---- #YAML:1.0 -name: JavaScript-SpiderMonkey -version: 0.19 -abstract: Perl interface to the JavaScript Engine -license: ~ -generated_by: ExtUtils::MakeMaker version 6.36 -distribution_type: module -requires: - Data::Dumper: 0 - Log::Log4perl: 0 -meta-spec: - url: http://module-build.sourceforge.net/META-spec-v1.2.html - version: 1.2 -author: - - Mike Schilli diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/Makefile.PL.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/Makefile.PL.svn-base deleted file mode 100644 index 545b124..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/Makefile.PL.svn-base +++ /dev/null @@ -1,166 +0,0 @@ -###################################################################### -# -# MakeMaker file for JavaScript::SpiderMonkey -# -# Revision: $Revision: 1.5 $ -# Last Checkin: $Date: 2007/06/08 19:03:08 $ -# By: $Author: thomas_busch $ -# -# Authors: Mike Schilli m@perlmeister.com, 2002-2005 -# Thomas Busch tbusch@cpan.org, 2006 -# -###################################################################### - -use ExtUtils::MakeMaker; -use Getopt::Long; - -# Get the right lib and include dirs for different platforms - -my $JS_LIB_DIR; -my @JS_INCL_DIRS; - -my @c_header_files = qw( - jsapi.h - jsautocfg.h -); - -my @possible_libraries = qw( - libjs.a - js32.dll - libmozjs.so -); - -my %possible_install_paths = ( - "../js/src/*" => "../js/src", - "/usr/lib" => "/usr/include", - "/usr/local/lib" => "/usr/local/include", - "/usr/lib/firefox" => "/usr/include/firefox", -); - -my ($JS_LIB_DIR, @JS_INCL_DIRS, $JS_LIB_NAME); - -foreach my $install_path(keys %possible_install_paths) { - foreach my $possible_lib(@possible_libraries) { - foreach my $libfile(glob "$install_path/$possible_lib") { - next if ! -f $libfile; - my $include_path = $possible_install_paths{$install_path}; - foreach my $c_header(@c_header_files) { - if (-f "$include_path/$c_header") { - my $include_dir = "$include_path/$c_header"; - $include_dir =~ s/$c_header$//; - push @JS_INCL_DIRS, $include_dir; - } - foreach my $headerfile(glob "$include_path/*/$c_header") { - my $include_dir = $headerfile; - $include_dir =~ s/$c_header$//; - push @JS_INCL_DIRS, $include_dir; - } - } - if (scalar(@JS_INCL_DIRS) == scalar(@c_header_files)) { - $JS_LIB_DIR = $libfile; - $JS_LIB_DIR =~ s/$possible_lib$//; - - $JS_LIB_NAME = $possible_lib; - $JS_LIB_NAME =~ s/\.(a|so|dll)$//; - $JS_LIB_NAME =~ s/^lib//; - - last; - } else { - @JS_INCL_DIRS = (); - } - } - last if $JS_LIB_DIR; - } - last if $JS_LIB_DIR; -} - -if ($JS_INCL_DIRS[0] eq $JS_INCL_DIRS[1]) { - shift @JS_INCL_DIRS; -} - -## If no SpiderMonkey library found report that and exit. -## Otherwise print lib and include paths. - -if (!$JS_LIB_DIR) { - print < \$E4X, - "JS_THREADSAFE" => \$JS_THREADSAFE, -); - - -## Determine library name and system-related defines -if ($^O ne 'MSWin32') { - $JS_DEFINE = '-DXP_UNIX'; -} else { - $JS_DEFINE = '-DXP_WIN'; -}; - -## Add E4X support if flag set. -## For more info about E4X check http://en.wikipedia.org/wiki/E4X -if ($E4X) { - $JS_DEFINE .= " -DE4X"; - print "E4X support enabled\n"; -} - -## Support compiling in thread safe environment -if ($JS_THREADSAFE) { - $JS_DEFINE .= " -DJS_THREADSAFE"; - print "Compiling with JS_THREADSAFE flag\n"; -} - - -#### See lib/ExtUtils/MakeMaker.pm for details of how to influence -#### the contents of the Makefile that is written. -################################################## - -WriteMakefile( - 'NAME' => 'JavaScript::SpiderMonkey', - 'VERSION_FROM' => 'SpiderMonkey.pm', # finds $VERSION - 'PREREQ_PM' => { - 'Log::Log4perl' => 0, - 'Data::Dumper' => 0, - }, # e.g., Module::Name => 1.1 - ($] >= 5.005 ? ## Add these new keywords supported since 5.005 - (ABSTRACT_FROM => 'SpiderMonkey.pm', # retrieve abstract from module - AUTHOR => 'Mike Schilli ') : ()), - 'LIBS' => ["-L$JS_LIB_DIR -l$JS_LIB_NAME"], # e.g., '-lm' - 'DEFINE' => $JS_DEFINE, # e.g., '-DHAVE_SOMETHING' - # Insert -I. if you add *.h files later: - 'INC' => "-I".join " -I", @JS_INCL_DIRS, - # Un-comment this if you add C files to link with later: - # 'OBJECT' => '$(O_FILES)', # link all the C files too -); - -###################################################################### -sub MY::postamble { -###################################################################### - ' -README: SpiderMonkey.pm - pod2text SpiderMonkey.pm >README - '; -} diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/README.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/README.svn-base deleted file mode 100644 index 3a68806..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/README.svn-base +++ /dev/null @@ -1,211 +0,0 @@ -###################################################################### - JavaScript::SpiderMonkey 0.17 -###################################################################### - -NAME - JavaScript::SpiderMonkey - Perl interface to the JavaScript Engine - -SYNOPSIS - use JavaScript::SpiderMonkey; - - my $js = JavaScript::SpiderMonkey->new(); - - $js->init(); # Initialize Runtime/Context - - # Define a perl callback for a new JavaScript function - $js->function_set("print_to_perl", sub { print "@_\n"; }); - - # Create a new (nested) object and a property - $js->property_by_path("document.location.href"); - - # Execute some code - my $rc = $js->eval(q! - document.location.href = append("http://", "www.aol.com"); - - print_to_perl("URL is ", document.location.href); - - function append(first, second) { - return first + second; - } - !); - - # Get the value of a property set in JS - my $url = $js->property_get("document.location.href"); - - $js->destroy(); - -INSTALL - JavaScript::SpiderMonkey requires Mozilla's readily compiled - SpiderMonkey 1.5 distribution or better. Please check "SpiderMonkey - Installation". - -DESCRIPTION - JavaScript::SpiderMonkey is a Perl Interface to the SpiderMonkey - JavaScript Engine. It is different from Claes Jacobsson's - "JavaScript.pm" in that it offers two different levels of access: - - [1] A 1:1 mapping of the SpiderMonkey API to Perl - - [2] A more Perl-like API - - This document describes [2], for [1], please check "SpiderMonkey.xs". - - new() - "$js = JavaScript::SpiderMonkey->new()" creates a new object to work - with. To initialize the JS runtime, call "$js->init()" afterwards. - - $js->destroy() - "$js->destroy()" destroys the current runtime and frees up all memory. - - $js->init() - "$js->init()" initializes the SpiderMonkey engine by creating a context, - default classes and objects and adding an error reporter. - - $js->array_by_path($name) - Creates an object of type *Array* in the JS runtime: - - $js->array_by_path("document.form"); - - will first create an object with the name "document" (unless it exists - already) and then define a property named "form" to it, which is an - object of type *Array*. Therefore, in the JS code, you're going to be - able define things like - - document.form[0] = "value"; - - $js->function_set($name, $funcref, [$obj]) - Binds a Perl function provided as a coderef ($funcref) to a newly - created JS function named $name in JS land. It's a real function - (therefore bound to the global object) if $obj is omitted. However, if - $obj is ref to a JS object (retrieved via "$js->object_by_path($path)" - or the like), the function will be a *method* of the specified object. - - $js->function_set("write", sub { print @_ }); - # write("hello"); // In JS land - - $obj = $j->object_by_path("navigator"); - $js->function_set("write", sub { print @_ }, $obj); - # navigator.write("hello"); // In JS land - - $js->array_set_element($obj, $idx, $val) - Sets the element of the array $obj at index position $idx to the value - $val. $obj is a reference to an object of type array (retrieved via - "$js->object_by_path($path)" or the like). - - $js->array_set_element_as_object($obj, $idx, $elobj) - Sets the element of the array $obj at index position $idx to the object - $elobj (both $obj and $elobj have been retrieved via - "$js->object_by_path($path)" or the like). - - $js->array_get_element($obj, $idx) - Gets the value of of the element at index $idx of the object of type - Array $obj. - - $js->property_by_path($path, $value, [$getter], [$setter]) - Sets the specified property of an object in $path to the value $value. - $path is the full name of the property, including the object(s) in JS - land it belongs to: - - $js-Eproperty_by_path("document.location.href", "abc"); - - This first creates the object "document" (if it doesn't exist already), - then the object "document.location", then attaches the property "href" - to it and sets it to "abc". - - $getter and $setter are coderefs that will be called by the JavaScript - engine when the respective property's value is requested or set: - - sub getter { - my($property_path, $value) = @_; - print "$property_path has value $value\n"; - } - - sub setter { - my($property_path, $value) = @_; - print "$property_path set to value $value\n"; - } - - $js-Eproperty_by_path("document.location.href", "abc", - \&getter, \&setter); - - If you leave out $getter and $setter, there's going to be no callbacks - triggerd while the properity is set or queried. If you just want to - specify a $setter, but no $getter, set the $getter to "undef". - - $js->object_by_path($path, [$newobj]) - Get a pointer to an object with the path specified. Create it if it's - not there yet. If $newobj is provided, the ref is used to bind the - existing object to the name in $path. - - $js->property_get($path) - Fetch the property specified by the $path. - - my $val = $js->property_get("document.location.href"); - - $js->eval($code) - Runs the specified piece of <$code> in the JS engine. Afterwards, - property values of objects previously defined will be available via - "$j->property_get($path)" and the like. - - my $rc = $js->eval("write('hello');"); - - The method returns 1 on success or else if there was an error in JS - land. In case of an error, the JS error text will be available in $@. - -SpiderMonkey Installation - First, get the latest SpiderMonkey distribution from mozilla.org: - http://www.mozilla.org/js/spidermonkey shows which releases are - available. "js-1.5-rc3a.tar.gz" has been proven to work. - - Untar it at the same directory level as you just untarred the - "JavaScript::SpiderMonkey" distribution you're currently reading. So, if - you're currently in "/my/path/JavaScript-SpiderMonkey-v.vv", do this: - - cp js-1.5-rc3a.tar.gz /my/path - cd /my/path - tar zxfv js-1.5-rc3a.tar.gz - - Then, compile the SpiderMonkey distribution, if you're on Linux, just - use: - - cd js/src - make -f Makefile.ref - - It's important that the js and JavaScript-SpiderMonkey-v.vv directories - are at the same level: - - [/my/path]$ ls - JavaScript-SpiderMonkey-v.vv - js - js-1.5-rc3a.tar.gz - [/my/path]$ - - (Note that you *can* untar the SpiderMonkey distribution elsewhere, but, - if so, then you need to edit the setting of $JSLIBPATH in Makefile.PL). - - Next, you need to copy the shared library file thus constructed (e.g., - libjs.so or js32.dll) to an appropriate directory on your library path. - On Windows, this can also be the directory where the perl executable - lives. On Unix, this has been shown to work without copying, but this - way you need to keep the compiled binary in the "js" build directory - forever. Copying "js/src/Your_OS_DBG.OBJ/libjs.so" to "/usr/local/lib" - and making sure that "/usr/local/lib" is in your "LD_LIBRARY_PATH" seems - to be safest bet. - - Now, build JavaScript::SpiderMonkey in the standard way: - - cd JavaScript-SpiderMonkey-v.vv - perl Makefile.PL - make - make test - make install - -AUTHOR - Mike Schilli, - -COPYRIGHT AND LICENSE - Copyright 2002 by Mike Schilli - - This library is free software; you can redistribute it and/or modify it - under the same terms as Perl itself. - diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/SpiderMonkey.h.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/SpiderMonkey.h.svn-base deleted file mode 100644 index ca7a318..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/SpiderMonkey.h.svn-base +++ /dev/null @@ -1,12 +0,0 @@ - -/* Strucuture that keeps track of contexts */ -struct PJS_Context { - /* total number of branch_operations the runtime went through in this context */ - int branch_count; - - /* max number of branch_operations allowed in this context */ - int branch_max; -}; - -typedef struct PJS_Context PJS_Context; - diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/SpiderMonkey.pm.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/SpiderMonkey.pm.svn-base deleted file mode 100644 index 4aa3cac..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/SpiderMonkey.pm.svn-base +++ /dev/null @@ -1,707 +0,0 @@ -###################################################################### -package JavaScript::SpiderMonkey; -###################################################################### -# Revision: $Revision: 1.8 $ -# Last Checkin: $Date: 2007/09/05 12:00:17 $ -# By: $Author: thomas_busch $ -# -# Author: Mike Schilli m@perlmeister.com, 2002 -###################################################################### - -=head1 NAME - -JavaScript::SpiderMonkey - Perl interface to the JavaScript Engine - -=head1 SYNOPSIS - - use JavaScript::SpiderMonkey; - - my $js = JavaScript::SpiderMonkey->new(); - - $js->init(); # Initialize Runtime/Context - - # Define a perl callback for a new JavaScript function - $js->function_set("print_to_perl", sub { print "@_\n"; }); - - # Create a new (nested) object and a property - $js->property_by_path("document.location.href"); - - # Execute some code - my $rc = $js->eval(q! - document.location.href = append("http://", "www.aol.com"); - - print_to_perl("URL is ", document.location.href); - - function append(first, second) { - return first + second; - } - !); - - # Get the value of a property set in JS - my $url = $js->property_get("document.location.href"); - - $js->destroy(); - -=head1 INSTALL - -JavaScript::SpiderMonkey requires Mozilla's readily compiled -SpiderMonkey 1.5 distribution or better. Please check -L. - -=head1 DESCRIPTION - -JavaScript::SpiderMonkey is a Perl Interface to the -SpiderMonkey JavaScript Engine. It is different from -Claes Jacobsson's C in that it offers two -different levels of access: - -=over 4 - -=item [1] - -A 1:1 mapping of the SpiderMonkey API to Perl - -=item [2] - -A more Perl-like API - -=back - -This document describes [2], for [1], please check C. - -=cut - -use 5.006; -use strict; -use warnings; -use Data::Dumper; -use Log::Log4perl qw(:easy); - -require Exporter; -require DynaLoader; - -our $VERSION = '0.19'; -our @ISA = qw(Exporter DynaLoader); -our %EXPORT_TAGS = ( 'all' => [ qw() ] ); -our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); -our @EXPORT = qw(); - -bootstrap JavaScript::SpiderMonkey $VERSION; - -our $GLOBAL; - -################################################## - -=head2 new() - -C<$js = JavaScript::SpiderMonkey-Enew()> creates a new object to work with. -To initialize the JS runtime, call C<$js-Einit()> afterwards. - -=cut - -################################################## -sub new { -################################################## - my ($class) = @_; - - my $self = { - 'runtime' => undef, - 'context' => undef, - 'global_object' => undef, - 'global_class' => undef, - 'objects' => { }, - }; - - # The function dispatcher is called from C and - # doesn't have 'self'. Store it in a class var. - # This means we can only have one instance of this - # JavaScript::SpiderMonkey object. Ouch. - our $GLOBAL = $self; - - bless $self, $class; -} - -################################################## - -=head2 $js-Edestroy() - -C<$js-Edestroy()> destroys the current runtime and frees up all memory. - -=cut - -################################################## -sub destroy { -################################################## - my ($self) = @_; - JavaScript::SpiderMonkey::JS_DestroyContext($self->{context}); - JavaScript::SpiderMonkey::JS_DestroyRuntime($self->{runtime}); -} - -################################################## - -=head2 $js-Einit() - -C<$js-Einit()> initializes the SpiderMonkey engine by creating a context, -default classes and objects and adding an error reporter. - -=cut - -################################################## -sub init { -################################################## - my ($self) = @_; - - $self->{runtime} = - JavaScript::SpiderMonkey::JS_Init(1000000); - $self->{context} = - JavaScript::SpiderMonkey::JS_NewContext($self->{runtime}, 8192); - $self->{global_class} = - JavaScript::SpiderMonkey::JS_GlobalClass(); - $self->{global_object} = - JavaScript::SpiderMonkey::JS_NewObject( - $self->{context}, $self->{global_class}, - $self->{global_class}, $self->{global_class}); - - JavaScript::SpiderMonkey::JS_InitStandardClasses($self->{context}, - $self->{global_object}); - JavaScript::SpiderMonkey::JS_SetErrorReporter($self->{context}); -} - -################################################## - -=head2 $js-Earray_by_path($name) - -Creates an object of type I -in the JS runtime: - - $js->array_by_path("document.form"); - -will first create an object with the name C (unless -it exists already) and then define a property named C
to it, -which is an object of type I. Therefore, in the JS code, -you're going to be able define things like - - document.form[0] = "value"; - -=cut - -################################################## -sub array_by_path { -################################################## - my ($self, $path) = @_; - - my $array = JavaScript::SpiderMonkey::JS_NewArrayObject($self->{context}); - return $self->object_by_path($path, $array); -} - -################################################## - -=head2 $js-Efunction_set($name, $funcref, [$obj]) - -Binds a Perl function provided as a coderef (C<$funcref>) -to a newly created JS function -named C<$name> in JS land. -It's a real function (therefore bound to the global object) if C<$obj> -is omitted. However, if C<$obj> is ref to -a JS object (retrieved via C<$js-Eobject_by_path($path)> or the like), -the function will be a I of the specified object. - - $js->function_set("write", sub { print @_ }); - # write("hello"); // In JS land - - $obj = $j->object_by_path("navigator"); - $js->function_set("write", sub { print @_ }, $obj); - # navigator.write("hello"); // In JS land - -=cut - -################################################## -sub function_set { -################################################## - my ($self, $name, $func, $obj) = @_; - - $obj ||= $self->{global_object}; # Defaults to global object - - $self->{functions}->{${$obj}}->{$name} = $func; - - return JavaScript::SpiderMonkey::JS_DefineFunction( - $self->{context}, $obj, $name, 0, 0); -} - -################################################## -sub function_dispatcher { -################################################## - my ($obj, $name, @args) = @_; - - DEBUG "Dispatching function $obj-$name-@args"; - - our $GLOBAL; - - ## Find the path for this object. - my $found = 0; - foreach( keys( %{$GLOBAL->{objects}} ) ){ - if( ${$GLOBAL->{objects}->{$_}} eq $obj && - exists( $GLOBAL->{functions}->{$obj}->{$name} ) ){ - DEBUG "Function found"; - $found = 1; - } - } - $obj = ${$GLOBAL->{global_object}} unless $found; - - if(! exists $GLOBAL->{functions}->{$obj}->{$name}) { - LOGDIE "Dispatcher: Can't find mapping for function $obj" . - ${$GLOBAL->{global_object}} . " '$name'"; - } - - my $val = $GLOBAL->{functions}->{$obj}->{$name}->(@args); - - DEBUG "retval=$val"; - - return $val; -} - -################################################## -sub getsetter_dispatcher { -################################################## - my ($obj, $propname, $what, $value) = @_; - - our $GLOBAL; - - DEBUG "Dispatcher obj=$obj"; - DEBUG "prop=$propname what=$what value=$value"; - - DEBUG "GETTING properties/$obj/$propname/$what"; - - if(exists $GLOBAL->{properties}->{$obj}->{$propname}->{$what}) { - my $entry = $GLOBAL->{properties}->{$obj}->{$propname}->{$what}; - my $path = $entry->{path}; - DEBUG "DISPATCHING for object $path ($what)"; - $entry->{callback}->($path, $value); - } else { - DEBUG "properties/$obj/$propname/$what doesn't exist"; - } -} - -################################################## - -=head2 $js-Earray_set_element($obj, $idx, $val) - -Sets the element of the array C<$obj> -at index position C<$idx> to the value C<$val>. -C<$obj> is a reference to an object of type array -(retrieved via C<$js-Eobject_by_path($path)> or the like). - -=cut - -################################################## -sub array_set_element { -################################################## - my ($self, $obj, $idx, $val) = @_; - - DEBUG "Setting $idx of $obj ($self->{context}) to $val"; - JavaScript::SpiderMonkey::JS_SetElement( - $self->{context}, $obj, $idx, $val); -} - -################################################## - -=head2 $js-Earray_set_element_as_object($obj, $idx, $elobj) - -Sets the element of the array C<$obj> -at index position C<$idx> to the object C<$elobj> -(both C<$obj> and C<$elobj> have been retrieved -via C<$js-Eobject_by_path($path)> or the like). - -=cut - -################################################## -sub array_set_element_as_object { -################################################## - my ($self, $obj, $idx, $elobj) = @_; - - JavaScript::SpiderMonkey::JS_SetElementAsObject( - $self->{context}, $obj, $idx, $elobj); -} - -################################################## - -=head2 $js-Earray_get_element($obj, $idx) - -Gets the value of of the element at index C<$idx> -of the object of type Array C<$obj>. - -=cut - -################################################## -sub array_get_element { -################################################## - my ($self, $obj, $idx) = @_; - - my $rc = JavaScript::SpiderMonkey::JS_GetElement( - $self->{context}, $obj, $idx); - - DEBUG("Getting $idx of $obj ($self->{context}): ", - ($rc || "undef")); - - return $rc; -} - -################################################## - -=head2 $js-Eproperty_by_path($path, $value, [$getter], [$setter]) - -Sets the specified property of an object in C<$path> to the -value C<$value>. C<$path> is the full name of the property, -including the object(s) in JS land it belongs to: - - $js-Eproperty_by_path("document.location.href", "abc"); - -This first creates the object C (if it doesn't exist already), -then the object C, then attaches the property -C to it and sets it to C<"abc">. - -C<$getter> and C<$setter> are coderefs that will be called by -the JavaScript engine when the respective property's value is -requested or set: - - sub getter { - my($property_path, $value) = @_; - print "$property_path has value $value\n"; - } - - sub setter { - my($property_path, $value) = @_; - print "$property_path set to value $value\n"; - } - - $js-Eproperty_by_path("document.location.href", "abc", - \&getter, \&setter); - -If you leave out C<$getter> and C<$setter>, there's going to be no -callbacks triggerd while the properity is set or queried. -If you just want to specify a C<$setter>, but no C<$getter>, -set the C<$getter> to C. - -=cut - -################################################## -sub property_by_path { -################################################## - my ($self, $path, $value, $getter, $setter) = @_; - - DEBUG "Retrieve/Create property $path"; - - (my $opath = $path) =~ s/\.[^.]+$//; - my $obj = $self->object_by_path($opath); - unless(defined $obj) { - LOGWARN "No object pointer found to $opath"; - return undef; - } - - DEBUG "$opath: obj=$obj"; - - $value = 'undef' unless defined $value; - - DEBUG "Define property $self->{context}, $obj, $path, $value"; - - (my $property = $path) =~ s/.*\.//; - - my $prop = JavaScript::SpiderMonkey::JS_DefineProperty( - $self->{context}, $obj, $property, $value); - - DEBUG "SETTING properties/$$obj/$property/getter"; - if($getter) { - # Store it under the original C pointer's value. We get - # back a PTRREF from JS_DefineObject, but we need the - # original value for the callback dispatcher. - $self->{properties}->{$$obj}->{$property}->{getter}->{callback} - = $getter; - $self->{properties}->{$$obj}->{$property}->{getter}->{path} = $path; - } - - if($setter) { - $self->{properties}->{$$obj}->{$property}->{setter}->{callback} - = $setter; - $self->{properties}->{$$obj}->{$property}->{setter}->{path} = $path; - } - - return $prop; -} - -################################################## - -=head2 $js-Eobject_by_path($path, [$newobj]) - -Get a pointer to an object with the path -specified. Create it if it's not there yet. -If C<$newobj> is provided, the ref is used to -bind the existing object to the name in C<$path>. - -=cut - -################################################## -sub object_by_path { -################################################## - my ($self, $path, $newobj) = @_; - - DEBUG "Retrieve/Create object $path"; - - DEBUG "Got a ", defined $newobj ? "predefined" : "undefined", - " object"; - - my $obj = $self->{global_object}; - - my @parts = split /\./, $path; - my $full = ""; - - return undef unless @parts; - - while(@parts >= 1) { - my $part = shift @parts; - $full .= "." if $full; - $full .= "$part"; - - if(exists $self->{objects}->{$full}) { - $obj = $self->{objects}->{$full}; - DEBUG "Object $full exists: $obj"; - } else { - my $gobj = $self->{global_object}; - if(defined $newobj and $path eq $full) { - DEBUG "Setting $path to predefined object"; - $obj = JavaScript::SpiderMonkey::JS_DefineObject( - $self->{context}, $obj, $part, - JavaScript::SpiderMonkey::JS_GetClass($self->{context}, $newobj), - $newobj); - } else { - $obj = JavaScript::SpiderMonkey::JS_DefineObject( - $self->{context}, $obj, $part, - $self->{global_class}, $self->{global_object}); - } - $self->{objects}->{$full} = $obj; - DEBUG "Object $full created: $obj"; - } - } - - return $obj; -} - -################################################## - -=head2 $js-Eproperty_get($path) - -Fetch the property specified by the C<$path>. - - my $val = $js->property_get("document.location.href"); - -=cut - -################################################## -sub property_get { -################################################## - my ($self, $string) = @_; - - my($path, $property) = ($string =~ /(.*)\.([^\.]+)$/); - - if(!exists $self->{objects}->{$path}) { - LOGWARN "Cannot find object $path via SpiderMonkey"; - return; - } - - DEBUG "Get property $self->{objects}->{$path}, $property"; - - return JavaScript::SpiderMonkey::JS_GetProperty( - $self->{context}, $self->{objects}->{$path}, - $property); -} - -################################################## - -=head2 $js-Eeval($code) - -Runs the specified piece of <$code> in the JS engine. -Afterwards, property values of objects previously defined -will be available via C<$j-Eproperty_get($path)> -and the like. - - my $rc = $js->eval("write('hello');"); - -The method returns C<1> on success or else if -there was an error in JS land. In case of an error, the JS -error text will be available in C<$@>. - -=cut - -################################################## -sub eval { -################################################## - my ($self, $script) = @_; - - return 1 unless defined $script; - - my $ok = - JavaScript::SpiderMonkey::JS_EvaluateScript( - $self->{context}, - $self->{global_object}, - $script, - $] > 5.007 ? bytes::length($script) : length($script), - "Perl", - 0); - - return $ok; -} - -################################################## - -=head2 $js-Eret_eval($code) - -Runs the specified piece of <$code> in the JS engine. -Differs from eval because it returns the results of -the last executed expression from the JS context. - - my $value = $js->ret_eval("2+2"); - -The method returns the result of the last evaluated -JS expression. In case of an error, the JS -error text will be available in C<$@>. - -=cut - -################################################## -sub ret_eval { -################################################## - my ($self, $script) = @_; - - return 1 unless defined $script; - - no warnings 'uninitialized'; #Silence a spurious undef warning I can't track down. - my $ok = - JavaScript::SpiderMonkey::JS_RetEvaluateScript( - $self->{context}, - $self->{global_object}, - $script, - #$] > 5.007 ? bytes::length($script) : length($script), - length($script), - "Perl", - 0); - - return $ok; -} - -################################################## - -=head2 $js-Eset_max_branch_operations($max_branch_operations) - -Set the maximum number of allowed branch operations. This protects -against infinite loops and guarantees that the eval operation -will terminate. - -=cut -################################################## -sub set_max_branch_operations { -################################################## - my ($self, $max_branch_operations) = @_; - JavaScript::SpiderMonkey::JS_SetMaxBranchOperations($self->{context}, $max_branch_operations); -} - -################################################## -sub dump { -################################################## - my ($self) = @_; - - Data::Dumper::Dumper($self->{objects}); -} - -################################################## -sub debug_enabled { -################################################## - my $logger = Log::Log4perl::get_logger("JavaScript::SpiderMonkey"); - if(Log::Log4perl->initialized() and $logger->is_debug()) { - # print "DEBUG IS ENABLED\n"; - return 1; - } else { - # print "DEBUG IS DISABLED\n"; - return 0; - } -} - -1; - -__END__ - -=head1 SpiderMonkey Installation - -First, get the latest SpiderMonkey distribution from mozilla.org: -http://www.mozilla.org/js/spidermonkey shows which releases are available. -C has been proven to work. - -Untar it at the same directory level as you just untarred the -C distribution you're currently reading. -So, if you're currently in C, do -this: - - cp js-1.6.tar.gz /my/path - cd /my/path - tar zxfv js-1.6.tar.gz - -Then, compile the SpiderMonkey distribution, if you're on Linux, -just use: - - cd js/src - make -f Makefile.ref - -It's important that the js and JavaScript-SpiderMonkey-v.vv directories -are at the same level: - - [/my/path]$ ls - JavaScript-SpiderMonkey-v.vv - js - js-1.6.tar.gz - [/my/path]$ - -(Note that you *can* untar the SpiderMonkey distribution elsewhere, -but, if so, then you need to edit the setting of $JSLIBPATH in Makefile.PL). - -Next, you need to copy the shared library file thus constructed -(e.g., libjs.so or js32.dll) to an appropriate directory on your library path. -On Windows, this can also be the directory where the perl executable -lives. On Unix, this has been shown to work without copying, but this way -you need to keep the compiled binary in the C build directory forever. -Copying -C to C and -making sure that C is in your C -seems to be safest bet. - -Now, build JavaScript::SpiderMonkey in the standard way: - - cd JavaScript-SpiderMonkey-v.vv - perl Makefile.PL - make - make test - make install - -=head1 E4X SUPPORT - -To build JavaScript-SpiderMonkey with E4X (ECMAScript for XML) support: - - perl Makefile.PL -E4X - -Please note that E4X support is only supported since SpiderMonkey release 1.6. - -=head1 THREAD SAFETY - -To build JavaScript-SpiderMonkey when using a thread safe version of SpiderMonkey: - - perl Makefile.PL -JS_THREADSAFE - -=head1 AUTHORS - - Mike Schilli, - Thomas Busch, (current maintainer) - -=head1 COPYRIGHT AND LICENSE - - Copyright (c) 2002-2005 Mike Schilli - Copyright (c) 2006-2007 Thomas Busch - -This library is free software; you can redistribute it and/or modify -it under the same terms as Perl itself. diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/SpiderMonkey.xs.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/SpiderMonkey.xs.svn-base deleted file mode 100644 index 74d3216..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/SpiderMonkey.xs.svn-base +++ /dev/null @@ -1,824 +0,0 @@ -/* --------------------------------------------------------------------- */ -/* SpiderMonkey.xs -- Perl Interface to the SpiderMonkey JavaScript */ -/* implementation. */ -/* */ -/* Revision: $Revision: 1.6 $ */ -/* Last Checkin: $Date: 2007/06/08 19:03:08 $ */ -/* By: $Author: thomas_busch $ */ -/* */ -/* Author: Mike Schilli mschilli1@aol.com, 2001 */ -/* --------------------------------------------------------------------- */ - -#include "EXTERN.h" -#include "perl.h" -#include "XSUB.h" -#include "jsapi.h" -#include "SpiderMonkey.h" - -#ifdef _MSC_VER - /* As suggested in https://rt.cpan.org/Ticket/Display.html?id=6984 */ -#define snprintf _snprintf -#endif - -/* JSRuntime needs this global class */ -static -JSClass global_class = { - "Global", 0, - JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub -}; - -static int Debug = 0; - -static int max_branch_operations = 0; - -/*==================================*/ -/* Begin Dirty Hackery */ -/*==================================*/ - -/* --------------------------------------------------------------------- */ -int obj_to_str( - JSContext *cx, - JSObject *obj, - SV *perl_str -/* --------------------------------------------------------------------- */ -) { - JSIdArray *fields = JS_Enumerate( cx, obj ); - int i = 0; - jsval property; - - sv_catpvn( perl_str, "{ ", 2 ); -/*printf("OBJ_TO_STR\n"); -printf("Length: %i\n", fields->length);*/ - - for( i = 0; i < fields->length; i++ ) - { - jsid id = fields->vector[i]; - jsval id_val; - char *prop_name; - - JS_IdToValue( cx, id, &id_val ); - prop_name = JS_GetStringBytes(JS_ValueToString(cx, id_val)); - JS_GetProperty( cx, obj, prop_name, &property ); - -/* printf("Adding %s to pv\n", prop_name); */ - sv_catpvn( perl_str, prop_name, strlen( prop_name ) ); - sv_catpvn( perl_str, ": ", 2 ); -/* printf( "Str: %s\n", SvPVbyte_nolen( perl_str ) ); */ - - if( JSVAL_IS_OBJECT( property ) ) - { - JSObject *prop_obj; - JS_ValueToObject( cx, property, &prop_obj ); - obj_to_str( cx, prop_obj, perl_str ); - } - else - { - JSString *prop_str = JS_ValueToString( cx, property ); - sv_catpvn( perl_str, JS_GetStringBytes( prop_str ), JS_GetStringLength( prop_str ) ); - /*sv_catpvn( perl_str, " ", 1 );*/ - } - - if( i < ( fields->length - 1 ) ) - { - sv_catpvn( perl_str, ", ", 2 ); - } - } - - sv_catpvn( perl_str, "}", 1 ); - JS_DestroyIdArray( cx, fields ); - return 1; -} -/*==================================*/ -/* End Dirty Hackery */ -/*==================================*/ - -/* It's kinda silly that we have to replicate this for getters and setters, - * but there doesn't seem to be a way to distinguish between getters - * and setters if we use the same function. (Somewhere I read in a - * usenet posting there's something like IS_ASSIGN, but this doesn't - * seem to be in SpiderMonkey 1.5). - */ - -/* --------------------------------------------------------------------- */ -JSBool getsetter_dispatcher( - JSContext *cx, - JSObject *obj, - jsval id, - jsval *vp, - char *what -/* --------------------------------------------------------------------- */ -) { - dSP; - - /* Call back into perl */ - ENTER ; - SAVETMPS ; - PUSHMARK(SP); - /* A somewhat nasty trick: Since JS_DefineObject() down below - * returns a *JS_Object, which is typemapped as T_PTRREF, - * and which is a reference (!) pointing to the real C pointer, - * we need to brutally obtain the obj's address by casting - * it to an int and forming a scalar out of it. - * On the other hand, when Spidermonkey.pm stores the - * object's setters/getters, it will dereference - * what it gets from JS_DefineObject() (therefore - * obtain the object's address in memory) to index its - * hash table. - * I hope all reasonable machines can hold an address in - * an int. - */ - XPUSHs(sv_2mortal(newSViv((int)obj))); - XPUSHs(sv_2mortal(newSVpv(JS_GetStringBytes(JSVAL_TO_STRING(id)), 0))); - XPUSHs(sv_2mortal(newSVpv(what, 0))); - XPUSHs(sv_2mortal(newSVpv(JS_GetStringBytes(JSVAL_TO_STRING(*vp)), 0))); - PUTBACK; - call_pv("JavaScript::SpiderMonkey::getsetter_dispatcher", G_DISCARD); - FREETMPS; - LEAVE; - - return JS_TRUE; -} - -/* --------------------------------------------------------------------- */ -JSBool getter_dispatcher( - JSContext *cx, - JSObject *obj, - jsval id, - jsval *vp -/* --------------------------------------------------------------------- */ -) { - return getsetter_dispatcher(cx, obj, id, vp, "getter"); -} - -/* --------------------------------------------------------------------- */ -JSBool setter_dispatcher( - JSContext *cx, - JSObject *obj, - jsval id, - jsval *vp -/* --------------------------------------------------------------------- */ -) { - return getsetter_dispatcher(cx, obj, id, vp, "setter"); -} - -/* --------------------------------------------------------------------- */ -int debug_enabled( -/* --------------------------------------------------------------------- */ -) { - dSP; - - int enabled = 0; - int count = 0; - - /* Call back into perl */ - ENTER ; - SAVETMPS ; - PUTBACK; - count = call_pv("JavaScript::SpiderMonkey::debug_enabled", G_SCALAR); - if(count == 1) { - if(POPi == 1) { - enabled = 1; - } - } - FREETMPS; - LEAVE; - - return enabled; -} - -/* --------------------------------------------------------------------- */ -static JSBool -FunctionDispatcher(JSContext *cx, JSObject *obj, uintN argc, - jsval *argv, jsval *rval) { -/* --------------------------------------------------------------------- */ - dSP; - SV *sv; - char *n_jstr; - int n_jnum; - double n_jdbl; - unsigned i; - int count; - JSFunction *fun; - fun = JS_ValueToFunction(cx, argv[-2]); - - /* printf("Function %s received %d arguments\n", - (char *) JS_GetFunctionName(fun), - (int) argc); */ - - /* Call back into perl */ - ENTER ; - SAVETMPS ; - PUSHMARK(SP); - XPUSHs(sv_2mortal(newSViv((int)obj))); - XPUSHs(sv_2mortal(newSVpv( - JS_GetFunctionName(fun), 0))); - for(i=0; i 0) { - sv = POPs; - if(SvROK(sv)) { - /* Im getting a perl reference here, the user - * seems to want to send a perl object to jscript - * ok, we will do it, although it seems like a painful - * thing to me. - */ - - if(Debug) - fprintf(stderr, "DEBUG: %lx is a ref!\n", (long) sv); - *rval = OBJECT_TO_JSVAL(SvIV(SvRV(sv))); - } - else if(SvIOK(sv)) { - /* It appears that we have been sent an int return - * value. Thats fine we can give javascript an int - */ - n_jnum=SvIV(sv); - if(Debug) - fprintf(stderr, "DEBUG: %lx is an int (%d)\n", (long) sv,n_jnum); - *rval = INT_TO_JSVAL(n_jnum); - } else if(SvNOK(sv)) { - /* It appears that we have been sent an double return - * value. Thats fine we can give javascript an double - */ - n_jdbl=SvNV(sv); - - if(Debug) - fprintf(stderr, "DEBUG: %lx is a double(%f)\n", (long) sv,n_jdbl); - *rval = DOUBLE_TO_JSVAL(JS_NewDouble(cx, n_jdbl)); - } else if(SvPOK(sv)) { - n_jstr = SvPV(sv, PL_na); - //warn("DEBUG: %s (%d)\n", n_jstr); - *rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, n_jstr)); - } - } - - PUTBACK; - FREETMPS; - LEAVE; - - return JS_TRUE; -} - -/* --------------------------------------------------------------------- */ -static void -ErrorReporter(JSContext *cx, const char *message, JSErrorReport *report) { -/* --------------------------------------------------------------------- */ - char msg[400]; - snprintf(msg, sizeof(msg), - "Error: %s at line %d: %s", message, report->lineno, - report->linebuf); - sv_setpv(get_sv("@", TRUE), msg); -} - -/* --------------------------------------------------------------------- */ -static JSBool -BranchHandler(JSContext *cx, JSScript *script) { -/* --------------------------------------------------------------------- */ - PJS_Context* pcx = (PJS_Context*) JS_GetContextPrivate(cx); - - pcx->branch_count++; - if (pcx->branch_count > pcx->branch_max) { - return JS_FALSE; - } else { - return JS_TRUE; - } -} - - - -MODULE = JavaScript::SpiderMonkey PACKAGE = JavaScript::SpiderMonkey -PROTOTYPES: DISABLE - -###################################################################### -char * -JS_GetImplementationVersion() -###################################################################### - CODE: - { - RETVAL = (char *) JS_GetImplementationVersion(); - } - OUTPUT: - RETVAL - -###################################################################### -JSRuntime * -JS_NewRuntime(maxbytes) - int maxbytes -###################################################################### - PREINIT: - JSRuntime *rt; - CODE: - { - rt = JS_NewRuntime(maxbytes); - if(!rt) { - XSRETURN_UNDEF; - } - RETVAL = rt; - } - OUTPUT: - RETVAL - -###################################################################### -int -JS_DestroyRuntime(rt) - JSRuntime *rt -###################################################################### - CODE: - { - JS_DestroyRuntime(rt); - RETVAL = 0; - } - OUTPUT: - RETVAL - -###################################################################### -JSRuntime * -JS_Init(maxbytes) - int maxbytes -###################################################################### - PREINIT: - JSRuntime *rt; - CODE: - { - rt = JS_Init(maxbytes); - if(!rt) { - XSRETURN_UNDEF; - } - /* Replace this by Debug = debug_enabled(); once - * Log::Log4perl 0.47 is out */ - Debug = 0; - RETVAL = rt; - } - OUTPUT: - RETVAL - -###################################################################### -JSContext * -JS_NewContext(rt, stack_chunk_size) - JSRuntime *rt - int stack_chunk_size -###################################################################### - PREINIT: - JSContext *cx; - CODE: - { - PJS_Context* pcx; - cx = JS_NewContext(rt, stack_chunk_size); - if(!cx) { - XSRETURN_UNDEF; - } -#ifdef E4X - JS_SetOptions(cx,JSOPTION_XML); -#endif - - Newz(1, pcx, 1, PJS_Context); - JS_SetContextPrivate(cx, (void *)pcx); - - RETVAL = cx; - } - OUTPUT: - RETVAL - -###################################################################### -int -JS_DestroyContext(cx) - JSContext *cx; -###################################################################### - CODE: - { - JS_DestroyContext(cx); - Safefree(JS_GetContextPrivate(cx)); - RETVAL = 0; - } - OUTPUT: - RETVAL - -###################################################################### -JSObject * -JS_NewObject(cx, class, proto, parent) - JSContext * cx - JSClass * class - JSObject * proto - JSObject * parent -###################################################################### - PREINIT: - JSObject *obj; - CODE: - { - obj = JS_NewObject(cx, class, NULL, NULL); - if(!obj) { - XSRETURN_UNDEF; - } - RETVAL = obj; - } - OUTPUT: - RETVAL - -###################################################################### -JSObject * -JS_InitClass(cx, iobj, parent_proto, clasp, constructor, nargs, ps, fs, static_ps, static_fs) - JSContext * cx - JSObject *iobj - JSObject *parent_proto - JSClass *clasp - JSNative constructor - int nargs - JSPropertySpec *ps - JSFunctionSpec *fs - JSPropertySpec *static_ps - JSFunctionSpec *static_fs -###################################################################### - PREINIT: - JSObject *obj; - uintN na; - INIT: - na = (uintN) nargs; - CODE: - { - obj = JS_InitClass(cx, iobj, parent_proto, clasp, - constructor, nargs, ps, fs, static_ps, - static_fs); - if(!obj) { - XSRETURN_UNDEF; - } - RETVAL = obj; - } - OUTPUT: - RETVAL - -###################################################################### -JSClass * -JS_GlobalClass() -###################################################################### - PREINIT: - JSClass *gc; - CODE: - { - gc = &global_class; - RETVAL = gc; - } - OUTPUT: - RETVAL - -###################################################################### -void -JS_ForceLatest(cx) - JSContext * cx -###################################################################### - CODE: - { - JS_SetVersion(cx, JSVERSION_LATEST); - } - -###################################################################### -char* -JS_RetEvaluateScript(cx, gobj, script, length, filename, lineno) - JSContext * cx - JSObject * gobj - char * script - int length - char * filename - int lineno -###################################################################### - PREINIT: - uintN len; - uintN ln; - int rc; - jsval jsval; - JSString *js_string; - char *return_string; - INIT: - len = (uintN) length; - ln = (uintN) lineno; - CODE: - { - rc = JS_EvaluateScript(cx, gobj, script, len, filename, - ln, &jsval); - if(!rc) { - XSRETURN_UNDEF; - } - - if( JSVAL_IS_OBJECT(jsval) ) - { - SV* sv = NEWSV(5,10); - JSObject *obj; - JS_ValueToObject( cx, jsval, &obj ); - obj_to_str(cx,obj,sv); - RETVAL = SvPVbyte_nolen( sv ); - } - - else - { - js_string = JS_ValueToString(cx, jsval); - return_string = JS_GetStringBytes(js_string); - RETVAL = return_string; - } - } - OUTPUT: - RETVAL - -###################################################################### -int -JS_EvaluateScript(cx, gobj, script, length, filename, lineno) - JSContext * cx - JSObject * gobj - char * script - int length - char * filename - int lineno -###################################################################### - PREINIT: - uintN len; - uintN ln; - int rc; - jsval jsval; - INIT: - len = (uintN) length; - ln = (uintN) lineno; - CODE: - { - rc = JS_EvaluateScript(cx, gobj, script, len, filename, - ln, &jsval); - if(!rc) { - XSRETURN_UNDEF; - } - RETVAL = rc; - } - OUTPUT: - RETVAL - -###################################################################### -int -JS_InitStandardClasses(cx, gobj) - JSContext * cx - JSObject * gobj -###################################################################### - PREINIT: - JSBool rc; - CODE: - { - rc = JS_InitStandardClasses(cx, gobj); - if(!rc) { - XSRETURN_UNDEF; - } - RETVAL = (int) rc; - } - OUTPUT: - RETVAL - -###################################################################### -int -JS_DefineFunction(cx, obj, name, nargs, flags) - JSContext * cx - JSObject * obj - char * name - int nargs - int flags -###################################################################### - PREINIT: - JSFunction *rc; - CODE: - { - rc = JS_DefineFunction(cx, obj, - (const char *) name, FunctionDispatcher, - (uintN) nargs, (uintN) flags); - if(!rc) { - XSRETURN_UNDEF; - } - RETVAL = (int) rc; - } - OUTPUT: - RETVAL - -###################################################################### -int -JS_SetErrorReporter(cx) - JSContext * cx -###################################################################### - CODE: - { - JS_SetErrorReporter(cx, ErrorReporter); - RETVAL = 0; - } - OUTPUT: - RETVAL - -###################################################################### -JSObject * -JS_DefineObject(cx, obj, name, class, proto) - JSContext * cx - JSObject * obj - char * name - JSClass * class - JSObject * proto -###################################################################### - PREINIT: - SV *sv = sv_newmortal(); - CODE: - { - RETVAL = JS_DefineObject(cx, obj, name, class, proto, 0); - } - OUTPUT: - RETVAL - -###################################################################### -int -JS_DefineProperty(cx, obj, name, value) - JSContext * cx - JSObject * obj - char * name - char * value - #JSPropertyOp getter - #JSPropertyOp setter - #uintN flags -###################################################################### - PREINIT: - JSBool rc; - JSString *str; - CODE: - { - str = JS_NewStringCopyZ(cx, value); - - /* This implementation is somewhat sub-optimal, since it - * calls back into perl even if no getters/setters have - * been defined. The necessity for a callback is determined - * at the perl level, where there's a data structure mapping - * out each object's properties and their getter/setter settings. - */ - rc = JS_DefineProperty(cx, obj, name, STRING_TO_JSVAL(str), - getter_dispatcher, setter_dispatcher, 0); - RETVAL = (int) rc; - } - OUTPUT: - RETVAL - -###################################################################### -void -JS_GetProperty(cx, obj, name) - JSContext * cx - JSObject * obj - char * name -###################################################################### - PREINIT: - JSBool rc; - jsval vp; - JSString *str; - SV *sv = sv_newmortal(); - PPCODE: - { - rc = JS_TRUE; - rc = JS_GetProperty(cx, obj, name, &vp); - if(rc) { - str = JS_ValueToString(cx, vp); - if(strcmp(JS_GetStringBytes(str), "undefined") == 0) { - sv = &PL_sv_undef; - } else { - sv_setpv(sv, JS_GetStringBytes(str)); - } - } else { - sv = &PL_sv_undef; - } - XPUSHs(sv); - } - -###################################################################### -JSObject * -JS_NewArrayObject(cx) - JSContext * cx -###################################################################### - PREINIT: - JSObject *rc; - CODE: - { - rc = JS_NewArrayObject(cx, 0, NULL); - RETVAL = rc; - } - OUTPUT: - RETVAL - -###################################################################### -int -JS_SetElement(cx, obj, idx, valptr) - JSContext *cx - JSObject *obj - int idx - char *valptr -###################################################################### - PREINIT: - JSBool rc; - JSString *str; - jsval val; - CODE: - { - str = JS_NewStringCopyZ(cx, valptr); - val = STRING_TO_JSVAL(str); - rc = JS_SetElement(cx, obj, idx, &val); - if(rc) { - RETVAL = 1; - } else { - RETVAL = 0; - } - } - OUTPUT: - RETVAL - -###################################################################### -int -JS_SetElementAsObject(cx, obj, idx, elobj) - JSContext *cx - JSObject *obj - int idx - JSObject *elobj -###################################################################### - PREINIT: - JSBool rc; - jsval val; - CODE: - { - val = OBJECT_TO_JSVAL(elobj); - rc = JS_SetElement(cx, obj, idx, &val); - if(rc) { - RETVAL = 1; - } else { - RETVAL = 0; - } - } - OUTPUT: - RETVAL - -###################################################################### -void -JS_GetElement(cx, obj, idx) - JSContext *cx - JSObject *obj - int idx -###################################################################### - PREINIT: - JSBool rc; - jsval vp; - JSString *str; - SV *sv = sv_newmortal(); - PPCODE: - { - rc = JS_GetElement(cx, obj, idx, &vp); - if(rc) { - str = JS_ValueToString(cx, vp); - if(strcmp(JS_GetStringBytes(str), "undefined") == 0) { - sv = &PL_sv_undef; - } else { - sv_setpv(sv, JS_GetStringBytes(str)); - } - } else { - sv = &PL_sv_undef; - } - XPUSHs(sv); - } - -###################################################################### -JSClass * -JS_GetClass(cx, obj) - JSContext * cx - JSObject * obj -###################################################################### - PREINIT: - JSClass *rc; - CODE: - { -#ifdef JS_THREADSAFE - rc = JS_GetClass(cx, obj); -#else - rc = JS_GetClass(obj); -#endif - RETVAL = rc; - } - OUTPUT: - RETVAL - - -###################################################################### -void -JS_SetMaxBranchOperations(cx, max_branch_operations) - JSContext *cx - int max_branch_operations -###################################################################### - CODE: - { - PJS_Context* pcx = (PJS_Context *) JS_GetContextPrivate(cx); - pcx->branch_count = 0; - pcx->branch_max = max_branch_operations; - JS_SetBranchCallback(cx, BranchHandler); - } - OUTPUT: - - -###################################################################### - diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/typemap.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/typemap.svn-base deleted file mode 100644 index b0e1ab4..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/.svn/text-base/typemap.svn-base +++ /dev/null @@ -1,17 +0,0 @@ -###################################################################### -# Typemap for JavaScript::SpiderMonkey -# -# Revision: $Revision: 1.1.1.1 $ -# Last Checkin: $Date: 2006/02/01 06:00:49 $ -# By: $Author: mschilli $ -# Author: Mike Schilli mschilli1@aol.com, 2002 -###################################################################### -JSRuntime * T_PTRREF -JSContext * T_PTRREF -JSClass * T_PTRREF -JSObject * T_PTRREF -JSNative T_PTRREF -JSPropertySpec * T_PTRREF -JSFunctionSpec * T_PTRREF -uintN T_SV -JSBool T_SV diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/Changes b/deps/JavaScript-SpiderMonkey-0.19-patched/Changes deleted file mode 100644 index 21e03dc..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/Changes +++ /dev/null @@ -1,94 +0,0 @@ -Revision history for Perl extension JavaScript::SpiderMonkey. - -0.19 (05/09/2007) - (tb) Allocate correct amount of memory for scripts that contain UTF-8 - characters with internal UTF-8 flag on. - -0.18 (08/06/2007) - (tb) Added protection against infinite loops - (tb) Added support for JS_THREADSAFE - -0.17 (27/07/2006) - (tb) Made sure eval function doesn't produce warnings when script - variable is uninitialized. - [was supposed to be part of 0.16 but is actually part of 0.17] - (tb) Added support for E4X - -0.16 (13/06/2006) - (tb) Added patch initially proposed by marc [at] igneousconsulting.com - and subsequently modified by Agent Zhang that allows mapped perl - functions to return varied datatypes back to JavaScript - -0.15 (28/02/2006) - (tb) Rewrote Makefile.PL to work on more platforms - -0.14 (12/02/2006) - (tb) Removed remaining debug info - -0.13 (05/02/2006) - (tb) Removed debug info - (tb) Made sure Makefile.PL finds libjs if installed in /usr/lib or - /usr/local/lib - -0.12 (12/03/2005) - (ms) Makefile.PL prerequisite changed from undef to '0'. - (ms) Thomas Busch added a check to Makefile.PL to find an already - installed JS lib. - -0.11 (08/22/2004) - * (ms) Added Log::Log4perl dependency in Makefile.PL as suggested - by an anonymous posting on rt.cpan.org. - * (ms) Added #define for MSC compiler as suggested in - https://rt.cpan.org/Ticket/Display.html?id=6984 - * (ms) Roger Crew provided patches for - a clean Win32 compile plus README text on installing the dll/so. - -0.10 06/20/2004 - * Nikita Savin provided a patch to - set $@ instead of printing to STDERR in case of a JS error. - * Added patch by Chris Blaise : - - Different objects can have the same named function. If no - object is specified on function_set, it's global. - * Log4perl in for debugging - * Chris Blaise submitted a patch to have a perl callback return - an object to JS. Applied with modifications, longer term we need - a solution on how the perl callback tells the JS wrapper what's coming - back: A JS string, an object or an integer. - -0.09 02/20/2004 - * Max Maischein added Win32 installation steps in Makefile.PL - -0.08 09/19/2002 - * Doc bug fixed, reported by Yoz Grahame. - -0.07 09/14/2002 - * Release mgmt changed - -0.06 07/10/2002 - * Made M*PL smarter to detect the JS target platform - -0.05 06/23/2002 - * Added installation instructions to README. - -0.04 06/23/2002 - * Added test case for just setter or just getter - * Added documentation - * Updated todo list - -0.03 06/23/2002 - * Added setters and getters for properties - -0.02 01/20/2002 - * Fixed properties (get/set) - -0.01 01/03/2002 - * Where it all began. - -TODO: - * setters/getters for arrays - * Get rid of GLOBAL and the limitation to one instance - * getter/setter called every time, callback settings checked - at perl level only - * Make fixed constants in init() configurable (1000000) - * Allow for different contexts - * Rethink function names (by_path, function_set etc.) diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/INSTALL b/deps/JavaScript-SpiderMonkey-0.19-patched/INSTALL deleted file mode 100644 index c382440..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/INSTALL +++ /dev/null @@ -1,33 +0,0 @@ - -How to install JavaScript::SpiderMonkey - -Get the latest SpiderMonkey distribution from mozilla.org: -http://www.mozilla.org/js/spidermonkey shows which releases are available. -http://ftp.mozilla.org/pub/js/js-1.5-rc3a.tar.gz has been proven to work. - -Untar it at the same directory level as the distribution of the -JavaScript::SpiderMonkey perl module distribution whichs README -you're currently reading: - -cd .. -tar zxfv js-1.5-rc3a.tar.gz - -It's important that the js and JavaScript-SpiderMonkey-v.vv directories -are at the same level: - -$ls -JavaScript-SpiderMonkey-1.00 -js -js-1.5-rc3a.tar.gz - -Now, build JavaScript::SpiderMonkey in the standard way: - -cd JavaScript-SpiderMonkey-1.00 -perl Makefile.PL -gmake -gmake test -gmake install - --- and you're good to go! Have fun. - -Mike Schilli, m@perlmeister.com, 2002 diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/MANIFEST b/deps/JavaScript-SpiderMonkey-0.19-patched/MANIFEST deleted file mode 100644 index 4ac2f9d..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/MANIFEST +++ /dev/null @@ -1,35 +0,0 @@ -Changes -INSTALL -Makefile.PL -MANIFEST -MANIFEST.SKIP -META.yml Module meta-data (added by MakeMaker) -README -SpiderMonkey.pm -SpiderMonkey.xs -SpiderMonkey.h -t/000readme.t -t/001properties.t -t/002functions.t -t/003properties.t -t/004setget.t -t/005error.t -t/006objmeth.t -t/007funcret.t -t/00array.t -t/01doc-href.t -t/02nav-appv.t -t/03doc-write.t -t/04loop.t -t/05form.t -t/06form2.t -t/07func.t -t/08func2.t -t/09meth.t -t/10elobj.t -t/11intret.t -t/12dblret.t -t/13strret.t -t/init.pl -typemap -util/download.pl diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/MANIFEST.SKIP b/deps/JavaScript-SpiderMonkey-0.19-patched/MANIFEST.SKIP deleted file mode 100644 index 378ffef..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/MANIFEST.SKIP +++ /dev/null @@ -1,11 +0,0 @@ -blib -^Makefile$ -^Makefile.old$ -CVS -.cvsignore -docs -MANIFEST.bak -adm/release -^SpiderMonkey.bs$ -^SpiderMonkey.c$ -^SpiderMonkey.o$ diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/META.yml b/deps/JavaScript-SpiderMonkey-0.19-patched/META.yml deleted file mode 100644 index ae4ed1f..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/META.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- #YAML:1.0 -name: JavaScript-SpiderMonkey -version: 0.19 -abstract: Perl interface to the JavaScript Engine -license: ~ -generated_by: ExtUtils::MakeMaker version 6.36 -distribution_type: module -requires: - Data::Dumper: 0 - Log::Log4perl: 0 -meta-spec: - url: http://module-build.sourceforge.net/META-spec-v1.2.html - version: 1.2 -author: - - Mike Schilli diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/Makefile.PL b/deps/JavaScript-SpiderMonkey-0.19-patched/Makefile.PL deleted file mode 100644 index 545b124..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/Makefile.PL +++ /dev/null @@ -1,166 +0,0 @@ -###################################################################### -# -# MakeMaker file for JavaScript::SpiderMonkey -# -# Revision: $Revision: 1.5 $ -# Last Checkin: $Date: 2007/06/08 19:03:08 $ -# By: $Author: thomas_busch $ -# -# Authors: Mike Schilli m@perlmeister.com, 2002-2005 -# Thomas Busch tbusch@cpan.org, 2006 -# -###################################################################### - -use ExtUtils::MakeMaker; -use Getopt::Long; - -# Get the right lib and include dirs for different platforms - -my $JS_LIB_DIR; -my @JS_INCL_DIRS; - -my @c_header_files = qw( - jsapi.h - jsautocfg.h -); - -my @possible_libraries = qw( - libjs.a - js32.dll - libmozjs.so -); - -my %possible_install_paths = ( - "../js/src/*" => "../js/src", - "/usr/lib" => "/usr/include", - "/usr/local/lib" => "/usr/local/include", - "/usr/lib/firefox" => "/usr/include/firefox", -); - -my ($JS_LIB_DIR, @JS_INCL_DIRS, $JS_LIB_NAME); - -foreach my $install_path(keys %possible_install_paths) { - foreach my $possible_lib(@possible_libraries) { - foreach my $libfile(glob "$install_path/$possible_lib") { - next if ! -f $libfile; - my $include_path = $possible_install_paths{$install_path}; - foreach my $c_header(@c_header_files) { - if (-f "$include_path/$c_header") { - my $include_dir = "$include_path/$c_header"; - $include_dir =~ s/$c_header$//; - push @JS_INCL_DIRS, $include_dir; - } - foreach my $headerfile(glob "$include_path/*/$c_header") { - my $include_dir = $headerfile; - $include_dir =~ s/$c_header$//; - push @JS_INCL_DIRS, $include_dir; - } - } - if (scalar(@JS_INCL_DIRS) == scalar(@c_header_files)) { - $JS_LIB_DIR = $libfile; - $JS_LIB_DIR =~ s/$possible_lib$//; - - $JS_LIB_NAME = $possible_lib; - $JS_LIB_NAME =~ s/\.(a|so|dll)$//; - $JS_LIB_NAME =~ s/^lib//; - - last; - } else { - @JS_INCL_DIRS = (); - } - } - last if $JS_LIB_DIR; - } - last if $JS_LIB_DIR; -} - -if ($JS_INCL_DIRS[0] eq $JS_INCL_DIRS[1]) { - shift @JS_INCL_DIRS; -} - -## If no SpiderMonkey library found report that and exit. -## Otherwise print lib and include paths. - -if (!$JS_LIB_DIR) { - print < \$E4X, - "JS_THREADSAFE" => \$JS_THREADSAFE, -); - - -## Determine library name and system-related defines -if ($^O ne 'MSWin32') { - $JS_DEFINE = '-DXP_UNIX'; -} else { - $JS_DEFINE = '-DXP_WIN'; -}; - -## Add E4X support if flag set. -## For more info about E4X check http://en.wikipedia.org/wiki/E4X -if ($E4X) { - $JS_DEFINE .= " -DE4X"; - print "E4X support enabled\n"; -} - -## Support compiling in thread safe environment -if ($JS_THREADSAFE) { - $JS_DEFINE .= " -DJS_THREADSAFE"; - print "Compiling with JS_THREADSAFE flag\n"; -} - - -#### See lib/ExtUtils/MakeMaker.pm for details of how to influence -#### the contents of the Makefile that is written. -################################################## - -WriteMakefile( - 'NAME' => 'JavaScript::SpiderMonkey', - 'VERSION_FROM' => 'SpiderMonkey.pm', # finds $VERSION - 'PREREQ_PM' => { - 'Log::Log4perl' => 0, - 'Data::Dumper' => 0, - }, # e.g., Module::Name => 1.1 - ($] >= 5.005 ? ## Add these new keywords supported since 5.005 - (ABSTRACT_FROM => 'SpiderMonkey.pm', # retrieve abstract from module - AUTHOR => 'Mike Schilli ') : ()), - 'LIBS' => ["-L$JS_LIB_DIR -l$JS_LIB_NAME"], # e.g., '-lm' - 'DEFINE' => $JS_DEFINE, # e.g., '-DHAVE_SOMETHING' - # Insert -I. if you add *.h files later: - 'INC' => "-I".join " -I", @JS_INCL_DIRS, - # Un-comment this if you add C files to link with later: - # 'OBJECT' => '$(O_FILES)', # link all the C files too -); - -###################################################################### -sub MY::postamble { -###################################################################### - ' -README: SpiderMonkey.pm - pod2text SpiderMonkey.pm >README - '; -} diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/README b/deps/JavaScript-SpiderMonkey-0.19-patched/README deleted file mode 100644 index 3a68806..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/README +++ /dev/null @@ -1,211 +0,0 @@ -###################################################################### - JavaScript::SpiderMonkey 0.17 -###################################################################### - -NAME - JavaScript::SpiderMonkey - Perl interface to the JavaScript Engine - -SYNOPSIS - use JavaScript::SpiderMonkey; - - my $js = JavaScript::SpiderMonkey->new(); - - $js->init(); # Initialize Runtime/Context - - # Define a perl callback for a new JavaScript function - $js->function_set("print_to_perl", sub { print "@_\n"; }); - - # Create a new (nested) object and a property - $js->property_by_path("document.location.href"); - - # Execute some code - my $rc = $js->eval(q! - document.location.href = append("http://", "www.aol.com"); - - print_to_perl("URL is ", document.location.href); - - function append(first, second) { - return first + second; - } - !); - - # Get the value of a property set in JS - my $url = $js->property_get("document.location.href"); - - $js->destroy(); - -INSTALL - JavaScript::SpiderMonkey requires Mozilla's readily compiled - SpiderMonkey 1.5 distribution or better. Please check "SpiderMonkey - Installation". - -DESCRIPTION - JavaScript::SpiderMonkey is a Perl Interface to the SpiderMonkey - JavaScript Engine. It is different from Claes Jacobsson's - "JavaScript.pm" in that it offers two different levels of access: - - [1] A 1:1 mapping of the SpiderMonkey API to Perl - - [2] A more Perl-like API - - This document describes [2], for [1], please check "SpiderMonkey.xs". - - new() - "$js = JavaScript::SpiderMonkey->new()" creates a new object to work - with. To initialize the JS runtime, call "$js->init()" afterwards. - - $js->destroy() - "$js->destroy()" destroys the current runtime and frees up all memory. - - $js->init() - "$js->init()" initializes the SpiderMonkey engine by creating a context, - default classes and objects and adding an error reporter. - - $js->array_by_path($name) - Creates an object of type *Array* in the JS runtime: - - $js->array_by_path("document.form"); - - will first create an object with the name "document" (unless it exists - already) and then define a property named "form" to it, which is an - object of type *Array*. Therefore, in the JS code, you're going to be - able define things like - - document.form[0] = "value"; - - $js->function_set($name, $funcref, [$obj]) - Binds a Perl function provided as a coderef ($funcref) to a newly - created JS function named $name in JS land. It's a real function - (therefore bound to the global object) if $obj is omitted. However, if - $obj is ref to a JS object (retrieved via "$js->object_by_path($path)" - or the like), the function will be a *method* of the specified object. - - $js->function_set("write", sub { print @_ }); - # write("hello"); // In JS land - - $obj = $j->object_by_path("navigator"); - $js->function_set("write", sub { print @_ }, $obj); - # navigator.write("hello"); // In JS land - - $js->array_set_element($obj, $idx, $val) - Sets the element of the array $obj at index position $idx to the value - $val. $obj is a reference to an object of type array (retrieved via - "$js->object_by_path($path)" or the like). - - $js->array_set_element_as_object($obj, $idx, $elobj) - Sets the element of the array $obj at index position $idx to the object - $elobj (both $obj and $elobj have been retrieved via - "$js->object_by_path($path)" or the like). - - $js->array_get_element($obj, $idx) - Gets the value of of the element at index $idx of the object of type - Array $obj. - - $js->property_by_path($path, $value, [$getter], [$setter]) - Sets the specified property of an object in $path to the value $value. - $path is the full name of the property, including the object(s) in JS - land it belongs to: - - $js-Eproperty_by_path("document.location.href", "abc"); - - This first creates the object "document" (if it doesn't exist already), - then the object "document.location", then attaches the property "href" - to it and sets it to "abc". - - $getter and $setter are coderefs that will be called by the JavaScript - engine when the respective property's value is requested or set: - - sub getter { - my($property_path, $value) = @_; - print "$property_path has value $value\n"; - } - - sub setter { - my($property_path, $value) = @_; - print "$property_path set to value $value\n"; - } - - $js-Eproperty_by_path("document.location.href", "abc", - \&getter, \&setter); - - If you leave out $getter and $setter, there's going to be no callbacks - triggerd while the properity is set or queried. If you just want to - specify a $setter, but no $getter, set the $getter to "undef". - - $js->object_by_path($path, [$newobj]) - Get a pointer to an object with the path specified. Create it if it's - not there yet. If $newobj is provided, the ref is used to bind the - existing object to the name in $path. - - $js->property_get($path) - Fetch the property specified by the $path. - - my $val = $js->property_get("document.location.href"); - - $js->eval($code) - Runs the specified piece of <$code> in the JS engine. Afterwards, - property values of objects previously defined will be available via - "$j->property_get($path)" and the like. - - my $rc = $js->eval("write('hello');"); - - The method returns 1 on success or else if there was an error in JS - land. In case of an error, the JS error text will be available in $@. - -SpiderMonkey Installation - First, get the latest SpiderMonkey distribution from mozilla.org: - http://www.mozilla.org/js/spidermonkey shows which releases are - available. "js-1.5-rc3a.tar.gz" has been proven to work. - - Untar it at the same directory level as you just untarred the - "JavaScript::SpiderMonkey" distribution you're currently reading. So, if - you're currently in "/my/path/JavaScript-SpiderMonkey-v.vv", do this: - - cp js-1.5-rc3a.tar.gz /my/path - cd /my/path - tar zxfv js-1.5-rc3a.tar.gz - - Then, compile the SpiderMonkey distribution, if you're on Linux, just - use: - - cd js/src - make -f Makefile.ref - - It's important that the js and JavaScript-SpiderMonkey-v.vv directories - are at the same level: - - [/my/path]$ ls - JavaScript-SpiderMonkey-v.vv - js - js-1.5-rc3a.tar.gz - [/my/path]$ - - (Note that you *can* untar the SpiderMonkey distribution elsewhere, but, - if so, then you need to edit the setting of $JSLIBPATH in Makefile.PL). - - Next, you need to copy the shared library file thus constructed (e.g., - libjs.so or js32.dll) to an appropriate directory on your library path. - On Windows, this can also be the directory where the perl executable - lives. On Unix, this has been shown to work without copying, but this - way you need to keep the compiled binary in the "js" build directory - forever. Copying "js/src/Your_OS_DBG.OBJ/libjs.so" to "/usr/local/lib" - and making sure that "/usr/local/lib" is in your "LD_LIBRARY_PATH" seems - to be safest bet. - - Now, build JavaScript::SpiderMonkey in the standard way: - - cd JavaScript-SpiderMonkey-v.vv - perl Makefile.PL - make - make test - make install - -AUTHOR - Mike Schilli, - -COPYRIGHT AND LICENSE - Copyright 2002 by Mike Schilli - - This library is free software; you can redistribute it and/or modify it - under the same terms as Perl itself. - diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/SpiderMonkey.h b/deps/JavaScript-SpiderMonkey-0.19-patched/SpiderMonkey.h deleted file mode 100644 index ca7a318..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/SpiderMonkey.h +++ /dev/null @@ -1,12 +0,0 @@ - -/* Strucuture that keeps track of contexts */ -struct PJS_Context { - /* total number of branch_operations the runtime went through in this context */ - int branch_count; - - /* max number of branch_operations allowed in this context */ - int branch_max; -}; - -typedef struct PJS_Context PJS_Context; - diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/SpiderMonkey.pm b/deps/JavaScript-SpiderMonkey-0.19-patched/SpiderMonkey.pm deleted file mode 100644 index 4aa3cac..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/SpiderMonkey.pm +++ /dev/null @@ -1,707 +0,0 @@ -###################################################################### -package JavaScript::SpiderMonkey; -###################################################################### -# Revision: $Revision: 1.8 $ -# Last Checkin: $Date: 2007/09/05 12:00:17 $ -# By: $Author: thomas_busch $ -# -# Author: Mike Schilli m@perlmeister.com, 2002 -###################################################################### - -=head1 NAME - -JavaScript::SpiderMonkey - Perl interface to the JavaScript Engine - -=head1 SYNOPSIS - - use JavaScript::SpiderMonkey; - - my $js = JavaScript::SpiderMonkey->new(); - - $js->init(); # Initialize Runtime/Context - - # Define a perl callback for a new JavaScript function - $js->function_set("print_to_perl", sub { print "@_\n"; }); - - # Create a new (nested) object and a property - $js->property_by_path("document.location.href"); - - # Execute some code - my $rc = $js->eval(q! - document.location.href = append("http://", "www.aol.com"); - - print_to_perl("URL is ", document.location.href); - - function append(first, second) { - return first + second; - } - !); - - # Get the value of a property set in JS - my $url = $js->property_get("document.location.href"); - - $js->destroy(); - -=head1 INSTALL - -JavaScript::SpiderMonkey requires Mozilla's readily compiled -SpiderMonkey 1.5 distribution or better. Please check -L. - -=head1 DESCRIPTION - -JavaScript::SpiderMonkey is a Perl Interface to the -SpiderMonkey JavaScript Engine. It is different from -Claes Jacobsson's C in that it offers two -different levels of access: - -=over 4 - -=item [1] - -A 1:1 mapping of the SpiderMonkey API to Perl - -=item [2] - -A more Perl-like API - -=back - -This document describes [2], for [1], please check C. - -=cut - -use 5.006; -use strict; -use warnings; -use Data::Dumper; -use Log::Log4perl qw(:easy); - -require Exporter; -require DynaLoader; - -our $VERSION = '0.19'; -our @ISA = qw(Exporter DynaLoader); -our %EXPORT_TAGS = ( 'all' => [ qw() ] ); -our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); -our @EXPORT = qw(); - -bootstrap JavaScript::SpiderMonkey $VERSION; - -our $GLOBAL; - -################################################## - -=head2 new() - -C<$js = JavaScript::SpiderMonkey-Enew()> creates a new object to work with. -To initialize the JS runtime, call C<$js-Einit()> afterwards. - -=cut - -################################################## -sub new { -################################################## - my ($class) = @_; - - my $self = { - 'runtime' => undef, - 'context' => undef, - 'global_object' => undef, - 'global_class' => undef, - 'objects' => { }, - }; - - # The function dispatcher is called from C and - # doesn't have 'self'. Store it in a class var. - # This means we can only have one instance of this - # JavaScript::SpiderMonkey object. Ouch. - our $GLOBAL = $self; - - bless $self, $class; -} - -################################################## - -=head2 $js-Edestroy() - -C<$js-Edestroy()> destroys the current runtime and frees up all memory. - -=cut - -################################################## -sub destroy { -################################################## - my ($self) = @_; - JavaScript::SpiderMonkey::JS_DestroyContext($self->{context}); - JavaScript::SpiderMonkey::JS_DestroyRuntime($self->{runtime}); -} - -################################################## - -=head2 $js-Einit() - -C<$js-Einit()> initializes the SpiderMonkey engine by creating a context, -default classes and objects and adding an error reporter. - -=cut - -################################################## -sub init { -################################################## - my ($self) = @_; - - $self->{runtime} = - JavaScript::SpiderMonkey::JS_Init(1000000); - $self->{context} = - JavaScript::SpiderMonkey::JS_NewContext($self->{runtime}, 8192); - $self->{global_class} = - JavaScript::SpiderMonkey::JS_GlobalClass(); - $self->{global_object} = - JavaScript::SpiderMonkey::JS_NewObject( - $self->{context}, $self->{global_class}, - $self->{global_class}, $self->{global_class}); - - JavaScript::SpiderMonkey::JS_InitStandardClasses($self->{context}, - $self->{global_object}); - JavaScript::SpiderMonkey::JS_SetErrorReporter($self->{context}); -} - -################################################## - -=head2 $js-Earray_by_path($name) - -Creates an object of type I -in the JS runtime: - - $js->array_by_path("document.form"); - -will first create an object with the name C (unless -it exists already) and then define a property named C to it, -which is an object of type I. Therefore, in the JS code, -you're going to be able define things like - - document.form[0] = "value"; - -=cut - -################################################## -sub array_by_path { -################################################## - my ($self, $path) = @_; - - my $array = JavaScript::SpiderMonkey::JS_NewArrayObject($self->{context}); - return $self->object_by_path($path, $array); -} - -################################################## - -=head2 $js-Efunction_set($name, $funcref, [$obj]) - -Binds a Perl function provided as a coderef (C<$funcref>) -to a newly created JS function -named C<$name> in JS land. -It's a real function (therefore bound to the global object) if C<$obj> -is omitted. However, if C<$obj> is ref to -a JS object (retrieved via C<$js-Eobject_by_path($path)> or the like), -the function will be a I of the specified object. - - $js->function_set("write", sub { print @_ }); - # write("hello"); // In JS land - - $obj = $j->object_by_path("navigator"); - $js->function_set("write", sub { print @_ }, $obj); - # navigator.write("hello"); // In JS land - -=cut - -################################################## -sub function_set { -################################################## - my ($self, $name, $func, $obj) = @_; - - $obj ||= $self->{global_object}; # Defaults to global object - - $self->{functions}->{${$obj}}->{$name} = $func; - - return JavaScript::SpiderMonkey::JS_DefineFunction( - $self->{context}, $obj, $name, 0, 0); -} - -################################################## -sub function_dispatcher { -################################################## - my ($obj, $name, @args) = @_; - - DEBUG "Dispatching function $obj-$name-@args"; - - our $GLOBAL; - - ## Find the path for this object. - my $found = 0; - foreach( keys( %{$GLOBAL->{objects}} ) ){ - if( ${$GLOBAL->{objects}->{$_}} eq $obj && - exists( $GLOBAL->{functions}->{$obj}->{$name} ) ){ - DEBUG "Function found"; - $found = 1; - } - } - $obj = ${$GLOBAL->{global_object}} unless $found; - - if(! exists $GLOBAL->{functions}->{$obj}->{$name}) { - LOGDIE "Dispatcher: Can't find mapping for function $obj" . - ${$GLOBAL->{global_object}} . " '$name'"; - } - - my $val = $GLOBAL->{functions}->{$obj}->{$name}->(@args); - - DEBUG "retval=$val"; - - return $val; -} - -################################################## -sub getsetter_dispatcher { -################################################## - my ($obj, $propname, $what, $value) = @_; - - our $GLOBAL; - - DEBUG "Dispatcher obj=$obj"; - DEBUG "prop=$propname what=$what value=$value"; - - DEBUG "GETTING properties/$obj/$propname/$what"; - - if(exists $GLOBAL->{properties}->{$obj}->{$propname}->{$what}) { - my $entry = $GLOBAL->{properties}->{$obj}->{$propname}->{$what}; - my $path = $entry->{path}; - DEBUG "DISPATCHING for object $path ($what)"; - $entry->{callback}->($path, $value); - } else { - DEBUG "properties/$obj/$propname/$what doesn't exist"; - } -} - -################################################## - -=head2 $js-Earray_set_element($obj, $idx, $val) - -Sets the element of the array C<$obj> -at index position C<$idx> to the value C<$val>. -C<$obj> is a reference to an object of type array -(retrieved via C<$js-Eobject_by_path($path)> or the like). - -=cut - -################################################## -sub array_set_element { -################################################## - my ($self, $obj, $idx, $val) = @_; - - DEBUG "Setting $idx of $obj ($self->{context}) to $val"; - JavaScript::SpiderMonkey::JS_SetElement( - $self->{context}, $obj, $idx, $val); -} - -################################################## - -=head2 $js-Earray_set_element_as_object($obj, $idx, $elobj) - -Sets the element of the array C<$obj> -at index position C<$idx> to the object C<$elobj> -(both C<$obj> and C<$elobj> have been retrieved -via C<$js-Eobject_by_path($path)> or the like). - -=cut - -################################################## -sub array_set_element_as_object { -################################################## - my ($self, $obj, $idx, $elobj) = @_; - - JavaScript::SpiderMonkey::JS_SetElementAsObject( - $self->{context}, $obj, $idx, $elobj); -} - -################################################## - -=head2 $js-Earray_get_element($obj, $idx) - -Gets the value of of the element at index C<$idx> -of the object of type Array C<$obj>. - -=cut - -################################################## -sub array_get_element { -################################################## - my ($self, $obj, $idx) = @_; - - my $rc = JavaScript::SpiderMonkey::JS_GetElement( - $self->{context}, $obj, $idx); - - DEBUG("Getting $idx of $obj ($self->{context}): ", - ($rc || "undef")); - - return $rc; -} - -################################################## - -=head2 $js-Eproperty_by_path($path, $value, [$getter], [$setter]) - -Sets the specified property of an object in C<$path> to the -value C<$value>. C<$path> is the full name of the property, -including the object(s) in JS land it belongs to: - - $js-Eproperty_by_path("document.location.href", "abc"); - -This first creates the object C (if it doesn't exist already), -then the object C, then attaches the property -C to it and sets it to C<"abc">. - -C<$getter> and C<$setter> are coderefs that will be called by -the JavaScript engine when the respective property's value is -requested or set: - - sub getter { - my($property_path, $value) = @_; - print "$property_path has value $value\n"; - } - - sub setter { - my($property_path, $value) = @_; - print "$property_path set to value $value\n"; - } - - $js-Eproperty_by_path("document.location.href", "abc", - \&getter, \&setter); - -If you leave out C<$getter> and C<$setter>, there's going to be no -callbacks triggerd while the properity is set or queried. -If you just want to specify a C<$setter>, but no C<$getter>, -set the C<$getter> to C. - -=cut - -################################################## -sub property_by_path { -################################################## - my ($self, $path, $value, $getter, $setter) = @_; - - DEBUG "Retrieve/Create property $path"; - - (my $opath = $path) =~ s/\.[^.]+$//; - my $obj = $self->object_by_path($opath); - unless(defined $obj) { - LOGWARN "No object pointer found to $opath"; - return undef; - } - - DEBUG "$opath: obj=$obj"; - - $value = 'undef' unless defined $value; - - DEBUG "Define property $self->{context}, $obj, $path, $value"; - - (my $property = $path) =~ s/.*\.//; - - my $prop = JavaScript::SpiderMonkey::JS_DefineProperty( - $self->{context}, $obj, $property, $value); - - DEBUG "SETTING properties/$$obj/$property/getter"; - if($getter) { - # Store it under the original C pointer's value. We get - # back a PTRREF from JS_DefineObject, but we need the - # original value for the callback dispatcher. - $self->{properties}->{$$obj}->{$property}->{getter}->{callback} - = $getter; - $self->{properties}->{$$obj}->{$property}->{getter}->{path} = $path; - } - - if($setter) { - $self->{properties}->{$$obj}->{$property}->{setter}->{callback} - = $setter; - $self->{properties}->{$$obj}->{$property}->{setter}->{path} = $path; - } - - return $prop; -} - -################################################## - -=head2 $js-Eobject_by_path($path, [$newobj]) - -Get a pointer to an object with the path -specified. Create it if it's not there yet. -If C<$newobj> is provided, the ref is used to -bind the existing object to the name in C<$path>. - -=cut - -################################################## -sub object_by_path { -################################################## - my ($self, $path, $newobj) = @_; - - DEBUG "Retrieve/Create object $path"; - - DEBUG "Got a ", defined $newobj ? "predefined" : "undefined", - " object"; - - my $obj = $self->{global_object}; - - my @parts = split /\./, $path; - my $full = ""; - - return undef unless @parts; - - while(@parts >= 1) { - my $part = shift @parts; - $full .= "." if $full; - $full .= "$part"; - - if(exists $self->{objects}->{$full}) { - $obj = $self->{objects}->{$full}; - DEBUG "Object $full exists: $obj"; - } else { - my $gobj = $self->{global_object}; - if(defined $newobj and $path eq $full) { - DEBUG "Setting $path to predefined object"; - $obj = JavaScript::SpiderMonkey::JS_DefineObject( - $self->{context}, $obj, $part, - JavaScript::SpiderMonkey::JS_GetClass($self->{context}, $newobj), - $newobj); - } else { - $obj = JavaScript::SpiderMonkey::JS_DefineObject( - $self->{context}, $obj, $part, - $self->{global_class}, $self->{global_object}); - } - $self->{objects}->{$full} = $obj; - DEBUG "Object $full created: $obj"; - } - } - - return $obj; -} - -################################################## - -=head2 $js-Eproperty_get($path) - -Fetch the property specified by the C<$path>. - - my $val = $js->property_get("document.location.href"); - -=cut - -################################################## -sub property_get { -################################################## - my ($self, $string) = @_; - - my($path, $property) = ($string =~ /(.*)\.([^\.]+)$/); - - if(!exists $self->{objects}->{$path}) { - LOGWARN "Cannot find object $path via SpiderMonkey"; - return; - } - - DEBUG "Get property $self->{objects}->{$path}, $property"; - - return JavaScript::SpiderMonkey::JS_GetProperty( - $self->{context}, $self->{objects}->{$path}, - $property); -} - -################################################## - -=head2 $js-Eeval($code) - -Runs the specified piece of <$code> in the JS engine. -Afterwards, property values of objects previously defined -will be available via C<$j-Eproperty_get($path)> -and the like. - - my $rc = $js->eval("write('hello');"); - -The method returns C<1> on success or else if -there was an error in JS land. In case of an error, the JS -error text will be available in C<$@>. - -=cut - -################################################## -sub eval { -################################################## - my ($self, $script) = @_; - - return 1 unless defined $script; - - my $ok = - JavaScript::SpiderMonkey::JS_EvaluateScript( - $self->{context}, - $self->{global_object}, - $script, - $] > 5.007 ? bytes::length($script) : length($script), - "Perl", - 0); - - return $ok; -} - -################################################## - -=head2 $js-Eret_eval($code) - -Runs the specified piece of <$code> in the JS engine. -Differs from eval because it returns the results of -the last executed expression from the JS context. - - my $value = $js->ret_eval("2+2"); - -The method returns the result of the last evaluated -JS expression. In case of an error, the JS -error text will be available in C<$@>. - -=cut - -################################################## -sub ret_eval { -################################################## - my ($self, $script) = @_; - - return 1 unless defined $script; - - no warnings 'uninitialized'; #Silence a spurious undef warning I can't track down. - my $ok = - JavaScript::SpiderMonkey::JS_RetEvaluateScript( - $self->{context}, - $self->{global_object}, - $script, - #$] > 5.007 ? bytes::length($script) : length($script), - length($script), - "Perl", - 0); - - return $ok; -} - -################################################## - -=head2 $js-Eset_max_branch_operations($max_branch_operations) - -Set the maximum number of allowed branch operations. This protects -against infinite loops and guarantees that the eval operation -will terminate. - -=cut -################################################## -sub set_max_branch_operations { -################################################## - my ($self, $max_branch_operations) = @_; - JavaScript::SpiderMonkey::JS_SetMaxBranchOperations($self->{context}, $max_branch_operations); -} - -################################################## -sub dump { -################################################## - my ($self) = @_; - - Data::Dumper::Dumper($self->{objects}); -} - -################################################## -sub debug_enabled { -################################################## - my $logger = Log::Log4perl::get_logger("JavaScript::SpiderMonkey"); - if(Log::Log4perl->initialized() and $logger->is_debug()) { - # print "DEBUG IS ENABLED\n"; - return 1; - } else { - # print "DEBUG IS DISABLED\n"; - return 0; - } -} - -1; - -__END__ - -=head1 SpiderMonkey Installation - -First, get the latest SpiderMonkey distribution from mozilla.org: -http://www.mozilla.org/js/spidermonkey shows which releases are available. -C has been proven to work. - -Untar it at the same directory level as you just untarred the -C distribution you're currently reading. -So, if you're currently in C, do -this: - - cp js-1.6.tar.gz /my/path - cd /my/path - tar zxfv js-1.6.tar.gz - -Then, compile the SpiderMonkey distribution, if you're on Linux, -just use: - - cd js/src - make -f Makefile.ref - -It's important that the js and JavaScript-SpiderMonkey-v.vv directories -are at the same level: - - [/my/path]$ ls - JavaScript-SpiderMonkey-v.vv - js - js-1.6.tar.gz - [/my/path]$ - -(Note that you *can* untar the SpiderMonkey distribution elsewhere, -but, if so, then you need to edit the setting of $JSLIBPATH in Makefile.PL). - -Next, you need to copy the shared library file thus constructed -(e.g., libjs.so or js32.dll) to an appropriate directory on your library path. -On Windows, this can also be the directory where the perl executable -lives. On Unix, this has been shown to work without copying, but this way -you need to keep the compiled binary in the C build directory forever. -Copying -C to C and -making sure that C is in your C -seems to be safest bet. - -Now, build JavaScript::SpiderMonkey in the standard way: - - cd JavaScript-SpiderMonkey-v.vv - perl Makefile.PL - make - make test - make install - -=head1 E4X SUPPORT - -To build JavaScript-SpiderMonkey with E4X (ECMAScript for XML) support: - - perl Makefile.PL -E4X - -Please note that E4X support is only supported since SpiderMonkey release 1.6. - -=head1 THREAD SAFETY - -To build JavaScript-SpiderMonkey when using a thread safe version of SpiderMonkey: - - perl Makefile.PL -JS_THREADSAFE - -=head1 AUTHORS - - Mike Schilli, - Thomas Busch, (current maintainer) - -=head1 COPYRIGHT AND LICENSE - - Copyright (c) 2002-2005 Mike Schilli - Copyright (c) 2006-2007 Thomas Busch - -This library is free software; you can redistribute it and/or modify -it under the same terms as Perl itself. diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/SpiderMonkey.xs b/deps/JavaScript-SpiderMonkey-0.19-patched/SpiderMonkey.xs deleted file mode 100644 index 74d3216..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/SpiderMonkey.xs +++ /dev/null @@ -1,824 +0,0 @@ -/* --------------------------------------------------------------------- */ -/* SpiderMonkey.xs -- Perl Interface to the SpiderMonkey JavaScript */ -/* implementation. */ -/* */ -/* Revision: $Revision: 1.6 $ */ -/* Last Checkin: $Date: 2007/06/08 19:03:08 $ */ -/* By: $Author: thomas_busch $ */ -/* */ -/* Author: Mike Schilli mschilli1@aol.com, 2001 */ -/* --------------------------------------------------------------------- */ - -#include "EXTERN.h" -#include "perl.h" -#include "XSUB.h" -#include "jsapi.h" -#include "SpiderMonkey.h" - -#ifdef _MSC_VER - /* As suggested in https://rt.cpan.org/Ticket/Display.html?id=6984 */ -#define snprintf _snprintf -#endif - -/* JSRuntime needs this global class */ -static -JSClass global_class = { - "Global", 0, - JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub -}; - -static int Debug = 0; - -static int max_branch_operations = 0; - -/*==================================*/ -/* Begin Dirty Hackery */ -/*==================================*/ - -/* --------------------------------------------------------------------- */ -int obj_to_str( - JSContext *cx, - JSObject *obj, - SV *perl_str -/* --------------------------------------------------------------------- */ -) { - JSIdArray *fields = JS_Enumerate( cx, obj ); - int i = 0; - jsval property; - - sv_catpvn( perl_str, "{ ", 2 ); -/*printf("OBJ_TO_STR\n"); -printf("Length: %i\n", fields->length);*/ - - for( i = 0; i < fields->length; i++ ) - { - jsid id = fields->vector[i]; - jsval id_val; - char *prop_name; - - JS_IdToValue( cx, id, &id_val ); - prop_name = JS_GetStringBytes(JS_ValueToString(cx, id_val)); - JS_GetProperty( cx, obj, prop_name, &property ); - -/* printf("Adding %s to pv\n", prop_name); */ - sv_catpvn( perl_str, prop_name, strlen( prop_name ) ); - sv_catpvn( perl_str, ": ", 2 ); -/* printf( "Str: %s\n", SvPVbyte_nolen( perl_str ) ); */ - - if( JSVAL_IS_OBJECT( property ) ) - { - JSObject *prop_obj; - JS_ValueToObject( cx, property, &prop_obj ); - obj_to_str( cx, prop_obj, perl_str ); - } - else - { - JSString *prop_str = JS_ValueToString( cx, property ); - sv_catpvn( perl_str, JS_GetStringBytes( prop_str ), JS_GetStringLength( prop_str ) ); - /*sv_catpvn( perl_str, " ", 1 );*/ - } - - if( i < ( fields->length - 1 ) ) - { - sv_catpvn( perl_str, ", ", 2 ); - } - } - - sv_catpvn( perl_str, "}", 1 ); - JS_DestroyIdArray( cx, fields ); - return 1; -} -/*==================================*/ -/* End Dirty Hackery */ -/*==================================*/ - -/* It's kinda silly that we have to replicate this for getters and setters, - * but there doesn't seem to be a way to distinguish between getters - * and setters if we use the same function. (Somewhere I read in a - * usenet posting there's something like IS_ASSIGN, but this doesn't - * seem to be in SpiderMonkey 1.5). - */ - -/* --------------------------------------------------------------------- */ -JSBool getsetter_dispatcher( - JSContext *cx, - JSObject *obj, - jsval id, - jsval *vp, - char *what -/* --------------------------------------------------------------------- */ -) { - dSP; - - /* Call back into perl */ - ENTER ; - SAVETMPS ; - PUSHMARK(SP); - /* A somewhat nasty trick: Since JS_DefineObject() down below - * returns a *JS_Object, which is typemapped as T_PTRREF, - * and which is a reference (!) pointing to the real C pointer, - * we need to brutally obtain the obj's address by casting - * it to an int and forming a scalar out of it. - * On the other hand, when Spidermonkey.pm stores the - * object's setters/getters, it will dereference - * what it gets from JS_DefineObject() (therefore - * obtain the object's address in memory) to index its - * hash table. - * I hope all reasonable machines can hold an address in - * an int. - */ - XPUSHs(sv_2mortal(newSViv((int)obj))); - XPUSHs(sv_2mortal(newSVpv(JS_GetStringBytes(JSVAL_TO_STRING(id)), 0))); - XPUSHs(sv_2mortal(newSVpv(what, 0))); - XPUSHs(sv_2mortal(newSVpv(JS_GetStringBytes(JSVAL_TO_STRING(*vp)), 0))); - PUTBACK; - call_pv("JavaScript::SpiderMonkey::getsetter_dispatcher", G_DISCARD); - FREETMPS; - LEAVE; - - return JS_TRUE; -} - -/* --------------------------------------------------------------------- */ -JSBool getter_dispatcher( - JSContext *cx, - JSObject *obj, - jsval id, - jsval *vp -/* --------------------------------------------------------------------- */ -) { - return getsetter_dispatcher(cx, obj, id, vp, "getter"); -} - -/* --------------------------------------------------------------------- */ -JSBool setter_dispatcher( - JSContext *cx, - JSObject *obj, - jsval id, - jsval *vp -/* --------------------------------------------------------------------- */ -) { - return getsetter_dispatcher(cx, obj, id, vp, "setter"); -} - -/* --------------------------------------------------------------------- */ -int debug_enabled( -/* --------------------------------------------------------------------- */ -) { - dSP; - - int enabled = 0; - int count = 0; - - /* Call back into perl */ - ENTER ; - SAVETMPS ; - PUTBACK; - count = call_pv("JavaScript::SpiderMonkey::debug_enabled", G_SCALAR); - if(count == 1) { - if(POPi == 1) { - enabled = 1; - } - } - FREETMPS; - LEAVE; - - return enabled; -} - -/* --------------------------------------------------------------------- */ -static JSBool -FunctionDispatcher(JSContext *cx, JSObject *obj, uintN argc, - jsval *argv, jsval *rval) { -/* --------------------------------------------------------------------- */ - dSP; - SV *sv; - char *n_jstr; - int n_jnum; - double n_jdbl; - unsigned i; - int count; - JSFunction *fun; - fun = JS_ValueToFunction(cx, argv[-2]); - - /* printf("Function %s received %d arguments\n", - (char *) JS_GetFunctionName(fun), - (int) argc); */ - - /* Call back into perl */ - ENTER ; - SAVETMPS ; - PUSHMARK(SP); - XPUSHs(sv_2mortal(newSViv((int)obj))); - XPUSHs(sv_2mortal(newSVpv( - JS_GetFunctionName(fun), 0))); - for(i=0; i 0) { - sv = POPs; - if(SvROK(sv)) { - /* Im getting a perl reference here, the user - * seems to want to send a perl object to jscript - * ok, we will do it, although it seems like a painful - * thing to me. - */ - - if(Debug) - fprintf(stderr, "DEBUG: %lx is a ref!\n", (long) sv); - *rval = OBJECT_TO_JSVAL(SvIV(SvRV(sv))); - } - else if(SvIOK(sv)) { - /* It appears that we have been sent an int return - * value. Thats fine we can give javascript an int - */ - n_jnum=SvIV(sv); - if(Debug) - fprintf(stderr, "DEBUG: %lx is an int (%d)\n", (long) sv,n_jnum); - *rval = INT_TO_JSVAL(n_jnum); - } else if(SvNOK(sv)) { - /* It appears that we have been sent an double return - * value. Thats fine we can give javascript an double - */ - n_jdbl=SvNV(sv); - - if(Debug) - fprintf(stderr, "DEBUG: %lx is a double(%f)\n", (long) sv,n_jdbl); - *rval = DOUBLE_TO_JSVAL(JS_NewDouble(cx, n_jdbl)); - } else if(SvPOK(sv)) { - n_jstr = SvPV(sv, PL_na); - //warn("DEBUG: %s (%d)\n", n_jstr); - *rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, n_jstr)); - } - } - - PUTBACK; - FREETMPS; - LEAVE; - - return JS_TRUE; -} - -/* --------------------------------------------------------------------- */ -static void -ErrorReporter(JSContext *cx, const char *message, JSErrorReport *report) { -/* --------------------------------------------------------------------- */ - char msg[400]; - snprintf(msg, sizeof(msg), - "Error: %s at line %d: %s", message, report->lineno, - report->linebuf); - sv_setpv(get_sv("@", TRUE), msg); -} - -/* --------------------------------------------------------------------- */ -static JSBool -BranchHandler(JSContext *cx, JSScript *script) { -/* --------------------------------------------------------------------- */ - PJS_Context* pcx = (PJS_Context*) JS_GetContextPrivate(cx); - - pcx->branch_count++; - if (pcx->branch_count > pcx->branch_max) { - return JS_FALSE; - } else { - return JS_TRUE; - } -} - - - -MODULE = JavaScript::SpiderMonkey PACKAGE = JavaScript::SpiderMonkey -PROTOTYPES: DISABLE - -###################################################################### -char * -JS_GetImplementationVersion() -###################################################################### - CODE: - { - RETVAL = (char *) JS_GetImplementationVersion(); - } - OUTPUT: - RETVAL - -###################################################################### -JSRuntime * -JS_NewRuntime(maxbytes) - int maxbytes -###################################################################### - PREINIT: - JSRuntime *rt; - CODE: - { - rt = JS_NewRuntime(maxbytes); - if(!rt) { - XSRETURN_UNDEF; - } - RETVAL = rt; - } - OUTPUT: - RETVAL - -###################################################################### -int -JS_DestroyRuntime(rt) - JSRuntime *rt -###################################################################### - CODE: - { - JS_DestroyRuntime(rt); - RETVAL = 0; - } - OUTPUT: - RETVAL - -###################################################################### -JSRuntime * -JS_Init(maxbytes) - int maxbytes -###################################################################### - PREINIT: - JSRuntime *rt; - CODE: - { - rt = JS_Init(maxbytes); - if(!rt) { - XSRETURN_UNDEF; - } - /* Replace this by Debug = debug_enabled(); once - * Log::Log4perl 0.47 is out */ - Debug = 0; - RETVAL = rt; - } - OUTPUT: - RETVAL - -###################################################################### -JSContext * -JS_NewContext(rt, stack_chunk_size) - JSRuntime *rt - int stack_chunk_size -###################################################################### - PREINIT: - JSContext *cx; - CODE: - { - PJS_Context* pcx; - cx = JS_NewContext(rt, stack_chunk_size); - if(!cx) { - XSRETURN_UNDEF; - } -#ifdef E4X - JS_SetOptions(cx,JSOPTION_XML); -#endif - - Newz(1, pcx, 1, PJS_Context); - JS_SetContextPrivate(cx, (void *)pcx); - - RETVAL = cx; - } - OUTPUT: - RETVAL - -###################################################################### -int -JS_DestroyContext(cx) - JSContext *cx; -###################################################################### - CODE: - { - JS_DestroyContext(cx); - Safefree(JS_GetContextPrivate(cx)); - RETVAL = 0; - } - OUTPUT: - RETVAL - -###################################################################### -JSObject * -JS_NewObject(cx, class, proto, parent) - JSContext * cx - JSClass * class - JSObject * proto - JSObject * parent -###################################################################### - PREINIT: - JSObject *obj; - CODE: - { - obj = JS_NewObject(cx, class, NULL, NULL); - if(!obj) { - XSRETURN_UNDEF; - } - RETVAL = obj; - } - OUTPUT: - RETVAL - -###################################################################### -JSObject * -JS_InitClass(cx, iobj, parent_proto, clasp, constructor, nargs, ps, fs, static_ps, static_fs) - JSContext * cx - JSObject *iobj - JSObject *parent_proto - JSClass *clasp - JSNative constructor - int nargs - JSPropertySpec *ps - JSFunctionSpec *fs - JSPropertySpec *static_ps - JSFunctionSpec *static_fs -###################################################################### - PREINIT: - JSObject *obj; - uintN na; - INIT: - na = (uintN) nargs; - CODE: - { - obj = JS_InitClass(cx, iobj, parent_proto, clasp, - constructor, nargs, ps, fs, static_ps, - static_fs); - if(!obj) { - XSRETURN_UNDEF; - } - RETVAL = obj; - } - OUTPUT: - RETVAL - -###################################################################### -JSClass * -JS_GlobalClass() -###################################################################### - PREINIT: - JSClass *gc; - CODE: - { - gc = &global_class; - RETVAL = gc; - } - OUTPUT: - RETVAL - -###################################################################### -void -JS_ForceLatest(cx) - JSContext * cx -###################################################################### - CODE: - { - JS_SetVersion(cx, JSVERSION_LATEST); - } - -###################################################################### -char* -JS_RetEvaluateScript(cx, gobj, script, length, filename, lineno) - JSContext * cx - JSObject * gobj - char * script - int length - char * filename - int lineno -###################################################################### - PREINIT: - uintN len; - uintN ln; - int rc; - jsval jsval; - JSString *js_string; - char *return_string; - INIT: - len = (uintN) length; - ln = (uintN) lineno; - CODE: - { - rc = JS_EvaluateScript(cx, gobj, script, len, filename, - ln, &jsval); - if(!rc) { - XSRETURN_UNDEF; - } - - if( JSVAL_IS_OBJECT(jsval) ) - { - SV* sv = NEWSV(5,10); - JSObject *obj; - JS_ValueToObject( cx, jsval, &obj ); - obj_to_str(cx,obj,sv); - RETVAL = SvPVbyte_nolen( sv ); - } - - else - { - js_string = JS_ValueToString(cx, jsval); - return_string = JS_GetStringBytes(js_string); - RETVAL = return_string; - } - } - OUTPUT: - RETVAL - -###################################################################### -int -JS_EvaluateScript(cx, gobj, script, length, filename, lineno) - JSContext * cx - JSObject * gobj - char * script - int length - char * filename - int lineno -###################################################################### - PREINIT: - uintN len; - uintN ln; - int rc; - jsval jsval; - INIT: - len = (uintN) length; - ln = (uintN) lineno; - CODE: - { - rc = JS_EvaluateScript(cx, gobj, script, len, filename, - ln, &jsval); - if(!rc) { - XSRETURN_UNDEF; - } - RETVAL = rc; - } - OUTPUT: - RETVAL - -###################################################################### -int -JS_InitStandardClasses(cx, gobj) - JSContext * cx - JSObject * gobj -###################################################################### - PREINIT: - JSBool rc; - CODE: - { - rc = JS_InitStandardClasses(cx, gobj); - if(!rc) { - XSRETURN_UNDEF; - } - RETVAL = (int) rc; - } - OUTPUT: - RETVAL - -###################################################################### -int -JS_DefineFunction(cx, obj, name, nargs, flags) - JSContext * cx - JSObject * obj - char * name - int nargs - int flags -###################################################################### - PREINIT: - JSFunction *rc; - CODE: - { - rc = JS_DefineFunction(cx, obj, - (const char *) name, FunctionDispatcher, - (uintN) nargs, (uintN) flags); - if(!rc) { - XSRETURN_UNDEF; - } - RETVAL = (int) rc; - } - OUTPUT: - RETVAL - -###################################################################### -int -JS_SetErrorReporter(cx) - JSContext * cx -###################################################################### - CODE: - { - JS_SetErrorReporter(cx, ErrorReporter); - RETVAL = 0; - } - OUTPUT: - RETVAL - -###################################################################### -JSObject * -JS_DefineObject(cx, obj, name, class, proto) - JSContext * cx - JSObject * obj - char * name - JSClass * class - JSObject * proto -###################################################################### - PREINIT: - SV *sv = sv_newmortal(); - CODE: - { - RETVAL = JS_DefineObject(cx, obj, name, class, proto, 0); - } - OUTPUT: - RETVAL - -###################################################################### -int -JS_DefineProperty(cx, obj, name, value) - JSContext * cx - JSObject * obj - char * name - char * value - #JSPropertyOp getter - #JSPropertyOp setter - #uintN flags -###################################################################### - PREINIT: - JSBool rc; - JSString *str; - CODE: - { - str = JS_NewStringCopyZ(cx, value); - - /* This implementation is somewhat sub-optimal, since it - * calls back into perl even if no getters/setters have - * been defined. The necessity for a callback is determined - * at the perl level, where there's a data structure mapping - * out each object's properties and their getter/setter settings. - */ - rc = JS_DefineProperty(cx, obj, name, STRING_TO_JSVAL(str), - getter_dispatcher, setter_dispatcher, 0); - RETVAL = (int) rc; - } - OUTPUT: - RETVAL - -###################################################################### -void -JS_GetProperty(cx, obj, name) - JSContext * cx - JSObject * obj - char * name -###################################################################### - PREINIT: - JSBool rc; - jsval vp; - JSString *str; - SV *sv = sv_newmortal(); - PPCODE: - { - rc = JS_TRUE; - rc = JS_GetProperty(cx, obj, name, &vp); - if(rc) { - str = JS_ValueToString(cx, vp); - if(strcmp(JS_GetStringBytes(str), "undefined") == 0) { - sv = &PL_sv_undef; - } else { - sv_setpv(sv, JS_GetStringBytes(str)); - } - } else { - sv = &PL_sv_undef; - } - XPUSHs(sv); - } - -###################################################################### -JSObject * -JS_NewArrayObject(cx) - JSContext * cx -###################################################################### - PREINIT: - JSObject *rc; - CODE: - { - rc = JS_NewArrayObject(cx, 0, NULL); - RETVAL = rc; - } - OUTPUT: - RETVAL - -###################################################################### -int -JS_SetElement(cx, obj, idx, valptr) - JSContext *cx - JSObject *obj - int idx - char *valptr -###################################################################### - PREINIT: - JSBool rc; - JSString *str; - jsval val; - CODE: - { - str = JS_NewStringCopyZ(cx, valptr); - val = STRING_TO_JSVAL(str); - rc = JS_SetElement(cx, obj, idx, &val); - if(rc) { - RETVAL = 1; - } else { - RETVAL = 0; - } - } - OUTPUT: - RETVAL - -###################################################################### -int -JS_SetElementAsObject(cx, obj, idx, elobj) - JSContext *cx - JSObject *obj - int idx - JSObject *elobj -###################################################################### - PREINIT: - JSBool rc; - jsval val; - CODE: - { - val = OBJECT_TO_JSVAL(elobj); - rc = JS_SetElement(cx, obj, idx, &val); - if(rc) { - RETVAL = 1; - } else { - RETVAL = 0; - } - } - OUTPUT: - RETVAL - -###################################################################### -void -JS_GetElement(cx, obj, idx) - JSContext *cx - JSObject *obj - int idx -###################################################################### - PREINIT: - JSBool rc; - jsval vp; - JSString *str; - SV *sv = sv_newmortal(); - PPCODE: - { - rc = JS_GetElement(cx, obj, idx, &vp); - if(rc) { - str = JS_ValueToString(cx, vp); - if(strcmp(JS_GetStringBytes(str), "undefined") == 0) { - sv = &PL_sv_undef; - } else { - sv_setpv(sv, JS_GetStringBytes(str)); - } - } else { - sv = &PL_sv_undef; - } - XPUSHs(sv); - } - -###################################################################### -JSClass * -JS_GetClass(cx, obj) - JSContext * cx - JSObject * obj -###################################################################### - PREINIT: - JSClass *rc; - CODE: - { -#ifdef JS_THREADSAFE - rc = JS_GetClass(cx, obj); -#else - rc = JS_GetClass(obj); -#endif - RETVAL = rc; - } - OUTPUT: - RETVAL - - -###################################################################### -void -JS_SetMaxBranchOperations(cx, max_branch_operations) - JSContext *cx - int max_branch_operations -###################################################################### - CODE: - { - PJS_Context* pcx = (PJS_Context *) JS_GetContextPrivate(cx); - pcx->branch_count = 0; - pcx->branch_max = max_branch_operations; - JS_SetBranchCallback(cx, BranchHandler); - } - OUTPUT: - - -###################################################################### - diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/entries b/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/entries deleted file mode 100644 index 9138553..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/entries +++ /dev/null @@ -1,810 +0,0 @@ -10 - -dir -475 -svn://erxz.com/bb3/branches/perlbuut/deps/JavaScript-SpiderMonkey-0.19-patched/t -svn://erxz.com/bb3 - - - -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - -dcb1cea6-7f7e-4c78-8a22-148ace8ce36e - -04loop.t -file - - - - -2009-10-03T22:54:20.000000Z -052aecc1ebdaa0ead11238233ae9e5ae -2009-10-03T22:53:42.528878Z -475 -simcop -has-props - - - - - - - - - - - - - - - - - - - - -543 - -001properties.t -file - - - - -2009-10-03T22:54:20.000000Z -74e475b5a99c51f2bb67598cf6697707 -2009-10-03T22:53:42.528878Z -475 -simcop -has-props - - - - - - - - - - - - - - - - - - - - -1837 - -000readme.t -file - - - - -2009-10-03T22:54:20.000000Z -289273fc220df68922686441714d5b5b -2009-10-03T22:53:42.528878Z -475 -simcop -has-props - - - - - - - - - - - - - - - - - - - - -909 - -00array.t -file - - - - -2009-10-03T22:54:20.000000Z -02cac23a1988e6ab507d0c6036449959 -2009-10-03T22:53:42.528878Z -475 -simcop -has-props - - - - - - - - - - - - - - - - - - - - -487 - -006objmeth.t -file - - - - -2009-10-03T22:54:20.000000Z -e07e8e7be6e6bd4d3bb7dc8fd6976f80 -2009-10-03T22:53:42.528878Z -475 -simcop -has-props - - - - - - - - - - - - - - - - - - - - -1366 - -005error.t -file - - - - -2009-10-03T22:54:20.000000Z -e82e5ab0c2ba6981e9054865548c5c6c -2009-10-03T22:53:42.528878Z -475 -simcop -has-props - - - - - - - - - - - - - - - - - - - - -640 - -004setget.t -file - - - - -2009-10-03T22:54:20.000000Z -388f649bb7374f728838a8b20f55caa8 -2009-10-03T22:53:42.528878Z -475 -simcop -has-props - - - - - - - - - - - - - - - - - - - - -2663 - -003properties.t -file - - - - -2009-10-03T22:54:20.000000Z -a65e4065a61c6e7f02f7f693760abca8 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -673 - -12dblret.t -file - - - - -2009-10-03T22:54:20.000000Z -a7916a2202255276a59f2e3f83ad9af9 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -763 - -08func2.t -file - - - - -2009-10-03T22:54:20.000000Z -66a09da3b8f4d7dc3b961cf10eab8bd2 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -487 - -13strret.t -file - - - - -2009-10-03T22:54:20.000000Z -59d3cecd83b3570288731abef7ad326a -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -819 - -01doc-href.t -file - - - - -2009-10-03T22:54:20.000000Z -e80d98b4a09abbb56324cdc372cf6002 -2009-10-03T22:53:42.528878Z -475 -simcop -has-props - - - - - - - - - - - - - - - - - - - - -487 - -02nav-appv.t -file - - - - -2009-10-03T22:54:20.000000Z -30e834fd2efb1165d28bc0f7269b931e -2009-10-03T22:53:42.528878Z -475 -simcop -has-props - - - - - - - - - - - - - - - - - - - - -469 - -002functions.t -file - - - - -2009-10-03T22:54:20.000000Z -31f0487aee924b1494f2b235dbceb5c7 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -1605 - -06form2.t -file - - - - -2009-10-03T22:54:20.000000Z -655b103727acf1ab73e382a3f019a1e7 -2009-10-03T22:53:42.528878Z -475 -simcop -has-props - - - - - - - - - - - - - - - - - - - - -739 - -10elobj.t -file - - - - -2009-10-03T22:54:20.000000Z -37abbfec8a0e87939014be3fd21048f0 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -634 - -007funcret.t -file - - - - -2009-10-03T22:54:20.000000Z -afd19ff93c781c661046451392b9ed67 -2009-10-03T22:53:42.528878Z -475 -simcop -has-props - - - - - - - - - - - - - - - - - - - - -1367 - -03doc-write.t -file - - - - -2009-10-03T22:54:20.000000Z -2ef4539e393834a8311b43749cc6660c -2009-10-03T22:53:42.528878Z -475 -simcop -has-props - - - - - - - - - - - - - - - - - - - - -449 - -07func.t -file - - - - -2009-10-03T22:54:20.000000Z -224aff71ecf2cd7afed1756111e69477 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -550 - -09meth.t -file - - - - -2009-10-03T22:54:20.000000Z -029ae9fa4c4690ed1983422785eea1b5 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -553 - -11intret.t -file - - - - -2009-10-03T22:54:20.000000Z -7f8d43a73df98e3cee3512d714d355df -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -923 - -05form.t -file - - - - -2009-10-03T22:54:20.000000Z -b7cf61e44e386e0d08e0028153c71847 -2009-10-03T22:53:42.528878Z -475 -simcop -has-props - - - - - - - - - - - - - - - - - - - - -602 - -init.pl -file - - - - -2009-10-03T22:54:20.000000Z -0197ac936fc64860a3175495240bde1d -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -778 - diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/000readme.t.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/000readme.t.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/000readme.t.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/001properties.t.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/001properties.t.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/001properties.t.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/004setget.t.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/004setget.t.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/004setget.t.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/005error.t.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/005error.t.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/005error.t.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/006objmeth.t.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/006objmeth.t.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/006objmeth.t.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/007funcret.t.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/007funcret.t.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/007funcret.t.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/00array.t.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/00array.t.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/00array.t.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/01doc-href.t.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/01doc-href.t.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/01doc-href.t.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/02nav-appv.t.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/02nav-appv.t.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/02nav-appv.t.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/03doc-write.t.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/03doc-write.t.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/03doc-write.t.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/04loop.t.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/04loop.t.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/04loop.t.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/05form.t.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/05form.t.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/05form.t.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/06form2.t.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/06form2.t.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/prop-base/06form2.t.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/000readme.t.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/000readme.t.svn-base deleted file mode 100644 index cacb8e4..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/000readme.t.svn-base +++ /dev/null @@ -1,33 +0,0 @@ -###################################################################### -# Testcase: Run the sample code from the README file -# Revision: $Revision: 1.1.1.1 $ -# Last Checkin: $Date: 2006/02/01 06:00:49 $ -# By: $Author: mschilli $ -# -# Author: Mike Schilli m@perlmeister.com, 2002 -###################################################################### - -use warnings; -use strict; - -print "1..1\n"; - -open FILE, "; -close FILE; - -my $buffer = ""; - - # Overwrite print() with our own routine filling $buffer -if(my($code) = ($data =~ /SYNOPSIS(.*?)=head1 INSTALL/s)) { - $code =~ s/print /myprint/g; - eval "sub myprint { \$buffer .= join('', \@_) } $code; - \$buffer.=\$rc; - \$buffer.=\$url;"; -} - -if($buffer ne "URL is http://www.aol.com\n1http://www.aol.com") { - print "not ('$buffer')"; -} - -print "ok 1\n"; diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/001properties.t.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/001properties.t.svn-base deleted file mode 100644 index 775a9a3..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/001properties.t.svn-base +++ /dev/null @@ -1,63 +0,0 @@ -###################################################################### -# Testcase: Set/Get properties of objects -# Revision: $Revision: 1.1.1.1 $ -# Last Checkin: $Date: 2006/02/01 06:00:49 $ -# By: $Author: mschilli $ -# -# Author: Mike Schilli m@perlmeister.com, 2002 -###################################################################### - -use warnings; -use strict; - -print "1..5\n"; - -use JavaScript::SpiderMonkey; -my $js = JavaScript::SpiderMonkey->new(); -$js->init(); - -$js->property_by_path("navigator.appName"); -$js->property_by_path("navigator.userAgent"); -$js->property_by_path("navigator.appVersion"); -$js->property_by_path("document.cookie"); -$js->property_by_path("parent.location"); -$js->property_by_path("document.location.href"); -$js->property_by_path("document.location.yodel"); - - # Function to write something from JS to a Perl $buffer -my $buffer; -my $doc = $js->object_by_path("document"); -$js->function_set("write", sub { $buffer .= join('', @_) }, $doc); -$buffer = ""; - -my $code = <eval($code); - -# Check return code -print "not " if $rc != 1; -print "ok 1\n"; - -# Check simple property -print "not " unless $js->property_get("navigator.appName") eq "Netscape"; -print "ok 2\n"; - -# Check simple property -print "not " unless $js->property_get("navigator.appVersion") eq "3"; -print "ok 3\n"; - -# Check simple property -print "not " unless - $js->property_get("document.cookie") eq "k=v; domain=.netscape.com"; -print "ok 4\n"; - -# Check buffer from document.write() -print "not " unless $buffer eq "Grugenheimer"; -print "ok 5\n"; diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/002functions.t.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/002functions.t.svn-base deleted file mode 100644 index 06fa80e..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/002functions.t.svn-base +++ /dev/null @@ -1,60 +0,0 @@ -###################################################################### -# Testcase: Define Functions and Perl callbacks -# Revision: $Revision: 1.1.1.1 $ -# Last Checkin: $Date: 2006/02/01 06:00:49 $ -# By: $Author: mschilli $ -# -# Author: Mike Schilli m@perlmeister.com, 2002 -###################################################################### - -print "1..3\n"; - -use JavaScript::SpiderMonkey; -my $js = JavaScript::SpiderMonkey->new(); -$js->init(); - -$js->object_by_path("navigator.appName"); -$js->object_by_path("document.location"); -my $parloc = $js->object_by_path("parent.location"); -$js->function_set("replace", - sub { $buffer .= "URL:$_[0]"; }, $parloc); - - # Function write() -our $buffer; -$js->function_set("write", sub { $buffer .= "f0" . join('', @_) }); - - # Method navigator.write() -my $doc = $js->object_by_path("document.location"); -$js->function_set("slice", sub { $buffer .= "f1" . join('', @_) }, $doc); - - # Method navigator.appName.write() -$doc = $js->object_by_path("navigator.appName"); -$js->function_set("dice", sub { $buffer .= "f2" . join('', @_) }, $doc); - -$buffer = ""; - -my $code = <eval($code); - -# Check return code -print "not " if $rc != 1; -print "ok 1\n"; - -# print $buffer; -# Check buffer for traces of function/method calls - -print "not " unless $buffer eq - "f0v1 f1v2 f2v3 URL:testurlf0v1 f1v2 f2v3 URL:testurl"; -print "ok 2\n"; - -$js->destroy(); - -print "ok 3\n"; diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/003properties.t.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/003properties.t.svn-base deleted file mode 100644 index 11dd916..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/003properties.t.svn-base +++ /dev/null @@ -1,25 +0,0 @@ -###################################################################### -# Testcase: Properties of multi-tiered objects -# Revision: $Revision: 1.1.1.1 $ -# Last Checkin: $Date: 2006/02/01 06:00:49 $ -# By: $Author: mschilli $ -# -# Author: Mike Schilli m@perlmeister.com, 2002 -###################################################################### - -print "1..2\n"; - -use JavaScript::SpiderMonkey; -my $js = JavaScript::SpiderMonkey->new(); -$js->init(); - -$js->property_by_path("parent.location.href", "abc"); -my $res = $js->property_get("parent.location.href"); - -# Check return code -print "not " if $res ne "abc"; -print "ok 1\n"; - -$js->destroy(); - -print "ok 2\n"; diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/004setget.t.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/004setget.t.svn-base deleted file mode 100644 index 66f3306..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/004setget.t.svn-base +++ /dev/null @@ -1,119 +0,0 @@ -###################################################################### -# Testcase: Set/Get properties of objects -# Revision: $Revision: 1.1.1.1 $ -# Last Checkin: $Date: 2006/02/01 06:00:49 $ -# By: $Author: mschilli $ -# -# Author: Mike Schilli m@perlmeister.com, 2002 -###################################################################### - -use warnings; -use strict; - -print "1..6\n"; - -use JavaScript::SpiderMonkey; -my $js = JavaScript::SpiderMonkey->new(); -$js->init(); - -our $buffer = ""; - -sub getter { - my(@args) = @_; - $buffer .= "GETTER: @args\n"; -} - -sub setter { - my(@args) = @_; - $buffer .= "SETTER: @args\n"; -} - -$js->property_by_path("navigator.appName", "", \&getter, \&setter); - - # Function to write something from JS to a Perl $buffer - -my $code = <eval($code); - -# Check return code -print "not " if $rc != 1; -print "ok 1\n"; - -# Check output -my $wanted = "SETTER: navigator.appName Netscape\n" . - "GETTER: navigator.appName Netscape\n" . - "SETTER: navigator.appName Netscape2\n" . - "GETTER: navigator.appName Netscape2\n"; -if($buffer ne $wanted) { - print "not ok 2\n"; - print "Expected $wanted but got '$buffer'\n"; -} else { - print "ok 2\n"; -} - -$js->destroy(); - -################################################## -# Setter only, no getter -################################################## -$js = JavaScript::SpiderMonkey->new(); -$js->init(); - -$buffer = ""; - -$js->property_by_path("navigator.appName", "", undef, \&setter); - -$rc = $js->eval($code); - -# Check return code -print "not " if $rc != 1; -print "ok 3\n"; - -# Check output -$wanted = "SETTER: navigator.appName Netscape\n" . - "SETTER: navigator.appName Netscape2\n"; - -if($buffer ne $wanted) { - print "not ok 4\n"; - print "Expected $wanted but got '$buffer'\n"; -} else { - print "ok 4\n"; -} - -$js->destroy(); - -################################################## -# Getter only, no setter -################################################## -$js = JavaScript::SpiderMonkey->new(); -$js->init(); - -$buffer = ""; - -$js->property_by_path("navigator.appName", "", \&getter); - -$rc = $js->eval($code); - -# Check return code -print "not " if $rc != 1; -print "ok 5\n"; - -# Check output -$wanted = "GETTER: navigator.appName Netscape\n" . - "GETTER: navigator.appName Netscape2\n"; - -if($buffer ne $wanted) { - print "not ok 6\n"; - print "Expected $wanted but got '$buffer'\n"; -} else { - print "ok 6\n"; -} - -$js->destroy(); - diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/005error.t.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/005error.t.svn-base deleted file mode 100644 index 4b019ba..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/005error.t.svn-base +++ /dev/null @@ -1,30 +0,0 @@ -###################################################################### -# Testcase: Produce an error and check $@ -# Revision: $Revision: 1.1.1.1 $ -# Last Checkin: $Date: 2006/02/01 06:00:49 $ -# By: $Author: mschilli $ -# -# Author: Mike Schilli m@perlmeister.com, 2004 -###################################################################### - -use warnings; -use strict; - -use JavaScript::SpiderMonkey; - -print "1..1\n"; - -my $js = JavaScript::SpiderMonkey->new(); -$js->init(); - -my $code = <new(); -$js->init(); - -$js->property_by_path("document.location.href"); -$js->property_by_path("document.location.yodel"); -$js->property_by_path("document.someobj.someprop"); - - # Function to write something from JS to a Perl $buffer -my $location_buffer; -my $doc = $js->object_by_path("document.location"); -$js->function_set("write", sub { $location_buffer .= join('', @_) }, $doc); - -my $someobj_buffer; -my $someobj = $js->object_by_path("document.someobj"); -$js->function_set("write", sub { $someobj_buffer .= join('', @_) }, $someobj); - -my $code = <eval($code); - -# Check return code -ok($rc, "JS return code"); - -# Check location buffer -is($location_buffer, "location message", "check loc buffer"); -is($someobj_buffer, "someobj message", "check someobj buffer"); diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/007funcret.t.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/007funcret.t.svn-base deleted file mode 100644 index 1270ed2..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/007funcret.t.svn-base +++ /dev/null @@ -1,47 +0,0 @@ -###################################################################### -# Testcase: Returning values from perl callbacks -# Revision: $Revision: 1.2 $ -# Last Checkin: $Date: 2006/06/13 13:42:58 $ -# By: $Author: thomas_busch $ -# -# Author: Mike Schilli m@perlmeister.com, 2004 -###################################################################### - -use warnings; -use strict; - -use Test::More qw(no_plan); - -use JavaScript::SpiderMonkey; -use Log::Log4perl qw(:easy); -Log::Log4perl->easy_init($ERROR); - -my $buffer = ""; - -my $js = JavaScript::SpiderMonkey->new(); -$js->init(); - - # Example by Chris Blaise: - # Let new function document.getElementById('id') (defined in Perl space) - # return an object into JS. - -my $doc = $js->object_by_path('document' ); -$js->property_by_path('fooobj.style' ); -$js->function_set( 'getElementById', sub { - if(exists $JavaScript::SpiderMonkey::GLOBAL->{objects}->{'fooobj'}) { - return $JavaScript::SpiderMonkey::GLOBAL->{objects}->{'fooobj'}; - } -}, $doc); -$js->function_set("write", sub { - $buffer .= join('', map { "[$_]" } @_) }, $doc); - -my $code = q{ - document.getElementById('bleh').style = 'something'; - document.write(fooobj.style); -}; - -my $rc = $js->eval($code); - -# Check return code -ok($rc, "Function returning object"); -is($buffer, "[something]", "Attribute assigned correctly"); diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/00array.t.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/00array.t.svn-base deleted file mode 100644 index 3bd85a6..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/00array.t.svn-base +++ /dev/null @@ -1,23 +0,0 @@ -###################################################################### -# Create an array as part of an object -###################################################################### - -print "1..1\n"; - -$init = ""; -require "t/init.pl"; - -$js->array_by_path("document.form"); - -my $source = <eval($source); -die "eval returned undef" unless $rc; -if($js->property_get("navigator.appVersion") ne "3") { - print "not "; -} - -print "ok 1\n"; diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/01doc-href.t.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/01doc-href.t.svn-base deleted file mode 100644 index 7f79c95..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/01doc-href.t.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -###################################################################### -# Set and retrieve document.location.href -###################################################################### - -print "1..1\n"; - -$init = ""; - -require "t/init.pl"; - -my $source = <eval($source); - -die "eval returned undef" unless $rc; - -if($js->property_get("document.location.href") ne "http://www.com") { - print "not "; -} - -print "ok 1\n"; diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/02nav-appv.t.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/02nav-appv.t.svn-base deleted file mode 100644 index d038f3e..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/02nav-appv.t.svn-base +++ /dev/null @@ -1,21 +0,0 @@ -###################################################################### -# Set and retrieve document.location.href -###################################################################### - -print "1..1\n"; - -$init = ""; -require "t/init.pl"; - -my $source = <eval($source); -die "eval returned undef" unless $rc; -if($js->property_get("navigator.appVersion") ne "3") { - print "not "; -} - -print "ok 1\n"; diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/03doc-write.t.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/03doc-write.t.svn-base deleted file mode 100644 index 9b38e21..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/03doc-write.t.svn-base +++ /dev/null @@ -1,21 +0,0 @@ -###################################################################### -# Set and retrieve document.location.href -###################################################################### - -print "1..1\n"; - -$init = ""; -require "t/init.pl"; - -my $source = <eval($source); -die "eval returned undef" unless $rc; -if($js->property_get("navigator.appVersion") ne "3") { - print "not "; -} - -print "ok 1\n"; diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/04loop.t.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/04loop.t.svn-base deleted file mode 100644 index 3757c1d..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/04loop.t.svn-base +++ /dev/null @@ -1,31 +0,0 @@ -###################################################################### -# docwrite() -###################################################################### - -print "1..1\n"; - -$init = ""; -require "t/init.pl"; - -my $source = <eval($source); - die "eval returned undef" unless $rc; - if($js->property_get("navigator.appVersion") eq "3") { - $oks++; - } -} - -if($nof != $oks) { - print "not "; -} - -print "ok 1\n"; - -$js->destroy(); diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/05form.t.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/05form.t.svn-base deleted file mode 100644 index 0dc763a..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/05form.t.svn-base +++ /dev/null @@ -1,31 +0,0 @@ -###################################################################### -# docwrite() -###################################################################### - -print "1..1\n"; - -$init = ""; -require "t/init.pl"; - -my $source = <eval($source); -die "eval returned undef" unless $rc; -if($js->property_get("document.location.href") ne "submitted!") { - print "not "; -} - -print "ok 1\n"; - -$js->destroy(); diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/06form2.t.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/06form2.t.svn-base deleted file mode 100644 index 9aacb7a..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/06form2.t.svn-base +++ /dev/null @@ -1,35 +0,0 @@ -###################################################################### -# docwrite() -###################################################################### - -print "1..1\n"; - -$init = ""; -require "t/init.pl"; - -my $a = $js->array_by_path("document.array"); -my $e = $js->array_set_element($a, 0, "gurkenhobel"); -#print "SetElement returned $e\n"; -my $r = $js->array_get_element($a, 0); -#print "r=$r\n"; -#print $js->dump(); - -my $source = <eval($source); - -die "eval returned undef" unless $rc; - -my $val = $js->property_get("document.location.href"); - -if($val ne "gurkenhobel") { - print STDERR "Val is '$val'\n"; - print "not "; -} - -print "ok 1\n"; - -$js->destroy(); diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/07func.t.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/07func.t.svn-base deleted file mode 100644 index c0f95cc..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/07func.t.svn-base +++ /dev/null @@ -1,27 +0,0 @@ -###################################################################### -# functions -###################################################################### - -print "1..1\n"; - -$init = ""; -$buffer = ""; -require "t/init.pl"; - -my $source = <eval($source); -die "eval returned undef" unless $rc; - -if($buffer ne "abcdefabc2def2abc3def3abc4def4") { - print "not "; -} -print "ok 1\n"; - -$js->destroy(); diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/08func2.t.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/08func2.t.svn-base deleted file mode 100644 index 6b49ef7..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/08func2.t.svn-base +++ /dev/null @@ -1,29 +0,0 @@ -###################################################################### -# functions2 -###################################################################### - -print "1..1\n"; - -$init = ""; -require "t/init.pl"; - -$args = ""; - -$js->function_set("farz", sub { $args = join '', @_ }); - -my $source = <eval($source); - -die "eval returned undef" unless $rc; - -if($args ne "abcdef358") { - print "not "; -} - -print "ok 1\n"; - -$js->destroy(); diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/09meth.t.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/09meth.t.svn-base deleted file mode 100644 index 4b5da81..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/09meth.t.svn-base +++ /dev/null @@ -1,30 +0,0 @@ -###################################################################### -# functions2 -###################################################################### - -print "1..1\n"; - -$init = ""; -require "t/init.pl"; - -$args = ""; - -my $docobj = $js->object_by_path("document"); -$js->function_set("schnubbel", sub { $args = join '', @_; }); - -my $source = <eval($source); - -die "eval returned undef" unless $rc; - -if($args ne "abcdef358") { - print "not "; -} - -print "ok 1\n"; - -$js->destroy(); diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/10elobj.t.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/10elobj.t.svn-base deleted file mode 100644 index d4eca5c..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/10elobj.t.svn-base +++ /dev/null @@ -1,33 +0,0 @@ -###################################################################### -# functions2 -###################################################################### - -print "1..1\n"; - -$init = ""; -require "t/init.pl"; - -$submitted = "0"; - -my $obj = $js->object_by_path("submitter"); -$js->function_set("submit", sub { $submitted = 1 }); - -my $forms = $js->array_by_path("document.forms"); -my $e = $js->array_set_element_as_object($forms, 0, $obj); - -my $source = <eval($source); - -die "eval returned undef" unless $rc; - -if(!$submitted) { - print "not "; -} - -print "ok 1\n"; - -$js->destroy(); diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/11intret.t.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/11intret.t.svn-base deleted file mode 100644 index 04d0797..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/11intret.t.svn-base +++ /dev/null @@ -1,29 +0,0 @@ -###################################################################### -# Testcase: Returning integer values from perl -# Revision: $Revision: 1.1 $ -# Last Checkin: $Date: 2006/06/13 13:43:51 $ -# By: $Author: thomas_busch $ -# -# Author: Marc Relation marc@igneousconsulting.com -###################################################################### - -use warnings; -use strict; - -print "1..1\n"; - -use JavaScript::SpiderMonkey; - -my $js=new JavaScript::SpiderMonkey; -my $buffer; -$js->init; -$js->function_set('get_int',sub {return(1000);}); -$js->function_set('get_float',sub {return(10.21);}); -$js->function_set('booltest',sub {return 1==$_[0];}); -#$js->function_set('write',sub {print STDERR $_[0] . "\n"}); -$js->function_set("write",sub { $buffer .= join('', @_) }); -$js->eval("write(get_int()+1);"); -$js->destroy; -# Check buffer from document.write() -print "not " unless $buffer == 1001; -print "ok 1\n"; diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/12dblret.t.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/12dblret.t.svn-base deleted file mode 100644 index 5696db1..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/12dblret.t.svn-base +++ /dev/null @@ -1,25 +0,0 @@ -###################################################################### -# Testcase: Returning double values from perl -# Revision: $Revision: 1.1 $ -# Last Checkin: $Date: 2006/06/13 13:43:51 $ -# By: $Author: thomas_busch $ -# -# Author: Marc Relation marc@igneousconsulting.com -###################################################################### - -use warnings; -use strict; - -print "1..1\n"; -use JavaScript::SpiderMonkey; - -my $js=new JavaScript::SpiderMonkey; -my $buffer; -$js->init; -$js->function_set('get_double',sub {return(10.21);}); -$js->function_set("write",sub { $buffer .= join('', @_) }); -$js->eval("write(get_double()+1.2);"); -$js->destroy; -# Check buffer from document.write() -print "not " unless $buffer == 11.41; -print "ok 1\n"; diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/13strret.t.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/13strret.t.svn-base deleted file mode 100644 index 5560e06..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/13strret.t.svn-base +++ /dev/null @@ -1,25 +0,0 @@ -###################################################################### -# Testcase: Returning string values from perl -# Revision: $Revision: 1.1 $ -# Last Checkin: $Date: 2006/06/13 13:43:51 $ -# By: $Author: thomas_busch $ -# -# Author: Marc Relation marc@igneousconsulting.com -###################################################################### - -use warnings; -use strict; -use Test::More tests => 1; - -use JavaScript::SpiderMonkey; - -my $js = new JavaScript::SpiderMonkey; -my $buffer; -$js->init; -$js->function_set('get_string',sub { return "John Doe";}); -#$js->function_set('write',sub {print STDERR $_[0] . "\n"}); -$js->function_set("write",sub { $buffer .= join('', @_) }); -$js->eval("write(get_string()+' who');"); -$js->destroy; -# Check buffer from document.write() -is $buffer, 'John Doe who'; diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/init.pl.svn-base b/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/init.pl.svn-base deleted file mode 100644 index da1b433..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/.svn/text-base/init.pl.svn-base +++ /dev/null @@ -1,28 +0,0 @@ - -use JavaScript::SpiderMonkey; - -my $docloc = "http://wurks"; -$js = JavaScript::SpiderMonkey->new(); -$js->init(); - -$js->property_by_path("navigator.appName"); -$js->property_by_path("navigator.userAgent"); -$js->property_by_path("navigator.appVersion"); -$js->property_by_path("document.cookie"); -$js->property_by_path("parent.location"); -$js->property_by_path("document.location.href"); - -my $doc = $js->object_by_path("document"); -$js->function_set("write", sub { $buffer .= join('', @_) }, $doc); -$buffer = ""; - -$init = <; -close FILE; - -my $buffer = ""; - - # Overwrite print() with our own routine filling $buffer -if(my($code) = ($data =~ /SYNOPSIS(.*?)=head1 INSTALL/s)) { - $code =~ s/print /myprint/g; - eval "sub myprint { \$buffer .= join('', \@_) } $code; - \$buffer.=\$rc; - \$buffer.=\$url;"; -} - -if($buffer ne "URL is http://www.aol.com\n1http://www.aol.com") { - print "not ('$buffer')"; -} - -print "ok 1\n"; diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/001properties.t b/deps/JavaScript-SpiderMonkey-0.19-patched/t/001properties.t deleted file mode 100755 index 775a9a3..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/001properties.t +++ /dev/null @@ -1,63 +0,0 @@ -###################################################################### -# Testcase: Set/Get properties of objects -# Revision: $Revision: 1.1.1.1 $ -# Last Checkin: $Date: 2006/02/01 06:00:49 $ -# By: $Author: mschilli $ -# -# Author: Mike Schilli m@perlmeister.com, 2002 -###################################################################### - -use warnings; -use strict; - -print "1..5\n"; - -use JavaScript::SpiderMonkey; -my $js = JavaScript::SpiderMonkey->new(); -$js->init(); - -$js->property_by_path("navigator.appName"); -$js->property_by_path("navigator.userAgent"); -$js->property_by_path("navigator.appVersion"); -$js->property_by_path("document.cookie"); -$js->property_by_path("parent.location"); -$js->property_by_path("document.location.href"); -$js->property_by_path("document.location.yodel"); - - # Function to write something from JS to a Perl $buffer -my $buffer; -my $doc = $js->object_by_path("document"); -$js->function_set("write", sub { $buffer .= join('', @_) }, $doc); -$buffer = ""; - -my $code = <eval($code); - -# Check return code -print "not " if $rc != 1; -print "ok 1\n"; - -# Check simple property -print "not " unless $js->property_get("navigator.appName") eq "Netscape"; -print "ok 2\n"; - -# Check simple property -print "not " unless $js->property_get("navigator.appVersion") eq "3"; -print "ok 3\n"; - -# Check simple property -print "not " unless - $js->property_get("document.cookie") eq "k=v; domain=.netscape.com"; -print "ok 4\n"; - -# Check buffer from document.write() -print "not " unless $buffer eq "Grugenheimer"; -print "ok 5\n"; diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/002functions.t b/deps/JavaScript-SpiderMonkey-0.19-patched/t/002functions.t deleted file mode 100644 index 06fa80e..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/002functions.t +++ /dev/null @@ -1,60 +0,0 @@ -###################################################################### -# Testcase: Define Functions and Perl callbacks -# Revision: $Revision: 1.1.1.1 $ -# Last Checkin: $Date: 2006/02/01 06:00:49 $ -# By: $Author: mschilli $ -# -# Author: Mike Schilli m@perlmeister.com, 2002 -###################################################################### - -print "1..3\n"; - -use JavaScript::SpiderMonkey; -my $js = JavaScript::SpiderMonkey->new(); -$js->init(); - -$js->object_by_path("navigator.appName"); -$js->object_by_path("document.location"); -my $parloc = $js->object_by_path("parent.location"); -$js->function_set("replace", - sub { $buffer .= "URL:$_[0]"; }, $parloc); - - # Function write() -our $buffer; -$js->function_set("write", sub { $buffer .= "f0" . join('', @_) }); - - # Method navigator.write() -my $doc = $js->object_by_path("document.location"); -$js->function_set("slice", sub { $buffer .= "f1" . join('', @_) }, $doc); - - # Method navigator.appName.write() -$doc = $js->object_by_path("navigator.appName"); -$js->function_set("dice", sub { $buffer .= "f2" . join('', @_) }, $doc); - -$buffer = ""; - -my $code = <eval($code); - -# Check return code -print "not " if $rc != 1; -print "ok 1\n"; - -# print $buffer; -# Check buffer for traces of function/method calls - -print "not " unless $buffer eq - "f0v1 f1v2 f2v3 URL:testurlf0v1 f1v2 f2v3 URL:testurl"; -print "ok 2\n"; - -$js->destroy(); - -print "ok 3\n"; diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/003properties.t b/deps/JavaScript-SpiderMonkey-0.19-patched/t/003properties.t deleted file mode 100644 index 11dd916..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/003properties.t +++ /dev/null @@ -1,25 +0,0 @@ -###################################################################### -# Testcase: Properties of multi-tiered objects -# Revision: $Revision: 1.1.1.1 $ -# Last Checkin: $Date: 2006/02/01 06:00:49 $ -# By: $Author: mschilli $ -# -# Author: Mike Schilli m@perlmeister.com, 2002 -###################################################################### - -print "1..2\n"; - -use JavaScript::SpiderMonkey; -my $js = JavaScript::SpiderMonkey->new(); -$js->init(); - -$js->property_by_path("parent.location.href", "abc"); -my $res = $js->property_get("parent.location.href"); - -# Check return code -print "not " if $res ne "abc"; -print "ok 1\n"; - -$js->destroy(); - -print "ok 2\n"; diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/004setget.t b/deps/JavaScript-SpiderMonkey-0.19-patched/t/004setget.t deleted file mode 100755 index 66f3306..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/004setget.t +++ /dev/null @@ -1,119 +0,0 @@ -###################################################################### -# Testcase: Set/Get properties of objects -# Revision: $Revision: 1.1.1.1 $ -# Last Checkin: $Date: 2006/02/01 06:00:49 $ -# By: $Author: mschilli $ -# -# Author: Mike Schilli m@perlmeister.com, 2002 -###################################################################### - -use warnings; -use strict; - -print "1..6\n"; - -use JavaScript::SpiderMonkey; -my $js = JavaScript::SpiderMonkey->new(); -$js->init(); - -our $buffer = ""; - -sub getter { - my(@args) = @_; - $buffer .= "GETTER: @args\n"; -} - -sub setter { - my(@args) = @_; - $buffer .= "SETTER: @args\n"; -} - -$js->property_by_path("navigator.appName", "", \&getter, \&setter); - - # Function to write something from JS to a Perl $buffer - -my $code = <eval($code); - -# Check return code -print "not " if $rc != 1; -print "ok 1\n"; - -# Check output -my $wanted = "SETTER: navigator.appName Netscape\n" . - "GETTER: navigator.appName Netscape\n" . - "SETTER: navigator.appName Netscape2\n" . - "GETTER: navigator.appName Netscape2\n"; -if($buffer ne $wanted) { - print "not ok 2\n"; - print "Expected $wanted but got '$buffer'\n"; -} else { - print "ok 2\n"; -} - -$js->destroy(); - -################################################## -# Setter only, no getter -################################################## -$js = JavaScript::SpiderMonkey->new(); -$js->init(); - -$buffer = ""; - -$js->property_by_path("navigator.appName", "", undef, \&setter); - -$rc = $js->eval($code); - -# Check return code -print "not " if $rc != 1; -print "ok 3\n"; - -# Check output -$wanted = "SETTER: navigator.appName Netscape\n" . - "SETTER: navigator.appName Netscape2\n"; - -if($buffer ne $wanted) { - print "not ok 4\n"; - print "Expected $wanted but got '$buffer'\n"; -} else { - print "ok 4\n"; -} - -$js->destroy(); - -################################################## -# Getter only, no setter -################################################## -$js = JavaScript::SpiderMonkey->new(); -$js->init(); - -$buffer = ""; - -$js->property_by_path("navigator.appName", "", \&getter); - -$rc = $js->eval($code); - -# Check return code -print "not " if $rc != 1; -print "ok 5\n"; - -# Check output -$wanted = "GETTER: navigator.appName Netscape\n" . - "GETTER: navigator.appName Netscape2\n"; - -if($buffer ne $wanted) { - print "not ok 6\n"; - print "Expected $wanted but got '$buffer'\n"; -} else { - print "ok 6\n"; -} - -$js->destroy(); - diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/005error.t b/deps/JavaScript-SpiderMonkey-0.19-patched/t/005error.t deleted file mode 100755 index 4b019ba..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/005error.t +++ /dev/null @@ -1,30 +0,0 @@ -###################################################################### -# Testcase: Produce an error and check $@ -# Revision: $Revision: 1.1.1.1 $ -# Last Checkin: $Date: 2006/02/01 06:00:49 $ -# By: $Author: mschilli $ -# -# Author: Mike Schilli m@perlmeister.com, 2004 -###################################################################### - -use warnings; -use strict; - -use JavaScript::SpiderMonkey; - -print "1..1\n"; - -my $js = JavaScript::SpiderMonkey->new(); -$js->init(); - -my $code = <new(); -$js->init(); - -$js->property_by_path("document.location.href"); -$js->property_by_path("document.location.yodel"); -$js->property_by_path("document.someobj.someprop"); - - # Function to write something from JS to a Perl $buffer -my $location_buffer; -my $doc = $js->object_by_path("document.location"); -$js->function_set("write", sub { $location_buffer .= join('', @_) }, $doc); - -my $someobj_buffer; -my $someobj = $js->object_by_path("document.someobj"); -$js->function_set("write", sub { $someobj_buffer .= join('', @_) }, $someobj); - -my $code = <eval($code); - -# Check return code -ok($rc, "JS return code"); - -# Check location buffer -is($location_buffer, "location message", "check loc buffer"); -is($someobj_buffer, "someobj message", "check someobj buffer"); diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/007funcret.t b/deps/JavaScript-SpiderMonkey-0.19-patched/t/007funcret.t deleted file mode 100755 index 1270ed2..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/007funcret.t +++ /dev/null @@ -1,47 +0,0 @@ -###################################################################### -# Testcase: Returning values from perl callbacks -# Revision: $Revision: 1.2 $ -# Last Checkin: $Date: 2006/06/13 13:42:58 $ -# By: $Author: thomas_busch $ -# -# Author: Mike Schilli m@perlmeister.com, 2004 -###################################################################### - -use warnings; -use strict; - -use Test::More qw(no_plan); - -use JavaScript::SpiderMonkey; -use Log::Log4perl qw(:easy); -Log::Log4perl->easy_init($ERROR); - -my $buffer = ""; - -my $js = JavaScript::SpiderMonkey->new(); -$js->init(); - - # Example by Chris Blaise: - # Let new function document.getElementById('id') (defined in Perl space) - # return an object into JS. - -my $doc = $js->object_by_path('document' ); -$js->property_by_path('fooobj.style' ); -$js->function_set( 'getElementById', sub { - if(exists $JavaScript::SpiderMonkey::GLOBAL->{objects}->{'fooobj'}) { - return $JavaScript::SpiderMonkey::GLOBAL->{objects}->{'fooobj'}; - } -}, $doc); -$js->function_set("write", sub { - $buffer .= join('', map { "[$_]" } @_) }, $doc); - -my $code = q{ - document.getElementById('bleh').style = 'something'; - document.write(fooobj.style); -}; - -my $rc = $js->eval($code); - -# Check return code -ok($rc, "Function returning object"); -is($buffer, "[something]", "Attribute assigned correctly"); diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/00array.t b/deps/JavaScript-SpiderMonkey-0.19-patched/t/00array.t deleted file mode 100755 index 3bd85a6..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/00array.t +++ /dev/null @@ -1,23 +0,0 @@ -###################################################################### -# Create an array as part of an object -###################################################################### - -print "1..1\n"; - -$init = ""; -require "t/init.pl"; - -$js->array_by_path("document.form"); - -my $source = <eval($source); -die "eval returned undef" unless $rc; -if($js->property_get("navigator.appVersion") ne "3") { - print "not "; -} - -print "ok 1\n"; diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/01doc-href.t b/deps/JavaScript-SpiderMonkey-0.19-patched/t/01doc-href.t deleted file mode 100755 index 7f79c95..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/01doc-href.t +++ /dev/null @@ -1,24 +0,0 @@ -###################################################################### -# Set and retrieve document.location.href -###################################################################### - -print "1..1\n"; - -$init = ""; - -require "t/init.pl"; - -my $source = <eval($source); - -die "eval returned undef" unless $rc; - -if($js->property_get("document.location.href") ne "http://www.com") { - print "not "; -} - -print "ok 1\n"; diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/02nav-appv.t b/deps/JavaScript-SpiderMonkey-0.19-patched/t/02nav-appv.t deleted file mode 100755 index d038f3e..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/02nav-appv.t +++ /dev/null @@ -1,21 +0,0 @@ -###################################################################### -# Set and retrieve document.location.href -###################################################################### - -print "1..1\n"; - -$init = ""; -require "t/init.pl"; - -my $source = <eval($source); -die "eval returned undef" unless $rc; -if($js->property_get("navigator.appVersion") ne "3") { - print "not "; -} - -print "ok 1\n"; diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/03doc-write.t b/deps/JavaScript-SpiderMonkey-0.19-patched/t/03doc-write.t deleted file mode 100755 index 9b38e21..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/03doc-write.t +++ /dev/null @@ -1,21 +0,0 @@ -###################################################################### -# Set and retrieve document.location.href -###################################################################### - -print "1..1\n"; - -$init = ""; -require "t/init.pl"; - -my $source = <eval($source); -die "eval returned undef" unless $rc; -if($js->property_get("navigator.appVersion") ne "3") { - print "not "; -} - -print "ok 1\n"; diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/04loop.t b/deps/JavaScript-SpiderMonkey-0.19-patched/t/04loop.t deleted file mode 100755 index 3757c1d..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/04loop.t +++ /dev/null @@ -1,31 +0,0 @@ -###################################################################### -# docwrite() -###################################################################### - -print "1..1\n"; - -$init = ""; -require "t/init.pl"; - -my $source = <eval($source); - die "eval returned undef" unless $rc; - if($js->property_get("navigator.appVersion") eq "3") { - $oks++; - } -} - -if($nof != $oks) { - print "not "; -} - -print "ok 1\n"; - -$js->destroy(); diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/05form.t b/deps/JavaScript-SpiderMonkey-0.19-patched/t/05form.t deleted file mode 100755 index 0dc763a..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/05form.t +++ /dev/null @@ -1,31 +0,0 @@ -###################################################################### -# docwrite() -###################################################################### - -print "1..1\n"; - -$init = ""; -require "t/init.pl"; - -my $source = <eval($source); -die "eval returned undef" unless $rc; -if($js->property_get("document.location.href") ne "submitted!") { - print "not "; -} - -print "ok 1\n"; - -$js->destroy(); diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/06form2.t b/deps/JavaScript-SpiderMonkey-0.19-patched/t/06form2.t deleted file mode 100755 index 9aacb7a..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/06form2.t +++ /dev/null @@ -1,35 +0,0 @@ -###################################################################### -# docwrite() -###################################################################### - -print "1..1\n"; - -$init = ""; -require "t/init.pl"; - -my $a = $js->array_by_path("document.array"); -my $e = $js->array_set_element($a, 0, "gurkenhobel"); -#print "SetElement returned $e\n"; -my $r = $js->array_get_element($a, 0); -#print "r=$r\n"; -#print $js->dump(); - -my $source = <eval($source); - -die "eval returned undef" unless $rc; - -my $val = $js->property_get("document.location.href"); - -if($val ne "gurkenhobel") { - print STDERR "Val is '$val'\n"; - print "not "; -} - -print "ok 1\n"; - -$js->destroy(); diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/07func.t b/deps/JavaScript-SpiderMonkey-0.19-patched/t/07func.t deleted file mode 100644 index c0f95cc..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/07func.t +++ /dev/null @@ -1,27 +0,0 @@ -###################################################################### -# functions -###################################################################### - -print "1..1\n"; - -$init = ""; -$buffer = ""; -require "t/init.pl"; - -my $source = <eval($source); -die "eval returned undef" unless $rc; - -if($buffer ne "abcdefabc2def2abc3def3abc4def4") { - print "not "; -} -print "ok 1\n"; - -$js->destroy(); diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/08func2.t b/deps/JavaScript-SpiderMonkey-0.19-patched/t/08func2.t deleted file mode 100644 index 6b49ef7..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/08func2.t +++ /dev/null @@ -1,29 +0,0 @@ -###################################################################### -# functions2 -###################################################################### - -print "1..1\n"; - -$init = ""; -require "t/init.pl"; - -$args = ""; - -$js->function_set("farz", sub { $args = join '', @_ }); - -my $source = <eval($source); - -die "eval returned undef" unless $rc; - -if($args ne "abcdef358") { - print "not "; -} - -print "ok 1\n"; - -$js->destroy(); diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/09meth.t b/deps/JavaScript-SpiderMonkey-0.19-patched/t/09meth.t deleted file mode 100644 index 4b5da81..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/09meth.t +++ /dev/null @@ -1,30 +0,0 @@ -###################################################################### -# functions2 -###################################################################### - -print "1..1\n"; - -$init = ""; -require "t/init.pl"; - -$args = ""; - -my $docobj = $js->object_by_path("document"); -$js->function_set("schnubbel", sub { $args = join '', @_; }); - -my $source = <eval($source); - -die "eval returned undef" unless $rc; - -if($args ne "abcdef358") { - print "not "; -} - -print "ok 1\n"; - -$js->destroy(); diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/10elobj.t b/deps/JavaScript-SpiderMonkey-0.19-patched/t/10elobj.t deleted file mode 100644 index d4eca5c..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/10elobj.t +++ /dev/null @@ -1,33 +0,0 @@ -###################################################################### -# functions2 -###################################################################### - -print "1..1\n"; - -$init = ""; -require "t/init.pl"; - -$submitted = "0"; - -my $obj = $js->object_by_path("submitter"); -$js->function_set("submit", sub { $submitted = 1 }); - -my $forms = $js->array_by_path("document.forms"); -my $e = $js->array_set_element_as_object($forms, 0, $obj); - -my $source = <eval($source); - -die "eval returned undef" unless $rc; - -if(!$submitted) { - print "not "; -} - -print "ok 1\n"; - -$js->destroy(); diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/11intret.t b/deps/JavaScript-SpiderMonkey-0.19-patched/t/11intret.t deleted file mode 100644 index 04d0797..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/11intret.t +++ /dev/null @@ -1,29 +0,0 @@ -###################################################################### -# Testcase: Returning integer values from perl -# Revision: $Revision: 1.1 $ -# Last Checkin: $Date: 2006/06/13 13:43:51 $ -# By: $Author: thomas_busch $ -# -# Author: Marc Relation marc@igneousconsulting.com -###################################################################### - -use warnings; -use strict; - -print "1..1\n"; - -use JavaScript::SpiderMonkey; - -my $js=new JavaScript::SpiderMonkey; -my $buffer; -$js->init; -$js->function_set('get_int',sub {return(1000);}); -$js->function_set('get_float',sub {return(10.21);}); -$js->function_set('booltest',sub {return 1==$_[0];}); -#$js->function_set('write',sub {print STDERR $_[0] . "\n"}); -$js->function_set("write",sub { $buffer .= join('', @_) }); -$js->eval("write(get_int()+1);"); -$js->destroy; -# Check buffer from document.write() -print "not " unless $buffer == 1001; -print "ok 1\n"; diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/12dblret.t b/deps/JavaScript-SpiderMonkey-0.19-patched/t/12dblret.t deleted file mode 100644 index 5696db1..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/12dblret.t +++ /dev/null @@ -1,25 +0,0 @@ -###################################################################### -# Testcase: Returning double values from perl -# Revision: $Revision: 1.1 $ -# Last Checkin: $Date: 2006/06/13 13:43:51 $ -# By: $Author: thomas_busch $ -# -# Author: Marc Relation marc@igneousconsulting.com -###################################################################### - -use warnings; -use strict; - -print "1..1\n"; -use JavaScript::SpiderMonkey; - -my $js=new JavaScript::SpiderMonkey; -my $buffer; -$js->init; -$js->function_set('get_double',sub {return(10.21);}); -$js->function_set("write",sub { $buffer .= join('', @_) }); -$js->eval("write(get_double()+1.2);"); -$js->destroy; -# Check buffer from document.write() -print "not " unless $buffer == 11.41; -print "ok 1\n"; diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/13strret.t b/deps/JavaScript-SpiderMonkey-0.19-patched/t/13strret.t deleted file mode 100644 index 5560e06..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/13strret.t +++ /dev/null @@ -1,25 +0,0 @@ -###################################################################### -# Testcase: Returning string values from perl -# Revision: $Revision: 1.1 $ -# Last Checkin: $Date: 2006/06/13 13:43:51 $ -# By: $Author: thomas_busch $ -# -# Author: Marc Relation marc@igneousconsulting.com -###################################################################### - -use warnings; -use strict; -use Test::More tests => 1; - -use JavaScript::SpiderMonkey; - -my $js = new JavaScript::SpiderMonkey; -my $buffer; -$js->init; -$js->function_set('get_string',sub { return "John Doe";}); -#$js->function_set('write',sub {print STDERR $_[0] . "\n"}); -$js->function_set("write",sub { $buffer .= join('', @_) }); -$js->eval("write(get_string()+' who');"); -$js->destroy; -# Check buffer from document.write() -is $buffer, 'John Doe who'; diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/t/init.pl b/deps/JavaScript-SpiderMonkey-0.19-patched/t/init.pl deleted file mode 100644 index da1b433..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/t/init.pl +++ /dev/null @@ -1,28 +0,0 @@ - -use JavaScript::SpiderMonkey; - -my $docloc = "http://wurks"; -$js = JavaScript::SpiderMonkey->new(); -$js->init(); - -$js->property_by_path("navigator.appName"); -$js->property_by_path("navigator.userAgent"); -$js->property_by_path("navigator.appVersion"); -$js->property_by_path("document.cookie"); -$js->property_by_path("parent.location"); -$js->property_by_path("document.location.href"); - -my $doc = $js->object_by_path("document"); -$js->function_set("write", sub { $buffer .= join('', @_) }, $doc); -$buffer = ""; - -$init = <new($JS_DIR_URL); -my $ftp = Net::FTP->new($url->host()); -die "Cannot connect: ", $ftp->message unless $ftp; -$ftp->login("anonymous",'-anonymous@') or - die "Cannot login: ", $ftp->message; -$ftp->cwd($url->path) or - die "Cannot change working directory: ", $ftp->message; -my $candidate; -foreach(File::Listing::parse_dir($ftp->dir())) { - my ($name) = @$_; - $candidate = $name if $name =~ /^js-1.*tar.gz$/; -} -$ftp->binary(); -print "Downloading $candidate\n"; -$ftp->get($candidate); -$ftp->quit; diff --git a/deps/JavaScript-SpiderMonkey-0.19-patched/util/download.pl b/deps/JavaScript-SpiderMonkey-0.19-patched/util/download.pl deleted file mode 100755 index c2867f7..0000000 --- a/deps/JavaScript-SpiderMonkey-0.19-patched/util/download.pl +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/perl -############################################################ -# Automatically download and install the SpiderMonkey lib -############################################################ - -use strict; -use warnings; - -my $JS_DIR_URL = "ftp://sunsite.rediris.es/pub/mozilla.org/js/"; - -use URI::URL; -use Net::FTP; -use File::Listing; - -my $url = URI::URL->new($JS_DIR_URL); -my $ftp = Net::FTP->new($url->host()); -die "Cannot connect: ", $ftp->message unless $ftp; -$ftp->login("anonymous",'-anonymous@') or - die "Cannot login: ", $ftp->message; -$ftp->cwd($url->path) or - die "Cannot change working directory: ", $ftp->message; -my $candidate; -foreach(File::Listing::parse_dir($ftp->dir())) { - my ($name) = @$_; - $candidate = $name if $name =~ /^js-1.*tar.gz$/; -} -$ftp->binary(); -print "Downloading $candidate\n"; -$ftp->get($candidate); -$ftp->quit; diff --git a/deps/Jplugin/.svn/entries b/deps/Jplugin/.svn/entries deleted file mode 100644 index e63d32f..0000000 --- a/deps/Jplugin/.svn/entries +++ /dev/null @@ -1,238 +0,0 @@ -10 - -dir -475 -svn://erxz.com/bb3/branches/perlbuut/deps/Jplugin -svn://erxz.com/bb3 - - - -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - -dcb1cea6-7f7e-4c78-8a22-148ace8ce36e - -Jplugin.xs -file - - - - -2009-10-03T22:54:20.000000Z -1659bae8a372d98a9ba18a1131d58801 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -2117 - -t -dir - -lib -dir - -MANIFEST -file - - - - -2009-10-03T22:54:20.000000Z -7e1c0e67e93e7f0fad17221e8f57bf14 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -83 - -Makefile.PL -file - - - - -2009-10-03T22:54:20.000000Z -710105a2a28eb4dff4991c4fd0e04a6c -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -925 - -Changes -file - - - - -2009-10-03T22:54:20.000000Z -01578d81afb54a2481b18da50f7a33f8 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -149 - -ppport.h -file - - - - -2009-10-03T22:54:20.000000Z -11f77b4d6f05a9801bc51b77c028fde2 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -118192 - -README -file - - - - -2009-10-03T22:54:20.000000Z -1cb07bfedd730f0b209c39f444491efe -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -1168 - diff --git a/deps/Jplugin/.svn/text-base/Changes.svn-base b/deps/Jplugin/.svn/text-base/Changes.svn-base deleted file mode 100644 index a649abe..0000000 --- a/deps/Jplugin/.svn/text-base/Changes.svn-base +++ /dev/null @@ -1,6 +0,0 @@ -Revision history for Perl extension Jplugin. - -0.01 Thu Apr 26 22:01:02 2007 - - original version; created by h2xs 1.23 with options - -A -n Jplugin - diff --git a/deps/Jplugin/.svn/text-base/Jplugin.xs.svn-base b/deps/Jplugin/.svn/text-base/Jplugin.xs.svn-base deleted file mode 100644 index 7fa04b7..0000000 --- a/deps/Jplugin/.svn/text-base/Jplugin.xs.svn-base +++ /dev/null @@ -1,89 +0,0 @@ -#include "EXTERN.h" -#include "perl.h" -#include "XSUB.h" - -#include "ppport.h" - -// j intepreter plugin for buubot - -#define _GNU_SOURCE -#include -#include -#include - -#define OUTPUT_MAXLEN 50*1024*1024 - -typedef void *Jinterp_t; -Jinterp_t JInit(void); -int JDo(Jinterp_t jsess, const char *cmd); -int JFree(Jinterp_t jsess); -int JGetM(Jinterp_t jsess, char *cmd, long *type, long *rank, long **shape, void **data); - -int -jplugin(char *cmd) { - Jinterp_t jp = JInit(); - if (JDo(jp, "9!:25]1")) { - fprintf(stderr, "|jplugin error: jdo safe\n"); - goto error; - } - if (JDo(jp, /*"(9!:1](2^31)|6!:9$0)["*/"(9!:33]50)[(9!:21]2^25)[(9!:7]'+++++++++|-')")) { - fprintf(stderr, "|jplugin error: jdo config\n"); - goto error; - } - static const char cmd_prefix[] = "res_boti_=: "; - char *lcmd = malloc(sizeof(cmd_prefix) + strlen(cmd) + 5); - if (!lcmd) { - fprintf(stderr, "|jplugin error: no memory\n"); - goto error; - } - stpcpy(stpcpy(lcmd, cmd_prefix), cmd); - if (JDo(jp, lcmd)) { - if (JDo(jp, "out_boti_=: ]13!:12''")) { - fprintf(stderr, "|jplugin error: jdo geterrmsg\n"); - goto error; - } - } else { - if (JDo(jp, "out_boti_=: 3 :'d=.5!:5 y if. 4!:0 y do. d else.if. ((1>:#@$)*.3!:0 e.2^1 17\"_)y@.0 do. 1 u:,y@.0 else. d end.end.' <'res_boti_'")) { - fprintf(stderr, "|jplugin error: jdo fmtoutput\n"); - goto error; - } - } - long tp = -1, rk = -1; long *di = 0; void *da = 0; - if (JGetM(jp, "out_boti_", &tp, &rk, &di, &da)) { - fprintf(stderr, "|jplugin error: jgetm output\n"); - goto error; - } - //fprintf(stderr, "[tp=%d rk=%d di0=%d]\n", tp, rk, di[0]); - if (!(2 == tp && 1 == rk)) { - fprintf(stderr, "|jplugin error: jgetm nonstring\n"); - goto error; - } - size_t sz = di[0]; - if (OUTPUT_MAXLEN < sz) - sz = OUTPUT_MAXLEN; - if (1 != fwrite((char *)da, sz, 1, stdout)) { - fprintf(stderr, "|jplugin error: write stdout\n"); - goto error; - } - if (0 != fflush(stdout)) { - fprintf(stderr, "|jplugin error: flush stdout\n"); - goto error; - } - JFree(jp); - return 0; -error: - JFree(jp); - return 1; -} - - -MODULE = Jplugin PACKAGE = Jplugin - -PROTOTYPES: DISABLE - -int -jplugin(cmd) - char *cmd - - - diff --git a/deps/Jplugin/.svn/text-base/MANIFEST.svn-base b/deps/Jplugin/.svn/text-base/MANIFEST.svn-base deleted file mode 100644 index ad03ab6..0000000 --- a/deps/Jplugin/.svn/text-base/MANIFEST.svn-base +++ /dev/null @@ -1,8 +0,0 @@ -Changes -Jplugin.xs -Makefile.PL -MANIFEST -ppport.h -README -t/Jplugin.t -lib/Jplugin.pm diff --git a/deps/Jplugin/.svn/text-base/Makefile.PL.svn-base b/deps/Jplugin/.svn/text-base/Makefile.PL.svn-base deleted file mode 100644 index 7537c2a..0000000 --- a/deps/Jplugin/.svn/text-base/Makefile.PL.svn-base +++ /dev/null @@ -1,21 +0,0 @@ -use 5.008008; -use ExtUtils::MakeMaker; -# See lib/ExtUtils/MakeMaker.pm for details of how to influence -# the contents of the Makefile that is written. - -# path where the shared library libj601.so resides -$jlibpath = "/home/ambrus/local/lib"; - -WriteMakefile( - NAME => 'Jplugin', - VERSION_FROM => 'lib/Jplugin.pm', # finds $VERSION - PREREQ_PM => {}, # e.g., Module::Name => 1.1 - ($] >= 5.005 ? ## Add these new keywords supported since 5.005 - (ABSTRACT_FROM => 'lib/Jplugin.pm', # retrieve abstract from module - AUTHOR => 'Zsban Ambrus ') : ()), - LIBS => ['-lj'], # e.g., '-lm' - DEFINE => '', # e.g., '-DHAVE_SOMETHING' - INC => '-I.', # e.g., '-I. -I/usr/include/other' - # Un-comment this if you add C files to link with later: - # OBJECT => '$(O_FILES)', # link all the C files too -); diff --git a/deps/Jplugin/.svn/text-base/README.svn-base b/deps/Jplugin/.svn/text-base/README.svn-base deleted file mode 100644 index 8b0a01d..0000000 --- a/deps/Jplugin/.svn/text-base/README.svn-base +++ /dev/null @@ -1,40 +0,0 @@ -Jplugin version 0.01 -==================== - -The README is used to introduce the module and provide instructions on -how to install the module, any machine dependencies it may have (for -example C compilers and installed libraries) and any other information -that should be provided before the module is installed. - -A README file is required for CPAN modules since CPAN extracts the -README file from a module distribution so that people browsing the -archive can use it get an idea of the modules uses. It is usually a -good idea to provide version information here so that people can -decide whether fixes for the module are worth downloading. - -INSTALLATION - -To install this module type the following: - - perl Makefile.PL - make - make test - make install - -DEPENDENCIES - -This module requires these other modules and libraries: - - blah blah blah - -COPYRIGHT AND LICENCE - -Put the correct copyright and licence information here. - -Copyright (C) 2007 by Zsban Ambrus - -This library is free software; you can redistribute it and/or modify -it under the same terms as Perl itself, either Perl version 5.8.8 or, -at your option, any later version of Perl 5 you may have available. - - diff --git a/deps/Jplugin/.svn/text-base/ppport.h.svn-base b/deps/Jplugin/.svn/text-base/ppport.h.svn-base deleted file mode 100644 index ad808de..0000000 --- a/deps/Jplugin/.svn/text-base/ppport.h.svn-base +++ /dev/null @@ -1,4954 +0,0 @@ -#if 0 -<<'SKIP'; -#endif -/* ----------------------------------------------------------------------- - - ppport.h -- Perl/Pollution/Portability Version 3.06_01 - - Automatically created by Devel::PPPort running under - perl 5.008008 on Thu Apr 26 22:01:02 2007. - - Do NOT edit this file directly! -- Edit PPPort_pm.PL and the - includes in parts/inc/ instead. - - Use 'perldoc ppport.h' to view the documentation below. - ----------------------------------------------------------------------- - -SKIP - -=pod - -=head1 NAME - -ppport.h - Perl/Pollution/Portability version 3.06_01 - -=head1 SYNOPSIS - - perl ppport.h [options] [source files] - - Searches current directory for files if no [source files] are given - - --help show short help - - --patch=file write one patch file with changes - --copy=suffix write changed copies with suffix - --diff=program use diff program and options - - --compat-version=version provide compatibility with Perl version - --cplusplus accept C++ comments - - --quiet don't output anything except fatal errors - --nodiag don't show diagnostics - --nohints don't show hints - --nochanges don't suggest changes - --nofilter don't filter input files - - --list-provided list provided API - --list-unsupported list unsupported API - --api-info=name show Perl API portability information - -=head1 COMPATIBILITY - -This version of F is designed to support operation with Perl -installations back to 5.003, and has been tested up to 5.9.3. - -=head1 OPTIONS - -=head2 --help - -Display a brief usage summary. - -=head2 --patch=I - -If this option is given, a single patch file will be created if -any changes are suggested. This requires a working diff program -to be installed on your system. - -=head2 --copy=I - -If this option is given, a copy of each file will be saved with -the given suffix that contains the suggested changes. This does -not require any external programs. - -If neither C<--patch> or C<--copy> are given, the default is to -simply print the diffs for each file. This requires either -C or a C program to be installed. - -=head2 --diff=I - -Manually set the diff program and options to use. The default -is to use C, when installed, and output unified -context diffs. - -=head2 --compat-version=I - -Tell F to check for compatibility with the given -Perl version. The default is to check for compatibility with Perl -version 5.003. You can use this option to reduce the output -of F if you intend to be backward compatible only -up to a certain Perl version. - -=head2 --cplusplus - -Usually, F will detect C++ style comments and -replace them with C style comments for portability reasons. -Using this option instructs F to leave C++ -comments untouched. - -=head2 --quiet - -Be quiet. Don't print anything except fatal errors. - -=head2 --nodiag - -Don't output any diagnostic messages. Only portability -alerts will be printed. - -=head2 --nohints - -Don't output any hints. Hints often contain useful portability -notes. - -=head2 --nochanges - -Don't suggest any changes. Only give diagnostic output and hints -unless these are also deactivated. - -=head2 --nofilter - -Don't filter the list of input files. By default, files not looking -like source code (i.e. not *.xs, *.c, *.cc, *.cpp or *.h) are skipped. - -=head2 --list-provided - -Lists the API elements for which compatibility is provided by -F. Also lists if it must be explicitly requested, -if it has dependencies, and if there are hints for it. - -=head2 --list-unsupported - -Lists the API elements that are known not to be supported by -F and below which version of Perl they probably -won't be available or work. - -=head2 --api-info=I - -Show portability information for API elements matching I. -If I is surrounded by slashes, it is interpreted as a regular -expression. - -=head1 DESCRIPTION - -In order for a Perl extension (XS) module to be as portable as possible -across differing versions of Perl itself, certain steps need to be taken. - -=over 4 - -=item * - -Including this header is the first major one. This alone will give you -access to a large part of the Perl API that hasn't been available in -earlier Perl releases. Use - - perl ppport.h --list-provided - -to see which API elements are provided by ppport.h. - -=item * - -You should avoid using deprecated parts of the API. For example, using -global Perl variables without the C prefix is deprecated. Also, -some API functions used to have a C prefix. Using this form is -also deprecated. You can safely use the supported API, as F -will provide wrappers for older Perl versions. - -=item * - -If you use one of a few functions that were not present in earlier -versions of Perl, and that can't be provided using a macro, you have -to explicitly request support for these functions by adding one or -more C<#define>s in your source code before the inclusion of F. - -These functions will be marked C in the list shown by -C<--list-provided>. - -Depending on whether you module has a single or multiple files that -use such functions, you want either C or global variants. - -For a C function, use: - - #define NEED_function - -For a global function, use: - - #define NEED_function_GLOBAL - -Note that you mustn't have more than one global request for one -function in your project. - - Function Static Request Global Request - ----------------------------------------------------------------------------------------- - eval_pv() NEED_eval_pv NEED_eval_pv_GLOBAL - grok_bin() NEED_grok_bin NEED_grok_bin_GLOBAL - grok_hex() NEED_grok_hex NEED_grok_hex_GLOBAL - grok_number() NEED_grok_number NEED_grok_number_GLOBAL - grok_numeric_radix() NEED_grok_numeric_radix NEED_grok_numeric_radix_GLOBAL - grok_oct() NEED_grok_oct NEED_grok_oct_GLOBAL - newCONSTSUB() NEED_newCONSTSUB NEED_newCONSTSUB_GLOBAL - newRV_noinc() NEED_newRV_noinc NEED_newRV_noinc_GLOBAL - sv_2pv_nolen() NEED_sv_2pv_nolen NEED_sv_2pv_nolen_GLOBAL - sv_2pvbyte() NEED_sv_2pvbyte NEED_sv_2pvbyte_GLOBAL - sv_catpvf_mg() NEED_sv_catpvf_mg NEED_sv_catpvf_mg_GLOBAL - sv_catpvf_mg_nocontext() NEED_sv_catpvf_mg_nocontext NEED_sv_catpvf_mg_nocontext_GLOBAL - sv_setpvf_mg() NEED_sv_setpvf_mg NEED_sv_setpvf_mg_GLOBAL - sv_setpvf_mg_nocontext() NEED_sv_setpvf_mg_nocontext NEED_sv_setpvf_mg_nocontext_GLOBAL - vnewSVpvf() NEED_vnewSVpvf NEED_vnewSVpvf_GLOBAL - -To avoid namespace conflicts, you can change the namespace of the -explicitly exported functions using the C macro. -Just C<#define> the macro before including C: - - #define DPPP_NAMESPACE MyOwnNamespace_ - #include "ppport.h" - -The default namespace is C. - -=back - -The good thing is that most of the above can be checked by running -F on your source code. See the next section for -details. - -=head1 EXAMPLES - -To verify whether F is needed for your module, whether you -should make any changes to your code, and whether any special defines -should be used, F can be run as a Perl script to check your -source code. Simply say: - - perl ppport.h - -The result will usually be a list of patches suggesting changes -that should at least be acceptable, if not necessarily the most -efficient solution, or a fix for all possible problems. - -If you know that your XS module uses features only available in -newer Perl releases, if you're aware that it uses C++ comments, -and if you want all suggestions as a single patch file, you could -use something like this: - - perl ppport.h --compat-version=5.6.0 --cplusplus --patch=test.diff - -If you only want your code to be scanned without any suggestions -for changes, use: - - perl ppport.h --nochanges - -You can specify a different C program or options, using -the C<--diff> option: - - perl ppport.h --diff='diff -C 10' - -This would output context diffs with 10 lines of context. - -To display portability information for the C function, -use: - - perl ppport.h --api-info=newSVpvn - -Since the argument to C<--api-info> can be a regular expression, -you can use - - perl ppport.h --api-info=/_nomg$/ - -to display portability information for all C<_nomg> functions or - - perl ppport.h --api-info=/./ - -to display information for all known API elements. - -=head1 BUGS - -If this version of F is causing failure during -the compilation of this module, please check if newer versions -of either this module or C are available on CPAN -before sending a bug report. - -If F was generated using the latest version of -C and is causing failure of this module, please -file a bug report using the CPAN Request Tracker at L. - -Please include the following information: - -=over 4 - -=item 1. - -The complete output from running "perl -V" - -=item 2. - -This file. - -=item 3. - -The name and version of the module you were trying to build. - -=item 4. - -A full log of the build that failed. - -=item 5. - -Any other information that you think could be relevant. - -=back - -For the latest version of this code, please get the C -module from CPAN. - -=head1 COPYRIGHT - -Version 3.x, Copyright (c) 2004-2005, Marcus Holland-Moritz. - -Version 2.x, Copyright (C) 2001, Paul Marquess. - -Version 1.x, Copyright (C) 1999, Kenneth Albanowski. - -This program is free software; you can redistribute it and/or -modify it under the same terms as Perl itself. - -=head1 SEE ALSO - -See L. - -=cut - -use strict; - -my %opt = ( - quiet => 0, - diag => 1, - hints => 1, - changes => 1, - cplusplus => 0, - filter => 1, -); - -my($ppport) = $0 =~ /([\w.]+)$/; -my $LF = '(?:\r\n|[\r\n])'; # line feed -my $HS = "[ \t]"; # horizontal whitespace - -eval { - require Getopt::Long; - Getopt::Long::GetOptions(\%opt, qw( - help quiet diag! filter! hints! changes! cplusplus - patch=s copy=s diff=s compat-version=s - list-provided list-unsupported api-info=s - )) or usage(); -}; - -if ($@ and grep /^-/, @ARGV) { - usage() if "@ARGV" =~ /^--?h(?:elp)?$/; - die "Getopt::Long not found. Please don't use any options.\n"; -} - -usage() if $opt{help}; - -if (exists $opt{'compat-version'}) { - my($r,$v,$s) = eval { parse_version($opt{'compat-version'}) }; - if ($@) { - die "Invalid version number format: '$opt{'compat-version'}'\n"; - } - die "Only Perl 5 is supported\n" if $r != 5; - die "Invalid version number: $opt{'compat-version'}\n" if $v >= 1000 || $s >= 1000; - $opt{'compat-version'} = sprintf "%d.%03d%03d", $r, $v, $s; -} -else { - $opt{'compat-version'} = 5; -} - -# Never use C comments in this file!!!!! -my $ccs = '/'.'*'; -my $cce = '*'.'/'; -my $rccs = quotemeta $ccs; -my $rcce = quotemeta $cce; - -my %API = map { /^(\w+)\|([^|]*)\|([^|]*)\|(\w*)$/ - ? ( $1 => { - ($2 ? ( base => $2 ) : ()), - ($3 ? ( todo => $3 ) : ()), - (index($4, 'v') >= 0 ? ( varargs => 1 ) : ()), - (index($4, 'p') >= 0 ? ( provided => 1 ) : ()), - (index($4, 'n') >= 0 ? ( nothxarg => 1 ) : ()), - } ) - : die "invalid spec: $_" } qw( -AvFILLp|5.004050||p -AvFILL||| -CLASS|||n -CX_CURPAD_SAVE||| -CX_CURPAD_SV||| -CopFILEAV|5.006000||p -CopFILEGV_set|5.006000||p -CopFILEGV|5.006000||p -CopFILESV|5.006000||p -CopFILE_set|5.006000||p -CopFILE|5.006000||p -CopSTASHPV_set|5.006000||p -CopSTASHPV|5.006000||p -CopSTASH_eq|5.006000||p -CopSTASH_set|5.006000||p -CopSTASH|5.006000||p -CopyD|5.009002||p -Copy||| -CvPADLIST||| -CvSTASH||| -CvWEAKOUTSIDE||| -DEFSV|5.004050||p -END_EXTERN_C|5.005000||p -ENTER||| -ERRSV|5.004050||p -EXTEND||| -EXTERN_C|5.005000||p -FREETMPS||| -GIMME_V||5.004000|n -GIMME|||n -GROK_NUMERIC_RADIX|5.007002||p -G_ARRAY||| -G_DISCARD||| -G_EVAL||| -G_NOARGS||| -G_SCALAR||| -G_VOID||5.004000| -GetVars||| -GvSV||| -Gv_AMupdate||| -HEf_SVKEY||5.004000| -HeHASH||5.004000| -HeKEY||5.004000| -HeKLEN||5.004000| -HePV||5.004000| -HeSVKEY_force||5.004000| -HeSVKEY_set||5.004000| -HeSVKEY||5.004000| -HeVAL||5.004000| -HvNAME||| -INT2PTR|5.006000||p -IN_LOCALE_COMPILETIME|5.007002||p -IN_LOCALE_RUNTIME|5.007002||p -IN_LOCALE|5.007002||p -IN_PERL_COMPILETIME|5.008001||p -IS_NUMBER_GREATER_THAN_UV_MAX|5.007002||p -IS_NUMBER_INFINITY|5.007002||p -IS_NUMBER_IN_UV|5.007002||p -IS_NUMBER_NAN|5.007003||p -IS_NUMBER_NEG|5.007002||p -IS_NUMBER_NOT_INT|5.007002||p -IVSIZE|5.006000||p -IVTYPE|5.006000||p -IVdf|5.006000||p -LEAVE||| -LVRET||| -MARK||| -MY_CXT_CLONE|5.009002||p -MY_CXT_INIT|5.007003||p -MY_CXT|5.007003||p -MoveD|5.009002||p -Move||| -NEWSV||| -NOOP|5.005000||p -NUM2PTR|5.006000||p -NVTYPE|5.006000||p -NVef|5.006001||p -NVff|5.006001||p -NVgf|5.006001||p -Newc||| -Newz||| -New||| -Nullav||| -Nullch||| -Nullcv||| -Nullhv||| -Nullsv||| -ORIGMARK||| -PAD_BASE_SV||| -PAD_CLONE_VARS||| -PAD_COMPNAME_FLAGS||| -PAD_COMPNAME_GEN_set||| -PAD_COMPNAME_GEN||| -PAD_COMPNAME_OURSTASH||| -PAD_COMPNAME_PV||| -PAD_COMPNAME_TYPE||| -PAD_RESTORE_LOCAL||| -PAD_SAVE_LOCAL||| -PAD_SAVE_SETNULLPAD||| -PAD_SETSV||| -PAD_SET_CUR_NOSAVE||| -PAD_SET_CUR||| -PAD_SVl||| -PAD_SV||| -PERL_BCDVERSION|5.009003||p -PERL_GCC_BRACE_GROUPS_FORBIDDEN|5.008001||p -PERL_INT_MAX|5.004000||p -PERL_INT_MIN|5.004000||p -PERL_LONG_MAX|5.004000||p -PERL_LONG_MIN|5.004000||p -PERL_MAGIC_arylen|5.007002||p -PERL_MAGIC_backref|5.007002||p -PERL_MAGIC_bm|5.007002||p -PERL_MAGIC_collxfrm|5.007002||p -PERL_MAGIC_dbfile|5.007002||p -PERL_MAGIC_dbline|5.007002||p -PERL_MAGIC_defelem|5.007002||p -PERL_MAGIC_envelem|5.007002||p -PERL_MAGIC_env|5.007002||p -PERL_MAGIC_ext|5.007002||p -PERL_MAGIC_fm|5.007002||p -PERL_MAGIC_glob|5.007002||p -PERL_MAGIC_isaelem|5.007002||p -PERL_MAGIC_isa|5.007002||p -PERL_MAGIC_mutex|5.007002||p -PERL_MAGIC_nkeys|5.007002||p -PERL_MAGIC_overload_elem|5.007002||p -PERL_MAGIC_overload_table|5.007002||p -PERL_MAGIC_overload|5.007002||p -PERL_MAGIC_pos|5.007002||p -PERL_MAGIC_qr|5.007002||p -PERL_MAGIC_regdata|5.007002||p -PERL_MAGIC_regdatum|5.007002||p -PERL_MAGIC_regex_global|5.007002||p -PERL_MAGIC_shared_scalar|5.007003||p -PERL_MAGIC_shared|5.007003||p -PERL_MAGIC_sigelem|5.007002||p -PERL_MAGIC_sig|5.007002||p -PERL_MAGIC_substr|5.007002||p -PERL_MAGIC_sv|5.007002||p -PERL_MAGIC_taint|5.007002||p -PERL_MAGIC_tiedelem|5.007002||p -PERL_MAGIC_tiedscalar|5.007002||p -PERL_MAGIC_tied|5.007002||p -PERL_MAGIC_utf8|5.008001||p -PERL_MAGIC_uvar_elem|5.007003||p -PERL_MAGIC_uvar|5.007002||p -PERL_MAGIC_vec|5.007002||p -PERL_MAGIC_vstring|5.008001||p -PERL_QUAD_MAX|5.004000||p -PERL_QUAD_MIN|5.004000||p -PERL_REVISION|5.006000||p -PERL_SCAN_ALLOW_UNDERSCORES|5.007003||p -PERL_SCAN_DISALLOW_PREFIX|5.007003||p -PERL_SCAN_GREATER_THAN_UV_MAX|5.007003||p -PERL_SCAN_SILENT_ILLDIGIT|5.008001||p -PERL_SHORT_MAX|5.004000||p -PERL_SHORT_MIN|5.004000||p -PERL_SUBVERSION|5.006000||p -PERL_UCHAR_MAX|5.004000||p -PERL_UCHAR_MIN|5.004000||p -PERL_UINT_MAX|5.004000||p -PERL_UINT_MIN|5.004000||p -PERL_ULONG_MAX|5.004000||p -PERL_ULONG_MIN|5.004000||p -PERL_UNUSED_DECL|5.007002||p -PERL_UQUAD_MAX|5.004000||p -PERL_UQUAD_MIN|5.004000||p -PERL_USHORT_MAX|5.004000||p -PERL_USHORT_MIN|5.004000||p -PERL_VERSION|5.006000||p -PL_DBsingle|||pn -PL_DBsub|||pn -PL_DBtrace|||n -PL_Sv|5.005000||p -PL_compiling|5.004050||p -PL_copline|5.005000||p -PL_curcop|5.004050||p -PL_curstash|5.004050||p -PL_debstash|5.004050||p -PL_defgv|5.004050||p -PL_diehook|5.004050||p -PL_dirty|5.004050||p -PL_dowarn|||pn -PL_errgv|5.004050||p -PL_hexdigit|5.005000||p -PL_hints|5.005000||p -PL_last_in_gv|||n -PL_modglobal||5.005000|n -PL_na|5.004050||pn -PL_no_modify|5.006000||p -PL_ofs_sv|||n -PL_perl_destruct_level|5.004050||p -PL_perldb|5.004050||p -PL_ppaddr|5.006000||p -PL_rsfp_filters|5.004050||p -PL_rsfp|5.004050||p -PL_rs|||n -PL_stack_base|5.004050||p -PL_stack_sp|5.004050||p -PL_stdingv|5.004050||p -PL_sv_arenaroot|5.004050||p -PL_sv_no|5.004050||pn -PL_sv_undef|5.004050||pn -PL_sv_yes|5.004050||pn -PL_tainted|5.004050||p -PL_tainting|5.004050||p -POPi|||n -POPl|||n -POPn|||n -POPpbytex||5.007001|n -POPpx||5.005030|n -POPp|||n -POPs|||n -PTR2IV|5.006000||p -PTR2NV|5.006000||p -PTR2UV|5.006000||p -PTR2ul|5.007001||p -PTRV|5.006000||p -PUSHMARK||| -PUSHi||| -PUSHmortal|5.009002||p -PUSHn||| -PUSHp||| -PUSHs||| -PUSHu|5.004000||p -PUTBACK||| -PerlIO_clearerr||5.007003| -PerlIO_close||5.007003| -PerlIO_eof||5.007003| -PerlIO_error||5.007003| -PerlIO_fileno||5.007003| -PerlIO_fill||5.007003| -PerlIO_flush||5.007003| -PerlIO_get_base||5.007003| -PerlIO_get_bufsiz||5.007003| -PerlIO_get_cnt||5.007003| -PerlIO_get_ptr||5.007003| -PerlIO_read||5.007003| -PerlIO_seek||5.007003| -PerlIO_set_cnt||5.007003| -PerlIO_set_ptrcnt||5.007003| -PerlIO_setlinebuf||5.007003| -PerlIO_stderr||5.007003| -PerlIO_stdin||5.007003| -PerlIO_stdout||5.007003| -PerlIO_tell||5.007003| -PerlIO_unread||5.007003| -PerlIO_write||5.007003| -Poison|5.008000||p -RETVAL|||n -Renewc||| -Renew||| -SAVECLEARSV||| -SAVECOMPPAD||| -SAVEPADSV||| -SAVETMPS||| -SAVE_DEFSV|5.004050||p -SPAGAIN||| -SP||| -START_EXTERN_C|5.005000||p -START_MY_CXT|5.007003||p -STMT_END|||p -STMT_START|||p -ST||| -SVt_IV||| -SVt_NV||| -SVt_PVAV||| -SVt_PVCV||| -SVt_PVHV||| -SVt_PVMG||| -SVt_PV||| -Safefree||| -Slab_Alloc||| -Slab_Free||| -StructCopy||| -SvCUR_set||| -SvCUR||| -SvEND||| -SvGETMAGIC|5.004050||p -SvGROW||| -SvIOK_UV||5.006000| -SvIOK_notUV||5.006000| -SvIOK_off||| -SvIOK_only_UV||5.006000| -SvIOK_only||| -SvIOK_on||| -SvIOKp||| -SvIOK||| -SvIVX||| -SvIV_nomg|5.009001||p -SvIV_set||| -SvIVx||| -SvIV||| -SvIsCOW_shared_hash||5.008003| -SvIsCOW||5.008003| -SvLEN_set||| -SvLEN||| -SvLOCK||5.007003| -SvMAGIC_set||5.009003| -SvNIOK_off||| -SvNIOKp||| -SvNIOK||| -SvNOK_off||| -SvNOK_only||| -SvNOK_on||| -SvNOKp||| -SvNOK||| -SvNVX||| -SvNV_set||| -SvNVx||| -SvNV||| -SvOK||| -SvOOK||| -SvPOK_off||| -SvPOK_only_UTF8||5.006000| -SvPOK_only||| -SvPOK_on||| -SvPOKp||| -SvPOK||| -SvPVX||| -SvPV_force_nomg|5.007002||p -SvPV_force||| -SvPV_nolen|5.006000||p -SvPV_nomg|5.007002||p -SvPV_set||| -SvPVbyte_force||5.009002| -SvPVbyte_nolen||5.006000| -SvPVbytex_force||5.006000| -SvPVbytex||5.006000| -SvPVbyte|5.006000||p -SvPVutf8_force||5.006000| -SvPVutf8_nolen||5.006000| -SvPVutf8x_force||5.006000| -SvPVutf8x||5.006000| -SvPVutf8||5.006000| -SvPVx||| -SvPV||| -SvREFCNT_dec||| -SvREFCNT_inc||| -SvREFCNT||| -SvROK_off||| -SvROK_on||| -SvROK||| -SvRV_set||5.009003| -SvRV||| -SvSETMAGIC||| -SvSHARE||5.007003| -SvSTASH_set||5.009003| -SvSTASH||| -SvSetMagicSV_nosteal||5.004000| -SvSetMagicSV||5.004000| -SvSetSV_nosteal||5.004000| -SvSetSV||| -SvTAINTED_off||5.004000| -SvTAINTED_on||5.004000| -SvTAINTED||5.004000| -SvTAINT||| -SvTRUE||| -SvTYPE||| -SvUNLOCK||5.007003| -SvUOK||5.007001| -SvUPGRADE||| -SvUTF8_off||5.006000| -SvUTF8_on||5.006000| -SvUTF8||5.006000| -SvUVXx|5.004000||p -SvUVX|5.004000||p -SvUV_nomg|5.009001||p -SvUV_set||5.009003| -SvUVx|5.004000||p -SvUV|5.004000||p -SvVOK||5.008001| -THIS|||n -UNDERBAR|5.009002||p -UVSIZE|5.006000||p -UVTYPE|5.006000||p -UVXf|5.007001||p -UVof|5.006000||p -UVuf|5.006000||p -UVxf|5.006000||p -XCPT_CATCH|5.009002||p -XCPT_RETHROW|5.009002||p -XCPT_TRY_END|5.009002||p -XCPT_TRY_START|5.009002||p -XPUSHi||| -XPUSHmortal|5.009002||p -XPUSHn||| -XPUSHp||| -XPUSHs||| -XPUSHu|5.004000||p -XSRETURN_EMPTY||| -XSRETURN_IV||| -XSRETURN_NO||| -XSRETURN_NV||| -XSRETURN_PV||| -XSRETURN_UNDEF||| -XSRETURN_UV|5.008001||p -XSRETURN_YES||| -XSRETURN||| -XST_mIV||| -XST_mNO||| -XST_mNV||| -XST_mPV||| -XST_mUNDEF||| -XST_mUV|5.008001||p -XST_mYES||| -XS_VERSION_BOOTCHECK||| -XS_VERSION||| -XS||| -ZeroD|5.009002||p -Zero||| -_aMY_CXT|5.007003||p -_pMY_CXT|5.007003||p -aMY_CXT_|5.007003||p -aMY_CXT|5.007003||p -aTHX_|5.006000||p -aTHX|5.006000||p -add_data||| -allocmy||| -amagic_call||| -any_dup||| -ao||| -append_elem||| -append_list||| -apply_attrs_my||| -apply_attrs_string||5.006001| -apply_attrs||| -apply||| -asIV||| -asUV||| -atfork_lock||5.007003|n -atfork_unlock||5.007003|n -av_arylen_p||5.009003| -av_clear||| -av_delete||5.006000| -av_exists||5.006000| -av_extend||| -av_fake||| -av_fetch||| -av_fill||| -av_len||| -av_make||| -av_pop||| -av_push||| -av_reify||| -av_shift||| -av_store||| -av_undef||| -av_unshift||| -ax|||n -bad_type||| -bind_match||| -block_end||| -block_gimme||5.004000| -block_start||| -boolSV|5.004000||p -boot_core_PerlIO||| -boot_core_UNIVERSAL||| -boot_core_xsutils||| -bytes_from_utf8||5.007001| -bytes_to_utf8||5.006001| -cache_re||| -call_argv|5.006000||p -call_atexit||5.006000| -call_body||| -call_list_body||| -call_list||5.004000| -call_method|5.006000||p -call_pv|5.006000||p -call_sv|5.006000||p -calloc||5.007002|n -cando||| -cast_i32||5.006000| -cast_iv||5.006000| -cast_ulong||5.006000| -cast_uv||5.006000| -check_uni||| -checkcomma||| -checkposixcc||| -ck_anoncode||| -ck_bitop||| -ck_concat||| -ck_defined||| -ck_delete||| -ck_die||| -ck_eof||| -ck_eval||| -ck_exec||| -ck_exists||| -ck_exit||| -ck_ftst||| -ck_fun||| -ck_glob||| -ck_grep||| -ck_index||| -ck_join||| -ck_lengthconst||| -ck_lfun||| -ck_listiob||| -ck_match||| -ck_method||| -ck_null||| -ck_open||| -ck_repeat||| -ck_require||| -ck_retarget||| -ck_return||| -ck_rfun||| -ck_rvconst||| -ck_sassign||| -ck_select||| -ck_shift||| -ck_sort||| -ck_spair||| -ck_split||| -ck_subr||| -ck_substr||| -ck_svconst||| -ck_trunc||| -ck_unpack||| -cl_and||| -cl_anything||| -cl_init_zero||| -cl_init||| -cl_is_anything||| -cl_or||| -closest_cop||| -convert||| -cop_free||| -cr_textfilter||| -croak_nocontext|||vn -croak|||v -csighandler||5.007001|n -custom_op_desc||5.007003| -custom_op_name||5.007003| -cv_ckproto||| -cv_clone||| -cv_const_sv||5.004000| -cv_dump||| -cv_undef||| -cx_dump||5.005000| -cx_dup||| -cxinc||| -dAXMARK||5.009003| -dAX|5.007002||p -dITEMS|5.007002||p -dMARK||| -dMY_CXT_SV|5.007003||p -dMY_CXT|5.007003||p -dNOOP|5.006000||p -dORIGMARK||| -dSP||| -dTHR|5.004050||p -dTHXa|5.006000||p -dTHXoa|5.006000||p -dTHX|5.006000||p -dUNDERBAR|5.009002||p -dXCPT|5.009002||p -dXSARGS||| -dXSI32||| -dXSTARG|5.006000||p -deb_curcv||| -deb_nocontext|||vn -deb_stack_all||| -deb_stack_n||| -debop||5.005000| -debprofdump||5.005000| -debprof||| -debstackptrs||5.007003| -debstack||5.007003| -deb||5.007003|v -del_he||| -del_sv||| -delimcpy||5.004000| -depcom||| -deprecate_old||| -deprecate||| -despatch_signals||5.007001| -die_nocontext|||vn -die_where||| -die|||v -dirp_dup||| -div128||| -djSP||| -do_aexec5||| -do_aexec||| -do_aspawn||| -do_binmode||5.004050| -do_chomp||| -do_chop||| -do_close||| -do_dump_pad||| -do_eof||| -do_exec3||| -do_execfree||| -do_exec||| -do_gv_dump||5.006000| -do_gvgv_dump||5.006000| -do_hv_dump||5.006000| -do_ipcctl||| -do_ipcget||| -do_join||| -do_kv||| -do_magic_dump||5.006000| -do_msgrcv||| -do_msgsnd||| -do_oddball||| -do_op_dump||5.006000| -do_open9||5.006000| -do_openn||5.007001| -do_open||5.004000| -do_pipe||| -do_pmop_dump||5.006000| -do_print||| -do_readline||| -do_seek||| -do_semop||| -do_shmio||| -do_spawn_nowait||| -do_spawn||| -do_sprintf||| -do_sv_dump||5.006000| -do_sysseek||| -do_tell||| -do_trans_complex_utf8||| -do_trans_complex||| -do_trans_count_utf8||| -do_trans_count||| -do_trans_simple_utf8||| -do_trans_simple||| -do_trans||| -do_vecget||| -do_vecset||| -do_vop||| -docatch_body||| -docatch||| -doeval||| -dofile||| -dofindlabel||| -doform||| -doing_taint||5.008001|n -dooneliner||| -doopen_pm||| -doparseform||| -dopoptoeval||| -dopoptolabel||| -dopoptoloop||| -dopoptosub_at||| -dopoptosub||| -dounwind||| -dowantarray||| -dump_all||5.006000| -dump_eval||5.006000| -dump_fds||| -dump_form||5.006000| -dump_indent||5.006000|v -dump_mstats||| -dump_packsubs||5.006000| -dump_sub||5.006000| -dump_vindent||5.006000| -dumpuntil||| -dup_attrlist||| -emulate_eaccess||| -eval_pv|5.006000||p -eval_sv|5.006000||p -expect_number||| -fbm_compile||5.005000| -fbm_instr||5.005000| -fd_on_nosuid_fs||| -filter_add||| -filter_del||| -filter_gets||| -filter_read||| -find_beginning||| -find_byclass||| -find_in_my_stash||| -find_runcv||| -find_rundefsvoffset||5.009002| -find_script||| -find_uninit_var||| -fold_constants||| -forbid_setid||| -force_ident||| -force_list||| -force_next||| -force_version||| -force_word||| -form_nocontext|||vn -form||5.004000|v -fp_dup||| -fprintf_nocontext|||vn -free_global_struct||| -free_tied_hv_pool||| -free_tmps||| -gen_constant_list||| -get_av|5.006000||p -get_context||5.006000|n -get_cv|5.006000||p -get_db_sub||| -get_debug_opts||| -get_hash_seed||| -get_hv|5.006000||p -get_mstats||| -get_no_modify||| -get_num||| -get_op_descs||5.005000| -get_op_names||5.005000| -get_opargs||| -get_ppaddr||5.006000| -get_sv|5.006000||p -get_vtbl||5.005030| -getcwd_sv||5.007002| -getenv_len||| -gp_dup||| -gp_free||| -gp_ref||| -grok_bin|5.007003||p -grok_hex|5.007003||p -grok_number|5.007002||p -grok_numeric_radix|5.007002||p -grok_oct|5.007003||p -group_end||| -gv_AVadd||| -gv_HVadd||| -gv_IOadd||| -gv_autoload4||5.004000| -gv_check||| -gv_dump||5.006000| -gv_efullname3||5.004000| -gv_efullname4||5.006001| -gv_efullname||| -gv_ename||| -gv_fetchfile||| -gv_fetchmeth_autoload||5.007003| -gv_fetchmethod_autoload||5.004000| -gv_fetchmethod||| -gv_fetchmeth||| -gv_fetchpvn_flags||5.009002| -gv_fetchpv||| -gv_fetchsv||5.009002| -gv_fullname3||5.004000| -gv_fullname4||5.006001| -gv_fullname||| -gv_handler||5.007001| -gv_init_sv||| -gv_init||| -gv_share||| -gv_stashpvn|5.006000||p -gv_stashpv||| -gv_stashsv||| -he_dup||| -hek_dup||| -hfreeentries||| -hsplit||| -hv_assert||5.009001| -hv_auxinit||| -hv_clear_placeholders||5.009001| -hv_clear||| -hv_delayfree_ent||5.004000| -hv_delete_common||| -hv_delete_ent||5.004000| -hv_delete||| -hv_eiter_p||5.009003| -hv_eiter_set||5.009003| -hv_exists_ent||5.004000| -hv_exists||| -hv_fetch_common||| -hv_fetch_ent||5.004000| -hv_fetch||| -hv_free_ent||5.004000| -hv_iterinit||| -hv_iterkeysv||5.004000| -hv_iterkey||| -hv_iternext_flags||5.008000| -hv_iternextsv||| -hv_iternext||| -hv_iterval||| -hv_ksplit||5.004000| -hv_magic_check||| -hv_magic||| -hv_name_set||5.009003| -hv_notallowed||| -hv_placeholders_get||5.009003| -hv_placeholders_p||5.009003| -hv_placeholders_set||5.009003| -hv_riter_p||5.009003| -hv_riter_set||5.009003| -hv_scalar||5.009001| -hv_store_ent||5.004000| -hv_store_flags||5.008000| -hv_store||| -hv_undef||| -ibcmp_locale||5.004000| -ibcmp_utf8||5.007003| -ibcmp||| -incl_perldb||| -incline||| -incpush||| -ingroup||| -init_argv_symbols||| -init_debugger||| -init_global_struct||| -init_i18nl10n||5.006000| -init_i18nl14n||5.006000| -init_ids||| -init_interp||| -init_lexer||| -init_main_stash||| -init_perllib||| -init_postdump_symbols||| -init_predump_symbols||| -init_stacks||5.005000| -init_tm||5.007002| -instr||| -intro_my||| -intuit_method||| -intuit_more||| -invert||| -io_close||| -isALNUM||| -isALPHA||| -isDIGIT||| -isLOWER||| -isSPACE||| -isUPPER||| -is_an_int||| -is_gv_magical_sv||| -is_gv_magical||| -is_handle_constructor||| -is_list_assignment||| -is_lvalue_sub||5.007001| -is_uni_alnum_lc||5.006000| -is_uni_alnumc_lc||5.006000| -is_uni_alnumc||5.006000| -is_uni_alnum||5.006000| -is_uni_alpha_lc||5.006000| -is_uni_alpha||5.006000| -is_uni_ascii_lc||5.006000| -is_uni_ascii||5.006000| -is_uni_cntrl_lc||5.006000| -is_uni_cntrl||5.006000| -is_uni_digit_lc||5.006000| -is_uni_digit||5.006000| -is_uni_graph_lc||5.006000| -is_uni_graph||5.006000| -is_uni_idfirst_lc||5.006000| -is_uni_idfirst||5.006000| -is_uni_lower_lc||5.006000| -is_uni_lower||5.006000| -is_uni_print_lc||5.006000| -is_uni_print||5.006000| -is_uni_punct_lc||5.006000| -is_uni_punct||5.006000| -is_uni_space_lc||5.006000| -is_uni_space||5.006000| -is_uni_upper_lc||5.006000| -is_uni_upper||5.006000| -is_uni_xdigit_lc||5.006000| -is_uni_xdigit||5.006000| -is_utf8_alnumc||5.006000| -is_utf8_alnum||5.006000| -is_utf8_alpha||5.006000| -is_utf8_ascii||5.006000| -is_utf8_char_slow||| -is_utf8_char||5.006000| -is_utf8_cntrl||5.006000| -is_utf8_digit||5.006000| -is_utf8_graph||5.006000| -is_utf8_idcont||5.008000| -is_utf8_idfirst||5.006000| -is_utf8_lower||5.006000| -is_utf8_mark||5.006000| -is_utf8_print||5.006000| -is_utf8_punct||5.006000| -is_utf8_space||5.006000| -is_utf8_string_loclen||5.009003| -is_utf8_string_loc||5.008001| -is_utf8_string||5.006001| -is_utf8_upper||5.006000| -is_utf8_xdigit||5.006000| -isa_lookup||| -items|||n -ix|||n -jmaybe||| -keyword||| -leave_scope||| -lex_end||| -lex_start||| -linklist||| -listkids||| -list||| -load_module_nocontext|||vn -load_module||5.006000|v -localize||| -looks_like_number||| -lop||| -mPUSHi|5.009002||p -mPUSHn|5.009002||p -mPUSHp|5.009002||p -mPUSHu|5.009002||p -mXPUSHi|5.009002||p -mXPUSHn|5.009002||p -mXPUSHp|5.009002||p -mXPUSHu|5.009002||p -magic_clear_all_env||| -magic_clearenv||| -magic_clearpack||| -magic_clearsig||| -magic_dump||5.006000| -magic_existspack||| -magic_freearylen_p||| -magic_freeovrld||| -magic_freeregexp||| -magic_getarylen||| -magic_getdefelem||| -magic_getglob||| -magic_getnkeys||| -magic_getpack||| -magic_getpos||| -magic_getsig||| -magic_getsubstr||| -magic_gettaint||| -magic_getuvar||| -magic_getvec||| -magic_get||| -magic_killbackrefs||| -magic_len||| -magic_methcall||| -magic_methpack||| -magic_nextpack||| -magic_regdata_cnt||| -magic_regdatum_get||| -magic_regdatum_set||| -magic_scalarpack||| -magic_set_all_env||| -magic_setamagic||| -magic_setarylen||| -magic_setbm||| -magic_setcollxfrm||| -magic_setdbline||| -magic_setdefelem||| -magic_setenv||| -magic_setfm||| -magic_setglob||| -magic_setisa||| -magic_setmglob||| -magic_setnkeys||| -magic_setpack||| -magic_setpos||| -magic_setregexp||| -magic_setsig||| -magic_setsubstr||| -magic_settaint||| -magic_setutf8||| -magic_setuvar||| -magic_setvec||| -magic_set||| -magic_sizepack||| -magic_wipepack||| -magicname||| -make_trie||| -malloced_size|||n -malloc||5.007002|n -markstack_grow||| -measure_struct||| -memEQ|5.004000||p -memNE|5.004000||p -mem_collxfrm||| -mess_alloc||| -mess_nocontext|||vn -mess||5.006000|v -method_common||| -mfree||5.007002|n -mg_clear||| -mg_copy||| -mg_dup||| -mg_find||| -mg_free||| -mg_get||| -mg_length||5.005000| -mg_localize||| -mg_magical||| -mg_set||| -mg_size||5.005000| -mini_mktime||5.007002| -missingterm||| -mode_from_discipline||| -modkids||| -mod||| -moreswitches||| -mul128||| -mulexp10|||n -my_atof2||5.007002| -my_atof||5.006000| -my_attrs||| -my_bcopy|||n -my_betoh16|||n -my_betoh32|||n -my_betoh64|||n -my_betohi|||n -my_betohl|||n -my_betohs|||n -my_bzero|||n -my_chsize||| -my_exit_jump||| -my_exit||| -my_failure_exit||5.004000| -my_fflush_all||5.006000| -my_fork||5.007003|n -my_htobe16|||n -my_htobe32|||n -my_htobe64|||n -my_htobei|||n -my_htobel|||n -my_htobes|||n -my_htole16|||n -my_htole32|||n -my_htole64|||n -my_htolei|||n -my_htolel|||n -my_htoles|||n -my_htonl||| -my_kid||| -my_letoh16|||n -my_letoh32|||n -my_letoh64|||n -my_letohi|||n -my_letohl|||n -my_letohs|||n -my_lstat||| -my_memcmp||5.004000|n -my_memset|||n -my_ntohl||| -my_pclose||5.004000| -my_popen_list||5.007001| -my_popen||5.004000| -my_setenv||| -my_socketpair||5.007003|n -my_stat||| -my_strftime||5.007002| -my_swabn|||n -my_swap||| -my_unexec||| -my||| -newANONATTRSUB||5.006000| -newANONHASH||| -newANONLIST||| -newANONSUB||| -newASSIGNOP||| -newATTRSUB||5.006000| -newAVREF||| -newAV||| -newBINOP||| -newCONDOP||| -newCONSTSUB|5.006000||p -newCVREF||| -newDEFSVOP||| -newFORM||| -newFOROP||| -newGVOP||| -newGVREF||| -newGVgen||| -newHVREF||| -newHVhv||5.005000| -newHV||| -newIO||| -newLISTOP||| -newLOGOP||| -newLOOPEX||| -newLOOPOP||| -newMYSUB||5.006000| -newNULLLIST||| -newOP||| -newPADOP||5.006000| -newPMOP||| -newPROG||| -newPVOP||| -newRANGE||| -newRV_inc|5.004000||p -newRV_noinc|5.006000||p -newRV||| -newSLICEOP||| -newSTATEOP||| -newSUB||| -newSVOP||| -newSVREF||| -newSVhek||5.009003| -newSViv||| -newSVnv||| -newSVpvf_nocontext|||vn -newSVpvf||5.004000|v -newSVpvn_share||5.007001| -newSVpvn|5.006000||p -newSVpv||| -newSVrv||| -newSVsv||| -newSVuv|5.006000||p -newSV||| -newUNOP||| -newWHILEOP||5.009003| -newXSproto||5.006000| -newXS||5.006000| -new_collate||5.006000| -new_constant||| -new_ctype||5.006000| -new_he||| -new_logop||| -new_numeric||5.006000| -new_stackinfo||5.005000| -new_version||5.009000| -next_symbol||| -nextargv||| -nextchar||| -ninstr||| -no_bareword_allowed||| -no_fh_allowed||| -no_op||| -not_a_number||| -nothreadhook||5.008000| -nuke_stacks||| -num_overflow|||n -oopsAV||| -oopsCV||| -oopsHV||| -op_clear||| -op_const_sv||| -op_dump||5.006000| -op_free||| -op_null||5.007002| -op_refcnt_lock||5.009002| -op_refcnt_unlock||5.009002| -open_script||| -pMY_CXT_|5.007003||p -pMY_CXT|5.007003||p -pTHX_|5.006000||p -pTHX|5.006000||p -pack_cat||5.007003| -pack_rec||| -package||| -packlist||5.008001| -pad_add_anon||| -pad_add_name||| -pad_alloc||| -pad_block_start||| -pad_check_dup||| -pad_compname_type||| -pad_findlex||| -pad_findmy||| -pad_fixup_inner_anons||| -pad_free||| -pad_leavemy||| -pad_new||| -pad_push||| -pad_reset||| -pad_setsv||| -pad_sv||| -pad_swipe||| -pad_tidy||| -pad_undef||| -parse_body||| -parse_unicode_opts||| -path_is_absolute||| -peep||| -pending_ident||| -perl_alloc_using|||n -perl_alloc|||n -perl_clone_using|||n -perl_clone|||n -perl_construct|||n -perl_destruct||5.007003|n -perl_free|||n -perl_parse||5.006000|n -perl_run|||n -pidgone||| -pmflag||| -pmop_dump||5.006000| -pmruntime||| -pmtrans||| -pop_scope||| -pregcomp||| -pregexec||| -pregfree||| -prepend_elem||| -printf_nocontext|||vn -ptr_table_clear||| -ptr_table_fetch||| -ptr_table_free||| -ptr_table_new||| -ptr_table_split||| -ptr_table_store||| -push_scope||| -put_byte||| -pv_display||5.006000| -pv_uni_display||5.007003| -qerror||| -re_croak2||| -re_dup||| -re_intuit_start||5.006000| -re_intuit_string||5.006000| -realloc||5.007002|n -reentrant_free||| -reentrant_init||| -reentrant_retry|||vn -reentrant_size||| -refkids||| -refto||| -ref||| -reg_node||| -reganode||| -regatom||| -regbranch||| -regclass_swash||5.007003| -regclass||| -regcp_set_to||| -regcppop||| -regcppush||| -regcurly||| -regdump||5.005000| -regexec_flags||5.005000| -reghop3||| -reghopmaybe3||| -reghopmaybe||| -reghop||| -reginclass||| -reginitcolors||5.006000| -reginsert||| -regmatch||| -regnext||5.005000| -regoptail||| -regpiece||| -regpposixcc||| -regprop||| -regrepeat_hard||| -regrepeat||| -regtail||| -regtry||| -reguni||| -regwhite||| -reg||| -repeatcpy||| -report_evil_fh||| -report_uninit||| -require_errno||| -require_pv||5.006000| -rninstr||| -rsignal_restore||| -rsignal_save||| -rsignal_state||5.004000| -rsignal||5.004000| -run_body||| -runops_debug||5.005000| -runops_standard||5.005000| -rvpv_dup||| -rxres_free||| -rxres_restore||| -rxres_save||| -safesyscalloc||5.006000|n -safesysfree||5.006000|n -safesysmalloc||5.006000|n -safesysrealloc||5.006000|n -same_dirent||| -save_I16||5.004000| -save_I32||| -save_I8||5.006000| -save_aelem||5.004050| -save_alloc||5.006000| -save_aptr||| -save_ary||| -save_bool||5.008001| -save_clearsv||| -save_delete||| -save_destructor_x||5.006000| -save_destructor||5.006000| -save_freeop||| -save_freepv||| -save_freesv||| -save_generic_pvref||5.006001| -save_generic_svref||5.005030| -save_gp||5.004000| -save_hash||| -save_hek_flags||| -save_helem||5.004050| -save_hints||5.005000| -save_hptr||| -save_int||| -save_item||| -save_iv||5.005000| -save_lines||| -save_list||| -save_long||| -save_magic||| -save_mortalizesv||5.007001| -save_nogv||| -save_op||| -save_padsv||5.007001| -save_pptr||| -save_re_context||5.006000| -save_scalar_at||| -save_scalar||| -save_set_svflags||5.009000| -save_shared_pvref||5.007003| -save_sptr||| -save_svref||| -save_threadsv||5.005000| -save_vptr||5.006000| -savepvn||| -savepv||| -savesharedpv||5.007003| -savestack_grow_cnt||5.008001| -savestack_grow||| -savesvpv||5.009002| -sawparens||| -scalar_mod_type||| -scalarboolean||| -scalarkids||| -scalarseq||| -scalarvoid||| -scalar||| -scan_bin||5.006000| -scan_commit||| -scan_const||| -scan_formline||| -scan_heredoc||| -scan_hex||| -scan_ident||| -scan_inputsymbol||| -scan_num||5.007001| -scan_oct||| -scan_pat||| -scan_str||| -scan_subst||| -scan_trans||| -scan_version||5.009001| -scan_vstring||5.008001| -scan_word||| -scope||| -screaminstr||5.005000| -seed||| -set_context||5.006000|n -set_csh||| -set_numeric_local||5.006000| -set_numeric_radix||5.006000| -set_numeric_standard||5.006000| -setdefout||| -setenv_getix||| -share_hek_flags||| -share_hek||| -si_dup||| -sighandler|||n -simplify_sort||| -skipspace||| -sortsv||5.007003| -ss_dup||| -stack_grow||| -start_glob||| -start_subparse||5.004000| -stashpv_hvname_match||5.009003| -stdize_locale||| -strEQ||| -strGE||| -strGT||| -strLE||| -strLT||| -strNE||| -str_to_version||5.006000| -strnEQ||| -strnNE||| -study_chunk||| -sub_crush_depth||| -sublex_done||| -sublex_push||| -sublex_start||| -sv_2bool||| -sv_2cv||| -sv_2io||| -sv_2iuv_non_preserve||| -sv_2iv_flags||5.009001| -sv_2iv||| -sv_2mortal||| -sv_2nv||| -sv_2pv_flags||5.007002| -sv_2pv_nolen|5.006000||p -sv_2pvbyte_nolen||| -sv_2pvbyte|5.006000||p -sv_2pvutf8_nolen||5.006000| -sv_2pvutf8||5.006000| -sv_2pv||| -sv_2uv_flags||5.009001| -sv_2uv|5.004000||p -sv_add_arena||| -sv_add_backref||| -sv_backoff||| -sv_bless||| -sv_cat_decode||5.008001| -sv_catpv_mg|5.006000||p -sv_catpvf_mg_nocontext|||pvn -sv_catpvf_mg|5.006000|5.004000|pv -sv_catpvf_nocontext|||vn -sv_catpvf||5.004000|v -sv_catpvn_flags||5.007002| -sv_catpvn_mg|5.006000||p -sv_catpvn_nomg|5.007002||p -sv_catpvn||| -sv_catpv||| -sv_catsv_flags||5.007002| -sv_catsv_mg|5.006000||p -sv_catsv_nomg|5.007002||p -sv_catsv||| -sv_chop||| -sv_clean_all||| -sv_clean_objs||| -sv_clear||| -sv_cmp_locale||5.004000| -sv_cmp||| -sv_collxfrm||| -sv_compile_2op||5.008001| -sv_copypv||5.007003| -sv_dec||| -sv_del_backref||| -sv_derived_from||5.004000| -sv_dump||| -sv_dup||| -sv_eq||| -sv_force_normal_flags||5.007001| -sv_force_normal||5.006000| -sv_free2||| -sv_free_arenas||| -sv_free||| -sv_gets||5.004000| -sv_grow||| -sv_inc||| -sv_insert||| -sv_isa||| -sv_isobject||| -sv_iv||5.005000| -sv_len_utf8||5.006000| -sv_len||| -sv_magicext||5.007003| -sv_magic||| -sv_mortalcopy||| -sv_newmortal||| -sv_newref||| -sv_nolocking||5.007003| -sv_nosharing||5.007003| -sv_nounlocking||5.007003| -sv_nv||5.005000| -sv_peek||5.005000| -sv_pos_b2u||5.006000| -sv_pos_u2b||5.006000| -sv_pvbyten_force||5.006000| -sv_pvbyten||5.006000| -sv_pvbyte||5.006000| -sv_pvn_force_flags||5.007002| -sv_pvn_force|||p -sv_pvn_nomg|5.007003||p -sv_pvn|5.006000||p -sv_pvutf8n_force||5.006000| -sv_pvutf8n||5.006000| -sv_pvutf8||5.006000| -sv_pv||5.006000| -sv_recode_to_utf8||5.007003| -sv_reftype||| -sv_release_COW||| -sv_release_IVX||| -sv_replace||| -sv_report_used||| -sv_reset||| -sv_rvweaken||5.006000| -sv_setiv_mg|5.006000||p -sv_setiv||| -sv_setnv_mg|5.006000||p -sv_setnv||| -sv_setpv_mg|5.006000||p -sv_setpvf_mg_nocontext|||pvn -sv_setpvf_mg|5.006000|5.004000|pv -sv_setpvf_nocontext|||vn -sv_setpvf||5.004000|v -sv_setpviv_mg||5.008001| -sv_setpviv||5.008001| -sv_setpvn_mg|5.006000||p -sv_setpvn||| -sv_setpv||| -sv_setref_iv||| -sv_setref_nv||| -sv_setref_pvn||| -sv_setref_pv||| -sv_setref_uv||5.007001| -sv_setsv_cow||| -sv_setsv_flags||5.007002| -sv_setsv_mg|5.006000||p -sv_setsv_nomg|5.007002||p -sv_setsv||| -sv_setuv_mg|5.006000||p -sv_setuv|5.006000||p -sv_tainted||5.004000| -sv_taint||5.004000| -sv_true||5.005000| -sv_unglob||| -sv_uni_display||5.007003| -sv_unmagic||| -sv_unref_flags||5.007001| -sv_unref||| -sv_untaint||5.004000| -sv_upgrade||| -sv_usepvn_mg|5.006000||p -sv_usepvn||| -sv_utf8_decode||5.006000| -sv_utf8_downgrade||5.006000| -sv_utf8_encode||5.006000| -sv_utf8_upgrade_flags||5.007002| -sv_utf8_upgrade||5.007001| -sv_uv|5.006000||p -sv_vcatpvf_mg|5.006000|5.004000|p -sv_vcatpvfn||5.004000| -sv_vcatpvf|5.006000|5.004000|p -sv_vsetpvf_mg|5.006000|5.004000|p -sv_vsetpvfn||5.004000| -sv_vsetpvf|5.006000|5.004000|p -svtype||| -swallow_bom||| -swash_fetch||5.007002| -swash_init||5.006000| -sys_intern_clear||| -sys_intern_dup||| -sys_intern_init||| -taint_env||| -taint_proper||| -tmps_grow||5.006000| -toLOWER||| -toUPPER||| -to_byte_substr||| -to_uni_fold||5.007003| -to_uni_lower_lc||5.006000| -to_uni_lower||5.007003| -to_uni_title_lc||5.006000| -to_uni_title||5.007003| -to_uni_upper_lc||5.006000| -to_uni_upper||5.007003| -to_utf8_case||5.007003| -to_utf8_fold||5.007003| -to_utf8_lower||5.007003| -to_utf8_substr||| -to_utf8_title||5.007003| -to_utf8_upper||5.007003| -tokeq||| -tokereport||| -too_few_arguments||| -too_many_arguments||| -unlnk||| -unpack_rec||| -unpack_str||5.007003| -unpackstring||5.008001| -unshare_hek_or_pvn||| -unshare_hek||| -unsharepvn||5.004000| -upg_version||5.009000| -usage||| -utf16_textfilter||| -utf16_to_utf8_reversed||5.006001| -utf16_to_utf8||5.006001| -utf16rev_textfilter||| -utf8_distance||5.006000| -utf8_hop||5.006000| -utf8_length||5.007001| -utf8_mg_pos_init||| -utf8_mg_pos||| -utf8_to_bytes||5.006001| -utf8_to_uvchr||5.007001| -utf8_to_uvuni||5.007001| -utf8n_to_uvchr||5.007001| -utf8n_to_uvuni||5.007001| -utilize||| -uvchr_to_utf8_flags||5.007003| -uvchr_to_utf8||5.007001| -uvuni_to_utf8_flags||5.007003| -uvuni_to_utf8||5.007001| -validate_suid||| -varname||| -vcmp||5.009000| -vcroak||5.006000| -vdeb||5.007003| -vdie||| -vform||5.006000| -visit||| -vivify_defelem||| -vivify_ref||| -vload_module||5.006000| -vmess||5.006000| -vnewSVpvf|5.006000|5.004000|p -vnormal||5.009002| -vnumify||5.009000| -vstringify||5.009000| -vwarner||5.006000| -vwarn||5.006000| -wait4pid||| -warn_nocontext|||vn -warner_nocontext|||vn -warner||5.006000|v -warn|||v -watch||| -whichsig||| -write_to_stderr||| -yyerror||| -yylex||| -yyparse||| -yywarn||| -); - -if (exists $opt{'list-unsupported'}) { - my $f; - for $f (sort { lc $a cmp lc $b } keys %API) { - next unless $API{$f}{todo}; - print "$f ", '.'x(40-length($f)), " ", format_version($API{$f}{todo}), "\n"; - } - exit 0; -} - -# Scan for possible replacement candidates - -my(%replace, %need, %hints, %depends); -my $replace = 0; -my $hint = ''; - -while () { - if ($hint) { - if (m{^\s*\*\s(.*?)\s*$}) { - $hints{$hint} ||= ''; # suppress warning with older perls - $hints{$hint} .= "$1\n"; - } - else { - $hint = ''; - } - } - $hint = $1 if m{^\s*$rccs\sHint:\s+(\w+)\s*$}; - - $replace = $1 if m{^\s*$rccs\s+Replace:\s+(\d+)\s+$rcce\s*$}; - $replace{$2} = $1 if $replace and m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(\w+)}; - $replace{$2} = $1 if m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(\w+).*$rccs\s+Replace\s+$rcce}; - $replace{$1} = $2 if m{^\s*$rccs\s+Replace (\w+) with (\w+)\s+$rcce\s*$}; - - if (m{^\s*$rccs\s+(\w+)\s+depends\s+on\s+(\w+(\s*,\s*\w+)*)\s+$rcce\s*$}) { - push @{$depends{$1}}, map { s/\s+//g; $_ } split /,/, $2; - } - - $need{$1} = 1 if m{^#if\s+defined\(NEED_(\w+)(?:_GLOBAL)?\)}; -} - -if (exists $opt{'api-info'}) { - my $f; - my $count = 0; - my $match = $opt{'api-info'} =~ m!^/(.*)/$! ? $1 : "^\Q$opt{'api-info'}\E\$"; - for $f (sort { lc $a cmp lc $b } keys %API) { - next unless $f =~ /$match/; - print "\n=== $f ===\n\n"; - my $info = 0; - if ($API{$f}{base} || $API{$f}{todo}) { - my $base = format_version($API{$f}{base} || $API{$f}{todo}); - print "Supported at least starting from perl-$base.\n"; - $info++; - } - if ($API{$f}{provided}) { - my $todo = $API{$f}{todo} ? format_version($API{$f}{todo}) : "5.003"; - print "Support by $ppport provided back to perl-$todo.\n"; - print "Support needs to be explicitly requested by NEED_$f.\n" if exists $need{$f}; - print "Depends on: ", join(', ', @{$depends{$f}}), ".\n" if exists $depends{$f}; - print "$hints{$f}" if exists $hints{$f}; - $info++; - } - unless ($info) { - print "No portability information available.\n"; - } - $count++; - } - if ($count > 0) { - print "\n"; - } - else { - print "Found no API matching '$opt{'api-info'}'.\n"; - } - exit 0; -} - -if (exists $opt{'list-provided'}) { - my $f; - for $f (sort { lc $a cmp lc $b } keys %API) { - next unless $API{$f}{provided}; - my @flags; - push @flags, 'explicit' if exists $need{$f}; - push @flags, 'depend' if exists $depends{$f}; - push @flags, 'hint' if exists $hints{$f}; - my $flags = @flags ? ' ['.join(', ', @flags).']' : ''; - print "$f$flags\n"; - } - exit 0; -} - -my @files; -my @srcext = qw( xs c h cc cpp ); -my $srcext = join '|', @srcext; - -if (@ARGV) { - my %seen; - @files = grep { -f && !exists $seen{$_} } map { glob $_ } @ARGV; -} -else { - eval { - require File::Find; - File::Find::find(sub { - $File::Find::name =~ /\.($srcext)$/i - and push @files, $File::Find::name; - }, '.'); - }; - if ($@) { - @files = map { glob "*.$_" } @srcext; - } -} - -if (!@ARGV || $opt{filter}) { - my(@in, @out); - my %xsc = map { /(.*)\.xs$/ ? ("$1.c" => 1, "$1.cc" => 1) : () } @files; - for (@files) { - my $out = exists $xsc{$_} || /\b\Q$ppport\E$/i || !/\.($srcext)$/i; - push @{ $out ? \@out : \@in }, $_; - } - if (@ARGV && @out) { - warning("Skipping the following files (use --nofilter to avoid this):\n| ", join "\n| ", @out); - } - @files = @in; -} - -unless (@files) { - die "No input files given!\n"; -} - -my(%files, %global, %revreplace); -%revreplace = reverse %replace; -my $filename; -my $patch_opened = 0; - -for $filename (@files) { - unless (open IN, "<$filename") { - warn "Unable to read from $filename: $!\n"; - next; - } - - info("Scanning $filename ..."); - - my $c = do { local $/; }; - close IN; - - my %file = (orig => $c, changes => 0); - - # temporarily remove C comments from the code - my @ccom; - $c =~ s{ - ( - [^"'/]+ - | - (?:"[^"\\]*(?:\\.[^"\\]*)*" [^"'/]*)+ - | - (?:'[^'\\]*(?:\\.[^'\\]*)*' [^"'/]*)+ - ) - | - (/ (?: - \*[^*]*\*+(?:[^$ccs][^*]*\*+)* / - | - /[^\r\n]* - )) - }{ - defined $2 and push @ccom, $2; - defined $1 ? $1 : "$ccs$#ccom$cce"; - }egsx; - - $file{ccom} = \@ccom; - $file{code} = $c; - $file{has_inc_ppport} = ($c =~ /#.*include.*\Q$ppport\E/); - - my $func; - - for $func (keys %API) { - my $match = $func; - $match .= "|$revreplace{$func}" if exists $revreplace{$func}; - if ($c =~ /\b(?:Perl_)?($match)\b/) { - $file{uses_replace}{$1}++ if exists $revreplace{$func} && $1 eq $revreplace{$func}; - $file{uses_Perl}{$func}++ if $c =~ /\bPerl_$func\b/; - if (exists $API{$func}{provided}) { - if (!exists $API{$func}{base} || $API{$func}{base} > $opt{'compat-version'}) { - $file{uses}{$func}++; - my @deps = rec_depend($func); - if (@deps) { - $file{uses_deps}{$func} = \@deps; - for (@deps) { - $file{uses}{$_} = 0 unless exists $file{uses}{$_}; - } - } - for ($func, @deps) { - if (exists $need{$_}) { - $file{needs}{$_} = 'static'; - } - } - } - } - if (exists $API{$func}{todo} && $API{$func}{todo} > $opt{'compat-version'}) { - if ($c =~ /\b$func\b/) { - $file{uses_todo}{$func}++; - } - } - } - } - - while ($c =~ /^$HS*#$HS*define$HS+(NEED_(\w+?)(_GLOBAL)?)\b/mg) { - if (exists $need{$2}) { - $file{defined $3 ? 'needed_global' : 'needed_static'}{$2}++; - } - else { - warning("Possibly wrong #define $1 in $filename"); - } - } - - for (qw(uses needs uses_todo needed_global needed_static)) { - for $func (keys %{$file{$_}}) { - push @{$global{$_}{$func}}, $filename; - } - } - - $files{$filename} = \%file; -} - -# Globally resolve NEED_'s -my $need; -for $need (keys %{$global{needs}}) { - if (@{$global{needs}{$need}} > 1) { - my @targets = @{$global{needs}{$need}}; - my @t = grep $files{$_}{needed_global}{$need}, @targets; - @targets = @t if @t; - @t = grep /\.xs$/i, @targets; - @targets = @t if @t; - my $target = shift @targets; - $files{$target}{needs}{$need} = 'global'; - for (@{$global{needs}{$need}}) { - $files{$_}{needs}{$need} = 'extern' if $_ ne $target; - } - } -} - -for $filename (@files) { - exists $files{$filename} or next; - - info("=== Analyzing $filename ==="); - - my %file = %{$files{$filename}}; - my $func; - my $c = $file{code}; - - for $func (sort keys %{$file{uses_Perl}}) { - if ($API{$func}{varargs}) { - my $changes = ($c =~ s{\b(Perl_$func\s*\(\s*)(?!aTHX_?)(\)|[^\s)]*\))} - { $1 . ($2 eq ')' ? 'aTHX' : 'aTHX_ ') . $2 }ge); - if ($changes) { - warning("Doesn't pass interpreter argument aTHX to Perl_$func"); - $file{changes} += $changes; - } - } - else { - warning("Uses Perl_$func instead of $func"); - $file{changes} += ($c =~ s{\bPerl_$func(\s*)\((\s*aTHX_?)?\s*} - {$func$1(}g); - } - } - - for $func (sort keys %{$file{uses_replace}}) { - warning("Uses $func instead of $replace{$func}"); - $file{changes} += ($c =~ s/\b$func\b/$replace{$func}/g); - } - - for $func (sort keys %{$file{uses}}) { - next unless $file{uses}{$func}; # if it's only a dependency - if (exists $file{uses_deps}{$func}) { - diag("Uses $func, which depends on ", join(', ', @{$file{uses_deps}{$func}})); - } - elsif (exists $replace{$func}) { - warning("Uses $func instead of $replace{$func}"); - $file{changes} += ($c =~ s/\b$func\b/$replace{$func}/g); - } - else { - diag("Uses $func"); - } - hint($func); - } - - for $func (sort keys %{$file{uses_todo}}) { - warning("Uses $func, which may not be portable below perl ", - format_version($API{$func}{todo})); - } - - for $func (sort keys %{$file{needed_static}}) { - my $message = ''; - if (not exists $file{uses}{$func}) { - $message = "No need to define NEED_$func if $func is never used"; - } - elsif (exists $file{needs}{$func} && $file{needs}{$func} ne 'static') { - $message = "No need to define NEED_$func when already needed globally"; - } - if ($message) { - diag($message); - $file{changes} += ($c =~ s/^$HS*#$HS*define$HS+NEED_$func\b.*$LF//mg); - } - } - - for $func (sort keys %{$file{needed_global}}) { - my $message = ''; - if (not exists $global{uses}{$func}) { - $message = "No need to define NEED_${func}_GLOBAL if $func is never used"; - } - elsif (exists $file{needs}{$func}) { - if ($file{needs}{$func} eq 'extern') { - $message = "No need to define NEED_${func}_GLOBAL when already needed globally"; - } - elsif ($file{needs}{$func} eq 'static') { - $message = "No need to define NEED_${func}_GLOBAL when only used in this file"; - } - } - if ($message) { - diag($message); - $file{changes} += ($c =~ s/^$HS*#$HS*define$HS+NEED_${func}_GLOBAL\b.*$LF//mg); - } - } - - $file{needs_inc_ppport} = keys %{$file{uses}}; - - if ($file{needs_inc_ppport}) { - my $pp = ''; - - for $func (sort keys %{$file{needs}}) { - my $type = $file{needs}{$func}; - next if $type eq 'extern'; - my $suffix = $type eq 'global' ? '_GLOBAL' : ''; - unless (exists $file{"needed_$type"}{$func}) { - if ($type eq 'global') { - diag("Files [@{$global{needs}{$func}}] need $func, adding global request"); - } - else { - diag("File needs $func, adding static request"); - } - $pp .= "#define NEED_$func$suffix\n"; - } - } - - if ($pp && ($c =~ s/^(?=$HS*#$HS*define$HS+NEED_\w+)/$pp/m)) { - $pp = ''; - $file{changes}++; - } - - unless ($file{has_inc_ppport}) { - diag("Needs to include '$ppport'"); - $pp .= qq(#include "$ppport"\n) - } - - if ($pp) { - $file{changes} += ($c =~ s/^($HS*#$HS*define$HS+NEED_\w+.*?)^/$1$pp/ms) - || ($c =~ s/^(?=$HS*#$HS*include.*\Q$ppport\E)/$pp/m) - || ($c =~ s/^($HS*#$HS*include.*XSUB.*\s*?)^/$1$pp/m) - || ($c =~ s/^/$pp/); - } - } - else { - if ($file{has_inc_ppport}) { - diag("No need to include '$ppport'"); - $file{changes} += ($c =~ s/^$HS*?#$HS*include.*\Q$ppport\E.*?$LF//m); - } - } - - # put back in our C comments - my $ix; - my $cppc = 0; - my @ccom = @{$file{ccom}}; - for $ix (0 .. $#ccom) { - if (!$opt{cplusplus} && $ccom[$ix] =~ s!^//!!) { - $cppc++; - $file{changes} += $c =~ s/$rccs$ix$rcce/$ccs$ccom[$ix] $cce/; - } - else { - $c =~ s/$rccs$ix$rcce/$ccom[$ix]/; - } - } - - if ($cppc) { - my $s = $cppc != 1 ? 's' : ''; - warning("Uses $cppc C++ style comment$s, which is not portable"); - } - - if ($file{changes}) { - if (exists $opt{copy}) { - my $newfile = "$filename$opt{copy}"; - if (-e $newfile) { - error("'$newfile' already exists, refusing to write copy of '$filename'"); - } - else { - local *F; - if (open F, ">$newfile") { - info("Writing copy of '$filename' with changes to '$newfile'"); - print F $c; - close F; - } - else { - error("Cannot open '$newfile' for writing: $!"); - } - } - } - elsif (exists $opt{patch} || $opt{changes}) { - if (exists $opt{patch}) { - unless ($patch_opened) { - if (open PATCH, ">$opt{patch}") { - $patch_opened = 1; - } - else { - error("Cannot open '$opt{patch}' for writing: $!"); - delete $opt{patch}; - $opt{changes} = 1; - goto fallback; - } - } - mydiff(\*PATCH, $filename, $c); - } - else { -fallback: - info("Suggested changes:"); - mydiff(\*STDOUT, $filename, $c); - } - } - else { - my $s = $file{changes} == 1 ? '' : 's'; - info("$file{changes} potentially required change$s detected"); - } - } - else { - info("Looks good"); - } -} - -close PATCH if $patch_opened; - -exit 0; - - -sub mydiff -{ - local *F = shift; - my($file, $str) = @_; - my $diff; - - if (exists $opt{diff}) { - $diff = run_diff($opt{diff}, $file, $str); - } - - if (!defined $diff and can_use('Text::Diff')) { - $diff = Text::Diff::diff($file, \$str, { STYLE => 'Unified' }); - $diff = <
$tmp") { - print F $str; - close F; - - if (open F, "$prog $file $tmp |") { - while () { - s/\Q$tmp\E/$file.patched/; - $diff .= $_; - } - close F; - unlink $tmp; - return $diff; - } - - unlink $tmp; - } - else { - error("Cannot open '$tmp' for writing: $!"); - } - - return undef; -} - -sub can_use -{ - eval "use @_;"; - return $@ eq ''; -} - -sub rec_depend -{ - my $func = shift; - my %seen; - return () unless exists $depends{$func}; - grep !$seen{$_}++, map { ($_, rec_depend($_)) } @{$depends{$func}}; -} - -sub parse_version -{ - my $ver = shift; - - if ($ver =~ /^(\d+)\.(\d+)\.(\d+)$/) { - return ($1, $2, $3); - } - elsif ($ver !~ /^\d+\.[\d_]+$/) { - die "cannot parse version '$ver'\n"; - } - - $ver =~ s/_//g; - $ver =~ s/$/000000/; - - my($r,$v,$s) = $ver =~ /(\d+)\.(\d{3})(\d{3})/; - - $v = int $v; - $s = int $s; - - if ($r < 5 || ($r == 5 && $v < 6)) { - if ($s % 10) { - die "cannot parse version '$ver'\n"; - } - } - - return ($r, $v, $s); -} - -sub format_version -{ - my $ver = shift; - - $ver =~ s/$/000000/; - my($r,$v,$s) = $ver =~ /(\d+)\.(\d{3})(\d{3})/; - - $v = int $v; - $s = int $s; - - if ($r < 5 || ($r == 5 && $v < 6)) { - if ($s % 10) { - die "invalid version '$ver'\n"; - } - $s /= 10; - - $ver = sprintf "%d.%03d", $r, $v; - $s > 0 and $ver .= sprintf "_%02d", $s; - - return $ver; - } - - return sprintf "%d.%d.%d", $r, $v, $s; -} - -sub info -{ - $opt{quiet} and return; - print @_, "\n"; -} - -sub diag -{ - $opt{quiet} and return; - $opt{diag} and print @_, "\n"; -} - -sub warning -{ - $opt{quiet} and return; - print "*** ", @_, "\n"; -} - -sub error -{ - print "*** ERROR: ", @_, "\n"; -} - -my %given_hints; -sub hint -{ - $opt{quiet} and return; - $opt{hints} or return; - my $func = shift; - exists $hints{$func} or return; - $given_hints{$func}++ and return; - my $hint = $hints{$func}; - $hint =~ s/^/ /mg; - print " --- hint for $func ---\n", $hint; -} - -sub usage -{ - my($usage) = do { local(@ARGV,$/)=($0); <> } =~ /^=head\d$HS+SYNOPSIS\s*^(.*?)\s*^=/ms; - my %M = ( 'I' => '*' ); - $usage =~ s/^\s*perl\s+\S+/$^X $0/; - $usage =~ s/([A-Z])<([^>]+)>/$M{$1}$2$M{$1}/g; - - print < -# endif -# if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL))) -# include -# endif -# ifndef PERL_REVISION -# define PERL_REVISION (5) - /* Replace: 1 */ -# define PERL_VERSION PATCHLEVEL -# define PERL_SUBVERSION SUBVERSION - /* Replace PERL_PATCHLEVEL with PERL_VERSION */ - /* Replace: 0 */ -# endif -#endif - -#define PERL_BCDVERSION ((PERL_REVISION * 0x1000000L) + (PERL_VERSION * 0x1000L) + PERL_SUBVERSION) - -/* It is very unlikely that anyone will try to use this with Perl 6 - (or greater), but who knows. - */ -#if PERL_REVISION != 5 -# error ppport.h only works with Perl version 5 -#endif /* PERL_REVISION != 5 */ - -#ifdef I_LIMITS -# include -#endif - -#ifndef PERL_UCHAR_MIN -# define PERL_UCHAR_MIN ((unsigned char)0) -#endif - -#ifndef PERL_UCHAR_MAX -# ifdef UCHAR_MAX -# define PERL_UCHAR_MAX ((unsigned char)UCHAR_MAX) -# else -# ifdef MAXUCHAR -# define PERL_UCHAR_MAX ((unsigned char)MAXUCHAR) -# else -# define PERL_UCHAR_MAX ((unsigned char)~(unsigned)0) -# endif -# endif -#endif - -#ifndef PERL_USHORT_MIN -# define PERL_USHORT_MIN ((unsigned short)0) -#endif - -#ifndef PERL_USHORT_MAX -# ifdef USHORT_MAX -# define PERL_USHORT_MAX ((unsigned short)USHORT_MAX) -# else -# ifdef MAXUSHORT -# define PERL_USHORT_MAX ((unsigned short)MAXUSHORT) -# else -# ifdef USHRT_MAX -# define PERL_USHORT_MAX ((unsigned short)USHRT_MAX) -# else -# define PERL_USHORT_MAX ((unsigned short)~(unsigned)0) -# endif -# endif -# endif -#endif - -#ifndef PERL_SHORT_MAX -# ifdef SHORT_MAX -# define PERL_SHORT_MAX ((short)SHORT_MAX) -# else -# ifdef MAXSHORT /* Often used in */ -# define PERL_SHORT_MAX ((short)MAXSHORT) -# else -# ifdef SHRT_MAX -# define PERL_SHORT_MAX ((short)SHRT_MAX) -# else -# define PERL_SHORT_MAX ((short) (PERL_USHORT_MAX >> 1)) -# endif -# endif -# endif -#endif - -#ifndef PERL_SHORT_MIN -# ifdef SHORT_MIN -# define PERL_SHORT_MIN ((short)SHORT_MIN) -# else -# ifdef MINSHORT -# define PERL_SHORT_MIN ((short)MINSHORT) -# else -# ifdef SHRT_MIN -# define PERL_SHORT_MIN ((short)SHRT_MIN) -# else -# define PERL_SHORT_MIN (-PERL_SHORT_MAX - ((3 & -1) == 3)) -# endif -# endif -# endif -#endif - -#ifndef PERL_UINT_MAX -# ifdef UINT_MAX -# define PERL_UINT_MAX ((unsigned int)UINT_MAX) -# else -# ifdef MAXUINT -# define PERL_UINT_MAX ((unsigned int)MAXUINT) -# else -# define PERL_UINT_MAX (~(unsigned int)0) -# endif -# endif -#endif - -#ifndef PERL_UINT_MIN -# define PERL_UINT_MIN ((unsigned int)0) -#endif - -#ifndef PERL_INT_MAX -# ifdef INT_MAX -# define PERL_INT_MAX ((int)INT_MAX) -# else -# ifdef MAXINT /* Often used in */ -# define PERL_INT_MAX ((int)MAXINT) -# else -# define PERL_INT_MAX ((int)(PERL_UINT_MAX >> 1)) -# endif -# endif -#endif - -#ifndef PERL_INT_MIN -# ifdef INT_MIN -# define PERL_INT_MIN ((int)INT_MIN) -# else -# ifdef MININT -# define PERL_INT_MIN ((int)MININT) -# else -# define PERL_INT_MIN (-PERL_INT_MAX - ((3 & -1) == 3)) -# endif -# endif -#endif - -#ifndef PERL_ULONG_MAX -# ifdef ULONG_MAX -# define PERL_ULONG_MAX ((unsigned long)ULONG_MAX) -# else -# ifdef MAXULONG -# define PERL_ULONG_MAX ((unsigned long)MAXULONG) -# else -# define PERL_ULONG_MAX (~(unsigned long)0) -# endif -# endif -#endif - -#ifndef PERL_ULONG_MIN -# define PERL_ULONG_MIN ((unsigned long)0L) -#endif - -#ifndef PERL_LONG_MAX -# ifdef LONG_MAX -# define PERL_LONG_MAX ((long)LONG_MAX) -# else -# ifdef MAXLONG -# define PERL_LONG_MAX ((long)MAXLONG) -# else -# define PERL_LONG_MAX ((long) (PERL_ULONG_MAX >> 1)) -# endif -# endif -#endif - -#ifndef PERL_LONG_MIN -# ifdef LONG_MIN -# define PERL_LONG_MIN ((long)LONG_MIN) -# else -# ifdef MINLONG -# define PERL_LONG_MIN ((long)MINLONG) -# else -# define PERL_LONG_MIN (-PERL_LONG_MAX - ((3 & -1) == 3)) -# endif -# endif -#endif - -#if defined(HAS_QUAD) && (defined(convex) || defined(uts)) -# ifndef PERL_UQUAD_MAX -# ifdef ULONGLONG_MAX -# define PERL_UQUAD_MAX ((unsigned long long)ULONGLONG_MAX) -# else -# ifdef MAXULONGLONG -# define PERL_UQUAD_MAX ((unsigned long long)MAXULONGLONG) -# else -# define PERL_UQUAD_MAX (~(unsigned long long)0) -# endif -# endif -# endif - -# ifndef PERL_UQUAD_MIN -# define PERL_UQUAD_MIN ((unsigned long long)0L) -# endif - -# ifndef PERL_QUAD_MAX -# ifdef LONGLONG_MAX -# define PERL_QUAD_MAX ((long long)LONGLONG_MAX) -# else -# ifdef MAXLONGLONG -# define PERL_QUAD_MAX ((long long)MAXLONGLONG) -# else -# define PERL_QUAD_MAX ((long long) (PERL_UQUAD_MAX >> 1)) -# endif -# endif -# endif - -# ifndef PERL_QUAD_MIN -# ifdef LONGLONG_MIN -# define PERL_QUAD_MIN ((long long)LONGLONG_MIN) -# else -# ifdef MINLONGLONG -# define PERL_QUAD_MIN ((long long)MINLONGLONG) -# else -# define PERL_QUAD_MIN (-PERL_QUAD_MAX - ((3 & -1) == 3)) -# endif -# endif -# endif -#endif - -/* This is based on code from 5.003 perl.h */ -#ifdef HAS_QUAD -# ifdef cray -#ifndef IVTYPE -# define IVTYPE int -#endif - -#ifndef IV_MIN -# define IV_MIN PERL_INT_MIN -#endif - -#ifndef IV_MAX -# define IV_MAX PERL_INT_MAX -#endif - -#ifndef UV_MIN -# define UV_MIN PERL_UINT_MIN -#endif - -#ifndef UV_MAX -# define UV_MAX PERL_UINT_MAX -#endif - -# ifdef INTSIZE -#ifndef IVSIZE -# define IVSIZE INTSIZE -#endif - -# endif -# else -# if defined(convex) || defined(uts) -#ifndef IVTYPE -# define IVTYPE long long -#endif - -#ifndef IV_MIN -# define IV_MIN PERL_QUAD_MIN -#endif - -#ifndef IV_MAX -# define IV_MAX PERL_QUAD_MAX -#endif - -#ifndef UV_MIN -# define UV_MIN PERL_UQUAD_MIN -#endif - -#ifndef UV_MAX -# define UV_MAX PERL_UQUAD_MAX -#endif - -# ifdef LONGLONGSIZE -#ifndef IVSIZE -# define IVSIZE LONGLONGSIZE -#endif - -# endif -# else -#ifndef IVTYPE -# define IVTYPE long -#endif - -#ifndef IV_MIN -# define IV_MIN PERL_LONG_MIN -#endif - -#ifndef IV_MAX -# define IV_MAX PERL_LONG_MAX -#endif - -#ifndef UV_MIN -# define UV_MIN PERL_ULONG_MIN -#endif - -#ifndef UV_MAX -# define UV_MAX PERL_ULONG_MAX -#endif - -# ifdef LONGSIZE -#ifndef IVSIZE -# define IVSIZE LONGSIZE -#endif - -# endif -# endif -# endif -#ifndef IVSIZE -# define IVSIZE 8 -#endif - -#ifndef PERL_QUAD_MIN -# define PERL_QUAD_MIN IV_MIN -#endif - -#ifndef PERL_QUAD_MAX -# define PERL_QUAD_MAX IV_MAX -#endif - -#ifndef PERL_UQUAD_MIN -# define PERL_UQUAD_MIN UV_MIN -#endif - -#ifndef PERL_UQUAD_MAX -# define PERL_UQUAD_MAX UV_MAX -#endif - -#else -#ifndef IVTYPE -# define IVTYPE long -#endif - -#ifndef IV_MIN -# define IV_MIN PERL_LONG_MIN -#endif - -#ifndef IV_MAX -# define IV_MAX PERL_LONG_MAX -#endif - -#ifndef UV_MIN -# define UV_MIN PERL_ULONG_MIN -#endif - -#ifndef UV_MAX -# define UV_MAX PERL_ULONG_MAX -#endif - -#endif - -#ifndef IVSIZE -# ifdef LONGSIZE -# define IVSIZE LONGSIZE -# else -# define IVSIZE 4 /* A bold guess, but the best we can make. */ -# endif -#endif -#ifndef UVTYPE -# define UVTYPE unsigned IVTYPE -#endif - -#ifndef UVSIZE -# define UVSIZE IVSIZE -#endif - -#ifndef sv_setuv -# define sv_setuv(sv, uv) \ - STMT_START { \ - UV TeMpUv = uv; \ - if (TeMpUv <= IV_MAX) \ - sv_setiv(sv, TeMpUv); \ - else \ - sv_setnv(sv, (double)TeMpUv); \ - } STMT_END -#endif - -#ifndef newSVuv -# define newSVuv(uv) ((uv) <= IV_MAX ? newSViv((IV)uv) : newSVnv((NV)uv)) -#endif -#ifndef sv_2uv -# define sv_2uv(sv) ((PL_Sv = (sv)), (UV) (SvNOK(PL_Sv) ? SvNV(PL_Sv) : sv_2nv(PL_Sv))) -#endif - -#ifndef SvUVX -# define SvUVX(sv) ((UV)SvIVX(sv)) -#endif - -#ifndef SvUVXx -# define SvUVXx(sv) SvUVX(sv) -#endif - -#ifndef SvUV -# define SvUV(sv) (SvIOK(sv) ? SvUVX(sv) : sv_2uv(sv)) -#endif - -#ifndef SvUVx -# define SvUVx(sv) ((PL_Sv = (sv)), SvUV(PL_Sv)) -#endif - -/* Hint: sv_uv - * Always use the SvUVx() macro instead of sv_uv(). - */ -#ifndef sv_uv -# define sv_uv(sv) SvUVx(sv) -#endif -#ifndef XST_mUV -# define XST_mUV(i,v) (ST(i) = sv_2mortal(newSVuv(v)) ) -#endif - -#ifndef XSRETURN_UV -# define XSRETURN_UV(v) STMT_START { XST_mUV(0,v); XSRETURN(1); } STMT_END -#endif -#ifndef PUSHu -# define PUSHu(u) STMT_START { sv_setuv(TARG, (UV)(u)); PUSHTARG; } STMT_END -#endif - -#ifndef XPUSHu -# define XPUSHu(u) STMT_START { sv_setuv(TARG, (UV)(u)); XPUSHTARG; } STMT_END -#endif - -#if (PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5)) -/* Replace: 1 */ -# define PL_DBsingle DBsingle -# define PL_DBsub DBsub -# define PL_Sv Sv -# define PL_compiling compiling -# define PL_copline copline -# define PL_curcop curcop -# define PL_curstash curstash -# define PL_debstash debstash -# define PL_defgv defgv -# define PL_diehook diehook -# define PL_dirty dirty -# define PL_dowarn dowarn -# define PL_errgv errgv -# define PL_hexdigit hexdigit -# define PL_hints hints -# define PL_na na -# define PL_no_modify no_modify -# define PL_perl_destruct_level perl_destruct_level -# define PL_perldb perldb -# define PL_ppaddr ppaddr -# define PL_rsfp_filters rsfp_filters -# define PL_rsfp rsfp -# define PL_stack_base stack_base -# define PL_stack_sp stack_sp -# define PL_stdingv stdingv -# define PL_sv_arenaroot sv_arenaroot -# define PL_sv_no sv_no -# define PL_sv_undef sv_undef -# define PL_sv_yes sv_yes -# define PL_tainted tainted -# define PL_tainting tainting -/* Replace: 0 */ -#endif - -#ifndef PERL_UNUSED_DECL -# ifdef HASATTRIBUTE -# if (defined(__GNUC__) && defined(__cplusplus)) || defined(__INTEL_COMPILER) -# define PERL_UNUSED_DECL -# else -# define PERL_UNUSED_DECL __attribute__((unused)) -# endif -# else -# define PERL_UNUSED_DECL -# endif -#endif -#ifndef NOOP -# define NOOP (void)0 -#endif - -#ifndef dNOOP -# define dNOOP extern int Perl___notused PERL_UNUSED_DECL -#endif - -#ifndef NVTYPE -# if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) -# define NVTYPE long double -# else -# define NVTYPE double -# endif -typedef NVTYPE NV; -#endif - -#ifndef INT2PTR - -# if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE) -# define PTRV UV -# define INT2PTR(any,d) (any)(d) -# else -# if PTRSIZE == LONGSIZE -# define PTRV unsigned long -# else -# define PTRV unsigned -# endif -# define INT2PTR(any,d) (any)(PTRV)(d) -# endif - -# define NUM2PTR(any,d) (any)(PTRV)(d) -# define PTR2IV(p) INT2PTR(IV,p) -# define PTR2UV(p) INT2PTR(UV,p) -# define PTR2NV(p) NUM2PTR(NV,p) - -# if PTRSIZE == LONGSIZE -# define PTR2ul(p) (unsigned long)(p) -# else -# define PTR2ul(p) INT2PTR(unsigned long,p) -# endif - -#endif /* !INT2PTR */ - -#undef START_EXTERN_C -#undef END_EXTERN_C -#undef EXTERN_C -#ifdef __cplusplus -# define START_EXTERN_C extern "C" { -# define END_EXTERN_C } -# define EXTERN_C extern "C" -#else -# define START_EXTERN_C -# define END_EXTERN_C -# define EXTERN_C extern -#endif - -#ifndef PERL_GCC_BRACE_GROUPS_FORBIDDEN -# if defined(__STRICT_ANSI__) && defined(PERL_GCC_PEDANTIC) -# define PERL_GCC_BRACE_GROUPS_FORBIDDEN -# endif -#endif - -#undef STMT_START -#undef STMT_END -#if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) && !defined(__cplusplus) -# define STMT_START (void)( /* gcc supports ``({ STATEMENTS; })'' */ -# define STMT_END ) -#else -# if defined(VOIDFLAGS) && (VOIDFLAGS) && (defined(sun) || defined(__sun__)) && !defined(__GNUC__) -# define STMT_START if (1) -# define STMT_END else (void)0 -# else -# define STMT_START do -# define STMT_END while (0) -# endif -#endif -#ifndef boolSV -# define boolSV(b) ((b) ? &PL_sv_yes : &PL_sv_no) -#endif - -/* DEFSV appears first in 5.004_56 */ -#ifndef DEFSV -# define DEFSV GvSV(PL_defgv) -#endif - -#ifndef SAVE_DEFSV -# define SAVE_DEFSV SAVESPTR(GvSV(PL_defgv)) -#endif - -/* Older perls (<=5.003) lack AvFILLp */ -#ifndef AvFILLp -# define AvFILLp AvFILL -#endif -#ifndef ERRSV -# define ERRSV get_sv("@",FALSE) -#endif -#ifndef newSVpvn -# define newSVpvn(data,len) ((data) \ - ? ((len) ? newSVpv((data), (len)) : newSVpv("", 0)) \ - : newSV(0)) -#endif - -/* Hint: gv_stashpvn - * This function's backport doesn't support the length parameter, but - * rather ignores it. Portability can only be ensured if the length - * parameter is used for speed reasons, but the length can always be - * correctly computed from the string argument. - */ -#ifndef gv_stashpvn -# define gv_stashpvn(str,len,create) gv_stashpv(str,create) -#endif - -/* Replace: 1 */ -#ifndef get_cv -# define get_cv perl_get_cv -#endif - -#ifndef get_sv -# define get_sv perl_get_sv -#endif - -#ifndef get_av -# define get_av perl_get_av -#endif - -#ifndef get_hv -# define get_hv perl_get_hv -#endif - -/* Replace: 0 */ - -#ifdef HAS_MEMCMP -#ifndef memNE -# define memNE(s1,s2,l) (memcmp(s1,s2,l)) -#endif - -#ifndef memEQ -# define memEQ(s1,s2,l) (!memcmp(s1,s2,l)) -#endif - -#else -#ifndef memNE -# define memNE(s1,s2,l) (bcmp(s1,s2,l)) -#endif - -#ifndef memEQ -# define memEQ(s1,s2,l) (!bcmp(s1,s2,l)) -#endif - -#endif -#ifndef MoveD -# define MoveD(s,d,n,t) memmove((char*)(d),(char*)(s), (n) * sizeof(t)) -#endif - -#ifndef CopyD -# define CopyD(s,d,n,t) memcpy((char*)(d),(char*)(s), (n) * sizeof(t)) -#endif - -#ifdef HAS_MEMSET -#ifndef ZeroD -# define ZeroD(d,n,t) memzero((char*)(d), (n) * sizeof(t)) -#endif - -#else -#ifndef ZeroD -# define ZeroD(d,n,t) ((void)memzero((char*)(d), (n) * sizeof(t)),d) -#endif - -#endif -#ifndef Poison -# define Poison(d,n,t) (void)memset((char*)(d), 0xAB, (n) * sizeof(t)) -#endif -#ifndef dUNDERBAR -# define dUNDERBAR dNOOP -#endif - -#ifndef UNDERBAR -# define UNDERBAR DEFSV -#endif -#ifndef dAX -# define dAX I32 ax = MARK - PL_stack_base + 1 -#endif - -#ifndef dITEMS -# define dITEMS I32 items = SP - MARK -#endif -#ifndef dXSTARG -# define dXSTARG SV * targ = sv_newmortal() -#endif -#ifndef dTHR -# define dTHR dNOOP -#endif -#ifndef dTHX -# define dTHX dNOOP -#endif - -#ifndef dTHXa -# define dTHXa(x) dNOOP -#endif -#ifndef pTHX -# define pTHX void -#endif - -#ifndef pTHX_ -# define pTHX_ -#endif - -#ifndef aTHX -# define aTHX -#endif - -#ifndef aTHX_ -# define aTHX_ -#endif -#ifndef dTHXoa -# define dTHXoa(x) dTHXa(x) -#endif -#ifndef PUSHmortal -# define PUSHmortal PUSHs(sv_newmortal()) -#endif - -#ifndef mPUSHp -# define mPUSHp(p,l) sv_setpvn_mg(PUSHmortal, (p), (l)) -#endif - -#ifndef mPUSHn -# define mPUSHn(n) sv_setnv_mg(PUSHmortal, (NV)(n)) -#endif - -#ifndef mPUSHi -# define mPUSHi(i) sv_setiv_mg(PUSHmortal, (IV)(i)) -#endif - -#ifndef mPUSHu -# define mPUSHu(u) sv_setuv_mg(PUSHmortal, (UV)(u)) -#endif -#ifndef XPUSHmortal -# define XPUSHmortal XPUSHs(sv_newmortal()) -#endif - -#ifndef mXPUSHp -# define mXPUSHp(p,l) STMT_START { EXTEND(sp,1); sv_setpvn_mg(PUSHmortal, (p), (l)); } STMT_END -#endif - -#ifndef mXPUSHn -# define mXPUSHn(n) STMT_START { EXTEND(sp,1); sv_setnv_mg(PUSHmortal, (NV)(n)); } STMT_END -#endif - -#ifndef mXPUSHi -# define mXPUSHi(i) STMT_START { EXTEND(sp,1); sv_setiv_mg(PUSHmortal, (IV)(i)); } STMT_END -#endif - -#ifndef mXPUSHu -# define mXPUSHu(u) STMT_START { EXTEND(sp,1); sv_setuv_mg(PUSHmortal, (UV)(u)); } STMT_END -#endif - -/* Replace: 1 */ -#ifndef call_sv -# define call_sv perl_call_sv -#endif - -#ifndef call_pv -# define call_pv perl_call_pv -#endif - -#ifndef call_argv -# define call_argv perl_call_argv -#endif - -#ifndef call_method -# define call_method perl_call_method -#endif -#ifndef eval_sv -# define eval_sv perl_eval_sv -#endif - -/* Replace: 0 */ - -/* Replace perl_eval_pv with eval_pv */ -/* eval_pv depends on eval_sv */ - -#ifndef eval_pv -#if defined(NEED_eval_pv) -static SV* DPPP_(my_eval_pv)(char *p, I32 croak_on_error); -static -#else -extern SV* DPPP_(my_eval_pv)(char *p, I32 croak_on_error); -#endif - -#ifdef eval_pv -# undef eval_pv -#endif -#define eval_pv(a,b) DPPP_(my_eval_pv)(aTHX_ a,b) -#define Perl_eval_pv DPPP_(my_eval_pv) - -#if defined(NEED_eval_pv) || defined(NEED_eval_pv_GLOBAL) - -SV* -DPPP_(my_eval_pv)(char *p, I32 croak_on_error) -{ - dSP; - SV* sv = newSVpv(p, 0); - - PUSHMARK(sp); - eval_sv(sv, G_SCALAR); - SvREFCNT_dec(sv); - - SPAGAIN; - sv = POPs; - PUTBACK; - - if (croak_on_error && SvTRUE(GvSV(errgv))) - croak(SvPVx(GvSV(errgv), na)); - - return sv; -} - -#endif -#endif -#ifndef newRV_inc -# define newRV_inc(sv) newRV(sv) /* Replace */ -#endif - -#ifndef newRV_noinc -#if defined(NEED_newRV_noinc) -static SV * DPPP_(my_newRV_noinc)(SV *sv); -static -#else -extern SV * DPPP_(my_newRV_noinc)(SV *sv); -#endif - -#ifdef newRV_noinc -# undef newRV_noinc -#endif -#define newRV_noinc(a) DPPP_(my_newRV_noinc)(aTHX_ a) -#define Perl_newRV_noinc DPPP_(my_newRV_noinc) - -#if defined(NEED_newRV_noinc) || defined(NEED_newRV_noinc_GLOBAL) -SV * -DPPP_(my_newRV_noinc)(SV *sv) -{ - SV *rv = (SV *)newRV(sv); - SvREFCNT_dec(sv); - return rv; -} -#endif -#endif - -/* Hint: newCONSTSUB - * Returns a CV* as of perl-5.7.1. This return value is not supported - * by Devel::PPPort. - */ - -/* newCONSTSUB from IO.xs is in the core starting with 5.004_63 */ -#if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION < 63))) && ((PERL_VERSION != 4) || (PERL_SUBVERSION != 5)) -#if defined(NEED_newCONSTSUB) -static void DPPP_(my_newCONSTSUB)(HV *stash, char *name, SV *sv); -static -#else -extern void DPPP_(my_newCONSTSUB)(HV *stash, char *name, SV *sv); -#endif - -#ifdef newCONSTSUB -# undef newCONSTSUB -#endif -#define newCONSTSUB(a,b,c) DPPP_(my_newCONSTSUB)(aTHX_ a,b,c) -#define Perl_newCONSTSUB DPPP_(my_newCONSTSUB) - -#if defined(NEED_newCONSTSUB) || defined(NEED_newCONSTSUB_GLOBAL) - -void -DPPP_(my_newCONSTSUB)(HV *stash, char *name, SV *sv) -{ - U32 oldhints = PL_hints; - HV *old_cop_stash = PL_curcop->cop_stash; - HV *old_curstash = PL_curstash; - line_t oldline = PL_curcop->cop_line; - PL_curcop->cop_line = PL_copline; - - PL_hints &= ~HINT_BLOCK_SCOPE; - if (stash) - PL_curstash = PL_curcop->cop_stash = stash; - - newSUB( - -#if ((PERL_VERSION < 3) || ((PERL_VERSION == 3) && (PERL_SUBVERSION < 22))) - start_subparse(), -#elif ((PERL_VERSION == 3) && (PERL_SUBVERSION == 22)) - start_subparse(0), -#else /* 5.003_23 onwards */ - start_subparse(FALSE, 0), -#endif - - newSVOP(OP_CONST, 0, newSVpv(name,0)), - newSVOP(OP_CONST, 0, &PL_sv_no), /* SvPV(&PL_sv_no) == "" -- GMB */ - newSTATEOP(0, Nullch, newSVOP(OP_CONST, 0, sv)) - ); - - PL_hints = oldhints; - PL_curcop->cop_stash = old_cop_stash; - PL_curstash = old_curstash; - PL_curcop->cop_line = oldline; -} -#endif -#endif - -/* - * Boilerplate macros for initializing and accessing interpreter-local - * data from C. All statics in extensions should be reworked to use - * this, if you want to make the extension thread-safe. See ext/re/re.xs - * for an example of the use of these macros. - * - * Code that uses these macros is responsible for the following: - * 1. #define MY_CXT_KEY to a unique string, e.g. "DynaLoader_guts" - * 2. Declare a typedef named my_cxt_t that is a structure that contains - * all the data that needs to be interpreter-local. - * 3. Use the START_MY_CXT macro after the declaration of my_cxt_t. - * 4. Use the MY_CXT_INIT macro such that it is called exactly once - * (typically put in the BOOT: section). - * 5. Use the members of the my_cxt_t structure everywhere as - * MY_CXT.member. - * 6. Use the dMY_CXT macro (a declaration) in all the functions that - * access MY_CXT. - */ - -#if defined(MULTIPLICITY) || defined(PERL_OBJECT) || \ - defined(PERL_CAPI) || defined(PERL_IMPLICIT_CONTEXT) - -#ifndef START_MY_CXT - -/* This must appear in all extensions that define a my_cxt_t structure, - * right after the definition (i.e. at file scope). The non-threads - * case below uses it to declare the data as static. */ -#define START_MY_CXT - -#if (PERL_VERSION < 4 || (PERL_VERSION == 4 && PERL_SUBVERSION < 68 )) -/* Fetches the SV that keeps the per-interpreter data. */ -#define dMY_CXT_SV \ - SV *my_cxt_sv = get_sv(MY_CXT_KEY, FALSE) -#else /* >= perl5.004_68 */ -#define dMY_CXT_SV \ - SV *my_cxt_sv = *hv_fetch(PL_modglobal, MY_CXT_KEY, \ - sizeof(MY_CXT_KEY)-1, TRUE) -#endif /* < perl5.004_68 */ - -/* This declaration should be used within all functions that use the - * interpreter-local data. */ -#define dMY_CXT \ - dMY_CXT_SV; \ - my_cxt_t *my_cxtp = INT2PTR(my_cxt_t*,SvUV(my_cxt_sv)) - -/* Creates and zeroes the per-interpreter data. - * (We allocate my_cxtp in a Perl SV so that it will be released when - * the interpreter goes away.) */ -#define MY_CXT_INIT \ - dMY_CXT_SV; \ - /* newSV() allocates one more than needed */ \ - my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\ - Zero(my_cxtp, 1, my_cxt_t); \ - sv_setuv(my_cxt_sv, PTR2UV(my_cxtp)) - -/* This macro must be used to access members of the my_cxt_t structure. - * e.g. MYCXT.some_data */ -#define MY_CXT (*my_cxtp) - -/* Judicious use of these macros can reduce the number of times dMY_CXT - * is used. Use is similar to pTHX, aTHX etc. */ -#define pMY_CXT my_cxt_t *my_cxtp -#define pMY_CXT_ pMY_CXT, -#define _pMY_CXT ,pMY_CXT -#define aMY_CXT my_cxtp -#define aMY_CXT_ aMY_CXT, -#define _aMY_CXT ,aMY_CXT - -#endif /* START_MY_CXT */ - -#ifndef MY_CXT_CLONE -/* Clones the per-interpreter data. */ -#define MY_CXT_CLONE \ - dMY_CXT_SV; \ - my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\ - Copy(INT2PTR(my_cxt_t*, SvUV(my_cxt_sv)), my_cxtp, 1, my_cxt_t);\ - sv_setuv(my_cxt_sv, PTR2UV(my_cxtp)) -#endif - -#else /* single interpreter */ - -#ifndef START_MY_CXT - -#define START_MY_CXT static my_cxt_t my_cxt; -#define dMY_CXT_SV dNOOP -#define dMY_CXT dNOOP -#define MY_CXT_INIT NOOP -#define MY_CXT my_cxt - -#define pMY_CXT void -#define pMY_CXT_ -#define _pMY_CXT -#define aMY_CXT -#define aMY_CXT_ -#define _aMY_CXT - -#endif /* START_MY_CXT */ - -#ifndef MY_CXT_CLONE -#define MY_CXT_CLONE NOOP -#endif - -#endif - -#ifndef IVdf -# if IVSIZE == LONGSIZE -# define IVdf "ld" -# define UVuf "lu" -# define UVof "lo" -# define UVxf "lx" -# define UVXf "lX" -# else -# if IVSIZE == INTSIZE -# define IVdf "d" -# define UVuf "u" -# define UVof "o" -# define UVxf "x" -# define UVXf "X" -# endif -# endif -#endif - -#ifndef NVef -# if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && \ - defined(PERL_PRIfldbl) /* Not very likely, but let's try anyway. */ -# define NVef PERL_PRIeldbl -# define NVff PERL_PRIfldbl -# define NVgf PERL_PRIgldbl -# else -# define NVef "e" -# define NVff "f" -# define NVgf "g" -# endif -#endif - -#ifndef SvPV_nolen - -#if defined(NEED_sv_2pv_nolen) -static char * DPPP_(my_sv_2pv_nolen)(pTHX_ register SV *sv); -static -#else -extern char * DPPP_(my_sv_2pv_nolen)(pTHX_ register SV *sv); -#endif - -#ifdef sv_2pv_nolen -# undef sv_2pv_nolen -#endif -#define sv_2pv_nolen(a) DPPP_(my_sv_2pv_nolen)(aTHX_ a) -#define Perl_sv_2pv_nolen DPPP_(my_sv_2pv_nolen) - -#if defined(NEED_sv_2pv_nolen) || defined(NEED_sv_2pv_nolen_GLOBAL) - -char * -DPPP_(my_sv_2pv_nolen)(pTHX_ register SV *sv) -{ - STRLEN n_a; - return sv_2pv(sv, &n_a); -} - -#endif - -/* Hint: sv_2pv_nolen - * Use the SvPV_nolen() macro instead of sv_2pv_nolen(). - */ - -/* SvPV_nolen depends on sv_2pv_nolen */ -#define SvPV_nolen(sv) \ - ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ - ? SvPVX(sv) : sv_2pv_nolen(sv)) - -#endif - -#ifdef SvPVbyte - -/* Hint: SvPVbyte - * Does not work in perl-5.6.1, ppport.h implements a version - * borrowed from perl-5.7.3. - */ - -#if ((PERL_VERSION < 7) || ((PERL_VERSION == 7) && (PERL_SUBVERSION < 0))) - -#if defined(NEED_sv_2pvbyte) -static char * DPPP_(my_sv_2pvbyte)(pTHX_ register SV *sv, STRLEN *lp); -static -#else -extern char * DPPP_(my_sv_2pvbyte)(pTHX_ register SV *sv, STRLEN *lp); -#endif - -#ifdef sv_2pvbyte -# undef sv_2pvbyte -#endif -#define sv_2pvbyte(a,b) DPPP_(my_sv_2pvbyte)(aTHX_ a,b) -#define Perl_sv_2pvbyte DPPP_(my_sv_2pvbyte) - -#if defined(NEED_sv_2pvbyte) || defined(NEED_sv_2pvbyte_GLOBAL) - -char * -DPPP_(my_sv_2pvbyte)(pTHX_ register SV *sv, STRLEN *lp) -{ - sv_utf8_downgrade(sv,0); - return SvPV(sv,*lp); -} - -#endif - -/* Hint: sv_2pvbyte - * Use the SvPVbyte() macro instead of sv_2pvbyte(). - */ - -#undef SvPVbyte - -/* SvPVbyte depends on sv_2pvbyte */ -#define SvPVbyte(sv, lp) \ - ((SvFLAGS(sv) & (SVf_POK|SVf_UTF8)) == (SVf_POK) \ - ? ((lp = SvCUR(sv)), SvPVX(sv)) : sv_2pvbyte(sv, &lp)) - -#endif - -#else - -# define SvPVbyte SvPV -# define sv_2pvbyte sv_2pv - -#endif - -/* sv_2pvbyte_nolen depends on sv_2pv_nolen */ -#ifndef sv_2pvbyte_nolen -# define sv_2pvbyte_nolen sv_2pv_nolen -#endif - -/* Hint: sv_pvn - * Always use the SvPV() macro instead of sv_pvn(). - */ -#ifndef sv_pvn -# define sv_pvn(sv, len) SvPV(sv, len) -#endif - -/* Hint: sv_pvn_force - * Always use the SvPV_force() macro instead of sv_pvn_force(). - */ -#ifndef sv_pvn_force -# define sv_pvn_force(sv, len) SvPV_force(sv, len) -#endif - -#if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0))) && !defined(vnewSVpvf) -#if defined(NEED_vnewSVpvf) -static SV * DPPP_(my_vnewSVpvf)(pTHX_ const char * pat, va_list * args); -static -#else -extern SV * DPPP_(my_vnewSVpvf)(pTHX_ const char * pat, va_list * args); -#endif - -#ifdef vnewSVpvf -# undef vnewSVpvf -#endif -#define vnewSVpvf(a,b) DPPP_(my_vnewSVpvf)(aTHX_ a,b) -#define Perl_vnewSVpvf DPPP_(my_vnewSVpvf) - -#if defined(NEED_vnewSVpvf) || defined(NEED_vnewSVpvf_GLOBAL) - -SV * -DPPP_(my_vnewSVpvf)(pTHX_ const char *pat, va_list *args) -{ - register SV *sv = newSV(0); - sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)); - return sv; -} - -#endif -#endif - -/* sv_vcatpvf depends on sv_vcatpvfn */ -#if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0))) && !defined(sv_vcatpvf) -# define sv_vcatpvf(sv, pat, args) sv_vcatpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)) -#endif - -/* sv_vsetpvf depends on sv_vsetpvfn */ -#if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0))) && !defined(sv_vsetpvf) -# define sv_vsetpvf(sv, pat, args) sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)) -#endif - -/* sv_catpvf_mg depends on sv_vcatpvfn, sv_catpvf_mg_nocontext */ -#if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0))) && !defined(sv_catpvf_mg) -#if defined(NEED_sv_catpvf_mg) -static void DPPP_(my_sv_catpvf_mg)(pTHX_ SV * sv, const char * pat, ...); -static -#else -extern void DPPP_(my_sv_catpvf_mg)(pTHX_ SV * sv, const char * pat, ...); -#endif - -#define Perl_sv_catpvf_mg DPPP_(my_sv_catpvf_mg) - -#if defined(NEED_sv_catpvf_mg) || defined(NEED_sv_catpvf_mg_GLOBAL) - -void -DPPP_(my_sv_catpvf_mg)(pTHX_ SV *sv, const char *pat, ...) -{ - va_list args; - va_start(args, pat); - sv_vcatpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); - SvSETMAGIC(sv); - va_end(args); -} - -#endif -#endif - -/* sv_catpvf_mg_nocontext depends on sv_vcatpvfn */ -#ifdef PERL_IMPLICIT_CONTEXT -#if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0))) && !defined(sv_catpvf_mg_nocontext) -#if defined(NEED_sv_catpvf_mg_nocontext) -static void DPPP_(my_sv_catpvf_mg_nocontext)(SV * sv, const char * pat, ...); -static -#else -extern void DPPP_(my_sv_catpvf_mg_nocontext)(SV * sv, const char * pat, ...); -#endif - -#define sv_catpvf_mg_nocontext DPPP_(my_sv_catpvf_mg_nocontext) -#define Perl_sv_catpvf_mg_nocontext DPPP_(my_sv_catpvf_mg_nocontext) - -#if defined(NEED_sv_catpvf_mg_nocontext) || defined(NEED_sv_catpvf_mg_nocontext_GLOBAL) - -void -DPPP_(my_sv_catpvf_mg_nocontext)(SV *sv, const char *pat, ...) -{ - dTHX; - va_list args; - va_start(args, pat); - sv_vcatpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); - SvSETMAGIC(sv); - va_end(args); -} - -#endif -#endif -#endif - -#ifndef sv_catpvf_mg -# ifdef PERL_IMPLICIT_CONTEXT -# define sv_catpvf_mg Perl_sv_catpvf_mg_nocontext -# else -# define sv_catpvf_mg Perl_sv_catpvf_mg -# endif -#endif - -/* sv_vcatpvf_mg depends on sv_vcatpvfn */ -#if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0))) && !defined(sv_vcatpvf_mg) -# define sv_vcatpvf_mg(sv, pat, args) \ - STMT_START { \ - sv_vcatpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)); \ - SvSETMAGIC(sv); \ - } STMT_END -#endif - -/* sv_setpvf_mg depends on sv_vsetpvfn, sv_setpvf_mg_nocontext */ -#if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0))) && !defined(sv_setpvf_mg) -#if defined(NEED_sv_setpvf_mg) -static void DPPP_(my_sv_setpvf_mg)(pTHX_ SV * sv, const char * pat, ...); -static -#else -extern void DPPP_(my_sv_setpvf_mg)(pTHX_ SV * sv, const char * pat, ...); -#endif - -#define Perl_sv_setpvf_mg DPPP_(my_sv_setpvf_mg) - -#if defined(NEED_sv_setpvf_mg) || defined(NEED_sv_setpvf_mg_GLOBAL) - -void -DPPP_(my_sv_setpvf_mg)(pTHX_ SV *sv, const char *pat, ...) -{ - va_list args; - va_start(args, pat); - sv_vsetpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); - SvSETMAGIC(sv); - va_end(args); -} - -#endif -#endif - -/* sv_setpvf_mg_nocontext depends on sv_vsetpvfn */ -#ifdef PERL_IMPLICIT_CONTEXT -#if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0))) && !defined(sv_setpvf_mg_nocontext) -#if defined(NEED_sv_setpvf_mg_nocontext) -static void DPPP_(my_sv_setpvf_mg_nocontext)(SV * sv, const char * pat, ...); -static -#else -extern void DPPP_(my_sv_setpvf_mg_nocontext)(SV * sv, const char * pat, ...); -#endif - -#define sv_setpvf_mg_nocontext DPPP_(my_sv_setpvf_mg_nocontext) -#define Perl_sv_setpvf_mg_nocontext DPPP_(my_sv_setpvf_mg_nocontext) - -#if defined(NEED_sv_setpvf_mg_nocontext) || defined(NEED_sv_setpvf_mg_nocontext_GLOBAL) - -void -DPPP_(my_sv_setpvf_mg_nocontext)(SV *sv, const char *pat, ...) -{ - dTHX; - va_list args; - va_start(args, pat); - sv_vsetpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); - SvSETMAGIC(sv); - va_end(args); -} - -#endif -#endif -#endif - -#ifndef sv_setpvf_mg -# ifdef PERL_IMPLICIT_CONTEXT -# define sv_setpvf_mg Perl_sv_setpvf_mg_nocontext -# else -# define sv_setpvf_mg Perl_sv_setpvf_mg -# endif -#endif - -/* sv_vsetpvf_mg depends on sv_vsetpvfn */ -#if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0))) && !defined(sv_vsetpvf_mg) -# define sv_vsetpvf_mg(sv, pat, args) \ - STMT_START { \ - sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)); \ - SvSETMAGIC(sv); \ - } STMT_END -#endif -#ifndef SvGETMAGIC -# define SvGETMAGIC(x) STMT_START { if (SvGMAGICAL(x)) mg_get(x); } STMT_END -#endif -#ifndef PERL_MAGIC_sv -# define PERL_MAGIC_sv '\0' -#endif - -#ifndef PERL_MAGIC_overload -# define PERL_MAGIC_overload 'A' -#endif - -#ifndef PERL_MAGIC_overload_elem -# define PERL_MAGIC_overload_elem 'a' -#endif - -#ifndef PERL_MAGIC_overload_table -# define PERL_MAGIC_overload_table 'c' -#endif - -#ifndef PERL_MAGIC_bm -# define PERL_MAGIC_bm 'B' -#endif - -#ifndef PERL_MAGIC_regdata -# define PERL_MAGIC_regdata 'D' -#endif - -#ifndef PERL_MAGIC_regdatum -# define PERL_MAGIC_regdatum 'd' -#endif - -#ifndef PERL_MAGIC_env -# define PERL_MAGIC_env 'E' -#endif - -#ifndef PERL_MAGIC_envelem -# define PERL_MAGIC_envelem 'e' -#endif - -#ifndef PERL_MAGIC_fm -# define PERL_MAGIC_fm 'f' -#endif - -#ifndef PERL_MAGIC_regex_global -# define PERL_MAGIC_regex_global 'g' -#endif - -#ifndef PERL_MAGIC_isa -# define PERL_MAGIC_isa 'I' -#endif - -#ifndef PERL_MAGIC_isaelem -# define PERL_MAGIC_isaelem 'i' -#endif - -#ifndef PERL_MAGIC_nkeys -# define PERL_MAGIC_nkeys 'k' -#endif - -#ifndef PERL_MAGIC_dbfile -# define PERL_MAGIC_dbfile 'L' -#endif - -#ifndef PERL_MAGIC_dbline -# define PERL_MAGIC_dbline 'l' -#endif - -#ifndef PERL_MAGIC_mutex -# define PERL_MAGIC_mutex 'm' -#endif - -#ifndef PERL_MAGIC_shared -# define PERL_MAGIC_shared 'N' -#endif - -#ifndef PERL_MAGIC_shared_scalar -# define PERL_MAGIC_shared_scalar 'n' -#endif - -#ifndef PERL_MAGIC_collxfrm -# define PERL_MAGIC_collxfrm 'o' -#endif - -#ifndef PERL_MAGIC_tied -# define PERL_MAGIC_tied 'P' -#endif - -#ifndef PERL_MAGIC_tiedelem -# define PERL_MAGIC_tiedelem 'p' -#endif - -#ifndef PERL_MAGIC_tiedscalar -# define PERL_MAGIC_tiedscalar 'q' -#endif - -#ifndef PERL_MAGIC_qr -# define PERL_MAGIC_qr 'r' -#endif - -#ifndef PERL_MAGIC_sig -# define PERL_MAGIC_sig 'S' -#endif - -#ifndef PERL_MAGIC_sigelem -# define PERL_MAGIC_sigelem 's' -#endif - -#ifndef PERL_MAGIC_taint -# define PERL_MAGIC_taint 't' -#endif - -#ifndef PERL_MAGIC_uvar -# define PERL_MAGIC_uvar 'U' -#endif - -#ifndef PERL_MAGIC_uvar_elem -# define PERL_MAGIC_uvar_elem 'u' -#endif - -#ifndef PERL_MAGIC_vstring -# define PERL_MAGIC_vstring 'V' -#endif - -#ifndef PERL_MAGIC_vec -# define PERL_MAGIC_vec 'v' -#endif - -#ifndef PERL_MAGIC_utf8 -# define PERL_MAGIC_utf8 'w' -#endif - -#ifndef PERL_MAGIC_substr -# define PERL_MAGIC_substr 'x' -#endif - -#ifndef PERL_MAGIC_defelem -# define PERL_MAGIC_defelem 'y' -#endif - -#ifndef PERL_MAGIC_glob -# define PERL_MAGIC_glob '*' -#endif - -#ifndef PERL_MAGIC_arylen -# define PERL_MAGIC_arylen '#' -#endif - -#ifndef PERL_MAGIC_pos -# define PERL_MAGIC_pos '.' -#endif - -#ifndef PERL_MAGIC_backref -# define PERL_MAGIC_backref '<' -#endif - -#ifndef PERL_MAGIC_ext -# define PERL_MAGIC_ext '~' -#endif - -/* That's the best we can do... */ -#ifndef SvPV_force_nomg -# define SvPV_force_nomg SvPV_force -#endif - -#ifndef SvPV_nomg -# define SvPV_nomg SvPV -#endif - -#ifndef sv_catpvn_nomg -# define sv_catpvn_nomg sv_catpvn -#endif - -#ifndef sv_catsv_nomg -# define sv_catsv_nomg sv_catsv -#endif - -#ifndef sv_setsv_nomg -# define sv_setsv_nomg sv_setsv -#endif - -#ifndef sv_pvn_nomg -# define sv_pvn_nomg sv_pvn -#endif - -#ifndef SvIV_nomg -# define SvIV_nomg SvIV -#endif - -#ifndef SvUV_nomg -# define SvUV_nomg SvUV -#endif - -#ifndef sv_catpv_mg -# define sv_catpv_mg(sv, ptr) \ - STMT_START { \ - SV *TeMpSv = sv; \ - sv_catpv(TeMpSv,ptr); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifndef sv_catpvn_mg -# define sv_catpvn_mg(sv, ptr, len) \ - STMT_START { \ - SV *TeMpSv = sv; \ - sv_catpvn(TeMpSv,ptr,len); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifndef sv_catsv_mg -# define sv_catsv_mg(dsv, ssv) \ - STMT_START { \ - SV *TeMpSv = dsv; \ - sv_catsv(TeMpSv,ssv); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifndef sv_setiv_mg -# define sv_setiv_mg(sv, i) \ - STMT_START { \ - SV *TeMpSv = sv; \ - sv_setiv(TeMpSv,i); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifndef sv_setnv_mg -# define sv_setnv_mg(sv, num) \ - STMT_START { \ - SV *TeMpSv = sv; \ - sv_setnv(TeMpSv,num); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifndef sv_setpv_mg -# define sv_setpv_mg(sv, ptr) \ - STMT_START { \ - SV *TeMpSv = sv; \ - sv_setpv(TeMpSv,ptr); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifndef sv_setpvn_mg -# define sv_setpvn_mg(sv, ptr, len) \ - STMT_START { \ - SV *TeMpSv = sv; \ - sv_setpvn(TeMpSv,ptr,len); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifndef sv_setsv_mg -# define sv_setsv_mg(dsv, ssv) \ - STMT_START { \ - SV *TeMpSv = dsv; \ - sv_setsv(TeMpSv,ssv); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifndef sv_setuv_mg -# define sv_setuv_mg(sv, i) \ - STMT_START { \ - SV *TeMpSv = sv; \ - sv_setuv(TeMpSv,i); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifndef sv_usepvn_mg -# define sv_usepvn_mg(sv, ptr, len) \ - STMT_START { \ - SV *TeMpSv = sv; \ - sv_usepvn(TeMpSv,ptr,len); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifdef USE_ITHREADS -#ifndef CopFILE -# define CopFILE(c) ((c)->cop_file) -#endif - -#ifndef CopFILEGV -# define CopFILEGV(c) (CopFILE(c) ? gv_fetchfile(CopFILE(c)) : Nullgv) -#endif - -#ifndef CopFILE_set -# define CopFILE_set(c,pv) ((c)->cop_file = savepv(pv)) -#endif - -#ifndef CopFILESV -# define CopFILESV(c) (CopFILE(c) ? GvSV(gv_fetchfile(CopFILE(c))) : Nullsv) -#endif - -#ifndef CopFILEAV -# define CopFILEAV(c) (CopFILE(c) ? GvAV(gv_fetchfile(CopFILE(c))) : Nullav) -#endif - -#ifndef CopSTASHPV -# define CopSTASHPV(c) ((c)->cop_stashpv) -#endif - -#ifndef CopSTASHPV_set -# define CopSTASHPV_set(c,pv) ((c)->cop_stashpv = ((pv) ? savepv(pv) : Nullch)) -#endif - -#ifndef CopSTASH -# define CopSTASH(c) (CopSTASHPV(c) ? gv_stashpv(CopSTASHPV(c),GV_ADD) : Nullhv) -#endif - -#ifndef CopSTASH_set -# define CopSTASH_set(c,hv) CopSTASHPV_set(c, (hv) ? HvNAME(hv) : Nullch) -#endif - -#ifndef CopSTASH_eq -# define CopSTASH_eq(c,hv) ((hv) && (CopSTASHPV(c) == HvNAME(hv) \ - || (CopSTASHPV(c) && HvNAME(hv) \ - && strEQ(CopSTASHPV(c), HvNAME(hv))))) -#endif - -#else -#ifndef CopFILEGV -# define CopFILEGV(c) ((c)->cop_filegv) -#endif - -#ifndef CopFILEGV_set -# define CopFILEGV_set(c,gv) ((c)->cop_filegv = (GV*)SvREFCNT_inc(gv)) -#endif - -#ifndef CopFILE_set -# define CopFILE_set(c,pv) CopFILEGV_set((c), gv_fetchfile(pv)) -#endif - -#ifndef CopFILESV -# define CopFILESV(c) (CopFILEGV(c) ? GvSV(CopFILEGV(c)) : Nullsv) -#endif - -#ifndef CopFILEAV -# define CopFILEAV(c) (CopFILEGV(c) ? GvAV(CopFILEGV(c)) : Nullav) -#endif - -#ifndef CopFILE -# define CopFILE(c) (CopFILESV(c) ? SvPVX(CopFILESV(c)) : Nullch) -#endif - -#ifndef CopSTASH -# define CopSTASH(c) ((c)->cop_stash) -#endif - -#ifndef CopSTASH_set -# define CopSTASH_set(c,hv) ((c)->cop_stash = (hv)) -#endif - -#ifndef CopSTASHPV -# define CopSTASHPV(c) (CopSTASH(c) ? HvNAME(CopSTASH(c)) : Nullch) -#endif - -#ifndef CopSTASHPV_set -# define CopSTASHPV_set(c,pv) CopSTASH_set((c), gv_stashpv(pv,GV_ADD)) -#endif - -#ifndef CopSTASH_eq -# define CopSTASH_eq(c,hv) (CopSTASH(c) == (hv)) -#endif - -#endif /* USE_ITHREADS */ -#ifndef IN_PERL_COMPILETIME -# define IN_PERL_COMPILETIME (PL_curcop == &PL_compiling) -#endif - -#ifndef IN_LOCALE_RUNTIME -# define IN_LOCALE_RUNTIME (PL_curcop->op_private & HINT_LOCALE) -#endif - -#ifndef IN_LOCALE_COMPILETIME -# define IN_LOCALE_COMPILETIME (PL_hints & HINT_LOCALE) -#endif - -#ifndef IN_LOCALE -# define IN_LOCALE (IN_PERL_COMPILETIME ? IN_LOCALE_COMPILETIME : IN_LOCALE_RUNTIME) -#endif -#ifndef IS_NUMBER_IN_UV -# define IS_NUMBER_IN_UV 0x01 -#endif - -#ifndef IS_NUMBER_GREATER_THAN_UV_MAX -# define IS_NUMBER_GREATER_THAN_UV_MAX 0x02 -#endif - -#ifndef IS_NUMBER_NOT_INT -# define IS_NUMBER_NOT_INT 0x04 -#endif - -#ifndef IS_NUMBER_NEG -# define IS_NUMBER_NEG 0x08 -#endif - -#ifndef IS_NUMBER_INFINITY -# define IS_NUMBER_INFINITY 0x10 -#endif - -#ifndef IS_NUMBER_NAN -# define IS_NUMBER_NAN 0x20 -#endif - -/* GROK_NUMERIC_RADIX depends on grok_numeric_radix */ -#ifndef GROK_NUMERIC_RADIX -# define GROK_NUMERIC_RADIX(sp, send) grok_numeric_radix(sp, send) -#endif -#ifndef PERL_SCAN_GREATER_THAN_UV_MAX -# define PERL_SCAN_GREATER_THAN_UV_MAX 0x02 -#endif - -#ifndef PERL_SCAN_SILENT_ILLDIGIT -# define PERL_SCAN_SILENT_ILLDIGIT 0x04 -#endif - -#ifndef PERL_SCAN_ALLOW_UNDERSCORES -# define PERL_SCAN_ALLOW_UNDERSCORES 0x01 -#endif - -#ifndef PERL_SCAN_DISALLOW_PREFIX -# define PERL_SCAN_DISALLOW_PREFIX 0x02 -#endif - -#ifndef grok_numeric_radix -#if defined(NEED_grok_numeric_radix) -static bool DPPP_(my_grok_numeric_radix)(pTHX_ const char ** sp, const char * send); -static -#else -extern bool DPPP_(my_grok_numeric_radix)(pTHX_ const char ** sp, const char * send); -#endif - -#ifdef grok_numeric_radix -# undef grok_numeric_radix -#endif -#define grok_numeric_radix(a,b) DPPP_(my_grok_numeric_radix)(aTHX_ a,b) -#define Perl_grok_numeric_radix DPPP_(my_grok_numeric_radix) - -#if defined(NEED_grok_numeric_radix) || defined(NEED_grok_numeric_radix_GLOBAL) -bool -DPPP_(my_grok_numeric_radix)(pTHX_ const char **sp, const char *send) -{ -#ifdef USE_LOCALE_NUMERIC -#ifdef PL_numeric_radix_sv - if (PL_numeric_radix_sv && IN_LOCALE) { - STRLEN len; - char* radix = SvPV(PL_numeric_radix_sv, len); - if (*sp + len <= send && memEQ(*sp, radix, len)) { - *sp += len; - return TRUE; - } - } -#else - /* older perls don't have PL_numeric_radix_sv so the radix - * must manually be requested from locale.h - */ -#include - dTHR; /* needed for older threaded perls */ - struct lconv *lc = localeconv(); - char *radix = lc->decimal_point; - if (radix && IN_LOCALE) { - STRLEN len = strlen(radix); - if (*sp + len <= send && memEQ(*sp, radix, len)) { - *sp += len; - return TRUE; - } - } -#endif /* PERL_VERSION */ -#endif /* USE_LOCALE_NUMERIC */ - /* always try "." if numeric radix didn't match because - * we may have data from different locales mixed */ - if (*sp < send && **sp == '.') { - ++*sp; - return TRUE; - } - return FALSE; -} -#endif -#endif - -/* grok_number depends on grok_numeric_radix */ - -#ifndef grok_number -#if defined(NEED_grok_number) -static int DPPP_(my_grok_number)(pTHX_ const char * pv, STRLEN len, UV * valuep); -static -#else -extern int DPPP_(my_grok_number)(pTHX_ const char * pv, STRLEN len, UV * valuep); -#endif - -#ifdef grok_number -# undef grok_number -#endif -#define grok_number(a,b,c) DPPP_(my_grok_number)(aTHX_ a,b,c) -#define Perl_grok_number DPPP_(my_grok_number) - -#if defined(NEED_grok_number) || defined(NEED_grok_number_GLOBAL) -int -DPPP_(my_grok_number)(pTHX_ const char *pv, STRLEN len, UV *valuep) -{ - const char *s = pv; - const char *send = pv + len; - const UV max_div_10 = UV_MAX / 10; - const char max_mod_10 = UV_MAX % 10; - int numtype = 0; - int sawinf = 0; - int sawnan = 0; - - while (s < send && isSPACE(*s)) - s++; - if (s == send) { - return 0; - } else if (*s == '-') { - s++; - numtype = IS_NUMBER_NEG; - } - else if (*s == '+') - s++; - - if (s == send) - return 0; - - /* next must be digit or the radix separator or beginning of infinity */ - if (isDIGIT(*s)) { - /* UVs are at least 32 bits, so the first 9 decimal digits cannot - overflow. */ - UV value = *s - '0'; - /* This construction seems to be more optimiser friendly. - (without it gcc does the isDIGIT test and the *s - '0' separately) - With it gcc on arm is managing 6 instructions (6 cycles) per digit. - In theory the optimiser could deduce how far to unroll the loop - before checking for overflow. */ - if (++s < send) { - int digit = *s - '0'; - if (digit >= 0 && digit <= 9) { - value = value * 10 + digit; - if (++s < send) { - digit = *s - '0'; - if (digit >= 0 && digit <= 9) { - value = value * 10 + digit; - if (++s < send) { - digit = *s - '0'; - if (digit >= 0 && digit <= 9) { - value = value * 10 + digit; - if (++s < send) { - digit = *s - '0'; - if (digit >= 0 && digit <= 9) { - value = value * 10 + digit; - if (++s < send) { - digit = *s - '0'; - if (digit >= 0 && digit <= 9) { - value = value * 10 + digit; - if (++s < send) { - digit = *s - '0'; - if (digit >= 0 && digit <= 9) { - value = value * 10 + digit; - if (++s < send) { - digit = *s - '0'; - if (digit >= 0 && digit <= 9) { - value = value * 10 + digit; - if (++s < send) { - digit = *s - '0'; - if (digit >= 0 && digit <= 9) { - value = value * 10 + digit; - if (++s < send) { - /* Now got 9 digits, so need to check - each time for overflow. */ - digit = *s - '0'; - while (digit >= 0 && digit <= 9 - && (value < max_div_10 - || (value == max_div_10 - && digit <= max_mod_10))) { - value = value * 10 + digit; - if (++s < send) - digit = *s - '0'; - else - break; - } - if (digit >= 0 && digit <= 9 - && (s < send)) { - /* value overflowed. - skip the remaining digits, don't - worry about setting *valuep. */ - do { - s++; - } while (s < send && isDIGIT(*s)); - numtype |= - IS_NUMBER_GREATER_THAN_UV_MAX; - goto skip_value; - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - numtype |= IS_NUMBER_IN_UV; - if (valuep) - *valuep = value; - - skip_value: - if (GROK_NUMERIC_RADIX(&s, send)) { - numtype |= IS_NUMBER_NOT_INT; - while (s < send && isDIGIT(*s)) /* optional digits after the radix */ - s++; - } - } - else if (GROK_NUMERIC_RADIX(&s, send)) { - numtype |= IS_NUMBER_NOT_INT | IS_NUMBER_IN_UV; /* valuep assigned below */ - /* no digits before the radix means we need digits after it */ - if (s < send && isDIGIT(*s)) { - do { - s++; - } while (s < send && isDIGIT(*s)); - if (valuep) { - /* integer approximation is valid - it's 0. */ - *valuep = 0; - } - } - else - return 0; - } else if (*s == 'I' || *s == 'i') { - s++; if (s == send || (*s != 'N' && *s != 'n')) return 0; - s++; if (s == send || (*s != 'F' && *s != 'f')) return 0; - s++; if (s < send && (*s == 'I' || *s == 'i')) { - s++; if (s == send || (*s != 'N' && *s != 'n')) return 0; - s++; if (s == send || (*s != 'I' && *s != 'i')) return 0; - s++; if (s == send || (*s != 'T' && *s != 't')) return 0; - s++; if (s == send || (*s != 'Y' && *s != 'y')) return 0; - s++; - } - sawinf = 1; - } else if (*s == 'N' || *s == 'n') { - /* XXX TODO: There are signaling NaNs and quiet NaNs. */ - s++; if (s == send || (*s != 'A' && *s != 'a')) return 0; - s++; if (s == send || (*s != 'N' && *s != 'n')) return 0; - s++; - sawnan = 1; - } else - return 0; - - if (sawinf) { - numtype &= IS_NUMBER_NEG; /* Keep track of sign */ - numtype |= IS_NUMBER_INFINITY | IS_NUMBER_NOT_INT; - } else if (sawnan) { - numtype &= IS_NUMBER_NEG; /* Keep track of sign */ - numtype |= IS_NUMBER_NAN | IS_NUMBER_NOT_INT; - } else if (s < send) { - /* we can have an optional exponent part */ - if (*s == 'e' || *s == 'E') { - /* The only flag we keep is sign. Blow away any "it's UV" */ - numtype &= IS_NUMBER_NEG; - numtype |= IS_NUMBER_NOT_INT; - s++; - if (s < send && (*s == '-' || *s == '+')) - s++; - if (s < send && isDIGIT(*s)) { - do { - s++; - } while (s < send && isDIGIT(*s)); - } - else - return 0; - } - } - while (s < send && isSPACE(*s)) - s++; - if (s >= send) - return numtype; - if (len == 10 && memEQ(pv, "0 but true", 10)) { - if (valuep) - *valuep = 0; - return IS_NUMBER_IN_UV; - } - return 0; -} -#endif -#endif - -/* - * The grok_* routines have been modified to use warn() instead of - * Perl_warner(). Also, 'hexdigit' was the former name of PL_hexdigit, - * which is why the stack variable has been renamed to 'xdigit'. - */ - -#ifndef grok_bin -#if defined(NEED_grok_bin) -static UV DPPP_(my_grok_bin)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result); -static -#else -extern UV DPPP_(my_grok_bin)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result); -#endif - -#ifdef grok_bin -# undef grok_bin -#endif -#define grok_bin(a,b,c,d) DPPP_(my_grok_bin)(aTHX_ a,b,c,d) -#define Perl_grok_bin DPPP_(my_grok_bin) - -#if defined(NEED_grok_bin) || defined(NEED_grok_bin_GLOBAL) -UV -DPPP_(my_grok_bin)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result) -{ - const char *s = start; - STRLEN len = *len_p; - UV value = 0; - NV value_nv = 0; - - const UV max_div_2 = UV_MAX / 2; - bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES; - bool overflowed = FALSE; - - if (!(*flags & PERL_SCAN_DISALLOW_PREFIX)) { - /* strip off leading b or 0b. - for compatibility silently suffer "b" and "0b" as valid binary - numbers. */ - if (len >= 1) { - if (s[0] == 'b') { - s++; - len--; - } - else if (len >= 2 && s[0] == '0' && s[1] == 'b') { - s+=2; - len-=2; - } - } - } - - for (; len-- && *s; s++) { - char bit = *s; - if (bit == '0' || bit == '1') { - /* Write it in this wonky order with a goto to attempt to get the - compiler to make the common case integer-only loop pretty tight. - With gcc seems to be much straighter code than old scan_bin. */ - redo: - if (!overflowed) { - if (value <= max_div_2) { - value = (value << 1) | (bit - '0'); - continue; - } - /* Bah. We're just overflowed. */ - warn("Integer overflow in binary number"); - overflowed = TRUE; - value_nv = (NV) value; - } - value_nv *= 2.0; - /* If an NV has not enough bits in its mantissa to - * represent a UV this summing of small low-order numbers - * is a waste of time (because the NV cannot preserve - * the low-order bits anyway): we could just remember when - * did we overflow and in the end just multiply value_nv by the - * right amount. */ - value_nv += (NV)(bit - '0'); - continue; - } - if (bit == '_' && len && allow_underscores && (bit = s[1]) - && (bit == '0' || bit == '1')) - { - --len; - ++s; - goto redo; - } - if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT)) - warn("Illegal binary digit '%c' ignored", *s); - break; - } - - if ( ( overflowed && value_nv > 4294967295.0) -#if UVSIZE > 4 - || (!overflowed && value > 0xffffffff ) -#endif - ) { - warn("Binary number > 0b11111111111111111111111111111111 non-portable"); - } - *len_p = s - start; - if (!overflowed) { - *flags = 0; - return value; - } - *flags = PERL_SCAN_GREATER_THAN_UV_MAX; - if (result) - *result = value_nv; - return UV_MAX; -} -#endif -#endif - -#ifndef grok_hex -#if defined(NEED_grok_hex) -static UV DPPP_(my_grok_hex)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result); -static -#else -extern UV DPPP_(my_grok_hex)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result); -#endif - -#ifdef grok_hex -# undef grok_hex -#endif -#define grok_hex(a,b,c,d) DPPP_(my_grok_hex)(aTHX_ a,b,c,d) -#define Perl_grok_hex DPPP_(my_grok_hex) - -#if defined(NEED_grok_hex) || defined(NEED_grok_hex_GLOBAL) -UV -DPPP_(my_grok_hex)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result) -{ - const char *s = start; - STRLEN len = *len_p; - UV value = 0; - NV value_nv = 0; - - const UV max_div_16 = UV_MAX / 16; - bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES; - bool overflowed = FALSE; - const char *xdigit; - - if (!(*flags & PERL_SCAN_DISALLOW_PREFIX)) { - /* strip off leading x or 0x. - for compatibility silently suffer "x" and "0x" as valid hex numbers. - */ - if (len >= 1) { - if (s[0] == 'x') { - s++; - len--; - } - else if (len >= 2 && s[0] == '0' && s[1] == 'x') { - s+=2; - len-=2; - } - } - } - - for (; len-- && *s; s++) { - xdigit = strchr((char *) PL_hexdigit, *s); - if (xdigit) { - /* Write it in this wonky order with a goto to attempt to get the - compiler to make the common case integer-only loop pretty tight. - With gcc seems to be much straighter code than old scan_hex. */ - redo: - if (!overflowed) { - if (value <= max_div_16) { - value = (value << 4) | ((xdigit - PL_hexdigit) & 15); - continue; - } - warn("Integer overflow in hexadecimal number"); - overflowed = TRUE; - value_nv = (NV) value; - } - value_nv *= 16.0; - /* If an NV has not enough bits in its mantissa to - * represent a UV this summing of small low-order numbers - * is a waste of time (because the NV cannot preserve - * the low-order bits anyway): we could just remember when - * did we overflow and in the end just multiply value_nv by the - * right amount of 16-tuples. */ - value_nv += (NV)((xdigit - PL_hexdigit) & 15); - continue; - } - if (*s == '_' && len && allow_underscores && s[1] - && (xdigit = strchr((char *) PL_hexdigit, s[1]))) - { - --len; - ++s; - goto redo; - } - if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT)) - warn("Illegal hexadecimal digit '%c' ignored", *s); - break; - } - - if ( ( overflowed && value_nv > 4294967295.0) -#if UVSIZE > 4 - || (!overflowed && value > 0xffffffff ) -#endif - ) { - warn("Hexadecimal number > 0xffffffff non-portable"); - } - *len_p = s - start; - if (!overflowed) { - *flags = 0; - return value; - } - *flags = PERL_SCAN_GREATER_THAN_UV_MAX; - if (result) - *result = value_nv; - return UV_MAX; -} -#endif -#endif - -#ifndef grok_oct -#if defined(NEED_grok_oct) -static UV DPPP_(my_grok_oct)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result); -static -#else -extern UV DPPP_(my_grok_oct)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result); -#endif - -#ifdef grok_oct -# undef grok_oct -#endif -#define grok_oct(a,b,c,d) DPPP_(my_grok_oct)(aTHX_ a,b,c,d) -#define Perl_grok_oct DPPP_(my_grok_oct) - -#if defined(NEED_grok_oct) || defined(NEED_grok_oct_GLOBAL) -UV -DPPP_(my_grok_oct)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result) -{ - const char *s = start; - STRLEN len = *len_p; - UV value = 0; - NV value_nv = 0; - - const UV max_div_8 = UV_MAX / 8; - bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES; - bool overflowed = FALSE; - - for (; len-- && *s; s++) { - /* gcc 2.95 optimiser not smart enough to figure that this subtraction - out front allows slicker code. */ - int digit = *s - '0'; - if (digit >= 0 && digit <= 7) { - /* Write it in this wonky order with a goto to attempt to get the - compiler to make the common case integer-only loop pretty tight. - */ - redo: - if (!overflowed) { - if (value <= max_div_8) { - value = (value << 3) | digit; - continue; - } - /* Bah. We're just overflowed. */ - warn("Integer overflow in octal number"); - overflowed = TRUE; - value_nv = (NV) value; - } - value_nv *= 8.0; - /* If an NV has not enough bits in its mantissa to - * represent a UV this summing of small low-order numbers - * is a waste of time (because the NV cannot preserve - * the low-order bits anyway): we could just remember when - * did we overflow and in the end just multiply value_nv by the - * right amount of 8-tuples. */ - value_nv += (NV)digit; - continue; - } - if (digit == ('_' - '0') && len && allow_underscores - && (digit = s[1] - '0') && (digit >= 0 && digit <= 7)) - { - --len; - ++s; - goto redo; - } - /* Allow \octal to work the DWIM way (that is, stop scanning - * as soon as non-octal characters are seen, complain only iff - * someone seems to want to use the digits eight and nine). */ - if (digit == 8 || digit == 9) { - if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT)) - warn("Illegal octal digit '%c' ignored", *s); - } - break; - } - - if ( ( overflowed && value_nv > 4294967295.0) -#if UVSIZE > 4 - || (!overflowed && value > 0xffffffff ) -#endif - ) { - warn("Octal number > 037777777777 non-portable"); - } - *len_p = s - start; - if (!overflowed) { - *flags = 0; - return value; - } - *flags = PERL_SCAN_GREATER_THAN_UV_MAX; - if (result) - *result = value_nv; - return UV_MAX; -} -#endif -#endif - -#ifdef NO_XSLOCKS -# ifdef dJMPENV -# define dXCPT dJMPENV; int rEtV = 0 -# define XCPT_TRY_START JMPENV_PUSH(rEtV); if (rEtV == 0) -# define XCPT_TRY_END JMPENV_POP; -# define XCPT_CATCH if (rEtV != 0) -# define XCPT_RETHROW JMPENV_JUMP(rEtV) -# else -# define dXCPT Sigjmp_buf oldTOP; int rEtV = 0 -# define XCPT_TRY_START Copy(top_env, oldTOP, 1, Sigjmp_buf); rEtV = Sigsetjmp(top_env, 1); if (rEtV == 0) -# define XCPT_TRY_END Copy(oldTOP, top_env, 1, Sigjmp_buf); -# define XCPT_CATCH if (rEtV != 0) -# define XCPT_RETHROW Siglongjmp(top_env, rEtV) -# endif -#endif - -#endif /* _P_P_PORTABILITY_H_ */ - -/* End of File ppport.h */ diff --git a/deps/Jplugin/Changes b/deps/Jplugin/Changes deleted file mode 100644 index a649abe..0000000 --- a/deps/Jplugin/Changes +++ /dev/null @@ -1,6 +0,0 @@ -Revision history for Perl extension Jplugin. - -0.01 Thu Apr 26 22:01:02 2007 - - original version; created by h2xs 1.23 with options - -A -n Jplugin - diff --git a/deps/Jplugin/Jplugin.xs b/deps/Jplugin/Jplugin.xs deleted file mode 100644 index 7fa04b7..0000000 --- a/deps/Jplugin/Jplugin.xs +++ /dev/null @@ -1,89 +0,0 @@ -#include "EXTERN.h" -#include "perl.h" -#include "XSUB.h" - -#include "ppport.h" - -// j intepreter plugin for buubot - -#define _GNU_SOURCE -#include -#include -#include - -#define OUTPUT_MAXLEN 50*1024*1024 - -typedef void *Jinterp_t; -Jinterp_t JInit(void); -int JDo(Jinterp_t jsess, const char *cmd); -int JFree(Jinterp_t jsess); -int JGetM(Jinterp_t jsess, char *cmd, long *type, long *rank, long **shape, void **data); - -int -jplugin(char *cmd) { - Jinterp_t jp = JInit(); - if (JDo(jp, "9!:25]1")) { - fprintf(stderr, "|jplugin error: jdo safe\n"); - goto error; - } - if (JDo(jp, /*"(9!:1](2^31)|6!:9$0)["*/"(9!:33]50)[(9!:21]2^25)[(9!:7]'+++++++++|-')")) { - fprintf(stderr, "|jplugin error: jdo config\n"); - goto error; - } - static const char cmd_prefix[] = "res_boti_=: "; - char *lcmd = malloc(sizeof(cmd_prefix) + strlen(cmd) + 5); - if (!lcmd) { - fprintf(stderr, "|jplugin error: no memory\n"); - goto error; - } - stpcpy(stpcpy(lcmd, cmd_prefix), cmd); - if (JDo(jp, lcmd)) { - if (JDo(jp, "out_boti_=: ]13!:12''")) { - fprintf(stderr, "|jplugin error: jdo geterrmsg\n"); - goto error; - } - } else { - if (JDo(jp, "out_boti_=: 3 :'d=.5!:5 y if. 4!:0 y do. d else.if. ((1>:#@$)*.3!:0 e.2^1 17\"_)y@.0 do. 1 u:,y@.0 else. d end.end.' <'res_boti_'")) { - fprintf(stderr, "|jplugin error: jdo fmtoutput\n"); - goto error; - } - } - long tp = -1, rk = -1; long *di = 0; void *da = 0; - if (JGetM(jp, "out_boti_", &tp, &rk, &di, &da)) { - fprintf(stderr, "|jplugin error: jgetm output\n"); - goto error; - } - //fprintf(stderr, "[tp=%d rk=%d di0=%d]\n", tp, rk, di[0]); - if (!(2 == tp && 1 == rk)) { - fprintf(stderr, "|jplugin error: jgetm nonstring\n"); - goto error; - } - size_t sz = di[0]; - if (OUTPUT_MAXLEN < sz) - sz = OUTPUT_MAXLEN; - if (1 != fwrite((char *)da, sz, 1, stdout)) { - fprintf(stderr, "|jplugin error: write stdout\n"); - goto error; - } - if (0 != fflush(stdout)) { - fprintf(stderr, "|jplugin error: flush stdout\n"); - goto error; - } - JFree(jp); - return 0; -error: - JFree(jp); - return 1; -} - - -MODULE = Jplugin PACKAGE = Jplugin - -PROTOTYPES: DISABLE - -int -jplugin(cmd) - char *cmd - - - diff --git a/deps/Jplugin/MANIFEST b/deps/Jplugin/MANIFEST deleted file mode 100644 index ad03ab6..0000000 --- a/deps/Jplugin/MANIFEST +++ /dev/null @@ -1,8 +0,0 @@ -Changes -Jplugin.xs -Makefile.PL -MANIFEST -ppport.h -README -t/Jplugin.t -lib/Jplugin.pm diff --git a/deps/Jplugin/Makefile.PL b/deps/Jplugin/Makefile.PL deleted file mode 100644 index 7537c2a..0000000 --- a/deps/Jplugin/Makefile.PL +++ /dev/null @@ -1,21 +0,0 @@ -use 5.008008; -use ExtUtils::MakeMaker; -# See lib/ExtUtils/MakeMaker.pm for details of how to influence -# the contents of the Makefile that is written. - -# path where the shared library libj601.so resides -$jlibpath = "/home/ambrus/local/lib"; - -WriteMakefile( - NAME => 'Jplugin', - VERSION_FROM => 'lib/Jplugin.pm', # finds $VERSION - PREREQ_PM => {}, # e.g., Module::Name => 1.1 - ($] >= 5.005 ? ## Add these new keywords supported since 5.005 - (ABSTRACT_FROM => 'lib/Jplugin.pm', # retrieve abstract from module - AUTHOR => 'Zsban Ambrus ') : ()), - LIBS => ['-lj'], # e.g., '-lm' - DEFINE => '', # e.g., '-DHAVE_SOMETHING' - INC => '-I.', # e.g., '-I. -I/usr/include/other' - # Un-comment this if you add C files to link with later: - # OBJECT => '$(O_FILES)', # link all the C files too -); diff --git a/deps/Jplugin/README b/deps/Jplugin/README deleted file mode 100644 index 8b0a01d..0000000 --- a/deps/Jplugin/README +++ /dev/null @@ -1,40 +0,0 @@ -Jplugin version 0.01 -==================== - -The README is used to introduce the module and provide instructions on -how to install the module, any machine dependencies it may have (for -example C compilers and installed libraries) and any other information -that should be provided before the module is installed. - -A README file is required for CPAN modules since CPAN extracts the -README file from a module distribution so that people browsing the -archive can use it get an idea of the modules uses. It is usually a -good idea to provide version information here so that people can -decide whether fixes for the module are worth downloading. - -INSTALLATION - -To install this module type the following: - - perl Makefile.PL - make - make test - make install - -DEPENDENCIES - -This module requires these other modules and libraries: - - blah blah blah - -COPYRIGHT AND LICENCE - -Put the correct copyright and licence information here. - -Copyright (C) 2007 by Zsban Ambrus - -This library is free software; you can redistribute it and/or modify -it under the same terms as Perl itself, either Perl version 5.8.8 or, -at your option, any later version of Perl 5 you may have available. - - diff --git a/deps/Jplugin/lib/.svn/entries b/deps/Jplugin/lib/.svn/entries deleted file mode 100644 index e58aa18..0000000 --- a/deps/Jplugin/lib/.svn/entries +++ /dev/null @@ -1,62 +0,0 @@ -10 - -dir -475 -svn://erxz.com/bb3/branches/perlbuut/deps/Jplugin/lib -svn://erxz.com/bb3 - - - -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - -dcb1cea6-7f7e-4c78-8a22-148ace8ce36e - -Jplugin.pm -file - - - - -2009-10-03T22:54:20.000000Z -f3e1c41580b6986cf5f3f1d76dd9c42b -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -1827 - diff --git a/deps/Jplugin/lib/.svn/text-base/Jplugin.pm.svn-base b/deps/Jplugin/lib/.svn/text-base/Jplugin.pm.svn-base deleted file mode 100644 index ba1e2f5..0000000 --- a/deps/Jplugin/lib/.svn/text-base/Jplugin.pm.svn-base +++ /dev/null @@ -1,78 +0,0 @@ -package Jplugin; - -use 5.008008; -use strict; -use warnings; - -require Exporter; - -our @ISA = qw(Exporter); - -# Items to export into callers namespace by default. Note: do not export -# names by default without a very good reason. Use EXPORT_OK instead. -# Do not simply export all your public functions/methods/constants. - -# This allows declaration use Jplugin ':all'; -# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK -# will save memory. -our %EXPORT_TAGS = ( 'all' => [ qw( - jplugin -) ] ); - -our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); - -our @EXPORT = qw( - -); - -our $VERSION = '0.01'; - -require XSLoader; -XSLoader::load('Jplugin', $VERSION); - -# Preloaded methods go here. - -1; -__END__ -# Below is stub documentation for your module. You'd better edit it! - -=head1 NAME - -Jplugin - J evaluation plugin for buubot - -=head1 SYNOPSIS - - use Jplugin; - # ... - # inside a safe-executed sub: - Jplugin::jplugin($code); - -=head1 DESCRIPTION - -The I function executes a j statement and prints the result -(in linear form) or the error message to the standard output. -It should be called inside a safe execution environment, after a fork. -The only argument is a string containing a single J command. - -=head1 REQUIREMENTS - -You need to get the J interpreter for this module, -specifically the shared library I. -You can download the interpreter from -I. - -=head1 AUTHOR - -Zsban Ambrus, Eambrus@math.bme.huE - -=head1 COPYRIGHT AND LICENSE - -Copyright (C) 2007 by Zsban Ambrus - -This library is free software; you can redistribute it and/or modify -it under the same terms as Perl itself, either Perl version 5.8.8 or, -at your option, any later version of Perl 5 you may have available. - -The J interpreter, however, has its own, stricter terms of copying. - -=cut diff --git a/deps/Jplugin/lib/Jplugin.pm b/deps/Jplugin/lib/Jplugin.pm deleted file mode 100644 index ba1e2f5..0000000 --- a/deps/Jplugin/lib/Jplugin.pm +++ /dev/null @@ -1,78 +0,0 @@ -package Jplugin; - -use 5.008008; -use strict; -use warnings; - -require Exporter; - -our @ISA = qw(Exporter); - -# Items to export into callers namespace by default. Note: do not export -# names by default without a very good reason. Use EXPORT_OK instead. -# Do not simply export all your public functions/methods/constants. - -# This allows declaration use Jplugin ':all'; -# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK -# will save memory. -our %EXPORT_TAGS = ( 'all' => [ qw( - jplugin -) ] ); - -our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); - -our @EXPORT = qw( - -); - -our $VERSION = '0.01'; - -require XSLoader; -XSLoader::load('Jplugin', $VERSION); - -# Preloaded methods go here. - -1; -__END__ -# Below is stub documentation for your module. You'd better edit it! - -=head1 NAME - -Jplugin - J evaluation plugin for buubot - -=head1 SYNOPSIS - - use Jplugin; - # ... - # inside a safe-executed sub: - Jplugin::jplugin($code); - -=head1 DESCRIPTION - -The I function executes a j statement and prints the result -(in linear form) or the error message to the standard output. -It should be called inside a safe execution environment, after a fork. -The only argument is a string containing a single J command. - -=head1 REQUIREMENTS - -You need to get the J interpreter for this module, -specifically the shared library I. -You can download the interpreter from -I. - -=head1 AUTHOR - -Zsban Ambrus, Eambrus@math.bme.huE - -=head1 COPYRIGHT AND LICENSE - -Copyright (C) 2007 by Zsban Ambrus - -This library is free software; you can redistribute it and/or modify -it under the same terms as Perl itself, either Perl version 5.8.8 or, -at your option, any later version of Perl 5 you may have available. - -The J interpreter, however, has its own, stricter terms of copying. - -=cut diff --git a/deps/Jplugin/ppport.h b/deps/Jplugin/ppport.h deleted file mode 100644 index ad808de..0000000 --- a/deps/Jplugin/ppport.h +++ /dev/null @@ -1,4954 +0,0 @@ -#if 0 -<<'SKIP'; -#endif -/* ----------------------------------------------------------------------- - - ppport.h -- Perl/Pollution/Portability Version 3.06_01 - - Automatically created by Devel::PPPort running under - perl 5.008008 on Thu Apr 26 22:01:02 2007. - - Do NOT edit this file directly! -- Edit PPPort_pm.PL and the - includes in parts/inc/ instead. - - Use 'perldoc ppport.h' to view the documentation below. - ----------------------------------------------------------------------- - -SKIP - -=pod - -=head1 NAME - -ppport.h - Perl/Pollution/Portability version 3.06_01 - -=head1 SYNOPSIS - - perl ppport.h [options] [source files] - - Searches current directory for files if no [source files] are given - - --help show short help - - --patch=file write one patch file with changes - --copy=suffix write changed copies with suffix - --diff=program use diff program and options - - --compat-version=version provide compatibility with Perl version - --cplusplus accept C++ comments - - --quiet don't output anything except fatal errors - --nodiag don't show diagnostics - --nohints don't show hints - --nochanges don't suggest changes - --nofilter don't filter input files - - --list-provided list provided API - --list-unsupported list unsupported API - --api-info=name show Perl API portability information - -=head1 COMPATIBILITY - -This version of F is designed to support operation with Perl -installations back to 5.003, and has been tested up to 5.9.3. - -=head1 OPTIONS - -=head2 --help - -Display a brief usage summary. - -=head2 --patch=I - -If this option is given, a single patch file will be created if -any changes are suggested. This requires a working diff program -to be installed on your system. - -=head2 --copy=I - -If this option is given, a copy of each file will be saved with -the given suffix that contains the suggested changes. This does -not require any external programs. - -If neither C<--patch> or C<--copy> are given, the default is to -simply print the diffs for each file. This requires either -C or a C program to be installed. - -=head2 --diff=I - -Manually set the diff program and options to use. The default -is to use C, when installed, and output unified -context diffs. - -=head2 --compat-version=I - -Tell F to check for compatibility with the given -Perl version. The default is to check for compatibility with Perl -version 5.003. You can use this option to reduce the output -of F if you intend to be backward compatible only -up to a certain Perl version. - -=head2 --cplusplus - -Usually, F will detect C++ style comments and -replace them with C style comments for portability reasons. -Using this option instructs F to leave C++ -comments untouched. - -=head2 --quiet - -Be quiet. Don't print anything except fatal errors. - -=head2 --nodiag - -Don't output any diagnostic messages. Only portability -alerts will be printed. - -=head2 --nohints - -Don't output any hints. Hints often contain useful portability -notes. - -=head2 --nochanges - -Don't suggest any changes. Only give diagnostic output and hints -unless these are also deactivated. - -=head2 --nofilter - -Don't filter the list of input files. By default, files not looking -like source code (i.e. not *.xs, *.c, *.cc, *.cpp or *.h) are skipped. - -=head2 --list-provided - -Lists the API elements for which compatibility is provided by -F. Also lists if it must be explicitly requested, -if it has dependencies, and if there are hints for it. - -=head2 --list-unsupported - -Lists the API elements that are known not to be supported by -F and below which version of Perl they probably -won't be available or work. - -=head2 --api-info=I - -Show portability information for API elements matching I. -If I is surrounded by slashes, it is interpreted as a regular -expression. - -=head1 DESCRIPTION - -In order for a Perl extension (XS) module to be as portable as possible -across differing versions of Perl itself, certain steps need to be taken. - -=over 4 - -=item * - -Including this header is the first major one. This alone will give you -access to a large part of the Perl API that hasn't been available in -earlier Perl releases. Use - - perl ppport.h --list-provided - -to see which API elements are provided by ppport.h. - -=item * - -You should avoid using deprecated parts of the API. For example, using -global Perl variables without the C prefix is deprecated. Also, -some API functions used to have a C prefix. Using this form is -also deprecated. You can safely use the supported API, as F -will provide wrappers for older Perl versions. - -=item * - -If you use one of a few functions that were not present in earlier -versions of Perl, and that can't be provided using a macro, you have -to explicitly request support for these functions by adding one or -more C<#define>s in your source code before the inclusion of F. - -These functions will be marked C in the list shown by -C<--list-provided>. - -Depending on whether you module has a single or multiple files that -use such functions, you want either C or global variants. - -For a C function, use: - - #define NEED_function - -For a global function, use: - - #define NEED_function_GLOBAL - -Note that you mustn't have more than one global request for one -function in your project. - - Function Static Request Global Request - ----------------------------------------------------------------------------------------- - eval_pv() NEED_eval_pv NEED_eval_pv_GLOBAL - grok_bin() NEED_grok_bin NEED_grok_bin_GLOBAL - grok_hex() NEED_grok_hex NEED_grok_hex_GLOBAL - grok_number() NEED_grok_number NEED_grok_number_GLOBAL - grok_numeric_radix() NEED_grok_numeric_radix NEED_grok_numeric_radix_GLOBAL - grok_oct() NEED_grok_oct NEED_grok_oct_GLOBAL - newCONSTSUB() NEED_newCONSTSUB NEED_newCONSTSUB_GLOBAL - newRV_noinc() NEED_newRV_noinc NEED_newRV_noinc_GLOBAL - sv_2pv_nolen() NEED_sv_2pv_nolen NEED_sv_2pv_nolen_GLOBAL - sv_2pvbyte() NEED_sv_2pvbyte NEED_sv_2pvbyte_GLOBAL - sv_catpvf_mg() NEED_sv_catpvf_mg NEED_sv_catpvf_mg_GLOBAL - sv_catpvf_mg_nocontext() NEED_sv_catpvf_mg_nocontext NEED_sv_catpvf_mg_nocontext_GLOBAL - sv_setpvf_mg() NEED_sv_setpvf_mg NEED_sv_setpvf_mg_GLOBAL - sv_setpvf_mg_nocontext() NEED_sv_setpvf_mg_nocontext NEED_sv_setpvf_mg_nocontext_GLOBAL - vnewSVpvf() NEED_vnewSVpvf NEED_vnewSVpvf_GLOBAL - -To avoid namespace conflicts, you can change the namespace of the -explicitly exported functions using the C macro. -Just C<#define> the macro before including C: - - #define DPPP_NAMESPACE MyOwnNamespace_ - #include "ppport.h" - -The default namespace is C. - -=back - -The good thing is that most of the above can be checked by running -F on your source code. See the next section for -details. - -=head1 EXAMPLES - -To verify whether F is needed for your module, whether you -should make any changes to your code, and whether any special defines -should be used, F can be run as a Perl script to check your -source code. Simply say: - - perl ppport.h - -The result will usually be a list of patches suggesting changes -that should at least be acceptable, if not necessarily the most -efficient solution, or a fix for all possible problems. - -If you know that your XS module uses features only available in -newer Perl releases, if you're aware that it uses C++ comments, -and if you want all suggestions as a single patch file, you could -use something like this: - - perl ppport.h --compat-version=5.6.0 --cplusplus --patch=test.diff - -If you only want your code to be scanned without any suggestions -for changes, use: - - perl ppport.h --nochanges - -You can specify a different C program or options, using -the C<--diff> option: - - perl ppport.h --diff='diff -C 10' - -This would output context diffs with 10 lines of context. - -To display portability information for the C function, -use: - - perl ppport.h --api-info=newSVpvn - -Since the argument to C<--api-info> can be a regular expression, -you can use - - perl ppport.h --api-info=/_nomg$/ - -to display portability information for all C<_nomg> functions or - - perl ppport.h --api-info=/./ - -to display information for all known API elements. - -=head1 BUGS - -If this version of F is causing failure during -the compilation of this module, please check if newer versions -of either this module or C are available on CPAN -before sending a bug report. - -If F was generated using the latest version of -C and is causing failure of this module, please -file a bug report using the CPAN Request Tracker at L. - -Please include the following information: - -=over 4 - -=item 1. - -The complete output from running "perl -V" - -=item 2. - -This file. - -=item 3. - -The name and version of the module you were trying to build. - -=item 4. - -A full log of the build that failed. - -=item 5. - -Any other information that you think could be relevant. - -=back - -For the latest version of this code, please get the C -module from CPAN. - -=head1 COPYRIGHT - -Version 3.x, Copyright (c) 2004-2005, Marcus Holland-Moritz. - -Version 2.x, Copyright (C) 2001, Paul Marquess. - -Version 1.x, Copyright (C) 1999, Kenneth Albanowski. - -This program is free software; you can redistribute it and/or -modify it under the same terms as Perl itself. - -=head1 SEE ALSO - -See L. - -=cut - -use strict; - -my %opt = ( - quiet => 0, - diag => 1, - hints => 1, - changes => 1, - cplusplus => 0, - filter => 1, -); - -my($ppport) = $0 =~ /([\w.]+)$/; -my $LF = '(?:\r\n|[\r\n])'; # line feed -my $HS = "[ \t]"; # horizontal whitespace - -eval { - require Getopt::Long; - Getopt::Long::GetOptions(\%opt, qw( - help quiet diag! filter! hints! changes! cplusplus - patch=s copy=s diff=s compat-version=s - list-provided list-unsupported api-info=s - )) or usage(); -}; - -if ($@ and grep /^-/, @ARGV) { - usage() if "@ARGV" =~ /^--?h(?:elp)?$/; - die "Getopt::Long not found. Please don't use any options.\n"; -} - -usage() if $opt{help}; - -if (exists $opt{'compat-version'}) { - my($r,$v,$s) = eval { parse_version($opt{'compat-version'}) }; - if ($@) { - die "Invalid version number format: '$opt{'compat-version'}'\n"; - } - die "Only Perl 5 is supported\n" if $r != 5; - die "Invalid version number: $opt{'compat-version'}\n" if $v >= 1000 || $s >= 1000; - $opt{'compat-version'} = sprintf "%d.%03d%03d", $r, $v, $s; -} -else { - $opt{'compat-version'} = 5; -} - -# Never use C comments in this file!!!!! -my $ccs = '/'.'*'; -my $cce = '*'.'/'; -my $rccs = quotemeta $ccs; -my $rcce = quotemeta $cce; - -my %API = map { /^(\w+)\|([^|]*)\|([^|]*)\|(\w*)$/ - ? ( $1 => { - ($2 ? ( base => $2 ) : ()), - ($3 ? ( todo => $3 ) : ()), - (index($4, 'v') >= 0 ? ( varargs => 1 ) : ()), - (index($4, 'p') >= 0 ? ( provided => 1 ) : ()), - (index($4, 'n') >= 0 ? ( nothxarg => 1 ) : ()), - } ) - : die "invalid spec: $_" } qw( -AvFILLp|5.004050||p -AvFILL||| -CLASS|||n -CX_CURPAD_SAVE||| -CX_CURPAD_SV||| -CopFILEAV|5.006000||p -CopFILEGV_set|5.006000||p -CopFILEGV|5.006000||p -CopFILESV|5.006000||p -CopFILE_set|5.006000||p -CopFILE|5.006000||p -CopSTASHPV_set|5.006000||p -CopSTASHPV|5.006000||p -CopSTASH_eq|5.006000||p -CopSTASH_set|5.006000||p -CopSTASH|5.006000||p -CopyD|5.009002||p -Copy||| -CvPADLIST||| -CvSTASH||| -CvWEAKOUTSIDE||| -DEFSV|5.004050||p -END_EXTERN_C|5.005000||p -ENTER||| -ERRSV|5.004050||p -EXTEND||| -EXTERN_C|5.005000||p -FREETMPS||| -GIMME_V||5.004000|n -GIMME|||n -GROK_NUMERIC_RADIX|5.007002||p -G_ARRAY||| -G_DISCARD||| -G_EVAL||| -G_NOARGS||| -G_SCALAR||| -G_VOID||5.004000| -GetVars||| -GvSV||| -Gv_AMupdate||| -HEf_SVKEY||5.004000| -HeHASH||5.004000| -HeKEY||5.004000| -HeKLEN||5.004000| -HePV||5.004000| -HeSVKEY_force||5.004000| -HeSVKEY_set||5.004000| -HeSVKEY||5.004000| -HeVAL||5.004000| -HvNAME||| -INT2PTR|5.006000||p -IN_LOCALE_COMPILETIME|5.007002||p -IN_LOCALE_RUNTIME|5.007002||p -IN_LOCALE|5.007002||p -IN_PERL_COMPILETIME|5.008001||p -IS_NUMBER_GREATER_THAN_UV_MAX|5.007002||p -IS_NUMBER_INFINITY|5.007002||p -IS_NUMBER_IN_UV|5.007002||p -IS_NUMBER_NAN|5.007003||p -IS_NUMBER_NEG|5.007002||p -IS_NUMBER_NOT_INT|5.007002||p -IVSIZE|5.006000||p -IVTYPE|5.006000||p -IVdf|5.006000||p -LEAVE||| -LVRET||| -MARK||| -MY_CXT_CLONE|5.009002||p -MY_CXT_INIT|5.007003||p -MY_CXT|5.007003||p -MoveD|5.009002||p -Move||| -NEWSV||| -NOOP|5.005000||p -NUM2PTR|5.006000||p -NVTYPE|5.006000||p -NVef|5.006001||p -NVff|5.006001||p -NVgf|5.006001||p -Newc||| -Newz||| -New||| -Nullav||| -Nullch||| -Nullcv||| -Nullhv||| -Nullsv||| -ORIGMARK||| -PAD_BASE_SV||| -PAD_CLONE_VARS||| -PAD_COMPNAME_FLAGS||| -PAD_COMPNAME_GEN_set||| -PAD_COMPNAME_GEN||| -PAD_COMPNAME_OURSTASH||| -PAD_COMPNAME_PV||| -PAD_COMPNAME_TYPE||| -PAD_RESTORE_LOCAL||| -PAD_SAVE_LOCAL||| -PAD_SAVE_SETNULLPAD||| -PAD_SETSV||| -PAD_SET_CUR_NOSAVE||| -PAD_SET_CUR||| -PAD_SVl||| -PAD_SV||| -PERL_BCDVERSION|5.009003||p -PERL_GCC_BRACE_GROUPS_FORBIDDEN|5.008001||p -PERL_INT_MAX|5.004000||p -PERL_INT_MIN|5.004000||p -PERL_LONG_MAX|5.004000||p -PERL_LONG_MIN|5.004000||p -PERL_MAGIC_arylen|5.007002||p -PERL_MAGIC_backref|5.007002||p -PERL_MAGIC_bm|5.007002||p -PERL_MAGIC_collxfrm|5.007002||p -PERL_MAGIC_dbfile|5.007002||p -PERL_MAGIC_dbline|5.007002||p -PERL_MAGIC_defelem|5.007002||p -PERL_MAGIC_envelem|5.007002||p -PERL_MAGIC_env|5.007002||p -PERL_MAGIC_ext|5.007002||p -PERL_MAGIC_fm|5.007002||p -PERL_MAGIC_glob|5.007002||p -PERL_MAGIC_isaelem|5.007002||p -PERL_MAGIC_isa|5.007002||p -PERL_MAGIC_mutex|5.007002||p -PERL_MAGIC_nkeys|5.007002||p -PERL_MAGIC_overload_elem|5.007002||p -PERL_MAGIC_overload_table|5.007002||p -PERL_MAGIC_overload|5.007002||p -PERL_MAGIC_pos|5.007002||p -PERL_MAGIC_qr|5.007002||p -PERL_MAGIC_regdata|5.007002||p -PERL_MAGIC_regdatum|5.007002||p -PERL_MAGIC_regex_global|5.007002||p -PERL_MAGIC_shared_scalar|5.007003||p -PERL_MAGIC_shared|5.007003||p -PERL_MAGIC_sigelem|5.007002||p -PERL_MAGIC_sig|5.007002||p -PERL_MAGIC_substr|5.007002||p -PERL_MAGIC_sv|5.007002||p -PERL_MAGIC_taint|5.007002||p -PERL_MAGIC_tiedelem|5.007002||p -PERL_MAGIC_tiedscalar|5.007002||p -PERL_MAGIC_tied|5.007002||p -PERL_MAGIC_utf8|5.008001||p -PERL_MAGIC_uvar_elem|5.007003||p -PERL_MAGIC_uvar|5.007002||p -PERL_MAGIC_vec|5.007002||p -PERL_MAGIC_vstring|5.008001||p -PERL_QUAD_MAX|5.004000||p -PERL_QUAD_MIN|5.004000||p -PERL_REVISION|5.006000||p -PERL_SCAN_ALLOW_UNDERSCORES|5.007003||p -PERL_SCAN_DISALLOW_PREFIX|5.007003||p -PERL_SCAN_GREATER_THAN_UV_MAX|5.007003||p -PERL_SCAN_SILENT_ILLDIGIT|5.008001||p -PERL_SHORT_MAX|5.004000||p -PERL_SHORT_MIN|5.004000||p -PERL_SUBVERSION|5.006000||p -PERL_UCHAR_MAX|5.004000||p -PERL_UCHAR_MIN|5.004000||p -PERL_UINT_MAX|5.004000||p -PERL_UINT_MIN|5.004000||p -PERL_ULONG_MAX|5.004000||p -PERL_ULONG_MIN|5.004000||p -PERL_UNUSED_DECL|5.007002||p -PERL_UQUAD_MAX|5.004000||p -PERL_UQUAD_MIN|5.004000||p -PERL_USHORT_MAX|5.004000||p -PERL_USHORT_MIN|5.004000||p -PERL_VERSION|5.006000||p -PL_DBsingle|||pn -PL_DBsub|||pn -PL_DBtrace|||n -PL_Sv|5.005000||p -PL_compiling|5.004050||p -PL_copline|5.005000||p -PL_curcop|5.004050||p -PL_curstash|5.004050||p -PL_debstash|5.004050||p -PL_defgv|5.004050||p -PL_diehook|5.004050||p -PL_dirty|5.004050||p -PL_dowarn|||pn -PL_errgv|5.004050||p -PL_hexdigit|5.005000||p -PL_hints|5.005000||p -PL_last_in_gv|||n -PL_modglobal||5.005000|n -PL_na|5.004050||pn -PL_no_modify|5.006000||p -PL_ofs_sv|||n -PL_perl_destruct_level|5.004050||p -PL_perldb|5.004050||p -PL_ppaddr|5.006000||p -PL_rsfp_filters|5.004050||p -PL_rsfp|5.004050||p -PL_rs|||n -PL_stack_base|5.004050||p -PL_stack_sp|5.004050||p -PL_stdingv|5.004050||p -PL_sv_arenaroot|5.004050||p -PL_sv_no|5.004050||pn -PL_sv_undef|5.004050||pn -PL_sv_yes|5.004050||pn -PL_tainted|5.004050||p -PL_tainting|5.004050||p -POPi|||n -POPl|||n -POPn|||n -POPpbytex||5.007001|n -POPpx||5.005030|n -POPp|||n -POPs|||n -PTR2IV|5.006000||p -PTR2NV|5.006000||p -PTR2UV|5.006000||p -PTR2ul|5.007001||p -PTRV|5.006000||p -PUSHMARK||| -PUSHi||| -PUSHmortal|5.009002||p -PUSHn||| -PUSHp||| -PUSHs||| -PUSHu|5.004000||p -PUTBACK||| -PerlIO_clearerr||5.007003| -PerlIO_close||5.007003| -PerlIO_eof||5.007003| -PerlIO_error||5.007003| -PerlIO_fileno||5.007003| -PerlIO_fill||5.007003| -PerlIO_flush||5.007003| -PerlIO_get_base||5.007003| -PerlIO_get_bufsiz||5.007003| -PerlIO_get_cnt||5.007003| -PerlIO_get_ptr||5.007003| -PerlIO_read||5.007003| -PerlIO_seek||5.007003| -PerlIO_set_cnt||5.007003| -PerlIO_set_ptrcnt||5.007003| -PerlIO_setlinebuf||5.007003| -PerlIO_stderr||5.007003| -PerlIO_stdin||5.007003| -PerlIO_stdout||5.007003| -PerlIO_tell||5.007003| -PerlIO_unread||5.007003| -PerlIO_write||5.007003| -Poison|5.008000||p -RETVAL|||n -Renewc||| -Renew||| -SAVECLEARSV||| -SAVECOMPPAD||| -SAVEPADSV||| -SAVETMPS||| -SAVE_DEFSV|5.004050||p -SPAGAIN||| -SP||| -START_EXTERN_C|5.005000||p -START_MY_CXT|5.007003||p -STMT_END|||p -STMT_START|||p -ST||| -SVt_IV||| -SVt_NV||| -SVt_PVAV||| -SVt_PVCV||| -SVt_PVHV||| -SVt_PVMG||| -SVt_PV||| -Safefree||| -Slab_Alloc||| -Slab_Free||| -StructCopy||| -SvCUR_set||| -SvCUR||| -SvEND||| -SvGETMAGIC|5.004050||p -SvGROW||| -SvIOK_UV||5.006000| -SvIOK_notUV||5.006000| -SvIOK_off||| -SvIOK_only_UV||5.006000| -SvIOK_only||| -SvIOK_on||| -SvIOKp||| -SvIOK||| -SvIVX||| -SvIV_nomg|5.009001||p -SvIV_set||| -SvIVx||| -SvIV||| -SvIsCOW_shared_hash||5.008003| -SvIsCOW||5.008003| -SvLEN_set||| -SvLEN||| -SvLOCK||5.007003| -SvMAGIC_set||5.009003| -SvNIOK_off||| -SvNIOKp||| -SvNIOK||| -SvNOK_off||| -SvNOK_only||| -SvNOK_on||| -SvNOKp||| -SvNOK||| -SvNVX||| -SvNV_set||| -SvNVx||| -SvNV||| -SvOK||| -SvOOK||| -SvPOK_off||| -SvPOK_only_UTF8||5.006000| -SvPOK_only||| -SvPOK_on||| -SvPOKp||| -SvPOK||| -SvPVX||| -SvPV_force_nomg|5.007002||p -SvPV_force||| -SvPV_nolen|5.006000||p -SvPV_nomg|5.007002||p -SvPV_set||| -SvPVbyte_force||5.009002| -SvPVbyte_nolen||5.006000| -SvPVbytex_force||5.006000| -SvPVbytex||5.006000| -SvPVbyte|5.006000||p -SvPVutf8_force||5.006000| -SvPVutf8_nolen||5.006000| -SvPVutf8x_force||5.006000| -SvPVutf8x||5.006000| -SvPVutf8||5.006000| -SvPVx||| -SvPV||| -SvREFCNT_dec||| -SvREFCNT_inc||| -SvREFCNT||| -SvROK_off||| -SvROK_on||| -SvROK||| -SvRV_set||5.009003| -SvRV||| -SvSETMAGIC||| -SvSHARE||5.007003| -SvSTASH_set||5.009003| -SvSTASH||| -SvSetMagicSV_nosteal||5.004000| -SvSetMagicSV||5.004000| -SvSetSV_nosteal||5.004000| -SvSetSV||| -SvTAINTED_off||5.004000| -SvTAINTED_on||5.004000| -SvTAINTED||5.004000| -SvTAINT||| -SvTRUE||| -SvTYPE||| -SvUNLOCK||5.007003| -SvUOK||5.007001| -SvUPGRADE||| -SvUTF8_off||5.006000| -SvUTF8_on||5.006000| -SvUTF8||5.006000| -SvUVXx|5.004000||p -SvUVX|5.004000||p -SvUV_nomg|5.009001||p -SvUV_set||5.009003| -SvUVx|5.004000||p -SvUV|5.004000||p -SvVOK||5.008001| -THIS|||n -UNDERBAR|5.009002||p -UVSIZE|5.006000||p -UVTYPE|5.006000||p -UVXf|5.007001||p -UVof|5.006000||p -UVuf|5.006000||p -UVxf|5.006000||p -XCPT_CATCH|5.009002||p -XCPT_RETHROW|5.009002||p -XCPT_TRY_END|5.009002||p -XCPT_TRY_START|5.009002||p -XPUSHi||| -XPUSHmortal|5.009002||p -XPUSHn||| -XPUSHp||| -XPUSHs||| -XPUSHu|5.004000||p -XSRETURN_EMPTY||| -XSRETURN_IV||| -XSRETURN_NO||| -XSRETURN_NV||| -XSRETURN_PV||| -XSRETURN_UNDEF||| -XSRETURN_UV|5.008001||p -XSRETURN_YES||| -XSRETURN||| -XST_mIV||| -XST_mNO||| -XST_mNV||| -XST_mPV||| -XST_mUNDEF||| -XST_mUV|5.008001||p -XST_mYES||| -XS_VERSION_BOOTCHECK||| -XS_VERSION||| -XS||| -ZeroD|5.009002||p -Zero||| -_aMY_CXT|5.007003||p -_pMY_CXT|5.007003||p -aMY_CXT_|5.007003||p -aMY_CXT|5.007003||p -aTHX_|5.006000||p -aTHX|5.006000||p -add_data||| -allocmy||| -amagic_call||| -any_dup||| -ao||| -append_elem||| -append_list||| -apply_attrs_my||| -apply_attrs_string||5.006001| -apply_attrs||| -apply||| -asIV||| -asUV||| -atfork_lock||5.007003|n -atfork_unlock||5.007003|n -av_arylen_p||5.009003| -av_clear||| -av_delete||5.006000| -av_exists||5.006000| -av_extend||| -av_fake||| -av_fetch||| -av_fill||| -av_len||| -av_make||| -av_pop||| -av_push||| -av_reify||| -av_shift||| -av_store||| -av_undef||| -av_unshift||| -ax|||n -bad_type||| -bind_match||| -block_end||| -block_gimme||5.004000| -block_start||| -boolSV|5.004000||p -boot_core_PerlIO||| -boot_core_UNIVERSAL||| -boot_core_xsutils||| -bytes_from_utf8||5.007001| -bytes_to_utf8||5.006001| -cache_re||| -call_argv|5.006000||p -call_atexit||5.006000| -call_body||| -call_list_body||| -call_list||5.004000| -call_method|5.006000||p -call_pv|5.006000||p -call_sv|5.006000||p -calloc||5.007002|n -cando||| -cast_i32||5.006000| -cast_iv||5.006000| -cast_ulong||5.006000| -cast_uv||5.006000| -check_uni||| -checkcomma||| -checkposixcc||| -ck_anoncode||| -ck_bitop||| -ck_concat||| -ck_defined||| -ck_delete||| -ck_die||| -ck_eof||| -ck_eval||| -ck_exec||| -ck_exists||| -ck_exit||| -ck_ftst||| -ck_fun||| -ck_glob||| -ck_grep||| -ck_index||| -ck_join||| -ck_lengthconst||| -ck_lfun||| -ck_listiob||| -ck_match||| -ck_method||| -ck_null||| -ck_open||| -ck_repeat||| -ck_require||| -ck_retarget||| -ck_return||| -ck_rfun||| -ck_rvconst||| -ck_sassign||| -ck_select||| -ck_shift||| -ck_sort||| -ck_spair||| -ck_split||| -ck_subr||| -ck_substr||| -ck_svconst||| -ck_trunc||| -ck_unpack||| -cl_and||| -cl_anything||| -cl_init_zero||| -cl_init||| -cl_is_anything||| -cl_or||| -closest_cop||| -convert||| -cop_free||| -cr_textfilter||| -croak_nocontext|||vn -croak|||v -csighandler||5.007001|n -custom_op_desc||5.007003| -custom_op_name||5.007003| -cv_ckproto||| -cv_clone||| -cv_const_sv||5.004000| -cv_dump||| -cv_undef||| -cx_dump||5.005000| -cx_dup||| -cxinc||| -dAXMARK||5.009003| -dAX|5.007002||p -dITEMS|5.007002||p -dMARK||| -dMY_CXT_SV|5.007003||p -dMY_CXT|5.007003||p -dNOOP|5.006000||p -dORIGMARK||| -dSP||| -dTHR|5.004050||p -dTHXa|5.006000||p -dTHXoa|5.006000||p -dTHX|5.006000||p -dUNDERBAR|5.009002||p -dXCPT|5.009002||p -dXSARGS||| -dXSI32||| -dXSTARG|5.006000||p -deb_curcv||| -deb_nocontext|||vn -deb_stack_all||| -deb_stack_n||| -debop||5.005000| -debprofdump||5.005000| -debprof||| -debstackptrs||5.007003| -debstack||5.007003| -deb||5.007003|v -del_he||| -del_sv||| -delimcpy||5.004000| -depcom||| -deprecate_old||| -deprecate||| -despatch_signals||5.007001| -die_nocontext|||vn -die_where||| -die|||v -dirp_dup||| -div128||| -djSP||| -do_aexec5||| -do_aexec||| -do_aspawn||| -do_binmode||5.004050| -do_chomp||| -do_chop||| -do_close||| -do_dump_pad||| -do_eof||| -do_exec3||| -do_execfree||| -do_exec||| -do_gv_dump||5.006000| -do_gvgv_dump||5.006000| -do_hv_dump||5.006000| -do_ipcctl||| -do_ipcget||| -do_join||| -do_kv||| -do_magic_dump||5.006000| -do_msgrcv||| -do_msgsnd||| -do_oddball||| -do_op_dump||5.006000| -do_open9||5.006000| -do_openn||5.007001| -do_open||5.004000| -do_pipe||| -do_pmop_dump||5.006000| -do_print||| -do_readline||| -do_seek||| -do_semop||| -do_shmio||| -do_spawn_nowait||| -do_spawn||| -do_sprintf||| -do_sv_dump||5.006000| -do_sysseek||| -do_tell||| -do_trans_complex_utf8||| -do_trans_complex||| -do_trans_count_utf8||| -do_trans_count||| -do_trans_simple_utf8||| -do_trans_simple||| -do_trans||| -do_vecget||| -do_vecset||| -do_vop||| -docatch_body||| -docatch||| -doeval||| -dofile||| -dofindlabel||| -doform||| -doing_taint||5.008001|n -dooneliner||| -doopen_pm||| -doparseform||| -dopoptoeval||| -dopoptolabel||| -dopoptoloop||| -dopoptosub_at||| -dopoptosub||| -dounwind||| -dowantarray||| -dump_all||5.006000| -dump_eval||5.006000| -dump_fds||| -dump_form||5.006000| -dump_indent||5.006000|v -dump_mstats||| -dump_packsubs||5.006000| -dump_sub||5.006000| -dump_vindent||5.006000| -dumpuntil||| -dup_attrlist||| -emulate_eaccess||| -eval_pv|5.006000||p -eval_sv|5.006000||p -expect_number||| -fbm_compile||5.005000| -fbm_instr||5.005000| -fd_on_nosuid_fs||| -filter_add||| -filter_del||| -filter_gets||| -filter_read||| -find_beginning||| -find_byclass||| -find_in_my_stash||| -find_runcv||| -find_rundefsvoffset||5.009002| -find_script||| -find_uninit_var||| -fold_constants||| -forbid_setid||| -force_ident||| -force_list||| -force_next||| -force_version||| -force_word||| -form_nocontext|||vn -form||5.004000|v -fp_dup||| -fprintf_nocontext|||vn -free_global_struct||| -free_tied_hv_pool||| -free_tmps||| -gen_constant_list||| -get_av|5.006000||p -get_context||5.006000|n -get_cv|5.006000||p -get_db_sub||| -get_debug_opts||| -get_hash_seed||| -get_hv|5.006000||p -get_mstats||| -get_no_modify||| -get_num||| -get_op_descs||5.005000| -get_op_names||5.005000| -get_opargs||| -get_ppaddr||5.006000| -get_sv|5.006000||p -get_vtbl||5.005030| -getcwd_sv||5.007002| -getenv_len||| -gp_dup||| -gp_free||| -gp_ref||| -grok_bin|5.007003||p -grok_hex|5.007003||p -grok_number|5.007002||p -grok_numeric_radix|5.007002||p -grok_oct|5.007003||p -group_end||| -gv_AVadd||| -gv_HVadd||| -gv_IOadd||| -gv_autoload4||5.004000| -gv_check||| -gv_dump||5.006000| -gv_efullname3||5.004000| -gv_efullname4||5.006001| -gv_efullname||| -gv_ename||| -gv_fetchfile||| -gv_fetchmeth_autoload||5.007003| -gv_fetchmethod_autoload||5.004000| -gv_fetchmethod||| -gv_fetchmeth||| -gv_fetchpvn_flags||5.009002| -gv_fetchpv||| -gv_fetchsv||5.009002| -gv_fullname3||5.004000| -gv_fullname4||5.006001| -gv_fullname||| -gv_handler||5.007001| -gv_init_sv||| -gv_init||| -gv_share||| -gv_stashpvn|5.006000||p -gv_stashpv||| -gv_stashsv||| -he_dup||| -hek_dup||| -hfreeentries||| -hsplit||| -hv_assert||5.009001| -hv_auxinit||| -hv_clear_placeholders||5.009001| -hv_clear||| -hv_delayfree_ent||5.004000| -hv_delete_common||| -hv_delete_ent||5.004000| -hv_delete||| -hv_eiter_p||5.009003| -hv_eiter_set||5.009003| -hv_exists_ent||5.004000| -hv_exists||| -hv_fetch_common||| -hv_fetch_ent||5.004000| -hv_fetch||| -hv_free_ent||5.004000| -hv_iterinit||| -hv_iterkeysv||5.004000| -hv_iterkey||| -hv_iternext_flags||5.008000| -hv_iternextsv||| -hv_iternext||| -hv_iterval||| -hv_ksplit||5.004000| -hv_magic_check||| -hv_magic||| -hv_name_set||5.009003| -hv_notallowed||| -hv_placeholders_get||5.009003| -hv_placeholders_p||5.009003| -hv_placeholders_set||5.009003| -hv_riter_p||5.009003| -hv_riter_set||5.009003| -hv_scalar||5.009001| -hv_store_ent||5.004000| -hv_store_flags||5.008000| -hv_store||| -hv_undef||| -ibcmp_locale||5.004000| -ibcmp_utf8||5.007003| -ibcmp||| -incl_perldb||| -incline||| -incpush||| -ingroup||| -init_argv_symbols||| -init_debugger||| -init_global_struct||| -init_i18nl10n||5.006000| -init_i18nl14n||5.006000| -init_ids||| -init_interp||| -init_lexer||| -init_main_stash||| -init_perllib||| -init_postdump_symbols||| -init_predump_symbols||| -init_stacks||5.005000| -init_tm||5.007002| -instr||| -intro_my||| -intuit_method||| -intuit_more||| -invert||| -io_close||| -isALNUM||| -isALPHA||| -isDIGIT||| -isLOWER||| -isSPACE||| -isUPPER||| -is_an_int||| -is_gv_magical_sv||| -is_gv_magical||| -is_handle_constructor||| -is_list_assignment||| -is_lvalue_sub||5.007001| -is_uni_alnum_lc||5.006000| -is_uni_alnumc_lc||5.006000| -is_uni_alnumc||5.006000| -is_uni_alnum||5.006000| -is_uni_alpha_lc||5.006000| -is_uni_alpha||5.006000| -is_uni_ascii_lc||5.006000| -is_uni_ascii||5.006000| -is_uni_cntrl_lc||5.006000| -is_uni_cntrl||5.006000| -is_uni_digit_lc||5.006000| -is_uni_digit||5.006000| -is_uni_graph_lc||5.006000| -is_uni_graph||5.006000| -is_uni_idfirst_lc||5.006000| -is_uni_idfirst||5.006000| -is_uni_lower_lc||5.006000| -is_uni_lower||5.006000| -is_uni_print_lc||5.006000| -is_uni_print||5.006000| -is_uni_punct_lc||5.006000| -is_uni_punct||5.006000| -is_uni_space_lc||5.006000| -is_uni_space||5.006000| -is_uni_upper_lc||5.006000| -is_uni_upper||5.006000| -is_uni_xdigit_lc||5.006000| -is_uni_xdigit||5.006000| -is_utf8_alnumc||5.006000| -is_utf8_alnum||5.006000| -is_utf8_alpha||5.006000| -is_utf8_ascii||5.006000| -is_utf8_char_slow||| -is_utf8_char||5.006000| -is_utf8_cntrl||5.006000| -is_utf8_digit||5.006000| -is_utf8_graph||5.006000| -is_utf8_idcont||5.008000| -is_utf8_idfirst||5.006000| -is_utf8_lower||5.006000| -is_utf8_mark||5.006000| -is_utf8_print||5.006000| -is_utf8_punct||5.006000| -is_utf8_space||5.006000| -is_utf8_string_loclen||5.009003| -is_utf8_string_loc||5.008001| -is_utf8_string||5.006001| -is_utf8_upper||5.006000| -is_utf8_xdigit||5.006000| -isa_lookup||| -items|||n -ix|||n -jmaybe||| -keyword||| -leave_scope||| -lex_end||| -lex_start||| -linklist||| -listkids||| -list||| -load_module_nocontext|||vn -load_module||5.006000|v -localize||| -looks_like_number||| -lop||| -mPUSHi|5.009002||p -mPUSHn|5.009002||p -mPUSHp|5.009002||p -mPUSHu|5.009002||p -mXPUSHi|5.009002||p -mXPUSHn|5.009002||p -mXPUSHp|5.009002||p -mXPUSHu|5.009002||p -magic_clear_all_env||| -magic_clearenv||| -magic_clearpack||| -magic_clearsig||| -magic_dump||5.006000| -magic_existspack||| -magic_freearylen_p||| -magic_freeovrld||| -magic_freeregexp||| -magic_getarylen||| -magic_getdefelem||| -magic_getglob||| -magic_getnkeys||| -magic_getpack||| -magic_getpos||| -magic_getsig||| -magic_getsubstr||| -magic_gettaint||| -magic_getuvar||| -magic_getvec||| -magic_get||| -magic_killbackrefs||| -magic_len||| -magic_methcall||| -magic_methpack||| -magic_nextpack||| -magic_regdata_cnt||| -magic_regdatum_get||| -magic_regdatum_set||| -magic_scalarpack||| -magic_set_all_env||| -magic_setamagic||| -magic_setarylen||| -magic_setbm||| -magic_setcollxfrm||| -magic_setdbline||| -magic_setdefelem||| -magic_setenv||| -magic_setfm||| -magic_setglob||| -magic_setisa||| -magic_setmglob||| -magic_setnkeys||| -magic_setpack||| -magic_setpos||| -magic_setregexp||| -magic_setsig||| -magic_setsubstr||| -magic_settaint||| -magic_setutf8||| -magic_setuvar||| -magic_setvec||| -magic_set||| -magic_sizepack||| -magic_wipepack||| -magicname||| -make_trie||| -malloced_size|||n -malloc||5.007002|n -markstack_grow||| -measure_struct||| -memEQ|5.004000||p -memNE|5.004000||p -mem_collxfrm||| -mess_alloc||| -mess_nocontext|||vn -mess||5.006000|v -method_common||| -mfree||5.007002|n -mg_clear||| -mg_copy||| -mg_dup||| -mg_find||| -mg_free||| -mg_get||| -mg_length||5.005000| -mg_localize||| -mg_magical||| -mg_set||| -mg_size||5.005000| -mini_mktime||5.007002| -missingterm||| -mode_from_discipline||| -modkids||| -mod||| -moreswitches||| -mul128||| -mulexp10|||n -my_atof2||5.007002| -my_atof||5.006000| -my_attrs||| -my_bcopy|||n -my_betoh16|||n -my_betoh32|||n -my_betoh64|||n -my_betohi|||n -my_betohl|||n -my_betohs|||n -my_bzero|||n -my_chsize||| -my_exit_jump||| -my_exit||| -my_failure_exit||5.004000| -my_fflush_all||5.006000| -my_fork||5.007003|n -my_htobe16|||n -my_htobe32|||n -my_htobe64|||n -my_htobei|||n -my_htobel|||n -my_htobes|||n -my_htole16|||n -my_htole32|||n -my_htole64|||n -my_htolei|||n -my_htolel|||n -my_htoles|||n -my_htonl||| -my_kid||| -my_letoh16|||n -my_letoh32|||n -my_letoh64|||n -my_letohi|||n -my_letohl|||n -my_letohs|||n -my_lstat||| -my_memcmp||5.004000|n -my_memset|||n -my_ntohl||| -my_pclose||5.004000| -my_popen_list||5.007001| -my_popen||5.004000| -my_setenv||| -my_socketpair||5.007003|n -my_stat||| -my_strftime||5.007002| -my_swabn|||n -my_swap||| -my_unexec||| -my||| -newANONATTRSUB||5.006000| -newANONHASH||| -newANONLIST||| -newANONSUB||| -newASSIGNOP||| -newATTRSUB||5.006000| -newAVREF||| -newAV||| -newBINOP||| -newCONDOP||| -newCONSTSUB|5.006000||p -newCVREF||| -newDEFSVOP||| -newFORM||| -newFOROP||| -newGVOP||| -newGVREF||| -newGVgen||| -newHVREF||| -newHVhv||5.005000| -newHV||| -newIO||| -newLISTOP||| -newLOGOP||| -newLOOPEX||| -newLOOPOP||| -newMYSUB||5.006000| -newNULLLIST||| -newOP||| -newPADOP||5.006000| -newPMOP||| -newPROG||| -newPVOP||| -newRANGE||| -newRV_inc|5.004000||p -newRV_noinc|5.006000||p -newRV||| -newSLICEOP||| -newSTATEOP||| -newSUB||| -newSVOP||| -newSVREF||| -newSVhek||5.009003| -newSViv||| -newSVnv||| -newSVpvf_nocontext|||vn -newSVpvf||5.004000|v -newSVpvn_share||5.007001| -newSVpvn|5.006000||p -newSVpv||| -newSVrv||| -newSVsv||| -newSVuv|5.006000||p -newSV||| -newUNOP||| -newWHILEOP||5.009003| -newXSproto||5.006000| -newXS||5.006000| -new_collate||5.006000| -new_constant||| -new_ctype||5.006000| -new_he||| -new_logop||| -new_numeric||5.006000| -new_stackinfo||5.005000| -new_version||5.009000| -next_symbol||| -nextargv||| -nextchar||| -ninstr||| -no_bareword_allowed||| -no_fh_allowed||| -no_op||| -not_a_number||| -nothreadhook||5.008000| -nuke_stacks||| -num_overflow|||n -oopsAV||| -oopsCV||| -oopsHV||| -op_clear||| -op_const_sv||| -op_dump||5.006000| -op_free||| -op_null||5.007002| -op_refcnt_lock||5.009002| -op_refcnt_unlock||5.009002| -open_script||| -pMY_CXT_|5.007003||p -pMY_CXT|5.007003||p -pTHX_|5.006000||p -pTHX|5.006000||p -pack_cat||5.007003| -pack_rec||| -package||| -packlist||5.008001| -pad_add_anon||| -pad_add_name||| -pad_alloc||| -pad_block_start||| -pad_check_dup||| -pad_compname_type||| -pad_findlex||| -pad_findmy||| -pad_fixup_inner_anons||| -pad_free||| -pad_leavemy||| -pad_new||| -pad_push||| -pad_reset||| -pad_setsv||| -pad_sv||| -pad_swipe||| -pad_tidy||| -pad_undef||| -parse_body||| -parse_unicode_opts||| -path_is_absolute||| -peep||| -pending_ident||| -perl_alloc_using|||n -perl_alloc|||n -perl_clone_using|||n -perl_clone|||n -perl_construct|||n -perl_destruct||5.007003|n -perl_free|||n -perl_parse||5.006000|n -perl_run|||n -pidgone||| -pmflag||| -pmop_dump||5.006000| -pmruntime||| -pmtrans||| -pop_scope||| -pregcomp||| -pregexec||| -pregfree||| -prepend_elem||| -printf_nocontext|||vn -ptr_table_clear||| -ptr_table_fetch||| -ptr_table_free||| -ptr_table_new||| -ptr_table_split||| -ptr_table_store||| -push_scope||| -put_byte||| -pv_display||5.006000| -pv_uni_display||5.007003| -qerror||| -re_croak2||| -re_dup||| -re_intuit_start||5.006000| -re_intuit_string||5.006000| -realloc||5.007002|n -reentrant_free||| -reentrant_init||| -reentrant_retry|||vn -reentrant_size||| -refkids||| -refto||| -ref||| -reg_node||| -reganode||| -regatom||| -regbranch||| -regclass_swash||5.007003| -regclass||| -regcp_set_to||| -regcppop||| -regcppush||| -regcurly||| -regdump||5.005000| -regexec_flags||5.005000| -reghop3||| -reghopmaybe3||| -reghopmaybe||| -reghop||| -reginclass||| -reginitcolors||5.006000| -reginsert||| -regmatch||| -regnext||5.005000| -regoptail||| -regpiece||| -regpposixcc||| -regprop||| -regrepeat_hard||| -regrepeat||| -regtail||| -regtry||| -reguni||| -regwhite||| -reg||| -repeatcpy||| -report_evil_fh||| -report_uninit||| -require_errno||| -require_pv||5.006000| -rninstr||| -rsignal_restore||| -rsignal_save||| -rsignal_state||5.004000| -rsignal||5.004000| -run_body||| -runops_debug||5.005000| -runops_standard||5.005000| -rvpv_dup||| -rxres_free||| -rxres_restore||| -rxres_save||| -safesyscalloc||5.006000|n -safesysfree||5.006000|n -safesysmalloc||5.006000|n -safesysrealloc||5.006000|n -same_dirent||| -save_I16||5.004000| -save_I32||| -save_I8||5.006000| -save_aelem||5.004050| -save_alloc||5.006000| -save_aptr||| -save_ary||| -save_bool||5.008001| -save_clearsv||| -save_delete||| -save_destructor_x||5.006000| -save_destructor||5.006000| -save_freeop||| -save_freepv||| -save_freesv||| -save_generic_pvref||5.006001| -save_generic_svref||5.005030| -save_gp||5.004000| -save_hash||| -save_hek_flags||| -save_helem||5.004050| -save_hints||5.005000| -save_hptr||| -save_int||| -save_item||| -save_iv||5.005000| -save_lines||| -save_list||| -save_long||| -save_magic||| -save_mortalizesv||5.007001| -save_nogv||| -save_op||| -save_padsv||5.007001| -save_pptr||| -save_re_context||5.006000| -save_scalar_at||| -save_scalar||| -save_set_svflags||5.009000| -save_shared_pvref||5.007003| -save_sptr||| -save_svref||| -save_threadsv||5.005000| -save_vptr||5.006000| -savepvn||| -savepv||| -savesharedpv||5.007003| -savestack_grow_cnt||5.008001| -savestack_grow||| -savesvpv||5.009002| -sawparens||| -scalar_mod_type||| -scalarboolean||| -scalarkids||| -scalarseq||| -scalarvoid||| -scalar||| -scan_bin||5.006000| -scan_commit||| -scan_const||| -scan_formline||| -scan_heredoc||| -scan_hex||| -scan_ident||| -scan_inputsymbol||| -scan_num||5.007001| -scan_oct||| -scan_pat||| -scan_str||| -scan_subst||| -scan_trans||| -scan_version||5.009001| -scan_vstring||5.008001| -scan_word||| -scope||| -screaminstr||5.005000| -seed||| -set_context||5.006000|n -set_csh||| -set_numeric_local||5.006000| -set_numeric_radix||5.006000| -set_numeric_standard||5.006000| -setdefout||| -setenv_getix||| -share_hek_flags||| -share_hek||| -si_dup||| -sighandler|||n -simplify_sort||| -skipspace||| -sortsv||5.007003| -ss_dup||| -stack_grow||| -start_glob||| -start_subparse||5.004000| -stashpv_hvname_match||5.009003| -stdize_locale||| -strEQ||| -strGE||| -strGT||| -strLE||| -strLT||| -strNE||| -str_to_version||5.006000| -strnEQ||| -strnNE||| -study_chunk||| -sub_crush_depth||| -sublex_done||| -sublex_push||| -sublex_start||| -sv_2bool||| -sv_2cv||| -sv_2io||| -sv_2iuv_non_preserve||| -sv_2iv_flags||5.009001| -sv_2iv||| -sv_2mortal||| -sv_2nv||| -sv_2pv_flags||5.007002| -sv_2pv_nolen|5.006000||p -sv_2pvbyte_nolen||| -sv_2pvbyte|5.006000||p -sv_2pvutf8_nolen||5.006000| -sv_2pvutf8||5.006000| -sv_2pv||| -sv_2uv_flags||5.009001| -sv_2uv|5.004000||p -sv_add_arena||| -sv_add_backref||| -sv_backoff||| -sv_bless||| -sv_cat_decode||5.008001| -sv_catpv_mg|5.006000||p -sv_catpvf_mg_nocontext|||pvn -sv_catpvf_mg|5.006000|5.004000|pv -sv_catpvf_nocontext|||vn -sv_catpvf||5.004000|v -sv_catpvn_flags||5.007002| -sv_catpvn_mg|5.006000||p -sv_catpvn_nomg|5.007002||p -sv_catpvn||| -sv_catpv||| -sv_catsv_flags||5.007002| -sv_catsv_mg|5.006000||p -sv_catsv_nomg|5.007002||p -sv_catsv||| -sv_chop||| -sv_clean_all||| -sv_clean_objs||| -sv_clear||| -sv_cmp_locale||5.004000| -sv_cmp||| -sv_collxfrm||| -sv_compile_2op||5.008001| -sv_copypv||5.007003| -sv_dec||| -sv_del_backref||| -sv_derived_from||5.004000| -sv_dump||| -sv_dup||| -sv_eq||| -sv_force_normal_flags||5.007001| -sv_force_normal||5.006000| -sv_free2||| -sv_free_arenas||| -sv_free||| -sv_gets||5.004000| -sv_grow||| -sv_inc||| -sv_insert||| -sv_isa||| -sv_isobject||| -sv_iv||5.005000| -sv_len_utf8||5.006000| -sv_len||| -sv_magicext||5.007003| -sv_magic||| -sv_mortalcopy||| -sv_newmortal||| -sv_newref||| -sv_nolocking||5.007003| -sv_nosharing||5.007003| -sv_nounlocking||5.007003| -sv_nv||5.005000| -sv_peek||5.005000| -sv_pos_b2u||5.006000| -sv_pos_u2b||5.006000| -sv_pvbyten_force||5.006000| -sv_pvbyten||5.006000| -sv_pvbyte||5.006000| -sv_pvn_force_flags||5.007002| -sv_pvn_force|||p -sv_pvn_nomg|5.007003||p -sv_pvn|5.006000||p -sv_pvutf8n_force||5.006000| -sv_pvutf8n||5.006000| -sv_pvutf8||5.006000| -sv_pv||5.006000| -sv_recode_to_utf8||5.007003| -sv_reftype||| -sv_release_COW||| -sv_release_IVX||| -sv_replace||| -sv_report_used||| -sv_reset||| -sv_rvweaken||5.006000| -sv_setiv_mg|5.006000||p -sv_setiv||| -sv_setnv_mg|5.006000||p -sv_setnv||| -sv_setpv_mg|5.006000||p -sv_setpvf_mg_nocontext|||pvn -sv_setpvf_mg|5.006000|5.004000|pv -sv_setpvf_nocontext|||vn -sv_setpvf||5.004000|v -sv_setpviv_mg||5.008001| -sv_setpviv||5.008001| -sv_setpvn_mg|5.006000||p -sv_setpvn||| -sv_setpv||| -sv_setref_iv||| -sv_setref_nv||| -sv_setref_pvn||| -sv_setref_pv||| -sv_setref_uv||5.007001| -sv_setsv_cow||| -sv_setsv_flags||5.007002| -sv_setsv_mg|5.006000||p -sv_setsv_nomg|5.007002||p -sv_setsv||| -sv_setuv_mg|5.006000||p -sv_setuv|5.006000||p -sv_tainted||5.004000| -sv_taint||5.004000| -sv_true||5.005000| -sv_unglob||| -sv_uni_display||5.007003| -sv_unmagic||| -sv_unref_flags||5.007001| -sv_unref||| -sv_untaint||5.004000| -sv_upgrade||| -sv_usepvn_mg|5.006000||p -sv_usepvn||| -sv_utf8_decode||5.006000| -sv_utf8_downgrade||5.006000| -sv_utf8_encode||5.006000| -sv_utf8_upgrade_flags||5.007002| -sv_utf8_upgrade||5.007001| -sv_uv|5.006000||p -sv_vcatpvf_mg|5.006000|5.004000|p -sv_vcatpvfn||5.004000| -sv_vcatpvf|5.006000|5.004000|p -sv_vsetpvf_mg|5.006000|5.004000|p -sv_vsetpvfn||5.004000| -sv_vsetpvf|5.006000|5.004000|p -svtype||| -swallow_bom||| -swash_fetch||5.007002| -swash_init||5.006000| -sys_intern_clear||| -sys_intern_dup||| -sys_intern_init||| -taint_env||| -taint_proper||| -tmps_grow||5.006000| -toLOWER||| -toUPPER||| -to_byte_substr||| -to_uni_fold||5.007003| -to_uni_lower_lc||5.006000| -to_uni_lower||5.007003| -to_uni_title_lc||5.006000| -to_uni_title||5.007003| -to_uni_upper_lc||5.006000| -to_uni_upper||5.007003| -to_utf8_case||5.007003| -to_utf8_fold||5.007003| -to_utf8_lower||5.007003| -to_utf8_substr||| -to_utf8_title||5.007003| -to_utf8_upper||5.007003| -tokeq||| -tokereport||| -too_few_arguments||| -too_many_arguments||| -unlnk||| -unpack_rec||| -unpack_str||5.007003| -unpackstring||5.008001| -unshare_hek_or_pvn||| -unshare_hek||| -unsharepvn||5.004000| -upg_version||5.009000| -usage||| -utf16_textfilter||| -utf16_to_utf8_reversed||5.006001| -utf16_to_utf8||5.006001| -utf16rev_textfilter||| -utf8_distance||5.006000| -utf8_hop||5.006000| -utf8_length||5.007001| -utf8_mg_pos_init||| -utf8_mg_pos||| -utf8_to_bytes||5.006001| -utf8_to_uvchr||5.007001| -utf8_to_uvuni||5.007001| -utf8n_to_uvchr||5.007001| -utf8n_to_uvuni||5.007001| -utilize||| -uvchr_to_utf8_flags||5.007003| -uvchr_to_utf8||5.007001| -uvuni_to_utf8_flags||5.007003| -uvuni_to_utf8||5.007001| -validate_suid||| -varname||| -vcmp||5.009000| -vcroak||5.006000| -vdeb||5.007003| -vdie||| -vform||5.006000| -visit||| -vivify_defelem||| -vivify_ref||| -vload_module||5.006000| -vmess||5.006000| -vnewSVpvf|5.006000|5.004000|p -vnormal||5.009002| -vnumify||5.009000| -vstringify||5.009000| -vwarner||5.006000| -vwarn||5.006000| -wait4pid||| -warn_nocontext|||vn -warner_nocontext|||vn -warner||5.006000|v -warn|||v -watch||| -whichsig||| -write_to_stderr||| -yyerror||| -yylex||| -yyparse||| -yywarn||| -); - -if (exists $opt{'list-unsupported'}) { - my $f; - for $f (sort { lc $a cmp lc $b } keys %API) { - next unless $API{$f}{todo}; - print "$f ", '.'x(40-length($f)), " ", format_version($API{$f}{todo}), "\n"; - } - exit 0; -} - -# Scan for possible replacement candidates - -my(%replace, %need, %hints, %depends); -my $replace = 0; -my $hint = ''; - -while () { - if ($hint) { - if (m{^\s*\*\s(.*?)\s*$}) { - $hints{$hint} ||= ''; # suppress warning with older perls - $hints{$hint} .= "$1\n"; - } - else { - $hint = ''; - } - } - $hint = $1 if m{^\s*$rccs\sHint:\s+(\w+)\s*$}; - - $replace = $1 if m{^\s*$rccs\s+Replace:\s+(\d+)\s+$rcce\s*$}; - $replace{$2} = $1 if $replace and m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(\w+)}; - $replace{$2} = $1 if m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(\w+).*$rccs\s+Replace\s+$rcce}; - $replace{$1} = $2 if m{^\s*$rccs\s+Replace (\w+) with (\w+)\s+$rcce\s*$}; - - if (m{^\s*$rccs\s+(\w+)\s+depends\s+on\s+(\w+(\s*,\s*\w+)*)\s+$rcce\s*$}) { - push @{$depends{$1}}, map { s/\s+//g; $_ } split /,/, $2; - } - - $need{$1} = 1 if m{^#if\s+defined\(NEED_(\w+)(?:_GLOBAL)?\)}; -} - -if (exists $opt{'api-info'}) { - my $f; - my $count = 0; - my $match = $opt{'api-info'} =~ m!^/(.*)/$! ? $1 : "^\Q$opt{'api-info'}\E\$"; - for $f (sort { lc $a cmp lc $b } keys %API) { - next unless $f =~ /$match/; - print "\n=== $f ===\n\n"; - my $info = 0; - if ($API{$f}{base} || $API{$f}{todo}) { - my $base = format_version($API{$f}{base} || $API{$f}{todo}); - print "Supported at least starting from perl-$base.\n"; - $info++; - } - if ($API{$f}{provided}) { - my $todo = $API{$f}{todo} ? format_version($API{$f}{todo}) : "5.003"; - print "Support by $ppport provided back to perl-$todo.\n"; - print "Support needs to be explicitly requested by NEED_$f.\n" if exists $need{$f}; - print "Depends on: ", join(', ', @{$depends{$f}}), ".\n" if exists $depends{$f}; - print "$hints{$f}" if exists $hints{$f}; - $info++; - } - unless ($info) { - print "No portability information available.\n"; - } - $count++; - } - if ($count > 0) { - print "\n"; - } - else { - print "Found no API matching '$opt{'api-info'}'.\n"; - } - exit 0; -} - -if (exists $opt{'list-provided'}) { - my $f; - for $f (sort { lc $a cmp lc $b } keys %API) { - next unless $API{$f}{provided}; - my @flags; - push @flags, 'explicit' if exists $need{$f}; - push @flags, 'depend' if exists $depends{$f}; - push @flags, 'hint' if exists $hints{$f}; - my $flags = @flags ? ' ['.join(', ', @flags).']' : ''; - print "$f$flags\n"; - } - exit 0; -} - -my @files; -my @srcext = qw( xs c h cc cpp ); -my $srcext = join '|', @srcext; - -if (@ARGV) { - my %seen; - @files = grep { -f && !exists $seen{$_} } map { glob $_ } @ARGV; -} -else { - eval { - require File::Find; - File::Find::find(sub { - $File::Find::name =~ /\.($srcext)$/i - and push @files, $File::Find::name; - }, '.'); - }; - if ($@) { - @files = map { glob "*.$_" } @srcext; - } -} - -if (!@ARGV || $opt{filter}) { - my(@in, @out); - my %xsc = map { /(.*)\.xs$/ ? ("$1.c" => 1, "$1.cc" => 1) : () } @files; - for (@files) { - my $out = exists $xsc{$_} || /\b\Q$ppport\E$/i || !/\.($srcext)$/i; - push @{ $out ? \@out : \@in }, $_; - } - if (@ARGV && @out) { - warning("Skipping the following files (use --nofilter to avoid this):\n| ", join "\n| ", @out); - } - @files = @in; -} - -unless (@files) { - die "No input files given!\n"; -} - -my(%files, %global, %revreplace); -%revreplace = reverse %replace; -my $filename; -my $patch_opened = 0; - -for $filename (@files) { - unless (open IN, "<$filename") { - warn "Unable to read from $filename: $!\n"; - next; - } - - info("Scanning $filename ..."); - - my $c = do { local $/; }; - close IN; - - my %file = (orig => $c, changes => 0); - - # temporarily remove C comments from the code - my @ccom; - $c =~ s{ - ( - [^"'/]+ - | - (?:"[^"\\]*(?:\\.[^"\\]*)*" [^"'/]*)+ - | - (?:'[^'\\]*(?:\\.[^'\\]*)*' [^"'/]*)+ - ) - | - (/ (?: - \*[^*]*\*+(?:[^$ccs][^*]*\*+)* / - | - /[^\r\n]* - )) - }{ - defined $2 and push @ccom, $2; - defined $1 ? $1 : "$ccs$#ccom$cce"; - }egsx; - - $file{ccom} = \@ccom; - $file{code} = $c; - $file{has_inc_ppport} = ($c =~ /#.*include.*\Q$ppport\E/); - - my $func; - - for $func (keys %API) { - my $match = $func; - $match .= "|$revreplace{$func}" if exists $revreplace{$func}; - if ($c =~ /\b(?:Perl_)?($match)\b/) { - $file{uses_replace}{$1}++ if exists $revreplace{$func} && $1 eq $revreplace{$func}; - $file{uses_Perl}{$func}++ if $c =~ /\bPerl_$func\b/; - if (exists $API{$func}{provided}) { - if (!exists $API{$func}{base} || $API{$func}{base} > $opt{'compat-version'}) { - $file{uses}{$func}++; - my @deps = rec_depend($func); - if (@deps) { - $file{uses_deps}{$func} = \@deps; - for (@deps) { - $file{uses}{$_} = 0 unless exists $file{uses}{$_}; - } - } - for ($func, @deps) { - if (exists $need{$_}) { - $file{needs}{$_} = 'static'; - } - } - } - } - if (exists $API{$func}{todo} && $API{$func}{todo} > $opt{'compat-version'}) { - if ($c =~ /\b$func\b/) { - $file{uses_todo}{$func}++; - } - } - } - } - - while ($c =~ /^$HS*#$HS*define$HS+(NEED_(\w+?)(_GLOBAL)?)\b/mg) { - if (exists $need{$2}) { - $file{defined $3 ? 'needed_global' : 'needed_static'}{$2}++; - } - else { - warning("Possibly wrong #define $1 in $filename"); - } - } - - for (qw(uses needs uses_todo needed_global needed_static)) { - for $func (keys %{$file{$_}}) { - push @{$global{$_}{$func}}, $filename; - } - } - - $files{$filename} = \%file; -} - -# Globally resolve NEED_'s -my $need; -for $need (keys %{$global{needs}}) { - if (@{$global{needs}{$need}} > 1) { - my @targets = @{$global{needs}{$need}}; - my @t = grep $files{$_}{needed_global}{$need}, @targets; - @targets = @t if @t; - @t = grep /\.xs$/i, @targets; - @targets = @t if @t; - my $target = shift @targets; - $files{$target}{needs}{$need} = 'global'; - for (@{$global{needs}{$need}}) { - $files{$_}{needs}{$need} = 'extern' if $_ ne $target; - } - } -} - -for $filename (@files) { - exists $files{$filename} or next; - - info("=== Analyzing $filename ==="); - - my %file = %{$files{$filename}}; - my $func; - my $c = $file{code}; - - for $func (sort keys %{$file{uses_Perl}}) { - if ($API{$func}{varargs}) { - my $changes = ($c =~ s{\b(Perl_$func\s*\(\s*)(?!aTHX_?)(\)|[^\s)]*\))} - { $1 . ($2 eq ')' ? 'aTHX' : 'aTHX_ ') . $2 }ge); - if ($changes) { - warning("Doesn't pass interpreter argument aTHX to Perl_$func"); - $file{changes} += $changes; - } - } - else { - warning("Uses Perl_$func instead of $func"); - $file{changes} += ($c =~ s{\bPerl_$func(\s*)\((\s*aTHX_?)?\s*} - {$func$1(}g); - } - } - - for $func (sort keys %{$file{uses_replace}}) { - warning("Uses $func instead of $replace{$func}"); - $file{changes} += ($c =~ s/\b$func\b/$replace{$func}/g); - } - - for $func (sort keys %{$file{uses}}) { - next unless $file{uses}{$func}; # if it's only a dependency - if (exists $file{uses_deps}{$func}) { - diag("Uses $func, which depends on ", join(', ', @{$file{uses_deps}{$func}})); - } - elsif (exists $replace{$func}) { - warning("Uses $func instead of $replace{$func}"); - $file{changes} += ($c =~ s/\b$func\b/$replace{$func}/g); - } - else { - diag("Uses $func"); - } - hint($func); - } - - for $func (sort keys %{$file{uses_todo}}) { - warning("Uses $func, which may not be portable below perl ", - format_version($API{$func}{todo})); - } - - for $func (sort keys %{$file{needed_static}}) { - my $message = ''; - if (not exists $file{uses}{$func}) { - $message = "No need to define NEED_$func if $func is never used"; - } - elsif (exists $file{needs}{$func} && $file{needs}{$func} ne 'static') { - $message = "No need to define NEED_$func when already needed globally"; - } - if ($message) { - diag($message); - $file{changes} += ($c =~ s/^$HS*#$HS*define$HS+NEED_$func\b.*$LF//mg); - } - } - - for $func (sort keys %{$file{needed_global}}) { - my $message = ''; - if (not exists $global{uses}{$func}) { - $message = "No need to define NEED_${func}_GLOBAL if $func is never used"; - } - elsif (exists $file{needs}{$func}) { - if ($file{needs}{$func} eq 'extern') { - $message = "No need to define NEED_${func}_GLOBAL when already needed globally"; - } - elsif ($file{needs}{$func} eq 'static') { - $message = "No need to define NEED_${func}_GLOBAL when only used in this file"; - } - } - if ($message) { - diag($message); - $file{changes} += ($c =~ s/^$HS*#$HS*define$HS+NEED_${func}_GLOBAL\b.*$LF//mg); - } - } - - $file{needs_inc_ppport} = keys %{$file{uses}}; - - if ($file{needs_inc_ppport}) { - my $pp = ''; - - for $func (sort keys %{$file{needs}}) { - my $type = $file{needs}{$func}; - next if $type eq 'extern'; - my $suffix = $type eq 'global' ? '_GLOBAL' : ''; - unless (exists $file{"needed_$type"}{$func}) { - if ($type eq 'global') { - diag("Files [@{$global{needs}{$func}}] need $func, adding global request"); - } - else { - diag("File needs $func, adding static request"); - } - $pp .= "#define NEED_$func$suffix\n"; - } - } - - if ($pp && ($c =~ s/^(?=$HS*#$HS*define$HS+NEED_\w+)/$pp/m)) { - $pp = ''; - $file{changes}++; - } - - unless ($file{has_inc_ppport}) { - diag("Needs to include '$ppport'"); - $pp .= qq(#include "$ppport"\n) - } - - if ($pp) { - $file{changes} += ($c =~ s/^($HS*#$HS*define$HS+NEED_\w+.*?)^/$1$pp/ms) - || ($c =~ s/^(?=$HS*#$HS*include.*\Q$ppport\E)/$pp/m) - || ($c =~ s/^($HS*#$HS*include.*XSUB.*\s*?)^/$1$pp/m) - || ($c =~ s/^/$pp/); - } - } - else { - if ($file{has_inc_ppport}) { - diag("No need to include '$ppport'"); - $file{changes} += ($c =~ s/^$HS*?#$HS*include.*\Q$ppport\E.*?$LF//m); - } - } - - # put back in our C comments - my $ix; - my $cppc = 0; - my @ccom = @{$file{ccom}}; - for $ix (0 .. $#ccom) { - if (!$opt{cplusplus} && $ccom[$ix] =~ s!^//!!) { - $cppc++; - $file{changes} += $c =~ s/$rccs$ix$rcce/$ccs$ccom[$ix] $cce/; - } - else { - $c =~ s/$rccs$ix$rcce/$ccom[$ix]/; - } - } - - if ($cppc) { - my $s = $cppc != 1 ? 's' : ''; - warning("Uses $cppc C++ style comment$s, which is not portable"); - } - - if ($file{changes}) { - if (exists $opt{copy}) { - my $newfile = "$filename$opt{copy}"; - if (-e $newfile) { - error("'$newfile' already exists, refusing to write copy of '$filename'"); - } - else { - local *F; - if (open F, ">$newfile") { - info("Writing copy of '$filename' with changes to '$newfile'"); - print F $c; - close F; - } - else { - error("Cannot open '$newfile' for writing: $!"); - } - } - } - elsif (exists $opt{patch} || $opt{changes}) { - if (exists $opt{patch}) { - unless ($patch_opened) { - if (open PATCH, ">$opt{patch}") { - $patch_opened = 1; - } - else { - error("Cannot open '$opt{patch}' for writing: $!"); - delete $opt{patch}; - $opt{changes} = 1; - goto fallback; - } - } - mydiff(\*PATCH, $filename, $c); - } - else { -fallback: - info("Suggested changes:"); - mydiff(\*STDOUT, $filename, $c); - } - } - else { - my $s = $file{changes} == 1 ? '' : 's'; - info("$file{changes} potentially required change$s detected"); - } - } - else { - info("Looks good"); - } -} - -close PATCH if $patch_opened; - -exit 0; - - -sub mydiff -{ - local *F = shift; - my($file, $str) = @_; - my $diff; - - if (exists $opt{diff}) { - $diff = run_diff($opt{diff}, $file, $str); - } - - if (!defined $diff and can_use('Text::Diff')) { - $diff = Text::Diff::diff($file, \$str, { STYLE => 'Unified' }); - $diff = <
$tmp") { - print F $str; - close F; - - if (open F, "$prog $file $tmp |") { - while () { - s/\Q$tmp\E/$file.patched/; - $diff .= $_; - } - close F; - unlink $tmp; - return $diff; - } - - unlink $tmp; - } - else { - error("Cannot open '$tmp' for writing: $!"); - } - - return undef; -} - -sub can_use -{ - eval "use @_;"; - return $@ eq ''; -} - -sub rec_depend -{ - my $func = shift; - my %seen; - return () unless exists $depends{$func}; - grep !$seen{$_}++, map { ($_, rec_depend($_)) } @{$depends{$func}}; -} - -sub parse_version -{ - my $ver = shift; - - if ($ver =~ /^(\d+)\.(\d+)\.(\d+)$/) { - return ($1, $2, $3); - } - elsif ($ver !~ /^\d+\.[\d_]+$/) { - die "cannot parse version '$ver'\n"; - } - - $ver =~ s/_//g; - $ver =~ s/$/000000/; - - my($r,$v,$s) = $ver =~ /(\d+)\.(\d{3})(\d{3})/; - - $v = int $v; - $s = int $s; - - if ($r < 5 || ($r == 5 && $v < 6)) { - if ($s % 10) { - die "cannot parse version '$ver'\n"; - } - } - - return ($r, $v, $s); -} - -sub format_version -{ - my $ver = shift; - - $ver =~ s/$/000000/; - my($r,$v,$s) = $ver =~ /(\d+)\.(\d{3})(\d{3})/; - - $v = int $v; - $s = int $s; - - if ($r < 5 || ($r == 5 && $v < 6)) { - if ($s % 10) { - die "invalid version '$ver'\n"; - } - $s /= 10; - - $ver = sprintf "%d.%03d", $r, $v; - $s > 0 and $ver .= sprintf "_%02d", $s; - - return $ver; - } - - return sprintf "%d.%d.%d", $r, $v, $s; -} - -sub info -{ - $opt{quiet} and return; - print @_, "\n"; -} - -sub diag -{ - $opt{quiet} and return; - $opt{diag} and print @_, "\n"; -} - -sub warning -{ - $opt{quiet} and return; - print "*** ", @_, "\n"; -} - -sub error -{ - print "*** ERROR: ", @_, "\n"; -} - -my %given_hints; -sub hint -{ - $opt{quiet} and return; - $opt{hints} or return; - my $func = shift; - exists $hints{$func} or return; - $given_hints{$func}++ and return; - my $hint = $hints{$func}; - $hint =~ s/^/ /mg; - print " --- hint for $func ---\n", $hint; -} - -sub usage -{ - my($usage) = do { local(@ARGV,$/)=($0); <> } =~ /^=head\d$HS+SYNOPSIS\s*^(.*?)\s*^=/ms; - my %M = ( 'I' => '*' ); - $usage =~ s/^\s*perl\s+\S+/$^X $0/; - $usage =~ s/([A-Z])<([^>]+)>/$M{$1}$2$M{$1}/g; - - print < -# endif -# if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL))) -# include -# endif -# ifndef PERL_REVISION -# define PERL_REVISION (5) - /* Replace: 1 */ -# define PERL_VERSION PATCHLEVEL -# define PERL_SUBVERSION SUBVERSION - /* Replace PERL_PATCHLEVEL with PERL_VERSION */ - /* Replace: 0 */ -# endif -#endif - -#define PERL_BCDVERSION ((PERL_REVISION * 0x1000000L) + (PERL_VERSION * 0x1000L) + PERL_SUBVERSION) - -/* It is very unlikely that anyone will try to use this with Perl 6 - (or greater), but who knows. - */ -#if PERL_REVISION != 5 -# error ppport.h only works with Perl version 5 -#endif /* PERL_REVISION != 5 */ - -#ifdef I_LIMITS -# include -#endif - -#ifndef PERL_UCHAR_MIN -# define PERL_UCHAR_MIN ((unsigned char)0) -#endif - -#ifndef PERL_UCHAR_MAX -# ifdef UCHAR_MAX -# define PERL_UCHAR_MAX ((unsigned char)UCHAR_MAX) -# else -# ifdef MAXUCHAR -# define PERL_UCHAR_MAX ((unsigned char)MAXUCHAR) -# else -# define PERL_UCHAR_MAX ((unsigned char)~(unsigned)0) -# endif -# endif -#endif - -#ifndef PERL_USHORT_MIN -# define PERL_USHORT_MIN ((unsigned short)0) -#endif - -#ifndef PERL_USHORT_MAX -# ifdef USHORT_MAX -# define PERL_USHORT_MAX ((unsigned short)USHORT_MAX) -# else -# ifdef MAXUSHORT -# define PERL_USHORT_MAX ((unsigned short)MAXUSHORT) -# else -# ifdef USHRT_MAX -# define PERL_USHORT_MAX ((unsigned short)USHRT_MAX) -# else -# define PERL_USHORT_MAX ((unsigned short)~(unsigned)0) -# endif -# endif -# endif -#endif - -#ifndef PERL_SHORT_MAX -# ifdef SHORT_MAX -# define PERL_SHORT_MAX ((short)SHORT_MAX) -# else -# ifdef MAXSHORT /* Often used in */ -# define PERL_SHORT_MAX ((short)MAXSHORT) -# else -# ifdef SHRT_MAX -# define PERL_SHORT_MAX ((short)SHRT_MAX) -# else -# define PERL_SHORT_MAX ((short) (PERL_USHORT_MAX >> 1)) -# endif -# endif -# endif -#endif - -#ifndef PERL_SHORT_MIN -# ifdef SHORT_MIN -# define PERL_SHORT_MIN ((short)SHORT_MIN) -# else -# ifdef MINSHORT -# define PERL_SHORT_MIN ((short)MINSHORT) -# else -# ifdef SHRT_MIN -# define PERL_SHORT_MIN ((short)SHRT_MIN) -# else -# define PERL_SHORT_MIN (-PERL_SHORT_MAX - ((3 & -1) == 3)) -# endif -# endif -# endif -#endif - -#ifndef PERL_UINT_MAX -# ifdef UINT_MAX -# define PERL_UINT_MAX ((unsigned int)UINT_MAX) -# else -# ifdef MAXUINT -# define PERL_UINT_MAX ((unsigned int)MAXUINT) -# else -# define PERL_UINT_MAX (~(unsigned int)0) -# endif -# endif -#endif - -#ifndef PERL_UINT_MIN -# define PERL_UINT_MIN ((unsigned int)0) -#endif - -#ifndef PERL_INT_MAX -# ifdef INT_MAX -# define PERL_INT_MAX ((int)INT_MAX) -# else -# ifdef MAXINT /* Often used in */ -# define PERL_INT_MAX ((int)MAXINT) -# else -# define PERL_INT_MAX ((int)(PERL_UINT_MAX >> 1)) -# endif -# endif -#endif - -#ifndef PERL_INT_MIN -# ifdef INT_MIN -# define PERL_INT_MIN ((int)INT_MIN) -# else -# ifdef MININT -# define PERL_INT_MIN ((int)MININT) -# else -# define PERL_INT_MIN (-PERL_INT_MAX - ((3 & -1) == 3)) -# endif -# endif -#endif - -#ifndef PERL_ULONG_MAX -# ifdef ULONG_MAX -# define PERL_ULONG_MAX ((unsigned long)ULONG_MAX) -# else -# ifdef MAXULONG -# define PERL_ULONG_MAX ((unsigned long)MAXULONG) -# else -# define PERL_ULONG_MAX (~(unsigned long)0) -# endif -# endif -#endif - -#ifndef PERL_ULONG_MIN -# define PERL_ULONG_MIN ((unsigned long)0L) -#endif - -#ifndef PERL_LONG_MAX -# ifdef LONG_MAX -# define PERL_LONG_MAX ((long)LONG_MAX) -# else -# ifdef MAXLONG -# define PERL_LONG_MAX ((long)MAXLONG) -# else -# define PERL_LONG_MAX ((long) (PERL_ULONG_MAX >> 1)) -# endif -# endif -#endif - -#ifndef PERL_LONG_MIN -# ifdef LONG_MIN -# define PERL_LONG_MIN ((long)LONG_MIN) -# else -# ifdef MINLONG -# define PERL_LONG_MIN ((long)MINLONG) -# else -# define PERL_LONG_MIN (-PERL_LONG_MAX - ((3 & -1) == 3)) -# endif -# endif -#endif - -#if defined(HAS_QUAD) && (defined(convex) || defined(uts)) -# ifndef PERL_UQUAD_MAX -# ifdef ULONGLONG_MAX -# define PERL_UQUAD_MAX ((unsigned long long)ULONGLONG_MAX) -# else -# ifdef MAXULONGLONG -# define PERL_UQUAD_MAX ((unsigned long long)MAXULONGLONG) -# else -# define PERL_UQUAD_MAX (~(unsigned long long)0) -# endif -# endif -# endif - -# ifndef PERL_UQUAD_MIN -# define PERL_UQUAD_MIN ((unsigned long long)0L) -# endif - -# ifndef PERL_QUAD_MAX -# ifdef LONGLONG_MAX -# define PERL_QUAD_MAX ((long long)LONGLONG_MAX) -# else -# ifdef MAXLONGLONG -# define PERL_QUAD_MAX ((long long)MAXLONGLONG) -# else -# define PERL_QUAD_MAX ((long long) (PERL_UQUAD_MAX >> 1)) -# endif -# endif -# endif - -# ifndef PERL_QUAD_MIN -# ifdef LONGLONG_MIN -# define PERL_QUAD_MIN ((long long)LONGLONG_MIN) -# else -# ifdef MINLONGLONG -# define PERL_QUAD_MIN ((long long)MINLONGLONG) -# else -# define PERL_QUAD_MIN (-PERL_QUAD_MAX - ((3 & -1) == 3)) -# endif -# endif -# endif -#endif - -/* This is based on code from 5.003 perl.h */ -#ifdef HAS_QUAD -# ifdef cray -#ifndef IVTYPE -# define IVTYPE int -#endif - -#ifndef IV_MIN -# define IV_MIN PERL_INT_MIN -#endif - -#ifndef IV_MAX -# define IV_MAX PERL_INT_MAX -#endif - -#ifndef UV_MIN -# define UV_MIN PERL_UINT_MIN -#endif - -#ifndef UV_MAX -# define UV_MAX PERL_UINT_MAX -#endif - -# ifdef INTSIZE -#ifndef IVSIZE -# define IVSIZE INTSIZE -#endif - -# endif -# else -# if defined(convex) || defined(uts) -#ifndef IVTYPE -# define IVTYPE long long -#endif - -#ifndef IV_MIN -# define IV_MIN PERL_QUAD_MIN -#endif - -#ifndef IV_MAX -# define IV_MAX PERL_QUAD_MAX -#endif - -#ifndef UV_MIN -# define UV_MIN PERL_UQUAD_MIN -#endif - -#ifndef UV_MAX -# define UV_MAX PERL_UQUAD_MAX -#endif - -# ifdef LONGLONGSIZE -#ifndef IVSIZE -# define IVSIZE LONGLONGSIZE -#endif - -# endif -# else -#ifndef IVTYPE -# define IVTYPE long -#endif - -#ifndef IV_MIN -# define IV_MIN PERL_LONG_MIN -#endif - -#ifndef IV_MAX -# define IV_MAX PERL_LONG_MAX -#endif - -#ifndef UV_MIN -# define UV_MIN PERL_ULONG_MIN -#endif - -#ifndef UV_MAX -# define UV_MAX PERL_ULONG_MAX -#endif - -# ifdef LONGSIZE -#ifndef IVSIZE -# define IVSIZE LONGSIZE -#endif - -# endif -# endif -# endif -#ifndef IVSIZE -# define IVSIZE 8 -#endif - -#ifndef PERL_QUAD_MIN -# define PERL_QUAD_MIN IV_MIN -#endif - -#ifndef PERL_QUAD_MAX -# define PERL_QUAD_MAX IV_MAX -#endif - -#ifndef PERL_UQUAD_MIN -# define PERL_UQUAD_MIN UV_MIN -#endif - -#ifndef PERL_UQUAD_MAX -# define PERL_UQUAD_MAX UV_MAX -#endif - -#else -#ifndef IVTYPE -# define IVTYPE long -#endif - -#ifndef IV_MIN -# define IV_MIN PERL_LONG_MIN -#endif - -#ifndef IV_MAX -# define IV_MAX PERL_LONG_MAX -#endif - -#ifndef UV_MIN -# define UV_MIN PERL_ULONG_MIN -#endif - -#ifndef UV_MAX -# define UV_MAX PERL_ULONG_MAX -#endif - -#endif - -#ifndef IVSIZE -# ifdef LONGSIZE -# define IVSIZE LONGSIZE -# else -# define IVSIZE 4 /* A bold guess, but the best we can make. */ -# endif -#endif -#ifndef UVTYPE -# define UVTYPE unsigned IVTYPE -#endif - -#ifndef UVSIZE -# define UVSIZE IVSIZE -#endif - -#ifndef sv_setuv -# define sv_setuv(sv, uv) \ - STMT_START { \ - UV TeMpUv = uv; \ - if (TeMpUv <= IV_MAX) \ - sv_setiv(sv, TeMpUv); \ - else \ - sv_setnv(sv, (double)TeMpUv); \ - } STMT_END -#endif - -#ifndef newSVuv -# define newSVuv(uv) ((uv) <= IV_MAX ? newSViv((IV)uv) : newSVnv((NV)uv)) -#endif -#ifndef sv_2uv -# define sv_2uv(sv) ((PL_Sv = (sv)), (UV) (SvNOK(PL_Sv) ? SvNV(PL_Sv) : sv_2nv(PL_Sv))) -#endif - -#ifndef SvUVX -# define SvUVX(sv) ((UV)SvIVX(sv)) -#endif - -#ifndef SvUVXx -# define SvUVXx(sv) SvUVX(sv) -#endif - -#ifndef SvUV -# define SvUV(sv) (SvIOK(sv) ? SvUVX(sv) : sv_2uv(sv)) -#endif - -#ifndef SvUVx -# define SvUVx(sv) ((PL_Sv = (sv)), SvUV(PL_Sv)) -#endif - -/* Hint: sv_uv - * Always use the SvUVx() macro instead of sv_uv(). - */ -#ifndef sv_uv -# define sv_uv(sv) SvUVx(sv) -#endif -#ifndef XST_mUV -# define XST_mUV(i,v) (ST(i) = sv_2mortal(newSVuv(v)) ) -#endif - -#ifndef XSRETURN_UV -# define XSRETURN_UV(v) STMT_START { XST_mUV(0,v); XSRETURN(1); } STMT_END -#endif -#ifndef PUSHu -# define PUSHu(u) STMT_START { sv_setuv(TARG, (UV)(u)); PUSHTARG; } STMT_END -#endif - -#ifndef XPUSHu -# define XPUSHu(u) STMT_START { sv_setuv(TARG, (UV)(u)); XPUSHTARG; } STMT_END -#endif - -#if (PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5)) -/* Replace: 1 */ -# define PL_DBsingle DBsingle -# define PL_DBsub DBsub -# define PL_Sv Sv -# define PL_compiling compiling -# define PL_copline copline -# define PL_curcop curcop -# define PL_curstash curstash -# define PL_debstash debstash -# define PL_defgv defgv -# define PL_diehook diehook -# define PL_dirty dirty -# define PL_dowarn dowarn -# define PL_errgv errgv -# define PL_hexdigit hexdigit -# define PL_hints hints -# define PL_na na -# define PL_no_modify no_modify -# define PL_perl_destruct_level perl_destruct_level -# define PL_perldb perldb -# define PL_ppaddr ppaddr -# define PL_rsfp_filters rsfp_filters -# define PL_rsfp rsfp -# define PL_stack_base stack_base -# define PL_stack_sp stack_sp -# define PL_stdingv stdingv -# define PL_sv_arenaroot sv_arenaroot -# define PL_sv_no sv_no -# define PL_sv_undef sv_undef -# define PL_sv_yes sv_yes -# define PL_tainted tainted -# define PL_tainting tainting -/* Replace: 0 */ -#endif - -#ifndef PERL_UNUSED_DECL -# ifdef HASATTRIBUTE -# if (defined(__GNUC__) && defined(__cplusplus)) || defined(__INTEL_COMPILER) -# define PERL_UNUSED_DECL -# else -# define PERL_UNUSED_DECL __attribute__((unused)) -# endif -# else -# define PERL_UNUSED_DECL -# endif -#endif -#ifndef NOOP -# define NOOP (void)0 -#endif - -#ifndef dNOOP -# define dNOOP extern int Perl___notused PERL_UNUSED_DECL -#endif - -#ifndef NVTYPE -# if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) -# define NVTYPE long double -# else -# define NVTYPE double -# endif -typedef NVTYPE NV; -#endif - -#ifndef INT2PTR - -# if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE) -# define PTRV UV -# define INT2PTR(any,d) (any)(d) -# else -# if PTRSIZE == LONGSIZE -# define PTRV unsigned long -# else -# define PTRV unsigned -# endif -# define INT2PTR(any,d) (any)(PTRV)(d) -# endif - -# define NUM2PTR(any,d) (any)(PTRV)(d) -# define PTR2IV(p) INT2PTR(IV,p) -# define PTR2UV(p) INT2PTR(UV,p) -# define PTR2NV(p) NUM2PTR(NV,p) - -# if PTRSIZE == LONGSIZE -# define PTR2ul(p) (unsigned long)(p) -# else -# define PTR2ul(p) INT2PTR(unsigned long,p) -# endif - -#endif /* !INT2PTR */ - -#undef START_EXTERN_C -#undef END_EXTERN_C -#undef EXTERN_C -#ifdef __cplusplus -# define START_EXTERN_C extern "C" { -# define END_EXTERN_C } -# define EXTERN_C extern "C" -#else -# define START_EXTERN_C -# define END_EXTERN_C -# define EXTERN_C extern -#endif - -#ifndef PERL_GCC_BRACE_GROUPS_FORBIDDEN -# if defined(__STRICT_ANSI__) && defined(PERL_GCC_PEDANTIC) -# define PERL_GCC_BRACE_GROUPS_FORBIDDEN -# endif -#endif - -#undef STMT_START -#undef STMT_END -#if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) && !defined(__cplusplus) -# define STMT_START (void)( /* gcc supports ``({ STATEMENTS; })'' */ -# define STMT_END ) -#else -# if defined(VOIDFLAGS) && (VOIDFLAGS) && (defined(sun) || defined(__sun__)) && !defined(__GNUC__) -# define STMT_START if (1) -# define STMT_END else (void)0 -# else -# define STMT_START do -# define STMT_END while (0) -# endif -#endif -#ifndef boolSV -# define boolSV(b) ((b) ? &PL_sv_yes : &PL_sv_no) -#endif - -/* DEFSV appears first in 5.004_56 */ -#ifndef DEFSV -# define DEFSV GvSV(PL_defgv) -#endif - -#ifndef SAVE_DEFSV -# define SAVE_DEFSV SAVESPTR(GvSV(PL_defgv)) -#endif - -/* Older perls (<=5.003) lack AvFILLp */ -#ifndef AvFILLp -# define AvFILLp AvFILL -#endif -#ifndef ERRSV -# define ERRSV get_sv("@",FALSE) -#endif -#ifndef newSVpvn -# define newSVpvn(data,len) ((data) \ - ? ((len) ? newSVpv((data), (len)) : newSVpv("", 0)) \ - : newSV(0)) -#endif - -/* Hint: gv_stashpvn - * This function's backport doesn't support the length parameter, but - * rather ignores it. Portability can only be ensured if the length - * parameter is used for speed reasons, but the length can always be - * correctly computed from the string argument. - */ -#ifndef gv_stashpvn -# define gv_stashpvn(str,len,create) gv_stashpv(str,create) -#endif - -/* Replace: 1 */ -#ifndef get_cv -# define get_cv perl_get_cv -#endif - -#ifndef get_sv -# define get_sv perl_get_sv -#endif - -#ifndef get_av -# define get_av perl_get_av -#endif - -#ifndef get_hv -# define get_hv perl_get_hv -#endif - -/* Replace: 0 */ - -#ifdef HAS_MEMCMP -#ifndef memNE -# define memNE(s1,s2,l) (memcmp(s1,s2,l)) -#endif - -#ifndef memEQ -# define memEQ(s1,s2,l) (!memcmp(s1,s2,l)) -#endif - -#else -#ifndef memNE -# define memNE(s1,s2,l) (bcmp(s1,s2,l)) -#endif - -#ifndef memEQ -# define memEQ(s1,s2,l) (!bcmp(s1,s2,l)) -#endif - -#endif -#ifndef MoveD -# define MoveD(s,d,n,t) memmove((char*)(d),(char*)(s), (n) * sizeof(t)) -#endif - -#ifndef CopyD -# define CopyD(s,d,n,t) memcpy((char*)(d),(char*)(s), (n) * sizeof(t)) -#endif - -#ifdef HAS_MEMSET -#ifndef ZeroD -# define ZeroD(d,n,t) memzero((char*)(d), (n) * sizeof(t)) -#endif - -#else -#ifndef ZeroD -# define ZeroD(d,n,t) ((void)memzero((char*)(d), (n) * sizeof(t)),d) -#endif - -#endif -#ifndef Poison -# define Poison(d,n,t) (void)memset((char*)(d), 0xAB, (n) * sizeof(t)) -#endif -#ifndef dUNDERBAR -# define dUNDERBAR dNOOP -#endif - -#ifndef UNDERBAR -# define UNDERBAR DEFSV -#endif -#ifndef dAX -# define dAX I32 ax = MARK - PL_stack_base + 1 -#endif - -#ifndef dITEMS -# define dITEMS I32 items = SP - MARK -#endif -#ifndef dXSTARG -# define dXSTARG SV * targ = sv_newmortal() -#endif -#ifndef dTHR -# define dTHR dNOOP -#endif -#ifndef dTHX -# define dTHX dNOOP -#endif - -#ifndef dTHXa -# define dTHXa(x) dNOOP -#endif -#ifndef pTHX -# define pTHX void -#endif - -#ifndef pTHX_ -# define pTHX_ -#endif - -#ifndef aTHX -# define aTHX -#endif - -#ifndef aTHX_ -# define aTHX_ -#endif -#ifndef dTHXoa -# define dTHXoa(x) dTHXa(x) -#endif -#ifndef PUSHmortal -# define PUSHmortal PUSHs(sv_newmortal()) -#endif - -#ifndef mPUSHp -# define mPUSHp(p,l) sv_setpvn_mg(PUSHmortal, (p), (l)) -#endif - -#ifndef mPUSHn -# define mPUSHn(n) sv_setnv_mg(PUSHmortal, (NV)(n)) -#endif - -#ifndef mPUSHi -# define mPUSHi(i) sv_setiv_mg(PUSHmortal, (IV)(i)) -#endif - -#ifndef mPUSHu -# define mPUSHu(u) sv_setuv_mg(PUSHmortal, (UV)(u)) -#endif -#ifndef XPUSHmortal -# define XPUSHmortal XPUSHs(sv_newmortal()) -#endif - -#ifndef mXPUSHp -# define mXPUSHp(p,l) STMT_START { EXTEND(sp,1); sv_setpvn_mg(PUSHmortal, (p), (l)); } STMT_END -#endif - -#ifndef mXPUSHn -# define mXPUSHn(n) STMT_START { EXTEND(sp,1); sv_setnv_mg(PUSHmortal, (NV)(n)); } STMT_END -#endif - -#ifndef mXPUSHi -# define mXPUSHi(i) STMT_START { EXTEND(sp,1); sv_setiv_mg(PUSHmortal, (IV)(i)); } STMT_END -#endif - -#ifndef mXPUSHu -# define mXPUSHu(u) STMT_START { EXTEND(sp,1); sv_setuv_mg(PUSHmortal, (UV)(u)); } STMT_END -#endif - -/* Replace: 1 */ -#ifndef call_sv -# define call_sv perl_call_sv -#endif - -#ifndef call_pv -# define call_pv perl_call_pv -#endif - -#ifndef call_argv -# define call_argv perl_call_argv -#endif - -#ifndef call_method -# define call_method perl_call_method -#endif -#ifndef eval_sv -# define eval_sv perl_eval_sv -#endif - -/* Replace: 0 */ - -/* Replace perl_eval_pv with eval_pv */ -/* eval_pv depends on eval_sv */ - -#ifndef eval_pv -#if defined(NEED_eval_pv) -static SV* DPPP_(my_eval_pv)(char *p, I32 croak_on_error); -static -#else -extern SV* DPPP_(my_eval_pv)(char *p, I32 croak_on_error); -#endif - -#ifdef eval_pv -# undef eval_pv -#endif -#define eval_pv(a,b) DPPP_(my_eval_pv)(aTHX_ a,b) -#define Perl_eval_pv DPPP_(my_eval_pv) - -#if defined(NEED_eval_pv) || defined(NEED_eval_pv_GLOBAL) - -SV* -DPPP_(my_eval_pv)(char *p, I32 croak_on_error) -{ - dSP; - SV* sv = newSVpv(p, 0); - - PUSHMARK(sp); - eval_sv(sv, G_SCALAR); - SvREFCNT_dec(sv); - - SPAGAIN; - sv = POPs; - PUTBACK; - - if (croak_on_error && SvTRUE(GvSV(errgv))) - croak(SvPVx(GvSV(errgv), na)); - - return sv; -} - -#endif -#endif -#ifndef newRV_inc -# define newRV_inc(sv) newRV(sv) /* Replace */ -#endif - -#ifndef newRV_noinc -#if defined(NEED_newRV_noinc) -static SV * DPPP_(my_newRV_noinc)(SV *sv); -static -#else -extern SV * DPPP_(my_newRV_noinc)(SV *sv); -#endif - -#ifdef newRV_noinc -# undef newRV_noinc -#endif -#define newRV_noinc(a) DPPP_(my_newRV_noinc)(aTHX_ a) -#define Perl_newRV_noinc DPPP_(my_newRV_noinc) - -#if defined(NEED_newRV_noinc) || defined(NEED_newRV_noinc_GLOBAL) -SV * -DPPP_(my_newRV_noinc)(SV *sv) -{ - SV *rv = (SV *)newRV(sv); - SvREFCNT_dec(sv); - return rv; -} -#endif -#endif - -/* Hint: newCONSTSUB - * Returns a CV* as of perl-5.7.1. This return value is not supported - * by Devel::PPPort. - */ - -/* newCONSTSUB from IO.xs is in the core starting with 5.004_63 */ -#if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION < 63))) && ((PERL_VERSION != 4) || (PERL_SUBVERSION != 5)) -#if defined(NEED_newCONSTSUB) -static void DPPP_(my_newCONSTSUB)(HV *stash, char *name, SV *sv); -static -#else -extern void DPPP_(my_newCONSTSUB)(HV *stash, char *name, SV *sv); -#endif - -#ifdef newCONSTSUB -# undef newCONSTSUB -#endif -#define newCONSTSUB(a,b,c) DPPP_(my_newCONSTSUB)(aTHX_ a,b,c) -#define Perl_newCONSTSUB DPPP_(my_newCONSTSUB) - -#if defined(NEED_newCONSTSUB) || defined(NEED_newCONSTSUB_GLOBAL) - -void -DPPP_(my_newCONSTSUB)(HV *stash, char *name, SV *sv) -{ - U32 oldhints = PL_hints; - HV *old_cop_stash = PL_curcop->cop_stash; - HV *old_curstash = PL_curstash; - line_t oldline = PL_curcop->cop_line; - PL_curcop->cop_line = PL_copline; - - PL_hints &= ~HINT_BLOCK_SCOPE; - if (stash) - PL_curstash = PL_curcop->cop_stash = stash; - - newSUB( - -#if ((PERL_VERSION < 3) || ((PERL_VERSION == 3) && (PERL_SUBVERSION < 22))) - start_subparse(), -#elif ((PERL_VERSION == 3) && (PERL_SUBVERSION == 22)) - start_subparse(0), -#else /* 5.003_23 onwards */ - start_subparse(FALSE, 0), -#endif - - newSVOP(OP_CONST, 0, newSVpv(name,0)), - newSVOP(OP_CONST, 0, &PL_sv_no), /* SvPV(&PL_sv_no) == "" -- GMB */ - newSTATEOP(0, Nullch, newSVOP(OP_CONST, 0, sv)) - ); - - PL_hints = oldhints; - PL_curcop->cop_stash = old_cop_stash; - PL_curstash = old_curstash; - PL_curcop->cop_line = oldline; -} -#endif -#endif - -/* - * Boilerplate macros for initializing and accessing interpreter-local - * data from C. All statics in extensions should be reworked to use - * this, if you want to make the extension thread-safe. See ext/re/re.xs - * for an example of the use of these macros. - * - * Code that uses these macros is responsible for the following: - * 1. #define MY_CXT_KEY to a unique string, e.g. "DynaLoader_guts" - * 2. Declare a typedef named my_cxt_t that is a structure that contains - * all the data that needs to be interpreter-local. - * 3. Use the START_MY_CXT macro after the declaration of my_cxt_t. - * 4. Use the MY_CXT_INIT macro such that it is called exactly once - * (typically put in the BOOT: section). - * 5. Use the members of the my_cxt_t structure everywhere as - * MY_CXT.member. - * 6. Use the dMY_CXT macro (a declaration) in all the functions that - * access MY_CXT. - */ - -#if defined(MULTIPLICITY) || defined(PERL_OBJECT) || \ - defined(PERL_CAPI) || defined(PERL_IMPLICIT_CONTEXT) - -#ifndef START_MY_CXT - -/* This must appear in all extensions that define a my_cxt_t structure, - * right after the definition (i.e. at file scope). The non-threads - * case below uses it to declare the data as static. */ -#define START_MY_CXT - -#if (PERL_VERSION < 4 || (PERL_VERSION == 4 && PERL_SUBVERSION < 68 )) -/* Fetches the SV that keeps the per-interpreter data. */ -#define dMY_CXT_SV \ - SV *my_cxt_sv = get_sv(MY_CXT_KEY, FALSE) -#else /* >= perl5.004_68 */ -#define dMY_CXT_SV \ - SV *my_cxt_sv = *hv_fetch(PL_modglobal, MY_CXT_KEY, \ - sizeof(MY_CXT_KEY)-1, TRUE) -#endif /* < perl5.004_68 */ - -/* This declaration should be used within all functions that use the - * interpreter-local data. */ -#define dMY_CXT \ - dMY_CXT_SV; \ - my_cxt_t *my_cxtp = INT2PTR(my_cxt_t*,SvUV(my_cxt_sv)) - -/* Creates and zeroes the per-interpreter data. - * (We allocate my_cxtp in a Perl SV so that it will be released when - * the interpreter goes away.) */ -#define MY_CXT_INIT \ - dMY_CXT_SV; \ - /* newSV() allocates one more than needed */ \ - my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\ - Zero(my_cxtp, 1, my_cxt_t); \ - sv_setuv(my_cxt_sv, PTR2UV(my_cxtp)) - -/* This macro must be used to access members of the my_cxt_t structure. - * e.g. MYCXT.some_data */ -#define MY_CXT (*my_cxtp) - -/* Judicious use of these macros can reduce the number of times dMY_CXT - * is used. Use is similar to pTHX, aTHX etc. */ -#define pMY_CXT my_cxt_t *my_cxtp -#define pMY_CXT_ pMY_CXT, -#define _pMY_CXT ,pMY_CXT -#define aMY_CXT my_cxtp -#define aMY_CXT_ aMY_CXT, -#define _aMY_CXT ,aMY_CXT - -#endif /* START_MY_CXT */ - -#ifndef MY_CXT_CLONE -/* Clones the per-interpreter data. */ -#define MY_CXT_CLONE \ - dMY_CXT_SV; \ - my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\ - Copy(INT2PTR(my_cxt_t*, SvUV(my_cxt_sv)), my_cxtp, 1, my_cxt_t);\ - sv_setuv(my_cxt_sv, PTR2UV(my_cxtp)) -#endif - -#else /* single interpreter */ - -#ifndef START_MY_CXT - -#define START_MY_CXT static my_cxt_t my_cxt; -#define dMY_CXT_SV dNOOP -#define dMY_CXT dNOOP -#define MY_CXT_INIT NOOP -#define MY_CXT my_cxt - -#define pMY_CXT void -#define pMY_CXT_ -#define _pMY_CXT -#define aMY_CXT -#define aMY_CXT_ -#define _aMY_CXT - -#endif /* START_MY_CXT */ - -#ifndef MY_CXT_CLONE -#define MY_CXT_CLONE NOOP -#endif - -#endif - -#ifndef IVdf -# if IVSIZE == LONGSIZE -# define IVdf "ld" -# define UVuf "lu" -# define UVof "lo" -# define UVxf "lx" -# define UVXf "lX" -# else -# if IVSIZE == INTSIZE -# define IVdf "d" -# define UVuf "u" -# define UVof "o" -# define UVxf "x" -# define UVXf "X" -# endif -# endif -#endif - -#ifndef NVef -# if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && \ - defined(PERL_PRIfldbl) /* Not very likely, but let's try anyway. */ -# define NVef PERL_PRIeldbl -# define NVff PERL_PRIfldbl -# define NVgf PERL_PRIgldbl -# else -# define NVef "e" -# define NVff "f" -# define NVgf "g" -# endif -#endif - -#ifndef SvPV_nolen - -#if defined(NEED_sv_2pv_nolen) -static char * DPPP_(my_sv_2pv_nolen)(pTHX_ register SV *sv); -static -#else -extern char * DPPP_(my_sv_2pv_nolen)(pTHX_ register SV *sv); -#endif - -#ifdef sv_2pv_nolen -# undef sv_2pv_nolen -#endif -#define sv_2pv_nolen(a) DPPP_(my_sv_2pv_nolen)(aTHX_ a) -#define Perl_sv_2pv_nolen DPPP_(my_sv_2pv_nolen) - -#if defined(NEED_sv_2pv_nolen) || defined(NEED_sv_2pv_nolen_GLOBAL) - -char * -DPPP_(my_sv_2pv_nolen)(pTHX_ register SV *sv) -{ - STRLEN n_a; - return sv_2pv(sv, &n_a); -} - -#endif - -/* Hint: sv_2pv_nolen - * Use the SvPV_nolen() macro instead of sv_2pv_nolen(). - */ - -/* SvPV_nolen depends on sv_2pv_nolen */ -#define SvPV_nolen(sv) \ - ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ - ? SvPVX(sv) : sv_2pv_nolen(sv)) - -#endif - -#ifdef SvPVbyte - -/* Hint: SvPVbyte - * Does not work in perl-5.6.1, ppport.h implements a version - * borrowed from perl-5.7.3. - */ - -#if ((PERL_VERSION < 7) || ((PERL_VERSION == 7) && (PERL_SUBVERSION < 0))) - -#if defined(NEED_sv_2pvbyte) -static char * DPPP_(my_sv_2pvbyte)(pTHX_ register SV *sv, STRLEN *lp); -static -#else -extern char * DPPP_(my_sv_2pvbyte)(pTHX_ register SV *sv, STRLEN *lp); -#endif - -#ifdef sv_2pvbyte -# undef sv_2pvbyte -#endif -#define sv_2pvbyte(a,b) DPPP_(my_sv_2pvbyte)(aTHX_ a,b) -#define Perl_sv_2pvbyte DPPP_(my_sv_2pvbyte) - -#if defined(NEED_sv_2pvbyte) || defined(NEED_sv_2pvbyte_GLOBAL) - -char * -DPPP_(my_sv_2pvbyte)(pTHX_ register SV *sv, STRLEN *lp) -{ - sv_utf8_downgrade(sv,0); - return SvPV(sv,*lp); -} - -#endif - -/* Hint: sv_2pvbyte - * Use the SvPVbyte() macro instead of sv_2pvbyte(). - */ - -#undef SvPVbyte - -/* SvPVbyte depends on sv_2pvbyte */ -#define SvPVbyte(sv, lp) \ - ((SvFLAGS(sv) & (SVf_POK|SVf_UTF8)) == (SVf_POK) \ - ? ((lp = SvCUR(sv)), SvPVX(sv)) : sv_2pvbyte(sv, &lp)) - -#endif - -#else - -# define SvPVbyte SvPV -# define sv_2pvbyte sv_2pv - -#endif - -/* sv_2pvbyte_nolen depends on sv_2pv_nolen */ -#ifndef sv_2pvbyte_nolen -# define sv_2pvbyte_nolen sv_2pv_nolen -#endif - -/* Hint: sv_pvn - * Always use the SvPV() macro instead of sv_pvn(). - */ -#ifndef sv_pvn -# define sv_pvn(sv, len) SvPV(sv, len) -#endif - -/* Hint: sv_pvn_force - * Always use the SvPV_force() macro instead of sv_pvn_force(). - */ -#ifndef sv_pvn_force -# define sv_pvn_force(sv, len) SvPV_force(sv, len) -#endif - -#if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0))) && !defined(vnewSVpvf) -#if defined(NEED_vnewSVpvf) -static SV * DPPP_(my_vnewSVpvf)(pTHX_ const char * pat, va_list * args); -static -#else -extern SV * DPPP_(my_vnewSVpvf)(pTHX_ const char * pat, va_list * args); -#endif - -#ifdef vnewSVpvf -# undef vnewSVpvf -#endif -#define vnewSVpvf(a,b) DPPP_(my_vnewSVpvf)(aTHX_ a,b) -#define Perl_vnewSVpvf DPPP_(my_vnewSVpvf) - -#if defined(NEED_vnewSVpvf) || defined(NEED_vnewSVpvf_GLOBAL) - -SV * -DPPP_(my_vnewSVpvf)(pTHX_ const char *pat, va_list *args) -{ - register SV *sv = newSV(0); - sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)); - return sv; -} - -#endif -#endif - -/* sv_vcatpvf depends on sv_vcatpvfn */ -#if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0))) && !defined(sv_vcatpvf) -# define sv_vcatpvf(sv, pat, args) sv_vcatpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)) -#endif - -/* sv_vsetpvf depends on sv_vsetpvfn */ -#if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0))) && !defined(sv_vsetpvf) -# define sv_vsetpvf(sv, pat, args) sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)) -#endif - -/* sv_catpvf_mg depends on sv_vcatpvfn, sv_catpvf_mg_nocontext */ -#if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0))) && !defined(sv_catpvf_mg) -#if defined(NEED_sv_catpvf_mg) -static void DPPP_(my_sv_catpvf_mg)(pTHX_ SV * sv, const char * pat, ...); -static -#else -extern void DPPP_(my_sv_catpvf_mg)(pTHX_ SV * sv, const char * pat, ...); -#endif - -#define Perl_sv_catpvf_mg DPPP_(my_sv_catpvf_mg) - -#if defined(NEED_sv_catpvf_mg) || defined(NEED_sv_catpvf_mg_GLOBAL) - -void -DPPP_(my_sv_catpvf_mg)(pTHX_ SV *sv, const char *pat, ...) -{ - va_list args; - va_start(args, pat); - sv_vcatpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); - SvSETMAGIC(sv); - va_end(args); -} - -#endif -#endif - -/* sv_catpvf_mg_nocontext depends on sv_vcatpvfn */ -#ifdef PERL_IMPLICIT_CONTEXT -#if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0))) && !defined(sv_catpvf_mg_nocontext) -#if defined(NEED_sv_catpvf_mg_nocontext) -static void DPPP_(my_sv_catpvf_mg_nocontext)(SV * sv, const char * pat, ...); -static -#else -extern void DPPP_(my_sv_catpvf_mg_nocontext)(SV * sv, const char * pat, ...); -#endif - -#define sv_catpvf_mg_nocontext DPPP_(my_sv_catpvf_mg_nocontext) -#define Perl_sv_catpvf_mg_nocontext DPPP_(my_sv_catpvf_mg_nocontext) - -#if defined(NEED_sv_catpvf_mg_nocontext) || defined(NEED_sv_catpvf_mg_nocontext_GLOBAL) - -void -DPPP_(my_sv_catpvf_mg_nocontext)(SV *sv, const char *pat, ...) -{ - dTHX; - va_list args; - va_start(args, pat); - sv_vcatpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); - SvSETMAGIC(sv); - va_end(args); -} - -#endif -#endif -#endif - -#ifndef sv_catpvf_mg -# ifdef PERL_IMPLICIT_CONTEXT -# define sv_catpvf_mg Perl_sv_catpvf_mg_nocontext -# else -# define sv_catpvf_mg Perl_sv_catpvf_mg -# endif -#endif - -/* sv_vcatpvf_mg depends on sv_vcatpvfn */ -#if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0))) && !defined(sv_vcatpvf_mg) -# define sv_vcatpvf_mg(sv, pat, args) \ - STMT_START { \ - sv_vcatpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)); \ - SvSETMAGIC(sv); \ - } STMT_END -#endif - -/* sv_setpvf_mg depends on sv_vsetpvfn, sv_setpvf_mg_nocontext */ -#if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0))) && !defined(sv_setpvf_mg) -#if defined(NEED_sv_setpvf_mg) -static void DPPP_(my_sv_setpvf_mg)(pTHX_ SV * sv, const char * pat, ...); -static -#else -extern void DPPP_(my_sv_setpvf_mg)(pTHX_ SV * sv, const char * pat, ...); -#endif - -#define Perl_sv_setpvf_mg DPPP_(my_sv_setpvf_mg) - -#if defined(NEED_sv_setpvf_mg) || defined(NEED_sv_setpvf_mg_GLOBAL) - -void -DPPP_(my_sv_setpvf_mg)(pTHX_ SV *sv, const char *pat, ...) -{ - va_list args; - va_start(args, pat); - sv_vsetpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); - SvSETMAGIC(sv); - va_end(args); -} - -#endif -#endif - -/* sv_setpvf_mg_nocontext depends on sv_vsetpvfn */ -#ifdef PERL_IMPLICIT_CONTEXT -#if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0))) && !defined(sv_setpvf_mg_nocontext) -#if defined(NEED_sv_setpvf_mg_nocontext) -static void DPPP_(my_sv_setpvf_mg_nocontext)(SV * sv, const char * pat, ...); -static -#else -extern void DPPP_(my_sv_setpvf_mg_nocontext)(SV * sv, const char * pat, ...); -#endif - -#define sv_setpvf_mg_nocontext DPPP_(my_sv_setpvf_mg_nocontext) -#define Perl_sv_setpvf_mg_nocontext DPPP_(my_sv_setpvf_mg_nocontext) - -#if defined(NEED_sv_setpvf_mg_nocontext) || defined(NEED_sv_setpvf_mg_nocontext_GLOBAL) - -void -DPPP_(my_sv_setpvf_mg_nocontext)(SV *sv, const char *pat, ...) -{ - dTHX; - va_list args; - va_start(args, pat); - sv_vsetpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); - SvSETMAGIC(sv); - va_end(args); -} - -#endif -#endif -#endif - -#ifndef sv_setpvf_mg -# ifdef PERL_IMPLICIT_CONTEXT -# define sv_setpvf_mg Perl_sv_setpvf_mg_nocontext -# else -# define sv_setpvf_mg Perl_sv_setpvf_mg -# endif -#endif - -/* sv_vsetpvf_mg depends on sv_vsetpvfn */ -#if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0))) && !defined(sv_vsetpvf_mg) -# define sv_vsetpvf_mg(sv, pat, args) \ - STMT_START { \ - sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)); \ - SvSETMAGIC(sv); \ - } STMT_END -#endif -#ifndef SvGETMAGIC -# define SvGETMAGIC(x) STMT_START { if (SvGMAGICAL(x)) mg_get(x); } STMT_END -#endif -#ifndef PERL_MAGIC_sv -# define PERL_MAGIC_sv '\0' -#endif - -#ifndef PERL_MAGIC_overload -# define PERL_MAGIC_overload 'A' -#endif - -#ifndef PERL_MAGIC_overload_elem -# define PERL_MAGIC_overload_elem 'a' -#endif - -#ifndef PERL_MAGIC_overload_table -# define PERL_MAGIC_overload_table 'c' -#endif - -#ifndef PERL_MAGIC_bm -# define PERL_MAGIC_bm 'B' -#endif - -#ifndef PERL_MAGIC_regdata -# define PERL_MAGIC_regdata 'D' -#endif - -#ifndef PERL_MAGIC_regdatum -# define PERL_MAGIC_regdatum 'd' -#endif - -#ifndef PERL_MAGIC_env -# define PERL_MAGIC_env 'E' -#endif - -#ifndef PERL_MAGIC_envelem -# define PERL_MAGIC_envelem 'e' -#endif - -#ifndef PERL_MAGIC_fm -# define PERL_MAGIC_fm 'f' -#endif - -#ifndef PERL_MAGIC_regex_global -# define PERL_MAGIC_regex_global 'g' -#endif - -#ifndef PERL_MAGIC_isa -# define PERL_MAGIC_isa 'I' -#endif - -#ifndef PERL_MAGIC_isaelem -# define PERL_MAGIC_isaelem 'i' -#endif - -#ifndef PERL_MAGIC_nkeys -# define PERL_MAGIC_nkeys 'k' -#endif - -#ifndef PERL_MAGIC_dbfile -# define PERL_MAGIC_dbfile 'L' -#endif - -#ifndef PERL_MAGIC_dbline -# define PERL_MAGIC_dbline 'l' -#endif - -#ifndef PERL_MAGIC_mutex -# define PERL_MAGIC_mutex 'm' -#endif - -#ifndef PERL_MAGIC_shared -# define PERL_MAGIC_shared 'N' -#endif - -#ifndef PERL_MAGIC_shared_scalar -# define PERL_MAGIC_shared_scalar 'n' -#endif - -#ifndef PERL_MAGIC_collxfrm -# define PERL_MAGIC_collxfrm 'o' -#endif - -#ifndef PERL_MAGIC_tied -# define PERL_MAGIC_tied 'P' -#endif - -#ifndef PERL_MAGIC_tiedelem -# define PERL_MAGIC_tiedelem 'p' -#endif - -#ifndef PERL_MAGIC_tiedscalar -# define PERL_MAGIC_tiedscalar 'q' -#endif - -#ifndef PERL_MAGIC_qr -# define PERL_MAGIC_qr 'r' -#endif - -#ifndef PERL_MAGIC_sig -# define PERL_MAGIC_sig 'S' -#endif - -#ifndef PERL_MAGIC_sigelem -# define PERL_MAGIC_sigelem 's' -#endif - -#ifndef PERL_MAGIC_taint -# define PERL_MAGIC_taint 't' -#endif - -#ifndef PERL_MAGIC_uvar -# define PERL_MAGIC_uvar 'U' -#endif - -#ifndef PERL_MAGIC_uvar_elem -# define PERL_MAGIC_uvar_elem 'u' -#endif - -#ifndef PERL_MAGIC_vstring -# define PERL_MAGIC_vstring 'V' -#endif - -#ifndef PERL_MAGIC_vec -# define PERL_MAGIC_vec 'v' -#endif - -#ifndef PERL_MAGIC_utf8 -# define PERL_MAGIC_utf8 'w' -#endif - -#ifndef PERL_MAGIC_substr -# define PERL_MAGIC_substr 'x' -#endif - -#ifndef PERL_MAGIC_defelem -# define PERL_MAGIC_defelem 'y' -#endif - -#ifndef PERL_MAGIC_glob -# define PERL_MAGIC_glob '*' -#endif - -#ifndef PERL_MAGIC_arylen -# define PERL_MAGIC_arylen '#' -#endif - -#ifndef PERL_MAGIC_pos -# define PERL_MAGIC_pos '.' -#endif - -#ifndef PERL_MAGIC_backref -# define PERL_MAGIC_backref '<' -#endif - -#ifndef PERL_MAGIC_ext -# define PERL_MAGIC_ext '~' -#endif - -/* That's the best we can do... */ -#ifndef SvPV_force_nomg -# define SvPV_force_nomg SvPV_force -#endif - -#ifndef SvPV_nomg -# define SvPV_nomg SvPV -#endif - -#ifndef sv_catpvn_nomg -# define sv_catpvn_nomg sv_catpvn -#endif - -#ifndef sv_catsv_nomg -# define sv_catsv_nomg sv_catsv -#endif - -#ifndef sv_setsv_nomg -# define sv_setsv_nomg sv_setsv -#endif - -#ifndef sv_pvn_nomg -# define sv_pvn_nomg sv_pvn -#endif - -#ifndef SvIV_nomg -# define SvIV_nomg SvIV -#endif - -#ifndef SvUV_nomg -# define SvUV_nomg SvUV -#endif - -#ifndef sv_catpv_mg -# define sv_catpv_mg(sv, ptr) \ - STMT_START { \ - SV *TeMpSv = sv; \ - sv_catpv(TeMpSv,ptr); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifndef sv_catpvn_mg -# define sv_catpvn_mg(sv, ptr, len) \ - STMT_START { \ - SV *TeMpSv = sv; \ - sv_catpvn(TeMpSv,ptr,len); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifndef sv_catsv_mg -# define sv_catsv_mg(dsv, ssv) \ - STMT_START { \ - SV *TeMpSv = dsv; \ - sv_catsv(TeMpSv,ssv); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifndef sv_setiv_mg -# define sv_setiv_mg(sv, i) \ - STMT_START { \ - SV *TeMpSv = sv; \ - sv_setiv(TeMpSv,i); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifndef sv_setnv_mg -# define sv_setnv_mg(sv, num) \ - STMT_START { \ - SV *TeMpSv = sv; \ - sv_setnv(TeMpSv,num); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifndef sv_setpv_mg -# define sv_setpv_mg(sv, ptr) \ - STMT_START { \ - SV *TeMpSv = sv; \ - sv_setpv(TeMpSv,ptr); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifndef sv_setpvn_mg -# define sv_setpvn_mg(sv, ptr, len) \ - STMT_START { \ - SV *TeMpSv = sv; \ - sv_setpvn(TeMpSv,ptr,len); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifndef sv_setsv_mg -# define sv_setsv_mg(dsv, ssv) \ - STMT_START { \ - SV *TeMpSv = dsv; \ - sv_setsv(TeMpSv,ssv); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifndef sv_setuv_mg -# define sv_setuv_mg(sv, i) \ - STMT_START { \ - SV *TeMpSv = sv; \ - sv_setuv(TeMpSv,i); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifndef sv_usepvn_mg -# define sv_usepvn_mg(sv, ptr, len) \ - STMT_START { \ - SV *TeMpSv = sv; \ - sv_usepvn(TeMpSv,ptr,len); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifdef USE_ITHREADS -#ifndef CopFILE -# define CopFILE(c) ((c)->cop_file) -#endif - -#ifndef CopFILEGV -# define CopFILEGV(c) (CopFILE(c) ? gv_fetchfile(CopFILE(c)) : Nullgv) -#endif - -#ifndef CopFILE_set -# define CopFILE_set(c,pv) ((c)->cop_file = savepv(pv)) -#endif - -#ifndef CopFILESV -# define CopFILESV(c) (CopFILE(c) ? GvSV(gv_fetchfile(CopFILE(c))) : Nullsv) -#endif - -#ifndef CopFILEAV -# define CopFILEAV(c) (CopFILE(c) ? GvAV(gv_fetchfile(CopFILE(c))) : Nullav) -#endif - -#ifndef CopSTASHPV -# define CopSTASHPV(c) ((c)->cop_stashpv) -#endif - -#ifndef CopSTASHPV_set -# define CopSTASHPV_set(c,pv) ((c)->cop_stashpv = ((pv) ? savepv(pv) : Nullch)) -#endif - -#ifndef CopSTASH -# define CopSTASH(c) (CopSTASHPV(c) ? gv_stashpv(CopSTASHPV(c),GV_ADD) : Nullhv) -#endif - -#ifndef CopSTASH_set -# define CopSTASH_set(c,hv) CopSTASHPV_set(c, (hv) ? HvNAME(hv) : Nullch) -#endif - -#ifndef CopSTASH_eq -# define CopSTASH_eq(c,hv) ((hv) && (CopSTASHPV(c) == HvNAME(hv) \ - || (CopSTASHPV(c) && HvNAME(hv) \ - && strEQ(CopSTASHPV(c), HvNAME(hv))))) -#endif - -#else -#ifndef CopFILEGV -# define CopFILEGV(c) ((c)->cop_filegv) -#endif - -#ifndef CopFILEGV_set -# define CopFILEGV_set(c,gv) ((c)->cop_filegv = (GV*)SvREFCNT_inc(gv)) -#endif - -#ifndef CopFILE_set -# define CopFILE_set(c,pv) CopFILEGV_set((c), gv_fetchfile(pv)) -#endif - -#ifndef CopFILESV -# define CopFILESV(c) (CopFILEGV(c) ? GvSV(CopFILEGV(c)) : Nullsv) -#endif - -#ifndef CopFILEAV -# define CopFILEAV(c) (CopFILEGV(c) ? GvAV(CopFILEGV(c)) : Nullav) -#endif - -#ifndef CopFILE -# define CopFILE(c) (CopFILESV(c) ? SvPVX(CopFILESV(c)) : Nullch) -#endif - -#ifndef CopSTASH -# define CopSTASH(c) ((c)->cop_stash) -#endif - -#ifndef CopSTASH_set -# define CopSTASH_set(c,hv) ((c)->cop_stash = (hv)) -#endif - -#ifndef CopSTASHPV -# define CopSTASHPV(c) (CopSTASH(c) ? HvNAME(CopSTASH(c)) : Nullch) -#endif - -#ifndef CopSTASHPV_set -# define CopSTASHPV_set(c,pv) CopSTASH_set((c), gv_stashpv(pv,GV_ADD)) -#endif - -#ifndef CopSTASH_eq -# define CopSTASH_eq(c,hv) (CopSTASH(c) == (hv)) -#endif - -#endif /* USE_ITHREADS */ -#ifndef IN_PERL_COMPILETIME -# define IN_PERL_COMPILETIME (PL_curcop == &PL_compiling) -#endif - -#ifndef IN_LOCALE_RUNTIME -# define IN_LOCALE_RUNTIME (PL_curcop->op_private & HINT_LOCALE) -#endif - -#ifndef IN_LOCALE_COMPILETIME -# define IN_LOCALE_COMPILETIME (PL_hints & HINT_LOCALE) -#endif - -#ifndef IN_LOCALE -# define IN_LOCALE (IN_PERL_COMPILETIME ? IN_LOCALE_COMPILETIME : IN_LOCALE_RUNTIME) -#endif -#ifndef IS_NUMBER_IN_UV -# define IS_NUMBER_IN_UV 0x01 -#endif - -#ifndef IS_NUMBER_GREATER_THAN_UV_MAX -# define IS_NUMBER_GREATER_THAN_UV_MAX 0x02 -#endif - -#ifndef IS_NUMBER_NOT_INT -# define IS_NUMBER_NOT_INT 0x04 -#endif - -#ifndef IS_NUMBER_NEG -# define IS_NUMBER_NEG 0x08 -#endif - -#ifndef IS_NUMBER_INFINITY -# define IS_NUMBER_INFINITY 0x10 -#endif - -#ifndef IS_NUMBER_NAN -# define IS_NUMBER_NAN 0x20 -#endif - -/* GROK_NUMERIC_RADIX depends on grok_numeric_radix */ -#ifndef GROK_NUMERIC_RADIX -# define GROK_NUMERIC_RADIX(sp, send) grok_numeric_radix(sp, send) -#endif -#ifndef PERL_SCAN_GREATER_THAN_UV_MAX -# define PERL_SCAN_GREATER_THAN_UV_MAX 0x02 -#endif - -#ifndef PERL_SCAN_SILENT_ILLDIGIT -# define PERL_SCAN_SILENT_ILLDIGIT 0x04 -#endif - -#ifndef PERL_SCAN_ALLOW_UNDERSCORES -# define PERL_SCAN_ALLOW_UNDERSCORES 0x01 -#endif - -#ifndef PERL_SCAN_DISALLOW_PREFIX -# define PERL_SCAN_DISALLOW_PREFIX 0x02 -#endif - -#ifndef grok_numeric_radix -#if defined(NEED_grok_numeric_radix) -static bool DPPP_(my_grok_numeric_radix)(pTHX_ const char ** sp, const char * send); -static -#else -extern bool DPPP_(my_grok_numeric_radix)(pTHX_ const char ** sp, const char * send); -#endif - -#ifdef grok_numeric_radix -# undef grok_numeric_radix -#endif -#define grok_numeric_radix(a,b) DPPP_(my_grok_numeric_radix)(aTHX_ a,b) -#define Perl_grok_numeric_radix DPPP_(my_grok_numeric_radix) - -#if defined(NEED_grok_numeric_radix) || defined(NEED_grok_numeric_radix_GLOBAL) -bool -DPPP_(my_grok_numeric_radix)(pTHX_ const char **sp, const char *send) -{ -#ifdef USE_LOCALE_NUMERIC -#ifdef PL_numeric_radix_sv - if (PL_numeric_radix_sv && IN_LOCALE) { - STRLEN len; - char* radix = SvPV(PL_numeric_radix_sv, len); - if (*sp + len <= send && memEQ(*sp, radix, len)) { - *sp += len; - return TRUE; - } - } -#else - /* older perls don't have PL_numeric_radix_sv so the radix - * must manually be requested from locale.h - */ -#include - dTHR; /* needed for older threaded perls */ - struct lconv *lc = localeconv(); - char *radix = lc->decimal_point; - if (radix && IN_LOCALE) { - STRLEN len = strlen(radix); - if (*sp + len <= send && memEQ(*sp, radix, len)) { - *sp += len; - return TRUE; - } - } -#endif /* PERL_VERSION */ -#endif /* USE_LOCALE_NUMERIC */ - /* always try "." if numeric radix didn't match because - * we may have data from different locales mixed */ - if (*sp < send && **sp == '.') { - ++*sp; - return TRUE; - } - return FALSE; -} -#endif -#endif - -/* grok_number depends on grok_numeric_radix */ - -#ifndef grok_number -#if defined(NEED_grok_number) -static int DPPP_(my_grok_number)(pTHX_ const char * pv, STRLEN len, UV * valuep); -static -#else -extern int DPPP_(my_grok_number)(pTHX_ const char * pv, STRLEN len, UV * valuep); -#endif - -#ifdef grok_number -# undef grok_number -#endif -#define grok_number(a,b,c) DPPP_(my_grok_number)(aTHX_ a,b,c) -#define Perl_grok_number DPPP_(my_grok_number) - -#if defined(NEED_grok_number) || defined(NEED_grok_number_GLOBAL) -int -DPPP_(my_grok_number)(pTHX_ const char *pv, STRLEN len, UV *valuep) -{ - const char *s = pv; - const char *send = pv + len; - const UV max_div_10 = UV_MAX / 10; - const char max_mod_10 = UV_MAX % 10; - int numtype = 0; - int sawinf = 0; - int sawnan = 0; - - while (s < send && isSPACE(*s)) - s++; - if (s == send) { - return 0; - } else if (*s == '-') { - s++; - numtype = IS_NUMBER_NEG; - } - else if (*s == '+') - s++; - - if (s == send) - return 0; - - /* next must be digit or the radix separator or beginning of infinity */ - if (isDIGIT(*s)) { - /* UVs are at least 32 bits, so the first 9 decimal digits cannot - overflow. */ - UV value = *s - '0'; - /* This construction seems to be more optimiser friendly. - (without it gcc does the isDIGIT test and the *s - '0' separately) - With it gcc on arm is managing 6 instructions (6 cycles) per digit. - In theory the optimiser could deduce how far to unroll the loop - before checking for overflow. */ - if (++s < send) { - int digit = *s - '0'; - if (digit >= 0 && digit <= 9) { - value = value * 10 + digit; - if (++s < send) { - digit = *s - '0'; - if (digit >= 0 && digit <= 9) { - value = value * 10 + digit; - if (++s < send) { - digit = *s - '0'; - if (digit >= 0 && digit <= 9) { - value = value * 10 + digit; - if (++s < send) { - digit = *s - '0'; - if (digit >= 0 && digit <= 9) { - value = value * 10 + digit; - if (++s < send) { - digit = *s - '0'; - if (digit >= 0 && digit <= 9) { - value = value * 10 + digit; - if (++s < send) { - digit = *s - '0'; - if (digit >= 0 && digit <= 9) { - value = value * 10 + digit; - if (++s < send) { - digit = *s - '0'; - if (digit >= 0 && digit <= 9) { - value = value * 10 + digit; - if (++s < send) { - digit = *s - '0'; - if (digit >= 0 && digit <= 9) { - value = value * 10 + digit; - if (++s < send) { - /* Now got 9 digits, so need to check - each time for overflow. */ - digit = *s - '0'; - while (digit >= 0 && digit <= 9 - && (value < max_div_10 - || (value == max_div_10 - && digit <= max_mod_10))) { - value = value * 10 + digit; - if (++s < send) - digit = *s - '0'; - else - break; - } - if (digit >= 0 && digit <= 9 - && (s < send)) { - /* value overflowed. - skip the remaining digits, don't - worry about setting *valuep. */ - do { - s++; - } while (s < send && isDIGIT(*s)); - numtype |= - IS_NUMBER_GREATER_THAN_UV_MAX; - goto skip_value; - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - numtype |= IS_NUMBER_IN_UV; - if (valuep) - *valuep = value; - - skip_value: - if (GROK_NUMERIC_RADIX(&s, send)) { - numtype |= IS_NUMBER_NOT_INT; - while (s < send && isDIGIT(*s)) /* optional digits after the radix */ - s++; - } - } - else if (GROK_NUMERIC_RADIX(&s, send)) { - numtype |= IS_NUMBER_NOT_INT | IS_NUMBER_IN_UV; /* valuep assigned below */ - /* no digits before the radix means we need digits after it */ - if (s < send && isDIGIT(*s)) { - do { - s++; - } while (s < send && isDIGIT(*s)); - if (valuep) { - /* integer approximation is valid - it's 0. */ - *valuep = 0; - } - } - else - return 0; - } else if (*s == 'I' || *s == 'i') { - s++; if (s == send || (*s != 'N' && *s != 'n')) return 0; - s++; if (s == send || (*s != 'F' && *s != 'f')) return 0; - s++; if (s < send && (*s == 'I' || *s == 'i')) { - s++; if (s == send || (*s != 'N' && *s != 'n')) return 0; - s++; if (s == send || (*s != 'I' && *s != 'i')) return 0; - s++; if (s == send || (*s != 'T' && *s != 't')) return 0; - s++; if (s == send || (*s != 'Y' && *s != 'y')) return 0; - s++; - } - sawinf = 1; - } else if (*s == 'N' || *s == 'n') { - /* XXX TODO: There are signaling NaNs and quiet NaNs. */ - s++; if (s == send || (*s != 'A' && *s != 'a')) return 0; - s++; if (s == send || (*s != 'N' && *s != 'n')) return 0; - s++; - sawnan = 1; - } else - return 0; - - if (sawinf) { - numtype &= IS_NUMBER_NEG; /* Keep track of sign */ - numtype |= IS_NUMBER_INFINITY | IS_NUMBER_NOT_INT; - } else if (sawnan) { - numtype &= IS_NUMBER_NEG; /* Keep track of sign */ - numtype |= IS_NUMBER_NAN | IS_NUMBER_NOT_INT; - } else if (s < send) { - /* we can have an optional exponent part */ - if (*s == 'e' || *s == 'E') { - /* The only flag we keep is sign. Blow away any "it's UV" */ - numtype &= IS_NUMBER_NEG; - numtype |= IS_NUMBER_NOT_INT; - s++; - if (s < send && (*s == '-' || *s == '+')) - s++; - if (s < send && isDIGIT(*s)) { - do { - s++; - } while (s < send && isDIGIT(*s)); - } - else - return 0; - } - } - while (s < send && isSPACE(*s)) - s++; - if (s >= send) - return numtype; - if (len == 10 && memEQ(pv, "0 but true", 10)) { - if (valuep) - *valuep = 0; - return IS_NUMBER_IN_UV; - } - return 0; -} -#endif -#endif - -/* - * The grok_* routines have been modified to use warn() instead of - * Perl_warner(). Also, 'hexdigit' was the former name of PL_hexdigit, - * which is why the stack variable has been renamed to 'xdigit'. - */ - -#ifndef grok_bin -#if defined(NEED_grok_bin) -static UV DPPP_(my_grok_bin)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result); -static -#else -extern UV DPPP_(my_grok_bin)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result); -#endif - -#ifdef grok_bin -# undef grok_bin -#endif -#define grok_bin(a,b,c,d) DPPP_(my_grok_bin)(aTHX_ a,b,c,d) -#define Perl_grok_bin DPPP_(my_grok_bin) - -#if defined(NEED_grok_bin) || defined(NEED_grok_bin_GLOBAL) -UV -DPPP_(my_grok_bin)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result) -{ - const char *s = start; - STRLEN len = *len_p; - UV value = 0; - NV value_nv = 0; - - const UV max_div_2 = UV_MAX / 2; - bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES; - bool overflowed = FALSE; - - if (!(*flags & PERL_SCAN_DISALLOW_PREFIX)) { - /* strip off leading b or 0b. - for compatibility silently suffer "b" and "0b" as valid binary - numbers. */ - if (len >= 1) { - if (s[0] == 'b') { - s++; - len--; - } - else if (len >= 2 && s[0] == '0' && s[1] == 'b') { - s+=2; - len-=2; - } - } - } - - for (; len-- && *s; s++) { - char bit = *s; - if (bit == '0' || bit == '1') { - /* Write it in this wonky order with a goto to attempt to get the - compiler to make the common case integer-only loop pretty tight. - With gcc seems to be much straighter code than old scan_bin. */ - redo: - if (!overflowed) { - if (value <= max_div_2) { - value = (value << 1) | (bit - '0'); - continue; - } - /* Bah. We're just overflowed. */ - warn("Integer overflow in binary number"); - overflowed = TRUE; - value_nv = (NV) value; - } - value_nv *= 2.0; - /* If an NV has not enough bits in its mantissa to - * represent a UV this summing of small low-order numbers - * is a waste of time (because the NV cannot preserve - * the low-order bits anyway): we could just remember when - * did we overflow and in the end just multiply value_nv by the - * right amount. */ - value_nv += (NV)(bit - '0'); - continue; - } - if (bit == '_' && len && allow_underscores && (bit = s[1]) - && (bit == '0' || bit == '1')) - { - --len; - ++s; - goto redo; - } - if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT)) - warn("Illegal binary digit '%c' ignored", *s); - break; - } - - if ( ( overflowed && value_nv > 4294967295.0) -#if UVSIZE > 4 - || (!overflowed && value > 0xffffffff ) -#endif - ) { - warn("Binary number > 0b11111111111111111111111111111111 non-portable"); - } - *len_p = s - start; - if (!overflowed) { - *flags = 0; - return value; - } - *flags = PERL_SCAN_GREATER_THAN_UV_MAX; - if (result) - *result = value_nv; - return UV_MAX; -} -#endif -#endif - -#ifndef grok_hex -#if defined(NEED_grok_hex) -static UV DPPP_(my_grok_hex)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result); -static -#else -extern UV DPPP_(my_grok_hex)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result); -#endif - -#ifdef grok_hex -# undef grok_hex -#endif -#define grok_hex(a,b,c,d) DPPP_(my_grok_hex)(aTHX_ a,b,c,d) -#define Perl_grok_hex DPPP_(my_grok_hex) - -#if defined(NEED_grok_hex) || defined(NEED_grok_hex_GLOBAL) -UV -DPPP_(my_grok_hex)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result) -{ - const char *s = start; - STRLEN len = *len_p; - UV value = 0; - NV value_nv = 0; - - const UV max_div_16 = UV_MAX / 16; - bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES; - bool overflowed = FALSE; - const char *xdigit; - - if (!(*flags & PERL_SCAN_DISALLOW_PREFIX)) { - /* strip off leading x or 0x. - for compatibility silently suffer "x" and "0x" as valid hex numbers. - */ - if (len >= 1) { - if (s[0] == 'x') { - s++; - len--; - } - else if (len >= 2 && s[0] == '0' && s[1] == 'x') { - s+=2; - len-=2; - } - } - } - - for (; len-- && *s; s++) { - xdigit = strchr((char *) PL_hexdigit, *s); - if (xdigit) { - /* Write it in this wonky order with a goto to attempt to get the - compiler to make the common case integer-only loop pretty tight. - With gcc seems to be much straighter code than old scan_hex. */ - redo: - if (!overflowed) { - if (value <= max_div_16) { - value = (value << 4) | ((xdigit - PL_hexdigit) & 15); - continue; - } - warn("Integer overflow in hexadecimal number"); - overflowed = TRUE; - value_nv = (NV) value; - } - value_nv *= 16.0; - /* If an NV has not enough bits in its mantissa to - * represent a UV this summing of small low-order numbers - * is a waste of time (because the NV cannot preserve - * the low-order bits anyway): we could just remember when - * did we overflow and in the end just multiply value_nv by the - * right amount of 16-tuples. */ - value_nv += (NV)((xdigit - PL_hexdigit) & 15); - continue; - } - if (*s == '_' && len && allow_underscores && s[1] - && (xdigit = strchr((char *) PL_hexdigit, s[1]))) - { - --len; - ++s; - goto redo; - } - if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT)) - warn("Illegal hexadecimal digit '%c' ignored", *s); - break; - } - - if ( ( overflowed && value_nv > 4294967295.0) -#if UVSIZE > 4 - || (!overflowed && value > 0xffffffff ) -#endif - ) { - warn("Hexadecimal number > 0xffffffff non-portable"); - } - *len_p = s - start; - if (!overflowed) { - *flags = 0; - return value; - } - *flags = PERL_SCAN_GREATER_THAN_UV_MAX; - if (result) - *result = value_nv; - return UV_MAX; -} -#endif -#endif - -#ifndef grok_oct -#if defined(NEED_grok_oct) -static UV DPPP_(my_grok_oct)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result); -static -#else -extern UV DPPP_(my_grok_oct)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result); -#endif - -#ifdef grok_oct -# undef grok_oct -#endif -#define grok_oct(a,b,c,d) DPPP_(my_grok_oct)(aTHX_ a,b,c,d) -#define Perl_grok_oct DPPP_(my_grok_oct) - -#if defined(NEED_grok_oct) || defined(NEED_grok_oct_GLOBAL) -UV -DPPP_(my_grok_oct)(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result) -{ - const char *s = start; - STRLEN len = *len_p; - UV value = 0; - NV value_nv = 0; - - const UV max_div_8 = UV_MAX / 8; - bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES; - bool overflowed = FALSE; - - for (; len-- && *s; s++) { - /* gcc 2.95 optimiser not smart enough to figure that this subtraction - out front allows slicker code. */ - int digit = *s - '0'; - if (digit >= 0 && digit <= 7) { - /* Write it in this wonky order with a goto to attempt to get the - compiler to make the common case integer-only loop pretty tight. - */ - redo: - if (!overflowed) { - if (value <= max_div_8) { - value = (value << 3) | digit; - continue; - } - /* Bah. We're just overflowed. */ - warn("Integer overflow in octal number"); - overflowed = TRUE; - value_nv = (NV) value; - } - value_nv *= 8.0; - /* If an NV has not enough bits in its mantissa to - * represent a UV this summing of small low-order numbers - * is a waste of time (because the NV cannot preserve - * the low-order bits anyway): we could just remember when - * did we overflow and in the end just multiply value_nv by the - * right amount of 8-tuples. */ - value_nv += (NV)digit; - continue; - } - if (digit == ('_' - '0') && len && allow_underscores - && (digit = s[1] - '0') && (digit >= 0 && digit <= 7)) - { - --len; - ++s; - goto redo; - } - /* Allow \octal to work the DWIM way (that is, stop scanning - * as soon as non-octal characters are seen, complain only iff - * someone seems to want to use the digits eight and nine). */ - if (digit == 8 || digit == 9) { - if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT)) - warn("Illegal octal digit '%c' ignored", *s); - } - break; - } - - if ( ( overflowed && value_nv > 4294967295.0) -#if UVSIZE > 4 - || (!overflowed && value > 0xffffffff ) -#endif - ) { - warn("Octal number > 037777777777 non-portable"); - } - *len_p = s - start; - if (!overflowed) { - *flags = 0; - return value; - } - *flags = PERL_SCAN_GREATER_THAN_UV_MAX; - if (result) - *result = value_nv; - return UV_MAX; -} -#endif -#endif - -#ifdef NO_XSLOCKS -# ifdef dJMPENV -# define dXCPT dJMPENV; int rEtV = 0 -# define XCPT_TRY_START JMPENV_PUSH(rEtV); if (rEtV == 0) -# define XCPT_TRY_END JMPENV_POP; -# define XCPT_CATCH if (rEtV != 0) -# define XCPT_RETHROW JMPENV_JUMP(rEtV) -# else -# define dXCPT Sigjmp_buf oldTOP; int rEtV = 0 -# define XCPT_TRY_START Copy(top_env, oldTOP, 1, Sigjmp_buf); rEtV = Sigsetjmp(top_env, 1); if (rEtV == 0) -# define XCPT_TRY_END Copy(oldTOP, top_env, 1, Sigjmp_buf); -# define XCPT_CATCH if (rEtV != 0) -# define XCPT_RETHROW Siglongjmp(top_env, rEtV) -# endif -#endif - -#endif /* _P_P_PORTABILITY_H_ */ - -/* End of File ppport.h */ diff --git a/deps/Jplugin/t/.svn/entries b/deps/Jplugin/t/.svn/entries deleted file mode 100644 index eb26e80..0000000 --- a/deps/Jplugin/t/.svn/entries +++ /dev/null @@ -1,62 +0,0 @@ -10 - -dir -475 -svn://erxz.com/bb3/branches/perlbuut/deps/Jplugin/t -svn://erxz.com/bb3 - - - -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - -dcb1cea6-7f7e-4c78-8a22-148ace8ce36e - -Jplugin.t -file - - - - -2009-10-03T22:54:20.000000Z -bdd6ed33cf958c0a924739d8b49ed64c -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -464 - diff --git a/deps/Jplugin/t/.svn/text-base/Jplugin.t.svn-base b/deps/Jplugin/t/.svn/text-base/Jplugin.t.svn-base deleted file mode 100644 index 33f62b2..0000000 --- a/deps/Jplugin/t/.svn/text-base/Jplugin.t.svn-base +++ /dev/null @@ -1,15 +0,0 @@ -# Before `make install' is performed this script should be runnable with -# `make test'. After `make install' it should work as `perl Jplugin.t' - -######################### - -# change 'tests => 1' to 'tests => last_test_to_print'; - -use Test::More tests => 1; -BEGIN { use_ok('Jplugin') }; - -######################### - -# Insert your test code below, the Test::More module is use()ed here so read -# its man page ( perldoc Test::More ) for help writing this test script. - diff --git a/deps/Jplugin/t/Jplugin.t b/deps/Jplugin/t/Jplugin.t deleted file mode 100644 index 33f62b2..0000000 --- a/deps/Jplugin/t/Jplugin.t +++ /dev/null @@ -1,15 +0,0 @@ -# Before `make install' is performed this script should be runnable with -# `make test'. After `make install' it should work as `perl Jplugin.t' - -######################### - -# change 'tests => 1' to 'tests => last_test_to_print'; - -use Test::More tests => 1; -BEGIN { use_ok('Jplugin') }; - -######################### - -# Insert your test code below, the Test::More module is use()ed here so read -# its man page ( perldoc Test::More ) for help writing this test script. - diff --git a/deps/Language-K20/.svn/entries b/deps/Language-K20/.svn/entries deleted file mode 100644 index 128bea3..0000000 --- a/deps/Language-K20/.svn/entries +++ /dev/null @@ -1,445 +0,0 @@ -10 - -dir -475 -svn://erxz.com/bb3/branches/perlbuut/deps/Language-K20 -svn://erxz.com/bb3 - - - -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - -dcb1cea6-7f7e-4c78-8a22-148ace8ce36e - -k20.h -file - - - - -2009-10-03T22:54:20.000000Z -704ab70a43e5c3da70b54c0269bd1023 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -1641 - -K20.xs -file - - - - -2009-10-03T22:54:20.000000Z -0a65d67fa34f71aee2981b5be6cf02ae -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -601 - -const-xs.inc -file - - - - -2009-10-03T22:54:20.000000Z -13caaef5933aaecf0dafdb6d7d44739f -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -2652 - -Makefile.PL -file - - - - -2009-10-03T22:54:20.000000Z -515cd069bfa9bd552b678f62c4855f58 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -1806 - -Makefile.old -file - - - - -2009-10-03T22:54:20.000000Z -dba4b29db68c5734f886d1542c620b3f -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -27761 - -stubs_xs.c -file - - - - -2009-10-03T22:54:20.000000Z -b46a89e7f3f5682d4776388a32e70746 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -1033 - -README -file - - - - -2009-10-03T22:54:20.000000Z -abac83b9a16a3e1800407ca273b50bba -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -1177 - -fallback -dir - -stubs_dl.c -file - - - - -2009-10-03T22:54:20.000000Z -6f69b5bb0e811aed045c21e952752b38 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -48 - -t -dir - -MANIFEST -file - - - - -2009-10-03T22:54:20.000000Z -5e5948dd803b2c45a25c55e492b25fe9 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -132 - -lib -dir - -Changes -file - - - - -2009-10-03T22:54:20.000000Z -24e920af82a9fe31dd60b8cab4da4afe -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -167 - -ppport.h -file - - - - -2009-10-03T22:54:20.000000Z -c1a05dcc666d2ea6ecc0b9e032db0476 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -172822 - -const-c.inc -file - - - - -2009-10-03T22:54:20.000000Z -24b4de74e5952209b3583056bb92ef17 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -1711 - diff --git a/deps/Language-K20/.svn/text-base/Changes.svn-base b/deps/Language-K20/.svn/text-base/Changes.svn-base deleted file mode 100644 index 3a4f41d..0000000 --- a/deps/Language-K20/.svn/text-base/Changes.svn-base +++ /dev/null @@ -1,6 +0,0 @@ -Revision history for Perl extension Language::K20. - -0.01 Thu May 28 16:42:04 2009 - - original version; created by h2xs 1.23 with options - -b 5.6.0 -n Language::K20 - diff --git a/deps/Language-K20/.svn/text-base/K20.xs.svn-base b/deps/Language-K20/.svn/text-base/K20.xs.svn-base deleted file mode 100644 index ed59d51..0000000 --- a/deps/Language-K20/.svn/text-base/K20.xs.svn-base +++ /dev/null @@ -1,36 +0,0 @@ -#include "EXTERN.h" -#include "perl.h" -#include "XSUB.h" - -#include "ppport.h" - -#include "const-c.inc" - -#include -#include - -MODULE = Language::K20 PACKAGE = Language::K20 - -INCLUDE: const-xs.inc - -void -k20eval(x) - char* x - CODE: - cd(ksk("",0)); - - int fd = dup(fileno(stderr)); - freopen("/dev/null", "w", stderr); - K foo = ksk(x, 0); - if(foo->t != 6){ - K s = ksk("{_ssr[5:x;\"\\n\";\";\"]}",gnk(1,foo)); - printf("%s\n", KC(s)); - cd(s); - } - else if(foo->n != 0) - printf("%s error\n", (S)foo->n); - cd(foo); - dup2(fd, fileno(stderr)); - close(fd); - clearerr(stderr); - diff --git a/deps/Language-K20/.svn/text-base/MANIFEST.svn-base b/deps/Language-K20/.svn/text-base/MANIFEST.svn-base deleted file mode 100644 index 035467d..0000000 --- a/deps/Language-K20/.svn/text-base/MANIFEST.svn-base +++ /dev/null @@ -1,10 +0,0 @@ -Changes -K20.xs -Makefile.PL -MANIFEST -ppport.h -README -t/Language-K20.t -fallback/const-c.inc -fallback/const-xs.inc -lib/Language/K20.pm diff --git a/deps/Language-K20/.svn/text-base/Makefile.PL.svn-base b/deps/Language-K20/.svn/text-base/Makefile.PL.svn-base deleted file mode 100644 index 769f545..0000000 --- a/deps/Language-K20/.svn/text-base/Makefile.PL.svn-base +++ /dev/null @@ -1,41 +0,0 @@ -use 5.006000; -use ExtUtils::MakeMaker; -# See lib/ExtUtils/MakeMaker.pm for details of how to influence -# the contents of the Makefile that is written. -WriteMakefile( - NAME => 'Language::K20', - VERSION_FROM => 'lib/Language/K20.pm', # finds $VERSION - PREREQ_PM => {}, # e.g., Module::Name => 1.1 - ($] >= 5.005 ? ## Add these new keywords supported since 5.005 - (ABSTRACT_FROM => 'lib/Language/K20.pm', # retrieve abstract from module - AUTHOR => 'A. U. Thor ') : ()), - LIBS => ['-lm -lk20'], # e.g., '-lm' - DEFINE => '', # e.g., '-DHAVE_SOMETHING' - INC => '-I.', # e.g., '-I. -I/usr/include/other' - NEEDS_LINKING => 1, - # Un-comment this if you add C files to link with later: - OBJECT => '$(O_FILES)', # link all the C files too -); -if (eval {require ExtUtils::Constant; 1}) { - # If you edit these definitions to change the constants used by this module, - # you will need to use the generated const-c.inc and const-xs.inc - # files to replace their "fallback" counterparts before distributing your - # changes. - my @names = (qw()); - ExtUtils::Constant::WriteConstants( - NAME => 'Language::K20', - NAMES => \@names, - DEFAULT_TYPE => 'IV', - C_FILE => 'const-c.inc', - XS_FILE => 'const-xs.inc', - ); - -} -else { - use File::Copy; - use File::Spec; - foreach my $file ('const-c.inc', 'const-xs.inc') { - my $fallback = File::Spec->catfile('fallback', $file); - copy ($fallback, $file) or die "Can't copy $fallback to $file: $!"; - } -} diff --git a/deps/Language-K20/.svn/text-base/Makefile.old.svn-base b/deps/Language-K20/.svn/text-base/Makefile.old.svn-base deleted file mode 100644 index 27e02bf..0000000 --- a/deps/Language-K20/.svn/text-base/Makefile.old.svn-base +++ /dev/null @@ -1,969 +0,0 @@ -# This Makefile is for the Language::K20 extension to perl. -# -# It was generated automatically by MakeMaker version -# 6.50 (Revision: 65000) from the contents of -# Makefile.PL. Don't edit this file, edit Makefile.PL instead. -# -# ANY CHANGES MADE HERE WILL BE LOST! -# -# MakeMaker ARGV: () -# -# MakeMaker Parameters: - -# ABSTRACT_FROM => q[lib/Language/K20.pm] -# AUTHOR => q[A. U. Thor ] -# DEFINE => q[] -# INC => q[-I.] -# LIBS => [q[-lm -lk20]] -# NAME => q[Language::K20] -# NEEDS_LINKING => q[1] -# OBJECT => q[$(O_FILES)] -# PREREQ_PM => { } -# VERSION_FROM => q[lib/Language/K20.pm] - -# --- MakeMaker post_initialize section: - - -# --- MakeMaker const_config section: - -# These definitions are from config.sh (via /usr/lib/perl/5.10/Config.pm). -# They may have been overridden via Makefile.PL or on the command line. -AR = ar -CC = cc -CCCDLFLAGS = -fPIC -CCDLFLAGS = -Wl,-E -DLEXT = so -DLSRC = dl_dlopen.xs -EXE_EXT = -FULL_AR = /usr/bin/ar -LD = cc -LDDLFLAGS = -shared -O2 -g -L/usr/local/lib -LDFLAGS = -L/usr/local/lib -LIBC = /lib/libc-2.7.so -LIB_EXT = .a -OBJ_EXT = .o -OSNAME = linux -OSVERS = 2.6.26-1-686 -RANLIB = : -SITELIBEXP = /usr/local/share/perl/5.10.0 -SITEARCHEXP = /usr/local/lib/perl/5.10.0 -SO = so -VENDORARCHEXP = /usr/lib/perl5 -VENDORLIBEXP = /usr/share/perl5 - - -# --- MakeMaker constants section: -AR_STATIC_ARGS = cr -DIRFILESEP = / -DFSEP = $(DIRFILESEP) -NAME = Language::K20 -NAME_SYM = Language_K20 -VERSION = 0.01 -VERSION_MACRO = VERSION -VERSION_SYM = 0_01 -DEFINE_VERSION = -D$(VERSION_MACRO)=\"$(VERSION)\" -XS_VERSION = 0.01 -XS_VERSION_MACRO = XS_VERSION -XS_DEFINE_VERSION = -D$(XS_VERSION_MACRO)=\"$(XS_VERSION)\" -INST_ARCHLIB = blib/arch -INST_SCRIPT = blib/script -INST_BIN = blib/bin -INST_LIB = blib/lib -INST_MAN1DIR = blib/man1 -INST_MAN3DIR = blib/man3 -MAN1EXT = 1p -MAN3EXT = 3pm -INSTALLDIRS = site -DESTDIR = -PREFIX = $(SITEPREFIX) -PERLPREFIX = /usr -SITEPREFIX = /usr/local -VENDORPREFIX = /usr -INSTALLPRIVLIB = /usr/share/perl/5.10 -DESTINSTALLPRIVLIB = $(DESTDIR)$(INSTALLPRIVLIB) -INSTALLSITELIB = /usr/local/share/perl/5.10.0 -DESTINSTALLSITELIB = $(DESTDIR)$(INSTALLSITELIB) -INSTALLVENDORLIB = /usr/share/perl5 -DESTINSTALLVENDORLIB = $(DESTDIR)$(INSTALLVENDORLIB) -INSTALLARCHLIB = /usr/lib/perl/5.10 -DESTINSTALLARCHLIB = $(DESTDIR)$(INSTALLARCHLIB) -INSTALLSITEARCH = /usr/local/lib/perl/5.10.0 -DESTINSTALLSITEARCH = $(DESTDIR)$(INSTALLSITEARCH) -INSTALLVENDORARCH = /usr/lib/perl5 -DESTINSTALLVENDORARCH = $(DESTDIR)$(INSTALLVENDORARCH) -INSTALLBIN = /usr/bin -DESTINSTALLBIN = $(DESTDIR)$(INSTALLBIN) -INSTALLSITEBIN = /usr/local/bin -DESTINSTALLSITEBIN = $(DESTDIR)$(INSTALLSITEBIN) -INSTALLVENDORBIN = /usr/bin -DESTINSTALLVENDORBIN = $(DESTDIR)$(INSTALLVENDORBIN) -INSTALLSCRIPT = /usr/bin -DESTINSTALLSCRIPT = $(DESTDIR)$(INSTALLSCRIPT) -INSTALLSITESCRIPT = /usr/local/bin -DESTINSTALLSITESCRIPT = $(DESTDIR)$(INSTALLSITESCRIPT) -INSTALLVENDORSCRIPT = /usr/bin -DESTINSTALLVENDORSCRIPT = $(DESTDIR)$(INSTALLVENDORSCRIPT) -INSTALLMAN1DIR = /usr/share/man/man1 -DESTINSTALLMAN1DIR = $(DESTDIR)$(INSTALLMAN1DIR) -INSTALLSITEMAN1DIR = /usr/local/man/man1 -DESTINSTALLSITEMAN1DIR = $(DESTDIR)$(INSTALLSITEMAN1DIR) -INSTALLVENDORMAN1DIR = /usr/share/man/man1 -DESTINSTALLVENDORMAN1DIR = $(DESTDIR)$(INSTALLVENDORMAN1DIR) -INSTALLMAN3DIR = /usr/share/man/man3 -DESTINSTALLMAN3DIR = $(DESTDIR)$(INSTALLMAN3DIR) -INSTALLSITEMAN3DIR = /usr/local/man/man3 -DESTINSTALLSITEMAN3DIR = $(DESTDIR)$(INSTALLSITEMAN3DIR) -INSTALLVENDORMAN3DIR = /usr/share/man/man3 -DESTINSTALLVENDORMAN3DIR = $(DESTDIR)$(INSTALLVENDORMAN3DIR) -PERL_LIB = /usr/share/perl/5.10 -PERL_ARCHLIB = /usr/lib/perl/5.10 -LIBPERL_A = libperl.a -FIRST_MAKEFILE = Makefile -MAKEFILE_OLD = Makefile.old -MAKE_APERL_FILE = Makefile.aperl -PERLMAINCC = $(CC) -PERL_INC = /usr/lib/perl/5.10/CORE -PERL = /usr/bin/perl -FULLPERL = /usr/bin/perl -ABSPERL = $(PERL) -PERLRUN = $(PERL) -FULLPERLRUN = $(FULLPERL) -ABSPERLRUN = $(ABSPERL) -PERLRUNINST = $(PERLRUN) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" -FULLPERLRUNINST = $(FULLPERLRUN) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" -ABSPERLRUNINST = $(ABSPERLRUN) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" -PERL_CORE = 0 -PERM_RW = 644 -PERM_RWX = 755 - -MAKEMAKER = /usr/share/perl/5.10/ExtUtils/MakeMaker.pm -MM_VERSION = 6.50 -MM_REVISION = 65000 - -# FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle). -# BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle) -# PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar) -# DLBASE = Basename part of dynamic library. May be just equal BASEEXT. -MAKE = make -FULLEXT = Language/K20 -BASEEXT = K20 -PARENT_NAME = Language -DLBASE = $(BASEEXT) -VERSION_FROM = lib/Language/K20.pm -INC = -I. -DEFINE = -OBJECT = $(O_FILES) -LDFROM = $(OBJECT) -LINKTYPE = dynamic -BOOTDEP = - -# Handy lists of source code files: -XS_FILES = K20.xs -C_FILES = K20.c \ - stubs_dl.c \ - stubs_xs.c -O_FILES = K20.o \ - stubs_dl.o \ - stubs_xs.o -H_FILES = k20.h \ - ppport.h -MAN1PODS = -MAN3PODS = lib/Language/K20.pm - -# Where is the Config information that we are using/depend on -CONFIGDEP = $(PERL_ARCHLIB)$(DFSEP)Config.pm $(PERL_INC)$(DFSEP)config.h - -# Where to build things -INST_LIBDIR = $(INST_LIB)/Language -INST_ARCHLIBDIR = $(INST_ARCHLIB)/Language - -INST_AUTODIR = $(INST_LIB)/auto/$(FULLEXT) -INST_ARCHAUTODIR = $(INST_ARCHLIB)/auto/$(FULLEXT) - -INST_STATIC = $(INST_ARCHAUTODIR)/$(BASEEXT)$(LIB_EXT) -INST_DYNAMIC = $(INST_ARCHAUTODIR)/$(DLBASE).$(DLEXT) -INST_BOOT = $(INST_ARCHAUTODIR)/$(BASEEXT).bs - -# Extra linker info -EXPORT_LIST = -PERL_ARCHIVE = -PERL_ARCHIVE_AFTER = - - -TO_INST_PM = lib/Language/K20.pm - -PM_TO_BLIB = lib/Language/K20.pm \ - blib/lib/Language/K20.pm - - -# --- MakeMaker platform_constants section: -MM_Unix_VERSION = 6.50 -PERL_MALLOC_DEF = -DPERL_EXTMALLOC_DEF -Dmalloc=Perl_malloc -Dfree=Perl_mfree -Drealloc=Perl_realloc -Dcalloc=Perl_calloc - - -# --- MakeMaker tool_autosplit section: -# Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto -AUTOSPLITFILE = $(ABSPERLRUN) -e 'use AutoSplit; autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1)' -- - - - -# --- MakeMaker tool_xsubpp section: - -XSUBPPDIR = /usr/share/perl/5.10/ExtUtils -XSUBPP = $(XSUBPPDIR)$(DFSEP)xsubpp -XSUBPPRUN = $(PERLRUN) $(XSUBPP) -XSPROTOARG = -XSUBPPDEPS = /usr/share/perl/5.10/ExtUtils/typemap $(XSUBPP) -XSUBPPARGS = -typemap /usr/share/perl/5.10/ExtUtils/typemap -XSUBPP_EXTRA_ARGS = - - -# --- MakeMaker tools_other section: -SHELL = /bin/sh -CHMOD = chmod -CP = cp -MV = mv -NOOP = $(SHELL) -c true -NOECHO = @ -RM_F = rm -f -RM_RF = rm -rf -TEST_F = test -f -TOUCH = touch -UMASK_NULL = umask 0 -DEV_NULL = > /dev/null 2>&1 -MKPATH = $(ABSPERLRUN) "-MExtUtils::Command" -e mkpath -EQUALIZE_TIMESTAMP = $(ABSPERLRUN) "-MExtUtils::Command" -e eqtime -ECHO = echo -ECHO_N = echo -n -UNINST = 0 -VERBINST = 0 -MOD_INSTALL = $(ABSPERLRUN) -MExtUtils::Install -e 'install({@ARGV}, '\''$(VERBINST)'\'', 0, '\''$(UNINST)'\'');' -- -DOC_INSTALL = $(ABSPERLRUN) "-MExtUtils::Command::MM" -e perllocal_install -UNINSTALL = $(ABSPERLRUN) "-MExtUtils::Command::MM" -e uninstall -WARN_IF_OLD_PACKLIST = $(ABSPERLRUN) "-MExtUtils::Command::MM" -e warn_if_old_packlist -MACROSTART = -MACROEND = -USEMAKEFILE = -f -FIXIN = $(PERLRUN) "-MExtUtils::MY" -e "MY->fixin(shift)" - - -# --- MakeMaker makemakerdflt section: -makemakerdflt : all - $(NOECHO) $(NOOP) - - -# --- MakeMaker dist section: -TAR = tar -TARFLAGS = cvf -ZIP = zip -ZIPFLAGS = -r -COMPRESS = gzip --best -SUFFIX = .gz -SHAR = shar -PREOP = $(NOECHO) $(NOOP) -POSTOP = $(NOECHO) $(NOOP) -TO_UNIX = $(NOECHO) $(NOOP) -CI = ci -u -RCS_LABEL = rcs -Nv$(VERSION_SYM): -q -DIST_CP = best -DIST_DEFAULT = tardist -DISTNAME = Language-K20 -DISTVNAME = Language-K20-0.01 - - -# --- MakeMaker macro section: - - -# --- MakeMaker depend section: - - -# --- MakeMaker cflags section: - -CCFLAGS = -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -OPTIMIZE = -O2 -g -PERLTYPE = -MPOLLUTE = - - -# --- MakeMaker const_loadlibs section: - -# Language::K20 might depend on some other libraries: -# See ExtUtils::Liblist for details -# -EXTRALIBS = -lk20 -LDLOADLIBS = -lm -lk20 -BSLOADLIBS = -LD_RUN_PATH = /usr/lib - - -# --- MakeMaker const_cccmd section: -CCCMD = $(CC) -c $(PASTHRU_INC) $(INC) \ - $(CCFLAGS) $(OPTIMIZE) \ - $(PERLTYPE) $(MPOLLUTE) $(DEFINE_VERSION) \ - $(XS_DEFINE_VERSION) - -# --- MakeMaker post_constants section: - - -# --- MakeMaker pasthru section: - -PASTHRU = LIBPERL_A="$(LIBPERL_A)"\ - LINKTYPE="$(LINKTYPE)"\ - OPTIMIZE="$(OPTIMIZE)"\ - PREFIX="$(PREFIX)"\ - PASTHRU_DEFINE="$(PASTHRU_DEFINE)"\ - PASTHRU_INC="$(PASTHRU_INC)" - - -# --- MakeMaker special_targets section: -.SUFFIXES : .xs .c .C .cpp .i .s .cxx .cc $(OBJ_EXT) - -.PHONY: all config static dynamic test linkext manifest blibdirs clean realclean disttest distdir - - - -# --- MakeMaker c_o section: - -.c.i: - cc -E -c $(PASTHRU_INC) $(INC) \ - $(CCFLAGS) $(OPTIMIZE) \ - $(PERLTYPE) $(MPOLLUTE) $(DEFINE_VERSION) \ - $(XS_DEFINE_VERSION) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.c > $*.i - -.c.s: - $(CCCMD) -S $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.c - -.c$(OBJ_EXT): - $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.c - -.cpp$(OBJ_EXT): - $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.cpp - -.cxx$(OBJ_EXT): - $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.cxx - -.cc$(OBJ_EXT): - $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.cc - -.C$(OBJ_EXT): - $(CCCMD) $*.C - - -# --- MakeMaker xs_c section: - -.xs.c: - $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $(XSUBPP_EXTRA_ARGS) $*.xs > $*.xsc && $(MV) $*.xsc $*.c - - -# --- MakeMaker xs_o section: - -.xs$(OBJ_EXT): - $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.xsc && $(MV) $*.xsc $*.c - $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.c - - -# --- MakeMaker top_targets section: -all :: pure_all manifypods - $(NOECHO) $(NOOP) - - -pure_all :: config pm_to_blib subdirs linkext - $(NOECHO) $(NOOP) - -subdirs :: $(MYEXTLIB) - $(NOECHO) $(NOOP) - -config :: $(FIRST_MAKEFILE) blibdirs - $(NOECHO) $(NOOP) - -$(O_FILES): $(H_FILES) - -help : - perldoc ExtUtils::MakeMaker - - -# --- MakeMaker blibdirs section: -blibdirs : $(INST_LIBDIR)$(DFSEP).exists $(INST_ARCHLIB)$(DFSEP).exists $(INST_AUTODIR)$(DFSEP).exists $(INST_ARCHAUTODIR)$(DFSEP).exists $(INST_BIN)$(DFSEP).exists $(INST_SCRIPT)$(DFSEP).exists $(INST_MAN1DIR)$(DFSEP).exists $(INST_MAN3DIR)$(DFSEP).exists - $(NOECHO) $(NOOP) - -# Backwards compat with 6.18 through 6.25 -blibdirs.ts : blibdirs - $(NOECHO) $(NOOP) - -$(INST_LIBDIR)$(DFSEP).exists :: Makefile.PL - $(NOECHO) $(MKPATH) $(INST_LIBDIR) - $(NOECHO) $(CHMOD) 755 $(INST_LIBDIR) - $(NOECHO) $(TOUCH) $(INST_LIBDIR)$(DFSEP).exists - -$(INST_ARCHLIB)$(DFSEP).exists :: Makefile.PL - $(NOECHO) $(MKPATH) $(INST_ARCHLIB) - $(NOECHO) $(CHMOD) 755 $(INST_ARCHLIB) - $(NOECHO) $(TOUCH) $(INST_ARCHLIB)$(DFSEP).exists - -$(INST_AUTODIR)$(DFSEP).exists :: Makefile.PL - $(NOECHO) $(MKPATH) $(INST_AUTODIR) - $(NOECHO) $(CHMOD) 755 $(INST_AUTODIR) - $(NOECHO) $(TOUCH) $(INST_AUTODIR)$(DFSEP).exists - -$(INST_ARCHAUTODIR)$(DFSEP).exists :: Makefile.PL - $(NOECHO) $(MKPATH) $(INST_ARCHAUTODIR) - $(NOECHO) $(CHMOD) 755 $(INST_ARCHAUTODIR) - $(NOECHO) $(TOUCH) $(INST_ARCHAUTODIR)$(DFSEP).exists - -$(INST_BIN)$(DFSEP).exists :: Makefile.PL - $(NOECHO) $(MKPATH) $(INST_BIN) - $(NOECHO) $(CHMOD) 755 $(INST_BIN) - $(NOECHO) $(TOUCH) $(INST_BIN)$(DFSEP).exists - -$(INST_SCRIPT)$(DFSEP).exists :: Makefile.PL - $(NOECHO) $(MKPATH) $(INST_SCRIPT) - $(NOECHO) $(CHMOD) 755 $(INST_SCRIPT) - $(NOECHO) $(TOUCH) $(INST_SCRIPT)$(DFSEP).exists - -$(INST_MAN1DIR)$(DFSEP).exists :: Makefile.PL - $(NOECHO) $(MKPATH) $(INST_MAN1DIR) - $(NOECHO) $(CHMOD) 755 $(INST_MAN1DIR) - $(NOECHO) $(TOUCH) $(INST_MAN1DIR)$(DFSEP).exists - -$(INST_MAN3DIR)$(DFSEP).exists :: Makefile.PL - $(NOECHO) $(MKPATH) $(INST_MAN3DIR) - $(NOECHO) $(CHMOD) 755 $(INST_MAN3DIR) - $(NOECHO) $(TOUCH) $(INST_MAN3DIR)$(DFSEP).exists - - - -# --- MakeMaker linkext section: - -linkext :: $(LINKTYPE) - $(NOECHO) $(NOOP) - - -# --- MakeMaker dlsyms section: - - -# --- MakeMaker dynamic section: - -dynamic :: $(FIRST_MAKEFILE) $(INST_DYNAMIC) $(INST_BOOT) - $(NOECHO) $(NOOP) - - -# --- MakeMaker dynamic_bs section: -BOOTSTRAP = $(BASEEXT).bs - -# As Mkbootstrap might not write a file (if none is required) -# we use touch to prevent make continually trying to remake it. -# The DynaLoader only reads a non-empty file. -$(BOOTSTRAP) : $(FIRST_MAKEFILE) $(BOOTDEP) $(INST_ARCHAUTODIR)$(DFSEP).exists - $(NOECHO) $(ECHO) "Running Mkbootstrap for $(NAME) ($(BSLOADLIBS))" - $(NOECHO) $(PERLRUN) \ - "-MExtUtils::Mkbootstrap" \ - -e "Mkbootstrap('$(BASEEXT)','$(BSLOADLIBS)');" - $(NOECHO) $(TOUCH) $@ - $(CHMOD) $(PERM_RW) $@ - -$(INST_BOOT) : $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DFSEP).exists - $(NOECHO) $(RM_RF) $@ - - $(CP) $(BOOTSTRAP) $@ - $(CHMOD) $(PERM_RW) $@ - - -# --- MakeMaker dynamic_lib section: - -# This section creates the dynamically loadable $(INST_DYNAMIC) -# from $(OBJECT) and possibly $(MYEXTLIB). -ARMAYBE = : -OTHERLDFLAGS = -INST_DYNAMIC_DEP = -INST_DYNAMIC_FIX = - -$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DFSEP).exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(PERL_ARCHIVE_AFTER) $(INST_DYNAMIC_DEP) - $(RM_F) $@ - LD_RUN_PATH="$(LD_RUN_PATH)" $(LD) $(LDDLFLAGS) $(LDFROM) $(OTHERLDFLAGS) -o $@ $(MYEXTLIB) \ - $(PERL_ARCHIVE) $(LDLOADLIBS) $(PERL_ARCHIVE_AFTER) $(EXPORT_LIST) \ - $(INST_DYNAMIC_FIX) - $(CHMOD) $(PERM_RWX) $@ - - -# --- MakeMaker static section: - -## $(INST_PM) has been moved to the all: target. -## It remains here for awhile to allow for old usage: "make static" -static :: $(FIRST_MAKEFILE) $(INST_STATIC) - $(NOECHO) $(NOOP) - - -# --- MakeMaker static_lib section: - -$(INST_STATIC) : $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)$(DFSEP).exists - $(RM_RF) $@ - $(FULL_AR) $(AR_STATIC_ARGS) $@ $(OBJECT) && $(RANLIB) $@ - $(CHMOD) $(PERM_RWX) $@ - $(NOECHO) $(ECHO) "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)/extralibs.ld - - -# --- MakeMaker manifypods section: - -POD2MAN_EXE = $(PERLRUN) "-MExtUtils::Command::MM" -e pod2man "--" -POD2MAN = $(POD2MAN_EXE) - - -manifypods : pure_all \ - lib/Language/K20.pm - $(NOECHO) $(POD2MAN) --section=3 --perm_rw=$(PERM_RW) \ - lib/Language/K20.pm $(INST_MAN3DIR)/Language::K20.$(MAN3EXT) - - - - -# --- MakeMaker processPL section: - - -# --- MakeMaker installbin section: - - -# --- MakeMaker subdirs section: - -# none - -# --- MakeMaker clean_subdirs section: -clean_subdirs : - $(NOECHO) $(NOOP) - - -# --- MakeMaker clean section: - -# Delete temporary files but do not touch installed files. We don't delete -# the Makefile here so a later make realclean still has a makefile to use. - -clean :: clean_subdirs - - $(RM_F) \ - *$(LIB_EXT) core \ - K20.c core.[0-9] \ - $(INST_ARCHAUTODIR)/extralibs.all core.[0-9][0-9] \ - $(BASEEXT).bso pm_to_blib.ts \ - core.[0-9][0-9][0-9][0-9] $(BASEEXT).x \ - $(BOOTSTRAP) perl$(EXE_EXT) \ - tmon.out *$(OBJ_EXT) \ - pm_to_blib $(INST_ARCHAUTODIR)/extralibs.ld \ - blibdirs.ts core.[0-9][0-9][0-9][0-9][0-9] \ - *perl.core core.*perl.*.? \ - $(MAKE_APERL_FILE) perl \ - $(BASEEXT).def core.[0-9][0-9][0-9] \ - mon.out lib$(BASEEXT).def \ - perlmain.c perl.exe \ - so_locations $(BASEEXT).exp - - $(RM_RF) \ - blib - - $(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD) $(DEV_NULL) - - -# --- MakeMaker realclean_subdirs section: -realclean_subdirs : - $(NOECHO) $(NOOP) - - -# --- MakeMaker realclean section: -# Delete temporary files (via clean) and also delete dist files -realclean purge :: clean realclean_subdirs - - $(RM_F) \ - $(OBJECT) $(MAKEFILE_OLD) \ - $(FIRST_MAKEFILE) - - $(RM_RF) \ - $(DISTVNAME) - - -# --- MakeMaker metafile section: -metafile : create_distdir - $(NOECHO) $(ECHO) Generating META.yml - $(NOECHO) $(ECHO) '--- #YAML:1.0' > META_new.yml - $(NOECHO) $(ECHO) 'name: Language-K20' >> META_new.yml - $(NOECHO) $(ECHO) 'version: 0.01' >> META_new.yml - $(NOECHO) $(ECHO) 'abstract: Perl extension for blah blah blah' >> META_new.yml - $(NOECHO) $(ECHO) 'author:' >> META_new.yml - $(NOECHO) $(ECHO) ' - A. U. Thor ' >> META_new.yml - $(NOECHO) $(ECHO) 'license: unknown' >> META_new.yml - $(NOECHO) $(ECHO) 'distribution_type: module' >> META_new.yml - $(NOECHO) $(ECHO) 'configure_requires:' >> META_new.yml - $(NOECHO) $(ECHO) ' ExtUtils::MakeMaker: 0' >> META_new.yml - $(NOECHO) $(ECHO) 'build_requires:' >> META_new.yml - $(NOECHO) $(ECHO) ' ExtUtils::MakeMaker: 0' >> META_new.yml - $(NOECHO) $(ECHO) 'requires: {}' >> META_new.yml - $(NOECHO) $(ECHO) 'no_index:' >> META_new.yml - $(NOECHO) $(ECHO) ' directory:' >> META_new.yml - $(NOECHO) $(ECHO) ' - t' >> META_new.yml - $(NOECHO) $(ECHO) ' - inc' >> META_new.yml - $(NOECHO) $(ECHO) 'generated_by: ExtUtils::MakeMaker version 6.50' >> META_new.yml - $(NOECHO) $(ECHO) 'meta-spec:' >> META_new.yml - $(NOECHO) $(ECHO) ' url: http://module-build.sourceforge.net/META-spec-v1.4.html' >> META_new.yml - $(NOECHO) $(ECHO) ' version: 1.4' >> META_new.yml - -$(NOECHO) $(MV) META_new.yml $(DISTVNAME)/META.yml - - -# --- MakeMaker signature section: -signature : - cpansign -s - - -# --- MakeMaker dist_basics section: -distclean :: realclean distcheck - $(NOECHO) $(NOOP) - -distcheck : - $(PERLRUN) "-MExtUtils::Manifest=fullcheck" -e fullcheck - -skipcheck : - $(PERLRUN) "-MExtUtils::Manifest=skipcheck" -e skipcheck - -manifest : - $(PERLRUN) "-MExtUtils::Manifest=mkmanifest" -e mkmanifest - -veryclean : realclean - $(RM_F) *~ */*~ *.orig */*.orig *.bak */*.bak *.old */*.old - - - -# --- MakeMaker dist_core section: - -dist : $(DIST_DEFAULT) $(FIRST_MAKEFILE) - $(NOECHO) $(ABSPERLRUN) -l -e 'print '\''Warning: Makefile possibly out of date with $(VERSION_FROM)'\''' \ - -e ' if -e '\''$(VERSION_FROM)'\'' and -M '\''$(VERSION_FROM)'\'' < -M '\''$(FIRST_MAKEFILE)'\'';' -- - -tardist : $(DISTVNAME).tar$(SUFFIX) - $(NOECHO) $(NOOP) - -uutardist : $(DISTVNAME).tar$(SUFFIX) - uuencode $(DISTVNAME).tar$(SUFFIX) $(DISTVNAME).tar$(SUFFIX) > $(DISTVNAME).tar$(SUFFIX)_uu - -$(DISTVNAME).tar$(SUFFIX) : distdir - $(PREOP) - $(TO_UNIX) - $(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME) - $(RM_RF) $(DISTVNAME) - $(COMPRESS) $(DISTVNAME).tar - $(POSTOP) - -zipdist : $(DISTVNAME).zip - $(NOECHO) $(NOOP) - -$(DISTVNAME).zip : distdir - $(PREOP) - $(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME) - $(RM_RF) $(DISTVNAME) - $(POSTOP) - -shdist : distdir - $(PREOP) - $(SHAR) $(DISTVNAME) > $(DISTVNAME).shar - $(RM_RF) $(DISTVNAME) - $(POSTOP) - - -# --- MakeMaker distdir section: -create_distdir : - $(RM_RF) $(DISTVNAME) - $(PERLRUN) "-MExtUtils::Manifest=manicopy,maniread" \ - -e "manicopy(maniread(),'$(DISTVNAME)', '$(DIST_CP)');" - -distdir : create_distdir distmeta - $(NOECHO) $(NOOP) - - - -# --- MakeMaker dist_test section: -disttest : distdir - cd $(DISTVNAME) && $(ABSPERLRUN) Makefile.PL - cd $(DISTVNAME) && $(MAKE) $(PASTHRU) - cd $(DISTVNAME) && $(MAKE) test $(PASTHRU) - - - -# --- MakeMaker dist_ci section: - -ci : - $(PERLRUN) "-MExtUtils::Manifest=maniread" \ - -e "@all = keys %{ maniread() };" \ - -e "print(qq{Executing $(CI) @all\n}); system(qq{$(CI) @all});" \ - -e "print(qq{Executing $(RCS_LABEL) ...\n}); system(qq{$(RCS_LABEL) @all});" - - -# --- MakeMaker distmeta section: -distmeta : create_distdir metafile - $(NOECHO) cd $(DISTVNAME) && $(ABSPERLRUN) -MExtUtils::Manifest=maniadd -e 'eval { maniadd({q{META.yml} => q{Module meta-data (added by MakeMaker)}}) } ' \ - -e ' or print "Could not add META.yml to MANIFEST: $${'\''@'\''}\n"' -- - - - -# --- MakeMaker distsignature section: -distsignature : create_distdir - $(NOECHO) cd $(DISTVNAME) && $(ABSPERLRUN) -MExtUtils::Manifest=maniadd -e 'eval { maniadd({q{SIGNATURE} => q{Public-key signature (added by MakeMaker)}}) } ' \ - -e ' or print "Could not add SIGNATURE to MANIFEST: $${'\''@'\''}\n"' -- - $(NOECHO) cd $(DISTVNAME) && $(TOUCH) SIGNATURE - cd $(DISTVNAME) && cpansign -s - - - -# --- MakeMaker install section: - -install :: all pure_install doc_install - $(NOECHO) $(NOOP) - -install_perl :: all pure_perl_install doc_perl_install - $(NOECHO) $(NOOP) - -install_site :: all pure_site_install doc_site_install - $(NOECHO) $(NOOP) - -install_vendor :: all pure_vendor_install doc_vendor_install - $(NOECHO) $(NOOP) - -pure_install :: pure_$(INSTALLDIRS)_install - $(NOECHO) $(NOOP) - -doc_install :: doc_$(INSTALLDIRS)_install - $(NOECHO) $(NOOP) - -pure__install : pure_site_install - $(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site - -doc__install : doc_site_install - $(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site - -pure_perl_install :: - $(NOECHO) $(MOD_INSTALL) \ - read $(PERL_ARCHLIB)/auto/$(FULLEXT)/.packlist \ - write $(DESTINSTALLARCHLIB)/auto/$(FULLEXT)/.packlist \ - $(INST_LIB) $(DESTINSTALLPRIVLIB) \ - $(INST_ARCHLIB) $(DESTINSTALLARCHLIB) \ - $(INST_BIN) $(DESTINSTALLBIN) \ - $(INST_SCRIPT) $(DESTINSTALLSCRIPT) \ - $(INST_MAN1DIR) $(DESTINSTALLMAN1DIR) \ - $(INST_MAN3DIR) $(DESTINSTALLMAN3DIR) - $(NOECHO) $(WARN_IF_OLD_PACKLIST) \ - $(SITEARCHEXP)/auto/$(FULLEXT) - - -pure_site_install :: - $(NOECHO) $(MOD_INSTALL) \ - read $(SITEARCHEXP)/auto/$(FULLEXT)/.packlist \ - write $(DESTINSTALLSITEARCH)/auto/$(FULLEXT)/.packlist \ - $(INST_LIB) $(DESTINSTALLSITELIB) \ - $(INST_ARCHLIB) $(DESTINSTALLSITEARCH) \ - $(INST_BIN) $(DESTINSTALLSITEBIN) \ - $(INST_SCRIPT) $(DESTINSTALLSITESCRIPT) \ - $(INST_MAN1DIR) $(DESTINSTALLSITEMAN1DIR) \ - $(INST_MAN3DIR) $(DESTINSTALLSITEMAN3DIR) - $(NOECHO) $(WARN_IF_OLD_PACKLIST) \ - $(PERL_ARCHLIB)/auto/$(FULLEXT) - -pure_vendor_install :: - $(NOECHO) $(MOD_INSTALL) \ - read $(VENDORARCHEXP)/auto/$(FULLEXT)/.packlist \ - write $(DESTINSTALLVENDORARCH)/auto/$(FULLEXT)/.packlist \ - $(INST_LIB) $(DESTINSTALLVENDORLIB) \ - $(INST_ARCHLIB) $(DESTINSTALLVENDORARCH) \ - $(INST_BIN) $(DESTINSTALLVENDORBIN) \ - $(INST_SCRIPT) $(DESTINSTALLVENDORSCRIPT) \ - $(INST_MAN1DIR) $(DESTINSTALLVENDORMAN1DIR) \ - $(INST_MAN3DIR) $(DESTINSTALLVENDORMAN3DIR) - -doc_perl_install :: - $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod - -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB) - -$(NOECHO) $(DOC_INSTALL) \ - "Module" "$(NAME)" \ - "installed into" "$(INSTALLPRIVLIB)" \ - LINKTYPE "$(LINKTYPE)" \ - VERSION "$(VERSION)" \ - EXE_FILES "$(EXE_FILES)" \ - >> $(DESTINSTALLARCHLIB)/perllocal.pod - -doc_site_install :: - $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod - -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB) - -$(NOECHO) $(DOC_INSTALL) \ - "Module" "$(NAME)" \ - "installed into" "$(INSTALLSITELIB)" \ - LINKTYPE "$(LINKTYPE)" \ - VERSION "$(VERSION)" \ - EXE_FILES "$(EXE_FILES)" \ - >> $(DESTINSTALLARCHLIB)/perllocal.pod - -doc_vendor_install :: - $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod - -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB) - -$(NOECHO) $(DOC_INSTALL) \ - "Module" "$(NAME)" \ - "installed into" "$(INSTALLVENDORLIB)" \ - LINKTYPE "$(LINKTYPE)" \ - VERSION "$(VERSION)" \ - EXE_FILES "$(EXE_FILES)" \ - >> $(DESTINSTALLARCHLIB)/perllocal.pod - - -uninstall :: uninstall_from_$(INSTALLDIRS)dirs - $(NOECHO) $(NOOP) - -uninstall_from_perldirs :: - $(NOECHO) $(UNINSTALL) $(PERL_ARCHLIB)/auto/$(FULLEXT)/.packlist - -uninstall_from_sitedirs :: - $(NOECHO) $(UNINSTALL) $(SITEARCHEXP)/auto/$(FULLEXT)/.packlist - -uninstall_from_vendordirs :: - $(NOECHO) $(UNINSTALL) $(VENDORARCHEXP)/auto/$(FULLEXT)/.packlist - - -# --- MakeMaker force section: -# Phony target to force checking subdirectories. -FORCE : - $(NOECHO) $(NOOP) - - -# --- MakeMaker perldepend section: - -PERL_HDRS = \ - $(PERL_INC)/EXTERN.h \ - $(PERL_INC)/INTERN.h \ - $(PERL_INC)/XSUB.h \ - $(PERL_INC)/av.h \ - $(PERL_INC)/cc_runtime.h \ - $(PERL_INC)/config.h \ - $(PERL_INC)/cop.h \ - $(PERL_INC)/cv.h \ - $(PERL_INC)/dosish.h \ - $(PERL_INC)/embed.h \ - $(PERL_INC)/embedvar.h \ - $(PERL_INC)/fakethr.h \ - $(PERL_INC)/form.h \ - $(PERL_INC)/gv.h \ - $(PERL_INC)/handy.h \ - $(PERL_INC)/hv.h \ - $(PERL_INC)/intrpvar.h \ - $(PERL_INC)/iperlsys.h \ - $(PERL_INC)/keywords.h \ - $(PERL_INC)/mg.h \ - $(PERL_INC)/nostdio.h \ - $(PERL_INC)/op.h \ - $(PERL_INC)/opcode.h \ - $(PERL_INC)/patchlevel.h \ - $(PERL_INC)/perl.h \ - $(PERL_INC)/perlio.h \ - $(PERL_INC)/perlsdio.h \ - $(PERL_INC)/perlsfio.h \ - $(PERL_INC)/perlvars.h \ - $(PERL_INC)/perly.h \ - $(PERL_INC)/pp.h \ - $(PERL_INC)/pp_proto.h \ - $(PERL_INC)/proto.h \ - $(PERL_INC)/regcomp.h \ - $(PERL_INC)/regexp.h \ - $(PERL_INC)/regnodes.h \ - $(PERL_INC)/scope.h \ - $(PERL_INC)/sv.h \ - $(PERL_INC)/thread.h \ - $(PERL_INC)/unixish.h \ - $(PERL_INC)/util.h - -$(OBJECT) : $(PERL_HDRS) - -K20.c : $(XSUBPPDEPS) - - -# --- MakeMaker makefile section: - -$(OBJECT) : $(FIRST_MAKEFILE) - -# We take a very conservative approach here, but it's worth it. -# We move Makefile to Makefile.old here to avoid gnu make looping. -$(FIRST_MAKEFILE) : Makefile.PL $(CONFIGDEP) - $(NOECHO) $(ECHO) "Makefile out-of-date with respect to $?" - $(NOECHO) $(ECHO) "Cleaning current config before rebuilding Makefile..." - -$(NOECHO) $(RM_F) $(MAKEFILE_OLD) - -$(NOECHO) $(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD) - - $(MAKE) $(USEMAKEFILE) $(MAKEFILE_OLD) clean $(DEV_NULL) - $(PERLRUN) Makefile.PL - $(NOECHO) $(ECHO) "==> Your Makefile has been rebuilt. <==" - $(NOECHO) $(ECHO) "==> Please rerun the $(MAKE) command. <==" - false - - - -# --- MakeMaker staticmake section: - -# --- MakeMaker makeaperl section --- -MAP_TARGET = perl -FULLPERL = /usr/bin/perl - -$(MAP_TARGET) :: static $(MAKE_APERL_FILE) - $(MAKE) $(USEMAKEFILE) $(MAKE_APERL_FILE) $@ - -$(MAKE_APERL_FILE) : $(FIRST_MAKEFILE) pm_to_blib - $(NOECHO) $(ECHO) Writing \"$(MAKE_APERL_FILE)\" for this $(MAP_TARGET) - $(NOECHO) $(PERLRUNINST) \ - Makefile.PL DIR= \ - MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \ - MAKEAPERL=1 NORECURS=1 CCCDLFLAGS= - - -# --- MakeMaker test section: - -TEST_VERBOSE=0 -TEST_TYPE=test_$(LINKTYPE) -TEST_FILE = test.pl -TEST_FILES = t/*.t -TESTDB_SW = -d - -testdb :: testdb_$(LINKTYPE) - -test :: $(TEST_TYPE) subdirs-test - -subdirs-test :: - $(NOECHO) $(NOOP) - - -test_dynamic :: pure_all - PERL_DL_NONLAZY=1 $(FULLPERLRUN) "-MExtUtils::Command::MM" "-e" "test_harness($(TEST_VERBOSE), '$(INST_LIB)', '$(INST_ARCHLIB)')" $(TEST_FILES) - -testdb_dynamic :: pure_all - PERL_DL_NONLAZY=1 $(FULLPERLRUN) $(TESTDB_SW) "-I$(INST_LIB)" "-I$(INST_ARCHLIB)" $(TEST_FILE) - -test_ : test_dynamic - -test_static :: pure_all $(MAP_TARGET) - PERL_DL_NONLAZY=1 ./$(MAP_TARGET) "-MExtUtils::Command::MM" "-e" "test_harness($(TEST_VERBOSE), '$(INST_LIB)', '$(INST_ARCHLIB)')" $(TEST_FILES) - -testdb_static :: pure_all $(MAP_TARGET) - PERL_DL_NONLAZY=1 ./$(MAP_TARGET) $(TESTDB_SW) "-I$(INST_LIB)" "-I$(INST_ARCHLIB)" $(TEST_FILE) - - - -# --- MakeMaker ppd section: -# Creates a PPD (Perl Package Description) for a binary distribution. -ppd : - $(NOECHO) $(ECHO) '' > $(DISTNAME).ppd - $(NOECHO) $(ECHO) ' $(DISTNAME)' >> $(DISTNAME).ppd - $(NOECHO) $(ECHO) ' Perl extension for blah blah blah' >> $(DISTNAME).ppd - $(NOECHO) $(ECHO) ' A. U. Thor <buu@>' >> $(DISTNAME).ppd - $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd - $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd - $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd - $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd - $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd - $(NOECHO) $(ECHO) '' >> $(DISTNAME).ppd - - -# --- MakeMaker pm_to_blib section: - -pm_to_blib : $(TO_INST_PM) - $(NOECHO) $(ABSPERLRUN) -MExtUtils::Install -e 'pm_to_blib({@ARGV}, '\''$(INST_LIB)/auto'\'', '\''$(PM_FILTER)'\'')' -- \ - lib/Language/K20.pm blib/lib/Language/K20.pm - $(NOECHO) $(TOUCH) pm_to_blib - - -# --- MakeMaker selfdocument section: - - -# --- MakeMaker postamble section: - - -# End. diff --git a/deps/Language-K20/.svn/text-base/README.svn-base b/deps/Language-K20/.svn/text-base/README.svn-base deleted file mode 100644 index 8902f8b..0000000 --- a/deps/Language-K20/.svn/text-base/README.svn-base +++ /dev/null @@ -1,40 +0,0 @@ -Language-K20 version 0.01 -========================= - -The README is used to introduce the module and provide instructions on -how to install the module, any machine dependencies it may have (for -example C compilers and installed libraries) and any other information -that should be provided before the module is installed. - -A README file is required for CPAN modules since CPAN extracts the -README file from a module distribution so that people browsing the -archive can use it get an idea of the modules uses. It is usually a -good idea to provide version information here so that people can -decide whether fixes for the module are worth downloading. - -INSTALLATION - -To install this module type the following: - - perl Makefile.PL - make - make test - make install - -DEPENDENCIES - -This module requires these other modules and libraries: - - blah blah blah - -COPYRIGHT AND LICENCE - -Put the correct copyright and licence information here. - -Copyright (C) 2009 by A. U. Thor - -This library is free software; you can redistribute it and/or modify -it under the same terms as Perl itself, either Perl version 5.10.0 or, -at your option, any later version of Perl 5 you may have available. - - diff --git a/deps/Language-K20/.svn/text-base/const-c.inc.svn-base b/deps/Language-K20/.svn/text-base/const-c.inc.svn-base deleted file mode 100644 index 380f16e..0000000 --- a/deps/Language-K20/.svn/text-base/const-c.inc.svn-base +++ /dev/null @@ -1,55 +0,0 @@ -#define PERL_constant_NOTFOUND 1 -#define PERL_constant_NOTDEF 2 -#define PERL_constant_ISIV 3 -#define PERL_constant_ISNO 4 -#define PERL_constant_ISNV 5 -#define PERL_constant_ISPV 6 -#define PERL_constant_ISPVN 7 -#define PERL_constant_ISSV 8 -#define PERL_constant_ISUNDEF 9 -#define PERL_constant_ISUV 10 -#define PERL_constant_ISYES 11 - -#ifndef NVTYPE -typedef double NV; /* 5.6 and later define NVTYPE, and typedef NV to it. */ -#endif -#ifndef aTHX_ -#define aTHX_ /* 5.6 or later define this for threading support. */ -#endif -#ifndef pTHX_ -#define pTHX_ /* 5.6 or later define this for threading support. */ -#endif - -static int -constant (pTHX_ const char *name, STRLEN len) { - /* Initially switch on the length of the name. */ - /* When generated this function returned values for the list of names given - in this section of perl code. Rather than manually editing these functions - to add or remove constants, which would result in this comment and section - of code becoming inaccurate, we recommend that you edit this section of - code, and use it to regenerate a new set of constant functions which you - then use to replace the originals. - - Regenerate these constant functions by feeding this entire source file to - perl -x - -#!/usr/bin/perl -w -use ExtUtils::Constant qw (constant_types C_constant XS_constant); - -my $types = {map {($_, 1)} qw()}; -my @names = (qw()); - -print constant_types(), "\n"; # macro defs -foreach (C_constant ("Language::K20", 'constant', 'IV', $types, undef, 3, @names) ) { - print $_, "\n"; # C constant subs -} -print "\n#### XS Section:\n"; -print XS_constant ("Language::K20", $types); -__END__ - */ - - switch (len) { - } - return PERL_constant_NOTFOUND; -} - diff --git a/deps/Language-K20/.svn/text-base/const-xs.inc.svn-base b/deps/Language-K20/.svn/text-base/const-xs.inc.svn-base deleted file mode 100644 index 4a2151f..0000000 --- a/deps/Language-K20/.svn/text-base/const-xs.inc.svn-base +++ /dev/null @@ -1,89 +0,0 @@ -void -constant(sv) - PREINIT: -#ifdef dXSTARG - dXSTARG; /* Faster if we have it. */ -#else - dTARGET; -#endif - STRLEN len; - int type; - /* IV iv; Uncomment this if you need to return IVs */ - /* NV nv; Uncomment this if you need to return NVs */ - /* const char *pv; Uncomment this if you need to return PVs */ - INPUT: - SV * sv; - const char * s = SvPV(sv, len); - PPCODE: - type = constant(aTHX_ s, len); - /* Return 1 or 2 items. First is error message, or undef if no error. - Second, if present, is found value */ - switch (type) { - case PERL_constant_NOTFOUND: - sv = - sv_2mortal(newSVpvf("%s is not a valid Language::K20 macro", s)); - PUSHs(sv); - break; - case PERL_constant_NOTDEF: - sv = sv_2mortal(newSVpvf( - "Your vendor has not defined Language::K20 macro %s, used", - s)); - PUSHs(sv); - break; - /* Uncomment this if you need to return IVs - case PERL_constant_ISIV: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHi(iv); - break; */ - /* Uncomment this if you need to return NOs - case PERL_constant_ISNO: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHs(&PL_sv_no); - break; */ - /* Uncomment this if you need to return NVs - case PERL_constant_ISNV: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHn(nv); - break; */ - /* Uncomment this if you need to return PVs - case PERL_constant_ISPV: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHp(pv, strlen(pv)); - break; */ - /* Uncomment this if you need to return PVNs - case PERL_constant_ISPVN: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHp(pv, iv); - break; */ - /* Uncomment this if you need to return SVs - case PERL_constant_ISSV: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHs(sv); - break; */ - /* Uncomment this if you need to return UNDEFs - case PERL_constant_ISUNDEF: - break; */ - /* Uncomment this if you need to return UVs - case PERL_constant_ISUV: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHu((UV)iv); - break; */ - /* Uncomment this if you need to return YESs - case PERL_constant_ISYES: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHs(&PL_sv_yes); - break; */ - default: - sv = sv_2mortal(newSVpvf( - "Unexpected return type %d while processing Language::K20 macro %s, used", - type, s)); - PUSHs(sv); - } diff --git a/deps/Language-K20/.svn/text-base/k20.h.svn-base b/deps/Language-K20/.svn/text-base/k20.h.svn-base deleted file mode 100644 index acf7cd7..0000000 --- a/deps/Language-K20/.svn/text-base/k20.h.svn-base +++ /dev/null @@ -1,69 +0,0 @@ -/* K(f:obj 2:("f";2)) call C(K f(K x,K y){}) MAX 7 args*/ -#define R return -#define O printf -#define Z static -#define DO(n,x) {I i=0,_i=(n);for(;i<_i;++i){x;}} -typedef int I;typedef double F;typedef char C;typedef C*S;typedef unsigned char UC; -typedef struct k0{I c,t,n;struct k0*k[1];}*K; - -/* atom accessors, e.g. Ki(x)=2 */ -#define Ki(x) ((x)->n) -#define Kf(x) (*KF(x)) -#define Kc(x) (*(UC*)&(x)->n) -#define Ks(x) (*(S*)&(x)->n) - -/* list accessors, e.g. KF(x)[i]=2.0 */ -#define KI(x) ((I*)((x)->k)) -#define KF(x) ((F*)((x)->k)) -#define KC(x) ((UC*)((x)->k)) -#define KS(x) ((S*)((x)->k)) -#define KK(x) ((K*)((x)->k)) - -#ifdef __cplusplus -extern "C" { -#endif - -extern S sp(S); /* symbol from phrase */ - -/* atom generators, e.g. gi(2),gf(2.0),gc('2'),gs(sp("2")) */ -extern K gi(I),gf(F),gc(C),gs(S),gn(void); - -/* list generator (t as in 4::), e.g. gtn(-1,9) integer vector */ -extern K gtn(I t,I n); - -/* phrase (-3=4::) generators, e.g. gp("asdf");C*s;gpn(s,4); */ -extern K gp(S),gpn(S,I); - -/* error, e.g. if(x->t!=-1)return kerr("need integer vector");*/ -extern K kerr(S),gsk(S,K),gnk(I,...),ci(K),ksk(S,K),kap(K*,void*); -extern I cd(K),jd(I),dj(I),scd(I),sdf(I,I(*)(void)),sfn(S,K(*)(void),I); - -#ifdef __cplusplus -} -#endif - -/* e.g. -load function(s) from a.c - -#include "k20.h" -K f(K x,K y){return gi(Ki(x)+Ki(y));} // add 2 integers -K g(K x){return gf(Kf(x)+1);} // add 1 to float -... - -LINUX(dlopen): cc -shared a.c -o a.so - -in k, - f:"[path]/a"2:("f";2) - g:"[path]/a"2:("g";1) - - f[2;3] -5 - g[2.3] -3.3 - -FILES: .l(k binary) 16 byte header: -3 1 type count -types -1(int) -2(float) -3(byte) can be mapped as is. -syms are null terminated. - -*/ - diff --git a/deps/Language-K20/.svn/text-base/ppport.h.svn-base b/deps/Language-K20/.svn/text-base/ppport.h.svn-base deleted file mode 100644 index 3e3d52f..0000000 --- a/deps/Language-K20/.svn/text-base/ppport.h.svn-base +++ /dev/null @@ -1,6984 +0,0 @@ -#if 0 -<<'SKIP'; -#endif -/* ----------------------------------------------------------------------- - - ppport.h -- Perl/Pollution/Portability Version 3.17 - - Automatically created by Devel::PPPort running under perl 5.010000. - - Do NOT edit this file directly! -- Edit PPPort_pm.PL and the - includes in parts/inc/ instead. - - Use 'perldoc ppport.h' to view the documentation below. - ----------------------------------------------------------------------- - -SKIP - -=pod - -=head1 NAME - -ppport.h - Perl/Pollution/Portability version 3.17 - -=head1 SYNOPSIS - - perl ppport.h [options] [source files] - - Searches current directory for files if no [source files] are given - - --help show short help - - --version show version - - --patch=file write one patch file with changes - --copy=suffix write changed copies with suffix - --diff=program use diff program and options - - --compat-version=version provide compatibility with Perl version - --cplusplus accept C++ comments - - --quiet don't output anything except fatal errors - --nodiag don't show diagnostics - --nohints don't show hints - --nochanges don't suggest changes - --nofilter don't filter input files - - --strip strip all script and doc functionality from - ppport.h - - --list-provided list provided API - --list-unsupported list unsupported API - --api-info=name show Perl API portability information - -=head1 COMPATIBILITY - -This version of F is designed to support operation with Perl -installations back to 5.003, and has been tested up to 5.10.0. - -=head1 OPTIONS - -=head2 --help - -Display a brief usage summary. - -=head2 --version - -Display the version of F. - -=head2 --patch=I - -If this option is given, a single patch file will be created if -any changes are suggested. This requires a working diff program -to be installed on your system. - -=head2 --copy=I - -If this option is given, a copy of each file will be saved with -the given suffix that contains the suggested changes. This does -not require any external programs. Note that this does not -automagially add a dot between the original filename and the -suffix. If you want the dot, you have to include it in the option -argument. - -If neither C<--patch> or C<--copy> are given, the default is to -simply print the diffs for each file. This requires either -C or a C program to be installed. - -=head2 --diff=I - -Manually set the diff program and options to use. The default -is to use C, when installed, and output unified -context diffs. - -=head2 --compat-version=I - -Tell F to check for compatibility with the given -Perl version. The default is to check for compatibility with Perl -version 5.003. You can use this option to reduce the output -of F if you intend to be backward compatible only -down to a certain Perl version. - -=head2 --cplusplus - -Usually, F will detect C++ style comments and -replace them with C style comments for portability reasons. -Using this option instructs F to leave C++ -comments untouched. - -=head2 --quiet - -Be quiet. Don't print anything except fatal errors. - -=head2 --nodiag - -Don't output any diagnostic messages. Only portability -alerts will be printed. - -=head2 --nohints - -Don't output any hints. Hints often contain useful portability -notes. Warnings will still be displayed. - -=head2 --nochanges - -Don't suggest any changes. Only give diagnostic output and hints -unless these are also deactivated. - -=head2 --nofilter - -Don't filter the list of input files. By default, files not looking -like source code (i.e. not *.xs, *.c, *.cc, *.cpp or *.h) are skipped. - -=head2 --strip - -Strip all script and documentation functionality from F. -This reduces the size of F dramatically and may be useful -if you want to include F in smaller modules without -increasing their distribution size too much. - -The stripped F will have a C<--unstrip> option that allows -you to undo the stripping, but only if an appropriate C -module is installed. - -=head2 --list-provided - -Lists the API elements for which compatibility is provided by -F. Also lists if it must be explicitly requested, -if it has dependencies, and if there are hints or warnings for it. - -=head2 --list-unsupported - -Lists the API elements that are known not to be supported by -F and below which version of Perl they probably -won't be available or work. - -=head2 --api-info=I - -Show portability information for API elements matching I. -If I is surrounded by slashes, it is interpreted as a regular -expression. - -=head1 DESCRIPTION - -In order for a Perl extension (XS) module to be as portable as possible -across differing versions of Perl itself, certain steps need to be taken. - -=over 4 - -=item * - -Including this header is the first major one. This alone will give you -access to a large part of the Perl API that hasn't been available in -earlier Perl releases. Use - - perl ppport.h --list-provided - -to see which API elements are provided by ppport.h. - -=item * - -You should avoid using deprecated parts of the API. For example, using -global Perl variables without the C prefix is deprecated. Also, -some API functions used to have a C prefix. Using this form is -also deprecated. You can safely use the supported API, as F -will provide wrappers for older Perl versions. - -=item * - -If you use one of a few functions or variables that were not present in -earlier versions of Perl, and that can't be provided using a macro, you -have to explicitly request support for these functions by adding one or -more C<#define>s in your source code before the inclusion of F. - -These functions or variables will be marked C in the list shown -by C<--list-provided>. - -Depending on whether you module has a single or multiple files that -use such functions or variables, you want either C or global -variants. - -For a C function or variable (used only in a single source -file), use: - - #define NEED_function - #define NEED_variable - -For a global function or variable (used in multiple source files), -use: - - #define NEED_function_GLOBAL - #define NEED_variable_GLOBAL - -Note that you mustn't have more than one global request for the -same function or variable in your project. - - Function / Variable Static Request Global Request - ----------------------------------------------------------------------------------------- - PL_parser NEED_PL_parser NEED_PL_parser_GLOBAL - PL_signals NEED_PL_signals NEED_PL_signals_GLOBAL - eval_pv() NEED_eval_pv NEED_eval_pv_GLOBAL - grok_bin() NEED_grok_bin NEED_grok_bin_GLOBAL - grok_hex() NEED_grok_hex NEED_grok_hex_GLOBAL - grok_number() NEED_grok_number NEED_grok_number_GLOBAL - grok_numeric_radix() NEED_grok_numeric_radix NEED_grok_numeric_radix_GLOBAL - grok_oct() NEED_grok_oct NEED_grok_oct_GLOBAL - load_module() NEED_load_module NEED_load_module_GLOBAL - my_snprintf() NEED_my_snprintf NEED_my_snprintf_GLOBAL - my_sprintf() NEED_my_sprintf NEED_my_sprintf_GLOBAL - my_strlcat() NEED_my_strlcat NEED_my_strlcat_GLOBAL - my_strlcpy() NEED_my_strlcpy NEED_my_strlcpy_GLOBAL - newCONSTSUB() NEED_newCONSTSUB NEED_newCONSTSUB_GLOBAL - newRV_noinc() NEED_newRV_noinc NEED_newRV_noinc_GLOBAL - newSVpvn_flags() NEED_newSVpvn_flags NEED_newSVpvn_flags_GLOBAL - newSVpvn_share() NEED_newSVpvn_share NEED_newSVpvn_share_GLOBAL - pv_display() NEED_pv_display NEED_pv_display_GLOBAL - pv_escape() NEED_pv_escape NEED_pv_escape_GLOBAL - pv_pretty() NEED_pv_pretty NEED_pv_pretty_GLOBAL - sv_2pv_flags() NEED_sv_2pv_flags NEED_sv_2pv_flags_GLOBAL - sv_2pvbyte() NEED_sv_2pvbyte NEED_sv_2pvbyte_GLOBAL - sv_catpvf_mg() NEED_sv_catpvf_mg NEED_sv_catpvf_mg_GLOBAL - sv_catpvf_mg_nocontext() NEED_sv_catpvf_mg_nocontext NEED_sv_catpvf_mg_nocontext_GLOBAL - sv_pvn_force_flags() NEED_sv_pvn_force_flags NEED_sv_pvn_force_flags_GLOBAL - sv_setpvf_mg() NEED_sv_setpvf_mg NEED_sv_setpvf_mg_GLOBAL - sv_setpvf_mg_nocontext() NEED_sv_setpvf_mg_nocontext NEED_sv_setpvf_mg_nocontext_GLOBAL - vload_module() NEED_vload_module NEED_vload_module_GLOBAL - vnewSVpvf() NEED_vnewSVpvf NEED_vnewSVpvf_GLOBAL - warner() NEED_warner NEED_warner_GLOBAL - -To avoid namespace conflicts, you can change the namespace of the -explicitly exported functions / variables using the C -macro. Just C<#define> the macro before including C: - - #define DPPP_NAMESPACE MyOwnNamespace_ - #include "ppport.h" - -The default namespace is C. - -=back - -The good thing is that most of the above can be checked by running -F on your source code. See the next section for -details. - -=head1 EXAMPLES - -To verify whether F is needed for your module, whether you -should make any changes to your code, and whether any special defines -should be used, F can be run as a Perl script to check your -source code. Simply say: - - perl ppport.h - -The result will usually be a list of patches suggesting changes -that should at least be acceptable, if not necessarily the most -efficient solution, or a fix for all possible problems. - -If you know that your XS module uses features only available in -newer Perl releases, if you're aware that it uses C++ comments, -and if you want all suggestions as a single patch file, you could -use something like this: - - perl ppport.h --compat-version=5.6.0 --cplusplus --patch=test.diff - -If you only want your code to be scanned without any suggestions -for changes, use: - - perl ppport.h --nochanges - -You can specify a different C program or options, using -the C<--diff> option: - - perl ppport.h --diff='diff -C 10' - -This would output context diffs with 10 lines of context. - -If you want to create patched copies of your files instead, use: - - perl ppport.h --copy=.new - -To display portability information for the C function, -use: - - perl ppport.h --api-info=newSVpvn - -Since the argument to C<--api-info> can be a regular expression, -you can use - - perl ppport.h --api-info=/_nomg$/ - -to display portability information for all C<_nomg> functions or - - perl ppport.h --api-info=/./ - -to display information for all known API elements. - -=head1 BUGS - -If this version of F is causing failure during -the compilation of this module, please check if newer versions -of either this module or C are available on CPAN -before sending a bug report. - -If F was generated using the latest version of -C and is causing failure of this module, please -file a bug report using the CPAN Request Tracker at L. - -Please include the following information: - -=over 4 - -=item 1. - -The complete output from running "perl -V" - -=item 2. - -This file. - -=item 3. - -The name and version of the module you were trying to build. - -=item 4. - -A full log of the build that failed. - -=item 5. - -Any other information that you think could be relevant. - -=back - -For the latest version of this code, please get the C -module from CPAN. - -=head1 COPYRIGHT - -Version 3.x, Copyright (c) 2004-2009, Marcus Holland-Moritz. - -Version 2.x, Copyright (C) 2001, Paul Marquess. - -Version 1.x, Copyright (C) 1999, Kenneth Albanowski. - -This program is free software; you can redistribute it and/or -modify it under the same terms as Perl itself. - -=head1 SEE ALSO - -See L. - -=cut - -use strict; - -# Disable broken TRIE-optimization -BEGIN { eval '${^RE_TRIE_MAXBUF} = -1' if $] >= 5.009004 && $] <= 5.009005 } - -my $VERSION = 3.17; - -my %opt = ( - quiet => 0, - diag => 1, - hints => 1, - changes => 1, - cplusplus => 0, - filter => 1, - strip => 0, - version => 0, -); - -my($ppport) = $0 =~ /([\w.]+)$/; -my $LF = '(?:\r\n|[\r\n])'; # line feed -my $HS = "[ \t]"; # horizontal whitespace - -# Never use C comments in this file! -my $ccs = '/'.'*'; -my $cce = '*'.'/'; -my $rccs = quotemeta $ccs; -my $rcce = quotemeta $cce; - -eval { - require Getopt::Long; - Getopt::Long::GetOptions(\%opt, qw( - help quiet diag! filter! hints! changes! cplusplus strip version - patch=s copy=s diff=s compat-version=s - list-provided list-unsupported api-info=s - )) or usage(); -}; - -if ($@ and grep /^-/, @ARGV) { - usage() if "@ARGV" =~ /^--?h(?:elp)?$/; - die "Getopt::Long not found. Please don't use any options.\n"; -} - -if ($opt{version}) { - print "This is $0 $VERSION.\n"; - exit 0; -} - -usage() if $opt{help}; -strip() if $opt{strip}; - -if (exists $opt{'compat-version'}) { - my($r,$v,$s) = eval { parse_version($opt{'compat-version'}) }; - if ($@) { - die "Invalid version number format: '$opt{'compat-version'}'\n"; - } - die "Only Perl 5 is supported\n" if $r != 5; - die "Invalid version number: $opt{'compat-version'}\n" if $v >= 1000 || $s >= 1000; - $opt{'compat-version'} = sprintf "%d.%03d%03d", $r, $v, $s; -} -else { - $opt{'compat-version'} = 5; -} - -my %API = map { /^(\w+)\|([^|]*)\|([^|]*)\|(\w*)$/ - ? ( $1 => { - ($2 ? ( base => $2 ) : ()), - ($3 ? ( todo => $3 ) : ()), - (index($4, 'v') >= 0 ? ( varargs => 1 ) : ()), - (index($4, 'p') >= 0 ? ( provided => 1 ) : ()), - (index($4, 'n') >= 0 ? ( nothxarg => 1 ) : ()), - } ) - : die "invalid spec: $_" } qw( -AvFILLp|5.004050||p -AvFILL||| -CLASS|||n -CPERLscope|5.005000||p -CX_CURPAD_SAVE||| -CX_CURPAD_SV||| -CopFILEAV|5.006000||p -CopFILEGV_set|5.006000||p -CopFILEGV|5.006000||p -CopFILESV|5.006000||p -CopFILE_set|5.006000||p -CopFILE|5.006000||p -CopSTASHPV_set|5.006000||p -CopSTASHPV|5.006000||p -CopSTASH_eq|5.006000||p -CopSTASH_set|5.006000||p -CopSTASH|5.006000||p -CopyD|5.009002||p -Copy||| -CvPADLIST||| -CvSTASH||| -CvWEAKOUTSIDE||| -DEFSV_set|5.011000||p -DEFSV|5.004050||p -END_EXTERN_C|5.005000||p -ENTER||| -ERRSV|5.004050||p -EXTEND||| -EXTERN_C|5.005000||p -F0convert|||n -FREETMPS||| -GIMME_V||5.004000|n -GIMME|||n -GROK_NUMERIC_RADIX|5.007002||p -G_ARRAY||| -G_DISCARD||| -G_EVAL||| -G_METHOD|5.006001||p -G_NOARGS||| -G_SCALAR||| -G_VOID||5.004000| -GetVars||| -GvSV||| -Gv_AMupdate||| -HEf_SVKEY||5.004000| -HeHASH||5.004000| -HeKEY||5.004000| -HeKLEN||5.004000| -HePV||5.004000| -HeSVKEY_force||5.004000| -HeSVKEY_set||5.004000| -HeSVKEY||5.004000| -HeUTF8||5.011000| -HeVAL||5.004000| -HvNAME||| -INT2PTR|5.006000||p -IN_LOCALE_COMPILETIME|5.007002||p -IN_LOCALE_RUNTIME|5.007002||p -IN_LOCALE|5.007002||p -IN_PERL_COMPILETIME|5.008001||p -IS_NUMBER_GREATER_THAN_UV_MAX|5.007002||p -IS_NUMBER_INFINITY|5.007002||p -IS_NUMBER_IN_UV|5.007002||p -IS_NUMBER_NAN|5.007003||p -IS_NUMBER_NEG|5.007002||p -IS_NUMBER_NOT_INT|5.007002||p -IVSIZE|5.006000||p -IVTYPE|5.006000||p -IVdf|5.006000||p -LEAVE||| -LVRET||| -MARK||| -MULTICALL||5.011000| -MY_CXT_CLONE|5.009002||p -MY_CXT_INIT|5.007003||p -MY_CXT|5.007003||p -MoveD|5.009002||p -Move||| -NOOP|5.005000||p -NUM2PTR|5.006000||p -NVTYPE|5.006000||p -NVef|5.006001||p -NVff|5.006001||p -NVgf|5.006001||p -Newxc|5.009003||p -Newxz|5.009003||p -Newx|5.009003||p -Nullav||| -Nullch||| -Nullcv||| -Nullhv||| -Nullsv||| -ORIGMARK||| -PAD_BASE_SV||| -PAD_CLONE_VARS||| -PAD_COMPNAME_FLAGS||| -PAD_COMPNAME_GEN_set||| -PAD_COMPNAME_GEN||| -PAD_COMPNAME_OURSTASH||| -PAD_COMPNAME_PV||| -PAD_COMPNAME_TYPE||| -PAD_DUP||| -PAD_RESTORE_LOCAL||| -PAD_SAVE_LOCAL||| -PAD_SAVE_SETNULLPAD||| -PAD_SETSV||| -PAD_SET_CUR_NOSAVE||| -PAD_SET_CUR||| -PAD_SVl||| -PAD_SV||| -PERLIO_FUNCS_CAST|5.009003||p -PERLIO_FUNCS_DECL|5.009003||p -PERL_ABS|5.008001||p -PERL_BCDVERSION|5.011000||p -PERL_GCC_BRACE_GROUPS_FORBIDDEN|5.008001||p -PERL_HASH|5.004000||p -PERL_INT_MAX|5.004000||p -PERL_INT_MIN|5.004000||p -PERL_LONG_MAX|5.004000||p -PERL_LONG_MIN|5.004000||p -PERL_MAGIC_arylen|5.007002||p -PERL_MAGIC_backref|5.007002||p -PERL_MAGIC_bm|5.007002||p -PERL_MAGIC_collxfrm|5.007002||p -PERL_MAGIC_dbfile|5.007002||p -PERL_MAGIC_dbline|5.007002||p -PERL_MAGIC_defelem|5.007002||p -PERL_MAGIC_envelem|5.007002||p -PERL_MAGIC_env|5.007002||p -PERL_MAGIC_ext|5.007002||p -PERL_MAGIC_fm|5.007002||p -PERL_MAGIC_glob|5.011000||p -PERL_MAGIC_isaelem|5.007002||p -PERL_MAGIC_isa|5.007002||p -PERL_MAGIC_mutex|5.011000||p -PERL_MAGIC_nkeys|5.007002||p -PERL_MAGIC_overload_elem|5.007002||p -PERL_MAGIC_overload_table|5.007002||p -PERL_MAGIC_overload|5.007002||p -PERL_MAGIC_pos|5.007002||p -PERL_MAGIC_qr|5.007002||p -PERL_MAGIC_regdata|5.007002||p -PERL_MAGIC_regdatum|5.007002||p -PERL_MAGIC_regex_global|5.007002||p -PERL_MAGIC_shared_scalar|5.007003||p -PERL_MAGIC_shared|5.007003||p -PERL_MAGIC_sigelem|5.007002||p -PERL_MAGIC_sig|5.007002||p -PERL_MAGIC_substr|5.007002||p -PERL_MAGIC_sv|5.007002||p -PERL_MAGIC_taint|5.007002||p -PERL_MAGIC_tiedelem|5.007002||p -PERL_MAGIC_tiedscalar|5.007002||p -PERL_MAGIC_tied|5.007002||p -PERL_MAGIC_utf8|5.008001||p -PERL_MAGIC_uvar_elem|5.007003||p -PERL_MAGIC_uvar|5.007002||p -PERL_MAGIC_vec|5.007002||p -PERL_MAGIC_vstring|5.008001||p -PERL_PV_ESCAPE_ALL|5.009004||p -PERL_PV_ESCAPE_FIRSTCHAR|5.009004||p -PERL_PV_ESCAPE_NOBACKSLASH|5.009004||p -PERL_PV_ESCAPE_NOCLEAR|5.009004||p -PERL_PV_ESCAPE_QUOTE|5.009004||p -PERL_PV_ESCAPE_RE|5.009005||p -PERL_PV_ESCAPE_UNI_DETECT|5.009004||p -PERL_PV_ESCAPE_UNI|5.009004||p -PERL_PV_PRETTY_DUMP|5.009004||p -PERL_PV_PRETTY_ELLIPSES|5.010000||p -PERL_PV_PRETTY_LTGT|5.009004||p -PERL_PV_PRETTY_NOCLEAR|5.010000||p -PERL_PV_PRETTY_QUOTE|5.009004||p -PERL_PV_PRETTY_REGPROP|5.009004||p -PERL_QUAD_MAX|5.004000||p -PERL_QUAD_MIN|5.004000||p -PERL_REVISION|5.006000||p -PERL_SCAN_ALLOW_UNDERSCORES|5.007003||p -PERL_SCAN_DISALLOW_PREFIX|5.007003||p -PERL_SCAN_GREATER_THAN_UV_MAX|5.007003||p -PERL_SCAN_SILENT_ILLDIGIT|5.008001||p -PERL_SHORT_MAX|5.004000||p -PERL_SHORT_MIN|5.004000||p -PERL_SIGNALS_UNSAFE_FLAG|5.008001||p -PERL_SUBVERSION|5.006000||p -PERL_UCHAR_MAX|5.004000||p -PERL_UCHAR_MIN|5.004000||p -PERL_UINT_MAX|5.004000||p -PERL_UINT_MIN|5.004000||p -PERL_ULONG_MAX|5.004000||p -PERL_ULONG_MIN|5.004000||p -PERL_UNUSED_ARG|5.009003||p -PERL_UNUSED_CONTEXT|5.009004||p -PERL_UNUSED_DECL|5.007002||p -PERL_UNUSED_VAR|5.007002||p -PERL_UQUAD_MAX|5.004000||p -PERL_UQUAD_MIN|5.004000||p -PERL_USE_GCC_BRACE_GROUPS|5.009004||p -PERL_USHORT_MAX|5.004000||p -PERL_USHORT_MIN|5.004000||p -PERL_VERSION|5.006000||p -PL_DBsignal|5.005000||p -PL_DBsingle|||pn -PL_DBsub|||pn -PL_DBtrace|||pn -PL_Sv|5.005000||p -PL_bufend|5.011000||p -PL_bufptr|5.011000||p -PL_compiling|5.004050||p -PL_copline|5.011000||p -PL_curcop|5.004050||p -PL_curstash|5.004050||p -PL_debstash|5.004050||p -PL_defgv|5.004050||p -PL_diehook|5.004050||p -PL_dirty|5.004050||p -PL_dowarn|||pn -PL_errgv|5.004050||p -PL_expect|5.011000||p -PL_hexdigit|5.005000||p -PL_hints|5.005000||p -PL_last_in_gv|||n -PL_laststatval|5.005000||p -PL_lex_state|5.011000||p -PL_lex_stuff|5.011000||p -PL_linestr|5.011000||p -PL_modglobal||5.005000|n -PL_na|5.004050||pn -PL_no_modify|5.006000||p -PL_ofsgv|||n -PL_parser|5.009005||p -PL_perl_destruct_level|5.004050||p -PL_perldb|5.004050||p -PL_ppaddr|5.006000||p -PL_rsfp_filters|5.004050||p -PL_rsfp|5.004050||p -PL_rs|||n -PL_signals|5.008001||p -PL_stack_base|5.004050||p -PL_stack_sp|5.004050||p -PL_statcache|5.005000||p -PL_stdingv|5.004050||p -PL_sv_arenaroot|5.004050||p -PL_sv_no|5.004050||pn -PL_sv_undef|5.004050||pn -PL_sv_yes|5.004050||pn -PL_tainted|5.004050||p -PL_tainting|5.004050||p -PL_tokenbuf|5.011000||p -POP_MULTICALL||5.011000| -POPi|||n -POPl|||n -POPn|||n -POPpbytex||5.007001|n -POPpx||5.005030|n -POPp|||n -POPs|||n -PTR2IV|5.006000||p -PTR2NV|5.006000||p -PTR2UV|5.006000||p -PTR2nat|5.009003||p -PTR2ul|5.007001||p -PTRV|5.006000||p -PUSHMARK||| -PUSH_MULTICALL||5.011000| -PUSHi||| -PUSHmortal|5.009002||p -PUSHn||| -PUSHp||| -PUSHs||| -PUSHu|5.004000||p -PUTBACK||| -PerlIO_clearerr||5.007003| -PerlIO_close||5.007003| -PerlIO_context_layers||5.009004| -PerlIO_eof||5.007003| -PerlIO_error||5.007003| -PerlIO_fileno||5.007003| -PerlIO_fill||5.007003| -PerlIO_flush||5.007003| -PerlIO_get_base||5.007003| -PerlIO_get_bufsiz||5.007003| -PerlIO_get_cnt||5.007003| -PerlIO_get_ptr||5.007003| -PerlIO_read||5.007003| -PerlIO_seek||5.007003| -PerlIO_set_cnt||5.007003| -PerlIO_set_ptrcnt||5.007003| -PerlIO_setlinebuf||5.007003| -PerlIO_stderr||5.007003| -PerlIO_stdin||5.007003| -PerlIO_stdout||5.007003| -PerlIO_tell||5.007003| -PerlIO_unread||5.007003| -PerlIO_write||5.007003| -Perl_signbit||5.009005|n -PoisonFree|5.009004||p -PoisonNew|5.009004||p -PoisonWith|5.009004||p -Poison|5.008000||p -RETVAL|||n -Renewc||| -Renew||| -SAVECLEARSV||| -SAVECOMPPAD||| -SAVEPADSV||| -SAVETMPS||| -SAVE_DEFSV|5.004050||p -SPAGAIN||| -SP||| -START_EXTERN_C|5.005000||p -START_MY_CXT|5.007003||p -STMT_END|||p -STMT_START|||p -STR_WITH_LEN|5.009003||p -ST||| -SV_CONST_RETURN|5.009003||p -SV_COW_DROP_PV|5.008001||p -SV_COW_SHARED_HASH_KEYS|5.009005||p -SV_GMAGIC|5.007002||p -SV_HAS_TRAILING_NUL|5.009004||p -SV_IMMEDIATE_UNREF|5.007001||p -SV_MUTABLE_RETURN|5.009003||p -SV_NOSTEAL|5.009002||p -SV_SMAGIC|5.009003||p -SV_UTF8_NO_ENCODING|5.008001||p -SVf_UTF8|5.006000||p -SVf|5.006000||p -SVt_IV||| -SVt_NV||| -SVt_PVAV||| -SVt_PVCV||| -SVt_PVHV||| -SVt_PVMG||| -SVt_PV||| -Safefree||| -Slab_Alloc||| -Slab_Free||| -Slab_to_rw||| -StructCopy||| -SvCUR_set||| -SvCUR||| -SvEND||| -SvGAMAGIC||5.006001| -SvGETMAGIC|5.004050||p -SvGROW||| -SvIOK_UV||5.006000| -SvIOK_notUV||5.006000| -SvIOK_off||| -SvIOK_only_UV||5.006000| -SvIOK_only||| -SvIOK_on||| -SvIOKp||| -SvIOK||| -SvIVX||| -SvIV_nomg|5.009001||p -SvIV_set||| -SvIVx||| -SvIV||| -SvIsCOW_shared_hash||5.008003| -SvIsCOW||5.008003| -SvLEN_set||| -SvLEN||| -SvLOCK||5.007003| -SvMAGIC_set|5.009003||p -SvNIOK_off||| -SvNIOKp||| -SvNIOK||| -SvNOK_off||| -SvNOK_only||| -SvNOK_on||| -SvNOKp||| -SvNOK||| -SvNVX||| -SvNV_set||| -SvNVx||| -SvNV||| -SvOK||| -SvOOK_offset||5.011000| -SvOOK||| -SvPOK_off||| -SvPOK_only_UTF8||5.006000| -SvPOK_only||| -SvPOK_on||| -SvPOKp||| -SvPOK||| -SvPVX_const|5.009003||p -SvPVX_mutable|5.009003||p -SvPVX||| -SvPV_const|5.009003||p -SvPV_flags_const_nolen|5.009003||p -SvPV_flags_const|5.009003||p -SvPV_flags_mutable|5.009003||p -SvPV_flags|5.007002||p -SvPV_force_flags_mutable|5.009003||p -SvPV_force_flags_nolen|5.009003||p -SvPV_force_flags|5.007002||p -SvPV_force_mutable|5.009003||p -SvPV_force_nolen|5.009003||p -SvPV_force_nomg_nolen|5.009003||p -SvPV_force_nomg|5.007002||p -SvPV_force|||p -SvPV_mutable|5.009003||p -SvPV_nolen_const|5.009003||p -SvPV_nolen|5.006000||p -SvPV_nomg_const_nolen|5.009003||p -SvPV_nomg_const|5.009003||p -SvPV_nomg|5.007002||p -SvPV_renew|5.009003||p -SvPV_set||| -SvPVbyte_force||5.009002| -SvPVbyte_nolen||5.006000| -SvPVbytex_force||5.006000| -SvPVbytex||5.006000| -SvPVbyte|5.006000||p -SvPVutf8_force||5.006000| -SvPVutf8_nolen||5.006000| -SvPVutf8x_force||5.006000| -SvPVutf8x||5.006000| -SvPVutf8||5.006000| -SvPVx||| -SvPV||| -SvREFCNT_dec||| -SvREFCNT_inc_NN|5.009004||p -SvREFCNT_inc_simple_NN|5.009004||p -SvREFCNT_inc_simple_void_NN|5.009004||p -SvREFCNT_inc_simple_void|5.009004||p -SvREFCNT_inc_simple|5.009004||p -SvREFCNT_inc_void_NN|5.009004||p -SvREFCNT_inc_void|5.009004||p -SvREFCNT_inc|||p -SvREFCNT||| -SvROK_off||| -SvROK_on||| -SvROK||| -SvRV_set|5.009003||p -SvRV||| -SvRXOK||5.009005| -SvRX||5.009005| -SvSETMAGIC||| -SvSHARED_HASH|5.009003||p -SvSHARE||5.007003| -SvSTASH_set|5.009003||p -SvSTASH||| -SvSetMagicSV_nosteal||5.004000| -SvSetMagicSV||5.004000| -SvSetSV_nosteal||5.004000| -SvSetSV||| -SvTAINTED_off||5.004000| -SvTAINTED_on||5.004000| -SvTAINTED||5.004000| -SvTAINT||| -SvTRUE||| -SvTYPE||| -SvUNLOCK||5.007003| -SvUOK|5.007001|5.006000|p -SvUPGRADE||| -SvUTF8_off||5.006000| -SvUTF8_on||5.006000| -SvUTF8||5.006000| -SvUVXx|5.004000||p -SvUVX|5.004000||p -SvUV_nomg|5.009001||p -SvUV_set|5.009003||p -SvUVx|5.004000||p -SvUV|5.004000||p -SvVOK||5.008001| -SvVSTRING_mg|5.009004||p -THIS|||n -UNDERBAR|5.009002||p -UTF8_MAXBYTES|5.009002||p -UVSIZE|5.006000||p -UVTYPE|5.006000||p -UVXf|5.007001||p -UVof|5.006000||p -UVuf|5.006000||p -UVxf|5.006000||p -WARN_ALL|5.006000||p -WARN_AMBIGUOUS|5.006000||p -WARN_ASSERTIONS|5.011000||p -WARN_BAREWORD|5.006000||p -WARN_CLOSED|5.006000||p -WARN_CLOSURE|5.006000||p -WARN_DEBUGGING|5.006000||p -WARN_DEPRECATED|5.006000||p -WARN_DIGIT|5.006000||p -WARN_EXEC|5.006000||p -WARN_EXITING|5.006000||p -WARN_GLOB|5.006000||p -WARN_INPLACE|5.006000||p -WARN_INTERNAL|5.006000||p -WARN_IO|5.006000||p -WARN_LAYER|5.008000||p -WARN_MALLOC|5.006000||p -WARN_MISC|5.006000||p -WARN_NEWLINE|5.006000||p -WARN_NUMERIC|5.006000||p -WARN_ONCE|5.006000||p -WARN_OVERFLOW|5.006000||p -WARN_PACK|5.006000||p -WARN_PARENTHESIS|5.006000||p -WARN_PIPE|5.006000||p -WARN_PORTABLE|5.006000||p -WARN_PRECEDENCE|5.006000||p -WARN_PRINTF|5.006000||p -WARN_PROTOTYPE|5.006000||p -WARN_QW|5.006000||p -WARN_RECURSION|5.006000||p -WARN_REDEFINE|5.006000||p -WARN_REGEXP|5.006000||p -WARN_RESERVED|5.006000||p -WARN_SEMICOLON|5.006000||p -WARN_SEVERE|5.006000||p -WARN_SIGNAL|5.006000||p -WARN_SUBSTR|5.006000||p -WARN_SYNTAX|5.006000||p -WARN_TAINT|5.006000||p -WARN_THREADS|5.008000||p -WARN_UNINITIALIZED|5.006000||p -WARN_UNOPENED|5.006000||p -WARN_UNPACK|5.006000||p -WARN_UNTIE|5.006000||p -WARN_UTF8|5.006000||p -WARN_VOID|5.006000||p -XCPT_CATCH|5.009002||p -XCPT_RETHROW|5.009002||p -XCPT_TRY_END|5.009002||p -XCPT_TRY_START|5.009002||p -XPUSHi||| -XPUSHmortal|5.009002||p -XPUSHn||| -XPUSHp||| -XPUSHs||| -XPUSHu|5.004000||p -XSRETURN_EMPTY||| -XSRETURN_IV||| -XSRETURN_NO||| -XSRETURN_NV||| -XSRETURN_PV||| -XSRETURN_UNDEF||| -XSRETURN_UV|5.008001||p -XSRETURN_YES||| -XSRETURN|||p -XST_mIV||| -XST_mNO||| -XST_mNV||| -XST_mPV||| -XST_mUNDEF||| -XST_mUV|5.008001||p -XST_mYES||| -XS_VERSION_BOOTCHECK||| -XS_VERSION||| -XSprePUSH|5.006000||p -XS||| -ZeroD|5.009002||p -Zero||| -_aMY_CXT|5.007003||p -_pMY_CXT|5.007003||p -aMY_CXT_|5.007003||p -aMY_CXT|5.007003||p -aTHXR_|5.011000||p -aTHXR|5.011000||p -aTHX_|5.006000||p -aTHX|5.006000||p -add_data|||n -addmad||| -allocmy||| -amagic_call||| -amagic_cmp_locale||| -amagic_cmp||| -amagic_i_ncmp||| -amagic_ncmp||| -any_dup||| -ao||| -append_elem||| -append_list||| -append_madprops||| -apply_attrs_my||| -apply_attrs_string||5.006001| -apply_attrs||| -apply||| -atfork_lock||5.007003|n -atfork_unlock||5.007003|n -av_arylen_p||5.009003| -av_clear||| -av_create_and_push||5.009005| -av_create_and_unshift_one||5.009005| -av_delete||5.006000| -av_exists||5.006000| -av_extend||| -av_fetch||| -av_fill||| -av_iter_p||5.011000| -av_len||| -av_make||| -av_pop||| -av_push||| -av_reify||| -av_shift||| -av_store||| -av_undef||| -av_unshift||| -ax|||n -bad_type||| -bind_match||| -block_end||| -block_gimme||5.004000| -block_start||| -boolSV|5.004000||p -boot_core_PerlIO||| -boot_core_UNIVERSAL||| -boot_core_mro||| -boot_core_xsutils||| -bytes_from_utf8||5.007001| -bytes_to_uni|||n -bytes_to_utf8||5.006001| -call_argv|5.006000||p -call_atexit||5.006000| -call_list||5.004000| -call_method|5.006000||p -call_pv|5.006000||p -call_sv|5.006000||p -calloc||5.007002|n -cando||| -cast_i32||5.006000| -cast_iv||5.006000| -cast_ulong||5.006000| -cast_uv||5.006000| -check_type_and_open||| -check_uni||| -checkcomma||| -checkposixcc||| -ckWARN|5.006000||p -ck_anoncode||| -ck_bitop||| -ck_concat||| -ck_defined||| -ck_delete||| -ck_die||| -ck_each||| -ck_eof||| -ck_eval||| -ck_exec||| -ck_exists||| -ck_exit||| -ck_ftst||| -ck_fun||| -ck_glob||| -ck_grep||| -ck_index||| -ck_join||| -ck_lfun||| -ck_listiob||| -ck_match||| -ck_method||| -ck_null||| -ck_open||| -ck_readline||| -ck_repeat||| -ck_require||| -ck_return||| -ck_rfun||| -ck_rvconst||| -ck_sassign||| -ck_select||| -ck_shift||| -ck_sort||| -ck_spair||| -ck_split||| -ck_subr||| -ck_substr||| -ck_svconst||| -ck_trunc||| -ck_unpack||| -ckwarn_d||5.009003| -ckwarn||5.009003| -cl_and|||n -cl_anything|||n -cl_init_zero|||n -cl_init|||n -cl_is_anything|||n -cl_or|||n -clear_placeholders||| -closest_cop||| -convert||| -cop_free||| -cr_textfilter||| -create_eval_scope||| -croak_nocontext|||vn -croak_xs_usage||5.011000| -croak|||v -csighandler||5.009003|n -curmad||| -custom_op_desc||5.007003| -custom_op_name||5.007003| -cv_ckproto_len||| -cv_clone||| -cv_const_sv||5.004000| -cv_dump||| -cv_undef||| -cx_dump||5.005000| -cx_dup||| -cxinc||| -dAXMARK|5.009003||p -dAX|5.007002||p -dITEMS|5.007002||p -dMARK||| -dMULTICALL||5.009003| -dMY_CXT_SV|5.007003||p -dMY_CXT|5.007003||p -dNOOP|5.006000||p -dORIGMARK||| -dSP||| -dTHR|5.004050||p -dTHXR|5.011000||p -dTHXa|5.006000||p -dTHXoa|5.006000||p -dTHX|5.006000||p -dUNDERBAR|5.009002||p -dVAR|5.009003||p -dXCPT|5.009002||p -dXSARGS||| -dXSI32||| -dXSTARG|5.006000||p -deb_curcv||| -deb_nocontext|||vn -deb_stack_all||| -deb_stack_n||| -debop||5.005000| -debprofdump||5.005000| -debprof||| -debstackptrs||5.007003| -debstack||5.007003| -debug_start_match||| -deb||5.007003|v -del_sv||| -delete_eval_scope||| -delimcpy||5.004000| -deprecate_old||| -deprecate||| -despatch_signals||5.007001| -destroy_matcher||| -die_nocontext|||vn -die_where||| -die|||v -dirp_dup||| -div128||| -djSP||| -do_aexec5||| -do_aexec||| -do_aspawn||| -do_binmode||5.004050| -do_chomp||| -do_chop||| -do_close||| -do_dump_pad||| -do_eof||| -do_exec3||| -do_execfree||| -do_exec||| -do_gv_dump||5.006000| -do_gvgv_dump||5.006000| -do_hv_dump||5.006000| -do_ipcctl||| -do_ipcget||| -do_join||| -do_kv||| -do_magic_dump||5.006000| -do_msgrcv||| -do_msgsnd||| -do_oddball||| -do_op_dump||5.006000| -do_op_xmldump||| -do_open9||5.006000| -do_openn||5.007001| -do_open||5.004000| -do_pmop_dump||5.006000| -do_pmop_xmldump||| -do_print||| -do_readline||| -do_seek||| -do_semop||| -do_shmio||| -do_smartmatch||| -do_spawn_nowait||| -do_spawn||| -do_sprintf||| -do_sv_dump||5.006000| -do_sysseek||| -do_tell||| -do_trans_complex_utf8||| -do_trans_complex||| -do_trans_count_utf8||| -do_trans_count||| -do_trans_simple_utf8||| -do_trans_simple||| -do_trans||| -do_vecget||| -do_vecset||| -do_vop||| -docatch||| -doeval||| -dofile||| -dofindlabel||| -doform||| -doing_taint||5.008001|n -dooneliner||| -doopen_pm||| -doparseform||| -dopoptoeval||| -dopoptogiven||| -dopoptolabel||| -dopoptoloop||| -dopoptosub_at||| -dopoptowhen||| -doref||5.009003| -dounwind||| -dowantarray||| -dump_all||5.006000| -dump_eval||5.006000| -dump_exec_pos||| -dump_fds||| -dump_form||5.006000| -dump_indent||5.006000|v -dump_mstats||| -dump_packsubs||5.006000| -dump_sub||5.006000| -dump_sv_child||| -dump_trie_interim_list||| -dump_trie_interim_table||| -dump_trie||| -dump_vindent||5.006000| -dumpuntil||| -dup_attrlist||| -emulate_cop_io||| -eval_pv|5.006000||p -eval_sv|5.006000||p -exec_failed||| -expect_number||| -fbm_compile||5.005000| -fbm_instr||5.005000| -feature_is_enabled||| -fetch_cop_label||5.011000| -filter_add||| -filter_del||| -filter_gets||| -filter_read||| -find_and_forget_pmops||| -find_array_subscript||| -find_beginning||| -find_byclass||| -find_hash_subscript||| -find_in_my_stash||| -find_runcv||5.008001| -find_rundefsvoffset||5.009002| -find_script||| -find_uninit_var||| -first_symbol|||n -fold_constants||| -forbid_setid||| -force_ident||| -force_list||| -force_next||| -force_version||| -force_word||| -forget_pmop||| -form_nocontext|||vn -form||5.004000|v -fp_dup||| -fprintf_nocontext|||vn -free_global_struct||| -free_tied_hv_pool||| -free_tmps||| -gen_constant_list||| -get_arena||| -get_aux_mg||| -get_av|5.006000||p -get_context||5.006000|n -get_cvn_flags||5.009005| -get_cv|5.006000||p -get_db_sub||| -get_debug_opts||| -get_hash_seed||| -get_hv|5.006000||p -get_isa_hash||| -get_mstats||| -get_no_modify||| -get_num||| -get_op_descs||5.005000| -get_op_names||5.005000| -get_opargs||| -get_ppaddr||5.006000| -get_re_arg||| -get_sv|5.006000||p -get_vtbl||5.005030| -getcwd_sv||5.007002| -getenv_len||| -glob_2number||| -glob_2pv||| -glob_assign_glob||| -glob_assign_ref||| -gp_dup||| -gp_free||| -gp_ref||| -grok_bin|5.007003||p -grok_hex|5.007003||p -grok_number|5.007002||p -grok_numeric_radix|5.007002||p -grok_oct|5.007003||p -group_end||| -gv_AVadd||| -gv_HVadd||| -gv_IOadd||| -gv_SVadd||| -gv_autoload4||5.004000| -gv_check||| -gv_const_sv||5.009003| -gv_dump||5.006000| -gv_efullname3||5.004000| -gv_efullname4||5.006001| -gv_efullname||| -gv_ename||| -gv_fetchfile_flags||5.009005| -gv_fetchfile||| -gv_fetchmeth_autoload||5.007003| -gv_fetchmethod_autoload||5.004000| -gv_fetchmethod_flags||5.011000| -gv_fetchmethod||| -gv_fetchmeth||| -gv_fetchpvn_flags||5.009002| -gv_fetchpv||| -gv_fetchsv||5.009002| -gv_fullname3||5.004000| -gv_fullname4||5.006001| -gv_fullname||| -gv_get_super_pkg||| -gv_handler||5.007001| -gv_init_sv||| -gv_init||| -gv_name_set||5.009004| -gv_stashpvn|5.004000||p -gv_stashpvs||5.009003| -gv_stashpv||| -gv_stashsv||| -he_dup||| -hek_dup||| -hfreeentries||| -hsplit||| -hv_assert||5.011000| -hv_auxinit|||n -hv_backreferences_p||| -hv_clear_placeholders||5.009001| -hv_clear||| -hv_common_key_len||5.010000| -hv_common||5.010000| -hv_copy_hints_hv||| -hv_delayfree_ent||5.004000| -hv_delete_common||| -hv_delete_ent||5.004000| -hv_delete||| -hv_eiter_p||5.009003| -hv_eiter_set||5.009003| -hv_exists_ent||5.004000| -hv_exists||| -hv_fetch_ent||5.004000| -hv_fetchs|5.009003||p -hv_fetch||| -hv_free_ent||5.004000| -hv_iterinit||| -hv_iterkeysv||5.004000| -hv_iterkey||| -hv_iternext_flags||5.008000| -hv_iternextsv||| -hv_iternext||| -hv_iterval||| -hv_kill_backrefs||| -hv_ksplit||5.004000| -hv_magic_check|||n -hv_magic||| -hv_name_set||5.009003| -hv_notallowed||| -hv_placeholders_get||5.009003| -hv_placeholders_p||5.009003| -hv_placeholders_set||5.009003| -hv_riter_p||5.009003| -hv_riter_set||5.009003| -hv_scalar||5.009001| -hv_store_ent||5.004000| -hv_store_flags||5.008000| -hv_stores|5.009004||p -hv_store||| -hv_undef||| -ibcmp_locale||5.004000| -ibcmp_utf8||5.007003| -ibcmp||| -incline||| -incpush_if_exists||| -incpush_use_sep||| -incpush||| -ingroup||| -init_argv_symbols||| -init_debugger||| -init_global_struct||| -init_i18nl10n||5.006000| -init_i18nl14n||5.006000| -init_ids||| -init_interp||| -init_main_stash||| -init_perllib||| -init_postdump_symbols||| -init_predump_symbols||| -init_stacks||5.005000| -init_tm||5.007002| -instr||| -intro_my||| -intuit_method||| -intuit_more||| -invert||| -io_close||| -isALNUMC|5.006000||p -isALNUM||| -isALPHA||| -isASCII|5.006000||p -isBLANK|5.006001||p -isCNTRL|5.006000||p -isDIGIT||| -isGRAPH|5.006000||p -isLOWER||| -isPRINT|5.004000||p -isPSXSPC|5.006001||p -isPUNCT|5.006000||p -isSPACE||| -isUPPER||| -isXDIGIT|5.006000||p -is_an_int||| -is_gv_magical_sv||| -is_handle_constructor|||n -is_list_assignment||| -is_lvalue_sub||5.007001| -is_uni_alnum_lc||5.006000| -is_uni_alnumc_lc||5.006000| -is_uni_alnumc||5.006000| -is_uni_alnum||5.006000| -is_uni_alpha_lc||5.006000| -is_uni_alpha||5.006000| -is_uni_ascii_lc||5.006000| -is_uni_ascii||5.006000| -is_uni_cntrl_lc||5.006000| -is_uni_cntrl||5.006000| -is_uni_digit_lc||5.006000| -is_uni_digit||5.006000| -is_uni_graph_lc||5.006000| -is_uni_graph||5.006000| -is_uni_idfirst_lc||5.006000| -is_uni_idfirst||5.006000| -is_uni_lower_lc||5.006000| -is_uni_lower||5.006000| -is_uni_print_lc||5.006000| -is_uni_print||5.006000| -is_uni_punct_lc||5.006000| -is_uni_punct||5.006000| -is_uni_space_lc||5.006000| -is_uni_space||5.006000| -is_uni_upper_lc||5.006000| -is_uni_upper||5.006000| -is_uni_xdigit_lc||5.006000| -is_uni_xdigit||5.006000| -is_utf8_alnumc||5.006000| -is_utf8_alnum||5.006000| -is_utf8_alpha||5.006000| -is_utf8_ascii||5.006000| -is_utf8_char_slow|||n -is_utf8_char||5.006000| -is_utf8_cntrl||5.006000| -is_utf8_common||| -is_utf8_digit||5.006000| -is_utf8_graph||5.006000| -is_utf8_idcont||5.008000| -is_utf8_idfirst||5.006000| -is_utf8_lower||5.006000| -is_utf8_mark||5.006000| -is_utf8_print||5.006000| -is_utf8_punct||5.006000| -is_utf8_space||5.006000| -is_utf8_string_loclen||5.009003| -is_utf8_string_loc||5.008001| -is_utf8_string||5.006001| -is_utf8_upper||5.006000| -is_utf8_xdigit||5.006000| -isa_lookup||| -items|||n -ix|||n -jmaybe||| -join_exact||| -keyword||| -leave_scope||| -lex_end||| -lex_start||| -linklist||| -listkids||| -list||| -load_module_nocontext|||vn -load_module|5.006000||pv -localize||| -looks_like_bool||| -looks_like_number||| -lop||| -mPUSHi|5.009002||p -mPUSHn|5.009002||p -mPUSHp|5.009002||p -mPUSHs|5.011000||p -mPUSHu|5.009002||p -mXPUSHi|5.009002||p -mXPUSHn|5.009002||p -mXPUSHp|5.009002||p -mXPUSHs|5.011000||p -mXPUSHu|5.009002||p -mad_free||| -madlex||| -madparse||| -magic_clear_all_env||| -magic_clearenv||| -magic_clearhint||| -magic_clearisa||| -magic_clearpack||| -magic_clearsig||| -magic_dump||5.006000| -magic_existspack||| -magic_freearylen_p||| -magic_freeovrld||| -magic_getarylen||| -magic_getdefelem||| -magic_getnkeys||| -magic_getpack||| -magic_getpos||| -magic_getsig||| -magic_getsubstr||| -magic_gettaint||| -magic_getuvar||| -magic_getvec||| -magic_get||| -magic_killbackrefs||| -magic_len||| -magic_methcall||| -magic_methpack||| -magic_nextpack||| -magic_regdata_cnt||| -magic_regdatum_get||| -magic_regdatum_set||| -magic_scalarpack||| -magic_set_all_env||| -magic_setamagic||| -magic_setarylen||| -magic_setcollxfrm||| -magic_setdbline||| -magic_setdefelem||| -magic_setenv||| -magic_sethint||| -magic_setisa||| -magic_setmglob||| -magic_setnkeys||| -magic_setpack||| -magic_setpos||| -magic_setregexp||| -magic_setsig||| -magic_setsubstr||| -magic_settaint||| -magic_setutf8||| -magic_setuvar||| -magic_setvec||| -magic_set||| -magic_sizepack||| -magic_wipepack||| -make_matcher||| -make_trie_failtable||| -make_trie||| -malloc_good_size|||n -malloced_size|||n -malloc||5.007002|n -markstack_grow||| -matcher_matches_sv||| -measure_struct||| -memEQ|5.004000||p -memNE|5.004000||p -mem_collxfrm||| -mem_log_common|||n -mess_alloc||| -mess_nocontext|||vn -mess||5.006000|v -method_common||| -mfree||5.007002|n -mg_clear||| -mg_copy||| -mg_dup||| -mg_find||| -mg_free||| -mg_get||| -mg_length||5.005000| -mg_localize||| -mg_magical||| -mg_set||| -mg_size||5.005000| -mini_mktime||5.007002| -missingterm||| -mode_from_discipline||| -modkids||| -mod||| -more_bodies||| -more_sv||| -moreswitches||| -mro_get_from_name||5.011000| -mro_get_linear_isa_dfs||| -mro_get_linear_isa||5.009005| -mro_get_private_data||5.011000| -mro_isa_changed_in||| -mro_meta_dup||| -mro_meta_init||| -mro_method_changed_in||5.009005| -mro_register||5.011000| -mro_set_mro||5.011000| -mro_set_private_data||5.011000| -mul128||| -mulexp10|||n -my_atof2||5.007002| -my_atof||5.006000| -my_attrs||| -my_bcopy|||n -my_betoh16|||n -my_betoh32|||n -my_betoh64|||n -my_betohi|||n -my_betohl|||n -my_betohs|||n -my_bzero|||n -my_chsize||| -my_clearenv||| -my_cxt_index||| -my_cxt_init||| -my_dirfd||5.009005| -my_exit_jump||| -my_exit||| -my_failure_exit||5.004000| -my_fflush_all||5.006000| -my_fork||5.007003|n -my_htobe16|||n -my_htobe32|||n -my_htobe64|||n -my_htobei|||n -my_htobel|||n -my_htobes|||n -my_htole16|||n -my_htole32|||n -my_htole64|||n -my_htolei|||n -my_htolel|||n -my_htoles|||n -my_htonl||| -my_kid||| -my_letoh16|||n -my_letoh32|||n -my_letoh64|||n -my_letohi|||n -my_letohl|||n -my_letohs|||n -my_lstat||| -my_memcmp||5.004000|n -my_memset|||n -my_ntohl||| -my_pclose||5.004000| -my_popen_list||5.007001| -my_popen||5.004000| -my_setenv||| -my_snprintf|5.009004||pvn -my_socketpair||5.007003|n -my_sprintf|5.009003||pvn -my_stat||| -my_strftime||5.007002| -my_strlcat|5.009004||pn -my_strlcpy|5.009004||pn -my_swabn|||n -my_swap||| -my_unexec||| -my_vsnprintf||5.009004|n -need_utf8|||n -newANONATTRSUB||5.006000| -newANONHASH||| -newANONLIST||| -newANONSUB||| -newASSIGNOP||| -newATTRSUB||5.006000| -newAVREF||| -newAV||| -newBINOP||| -newCONDOP||| -newCONSTSUB|5.004050||p -newCVREF||| -newDEFSVOP||| -newFORM||| -newFOROP||| -newGIVENOP||5.009003| -newGIVWHENOP||| -newGP||| -newGVOP||| -newGVREF||| -newGVgen||| -newHVREF||| -newHVhv||5.005000| -newHV||| -newIO||| -newLISTOP||| -newLOGOP||| -newLOOPEX||| -newLOOPOP||| -newMADPROP||| -newMADsv||| -newMYSUB||| -newNULLLIST||| -newOP||| -newPADOP||| -newPMOP||| -newPROG||| -newPVOP||| -newRANGE||| -newRV_inc|5.004000||p -newRV_noinc|5.004000||p -newRV||| -newSLICEOP||| -newSTATEOP||| -newSUB||| -newSVOP||| -newSVREF||| -newSV_type||5.009005| -newSVhek||5.009003| -newSViv||| -newSVnv||| -newSVpvf_nocontext|||vn -newSVpvf||5.004000|v -newSVpvn_flags|5.011000||p -newSVpvn_share|5.007001||p -newSVpvn_utf8|5.011000||p -newSVpvn|5.004050||p -newSVpvs_flags|5.011000||p -newSVpvs_share||5.009003| -newSVpvs|5.009003||p -newSVpv||| -newSVrv||| -newSVsv||| -newSVuv|5.006000||p -newSV||| -newTOKEN||| -newUNOP||| -newWHENOP||5.009003| -newWHILEOP||5.009003| -newXS_flags||5.009004| -newXSproto||5.006000| -newXS||5.006000| -new_collate||5.006000| -new_constant||| -new_ctype||5.006000| -new_he||| -new_logop||| -new_numeric||5.006000| -new_stackinfo||5.005000| -new_version||5.009000| -new_warnings_bitfield||| -next_symbol||| -nextargv||| -nextchar||| -ninstr||| -no_bareword_allowed||| -no_fh_allowed||| -no_op||| -not_a_number||| -nothreadhook||5.008000| -nuke_stacks||| -num_overflow|||n -offer_nice_chunk||| -oopsAV||| -oopsHV||| -op_clear||| -op_const_sv||| -op_dump||5.006000| -op_free||| -op_getmad_weak||| -op_getmad||| -op_null||5.007002| -op_refcnt_dec||| -op_refcnt_inc||| -op_refcnt_lock||5.009002| -op_refcnt_unlock||5.009002| -op_xmldump||| -open_script||| -pMY_CXT_|5.007003||p -pMY_CXT|5.007003||p -pTHX_|5.006000||p -pTHX|5.006000||p -packWARN|5.007003||p -pack_cat||5.007003| -pack_rec||| -package||| -packlist||5.008001| -pad_add_anon||| -pad_add_name||| -pad_alloc||| -pad_block_start||| -pad_check_dup||| -pad_compname_type||| -pad_findlex||| -pad_findmy||| -pad_fixup_inner_anons||| -pad_free||| -pad_leavemy||| -pad_new||| -pad_peg|||n -pad_push||| -pad_reset||| -pad_setsv||| -pad_sv||5.011000| -pad_swipe||| -pad_tidy||| -pad_undef||| -parse_body||| -parse_unicode_opts||| -parser_dup||| -parser_free||| -path_is_absolute|||n -peep||| -pending_Slabs_to_ro||| -perl_alloc_using|||n -perl_alloc|||n -perl_clone_using|||n -perl_clone|||n -perl_construct|||n -perl_destruct||5.007003|n -perl_free|||n -perl_parse||5.006000|n -perl_run|||n -pidgone||| -pm_description||| -pmflag||| -pmop_dump||5.006000| -pmop_xmldump||| -pmruntime||| -pmtrans||| -pop_scope||| -pregcomp||5.009005| -pregexec||| -pregfree2||5.011000| -pregfree||| -prepend_elem||| -prepend_madprops||| -printbuf||| -printf_nocontext|||vn -process_special_blocks||| -ptr_table_clear||5.009005| -ptr_table_fetch||5.009005| -ptr_table_find|||n -ptr_table_free||5.009005| -ptr_table_new||5.009005| -ptr_table_split||5.009005| -ptr_table_store||5.009005| -push_scope||| -put_byte||| -pv_display|5.006000||p -pv_escape|5.009004||p -pv_pretty|5.009004||p -pv_uni_display||5.007003| -qerror||| -qsortsvu||| -re_compile||5.009005| -re_croak2||| -re_dup_guts||| -re_intuit_start||5.009005| -re_intuit_string||5.006000| -readpipe_override||| -realloc||5.007002|n -reentrant_free||| -reentrant_init||| -reentrant_retry|||vn -reentrant_size||| -ref_array_or_hash||| -refcounted_he_chain_2hv||| -refcounted_he_fetch||| -refcounted_he_free||| -refcounted_he_new_common||| -refcounted_he_new||| -refcounted_he_value||| -refkids||| -refto||| -ref||5.011000| -reg_check_named_buff_matched||| -reg_named_buff_all||5.009005| -reg_named_buff_exists||5.009005| -reg_named_buff_fetch||5.009005| -reg_named_buff_firstkey||5.009005| -reg_named_buff_iter||| -reg_named_buff_nextkey||5.009005| -reg_named_buff_scalar||5.009005| -reg_named_buff||| -reg_namedseq||| -reg_node||| -reg_numbered_buff_fetch||| -reg_numbered_buff_length||| -reg_numbered_buff_store||| -reg_qr_package||| -reg_recode||| -reg_scan_name||| -reg_skipcomment||| -reg_temp_copy||| -reganode||| -regatom||| -regbranch||| -regclass_swash||5.009004| -regclass||| -regcppop||| -regcppush||| -regcurly|||n -regdump_extflags||| -regdump||5.005000| -regdupe_internal||| -regexec_flags||5.005000| -regfree_internal||5.009005| -reghop3|||n -reghop4|||n -reghopmaybe3|||n -reginclass||| -reginitcolors||5.006000| -reginsert||| -regmatch||| -regnext||5.005000| -regpiece||| -regpposixcc||| -regprop||| -regrepeat||| -regtail_study||| -regtail||| -regtry||| -reguni||| -regwhite|||n -reg||| -repeatcpy||| -report_evil_fh||| -report_uninit||| -require_pv||5.006000| -require_tie_mod||| -restore_magic||| -rninstr||| -rsignal_restore||| -rsignal_save||| -rsignal_state||5.004000| -rsignal||5.004000| -run_body||| -run_user_filter||| -runops_debug||5.005000| -runops_standard||5.005000| -rvpv_dup||| -rxres_free||| -rxres_restore||| -rxres_save||| -safesyscalloc||5.006000|n -safesysfree||5.006000|n -safesysmalloc||5.006000|n -safesysrealloc||5.006000|n -same_dirent||| -save_I16||5.004000| -save_I32||| -save_I8||5.006000| -save_adelete||5.011000| -save_aelem||5.004050| -save_alloc||5.006000| -save_aptr||| -save_ary||| -save_bool||5.008001| -save_clearsv||| -save_delete||| -save_destructor_x||5.006000| -save_destructor||5.006000| -save_freeop||| -save_freepv||| -save_freesv||| -save_generic_pvref||5.006001| -save_generic_svref||5.005030| -save_gp||5.004000| -save_hash||| -save_hek_flags|||n -save_helem_flags||5.011000| -save_helem||5.004050| -save_hints||| -save_hptr||| -save_int||| -save_item||| -save_iv||5.005000| -save_lines||| -save_list||| -save_long||| -save_magic||| -save_mortalizesv||5.007001| -save_nogv||| -save_op||| -save_padsv_and_mortalize||5.011000| -save_pptr||| -save_pushi32ptr||| -save_pushptri32ptr||| -save_pushptrptr||| -save_pushptr||5.011000| -save_re_context||5.006000| -save_scalar_at||| -save_scalar||| -save_set_svflags||5.009000| -save_shared_pvref||5.007003| -save_sptr||| -save_svref||| -save_vptr||5.006000| -savepvn||| -savepvs||5.009003| -savepv||| -savesharedpvn||5.009005| -savesharedpv||5.007003| -savestack_grow_cnt||5.008001| -savestack_grow||| -savesvpv||5.009002| -sawparens||| -scalar_mod_type|||n -scalarboolean||| -scalarkids||| -scalarseq||| -scalarvoid||| -scalar||| -scan_bin||5.006000| -scan_commit||| -scan_const||| -scan_formline||| -scan_heredoc||| -scan_hex||| -scan_ident||| -scan_inputsymbol||| -scan_num||5.007001| -scan_oct||| -scan_pat||| -scan_str||| -scan_subst||| -scan_trans||| -scan_version||5.009001| -scan_vstring||5.009005| -scan_word||| -scope||| -screaminstr||5.005000| -search_const||| -seed||5.008001| -sequence_num||| -sequence_tail||| -sequence||| -set_context||5.006000|n -set_numeric_local||5.006000| -set_numeric_radix||5.006000| -set_numeric_standard||5.006000| -setdefout||| -share_hek_flags||| -share_hek||5.004000| -si_dup||| -sighandler|||n -simplify_sort||| -skipspace0||| -skipspace1||| -skipspace2||| -skipspace||| -softref2xv||| -sortcv_stacked||| -sortcv_xsub||| -sortcv||| -sortsv_flags||5.009003| -sortsv||5.007003| -space_join_names_mortal||| -ss_dup||| -stack_grow||| -start_force||| -start_glob||| -start_subparse||5.004000| -stashpv_hvname_match||5.011000| -stdize_locale||| -store_cop_label||| -strEQ||| -strGE||| -strGT||| -strLE||| -strLT||| -strNE||| -str_to_version||5.006000| -strip_return||| -strnEQ||| -strnNE||| -study_chunk||| -sub_crush_depth||| -sublex_done||| -sublex_push||| -sublex_start||| -sv_2bool||| -sv_2cv||| -sv_2io||| -sv_2iuv_common||| -sv_2iuv_non_preserve||| -sv_2iv_flags||5.009001| -sv_2iv||| -sv_2mortal||| -sv_2num||| -sv_2nv||| -sv_2pv_flags|5.007002||p -sv_2pv_nolen|5.006000||p -sv_2pvbyte_nolen|5.006000||p -sv_2pvbyte|5.006000||p -sv_2pvutf8_nolen||5.006000| -sv_2pvutf8||5.006000| -sv_2pv||| -sv_2uv_flags||5.009001| -sv_2uv|5.004000||p -sv_add_arena||| -sv_add_backref||| -sv_backoff||| -sv_bless||| -sv_cat_decode||5.008001| -sv_catpv_mg|5.004050||p -sv_catpvf_mg_nocontext|||pvn -sv_catpvf_mg|5.006000|5.004000|pv -sv_catpvf_nocontext|||vn -sv_catpvf||5.004000|v -sv_catpvn_flags||5.007002| -sv_catpvn_mg|5.004050||p -sv_catpvn_nomg|5.007002||p -sv_catpvn||| -sv_catpvs|5.009003||p -sv_catpv||| -sv_catsv_flags||5.007002| -sv_catsv_mg|5.004050||p -sv_catsv_nomg|5.007002||p -sv_catsv||| -sv_catxmlpvn||| -sv_catxmlsv||| -sv_chop||| -sv_clean_all||| -sv_clean_objs||| -sv_clear||| -sv_cmp_locale||5.004000| -sv_cmp||| -sv_collxfrm||| -sv_compile_2op||5.008001| -sv_copypv||5.007003| -sv_dec||| -sv_del_backref||| -sv_derived_from||5.004000| -sv_destroyable||5.010000| -sv_does||5.009004| -sv_dump||| -sv_dup||| -sv_eq||| -sv_exp_grow||| -sv_force_normal_flags||5.007001| -sv_force_normal||5.006000| -sv_free2||| -sv_free_arenas||| -sv_free||| -sv_gets||5.004000| -sv_grow||| -sv_i_ncmp||| -sv_inc||| -sv_insert_flags||5.011000| -sv_insert||| -sv_isa||| -sv_isobject||| -sv_iv||5.005000| -sv_kill_backrefs||| -sv_len_utf8||5.006000| -sv_len||| -sv_magic_portable|5.011000|5.004000|p -sv_magicext||5.007003| -sv_magic||| -sv_mortalcopy||| -sv_ncmp||| -sv_newmortal||| -sv_newref||| -sv_nolocking||5.007003| -sv_nosharing||5.007003| -sv_nounlocking||| -sv_nv||5.005000| -sv_peek||5.005000| -sv_pos_b2u_midway||| -sv_pos_b2u||5.006000| -sv_pos_u2b_cached||| -sv_pos_u2b_forwards|||n -sv_pos_u2b_midway|||n -sv_pos_u2b||5.006000| -sv_pvbyten_force||5.006000| -sv_pvbyten||5.006000| -sv_pvbyte||5.006000| -sv_pvn_force_flags|5.007002||p -sv_pvn_force||| -sv_pvn_nomg|5.007003|5.005000|p -sv_pvn||5.005000| -sv_pvutf8n_force||5.006000| -sv_pvutf8n||5.006000| -sv_pvutf8||5.006000| -sv_pv||5.006000| -sv_recode_to_utf8||5.007003| -sv_reftype||| -sv_release_COW||| -sv_replace||| -sv_report_used||| -sv_reset||| -sv_rvweaken||5.006000| -sv_setiv_mg|5.004050||p -sv_setiv||| -sv_setnv_mg|5.006000||p -sv_setnv||| -sv_setpv_mg|5.004050||p -sv_setpvf_mg_nocontext|||pvn -sv_setpvf_mg|5.006000|5.004000|pv -sv_setpvf_nocontext|||vn -sv_setpvf||5.004000|v -sv_setpviv_mg||5.008001| -sv_setpviv||5.008001| -sv_setpvn_mg|5.004050||p -sv_setpvn||| -sv_setpvs|5.009004||p -sv_setpv||| -sv_setref_iv||| -sv_setref_nv||| -sv_setref_pvn||| -sv_setref_pv||| -sv_setref_uv||5.007001| -sv_setsv_cow||| -sv_setsv_flags||5.007002| -sv_setsv_mg|5.004050||p -sv_setsv_nomg|5.007002||p -sv_setsv||| -sv_setuv_mg|5.004050||p -sv_setuv|5.004000||p -sv_tainted||5.004000| -sv_taint||5.004000| -sv_true||5.005000| -sv_unglob||| -sv_uni_display||5.007003| -sv_unmagic||| -sv_unref_flags||5.007001| -sv_unref||| -sv_untaint||5.004000| -sv_upgrade||| -sv_usepvn_flags||5.009004| -sv_usepvn_mg|5.004050||p -sv_usepvn||| -sv_utf8_decode||5.006000| -sv_utf8_downgrade||5.006000| -sv_utf8_encode||5.006000| -sv_utf8_upgrade_flags_grow||5.011000| -sv_utf8_upgrade_flags||5.007002| -sv_utf8_upgrade_nomg||5.007002| -sv_utf8_upgrade||5.007001| -sv_uv|5.005000||p -sv_vcatpvf_mg|5.006000|5.004000|p -sv_vcatpvfn||5.004000| -sv_vcatpvf|5.006000|5.004000|p -sv_vsetpvf_mg|5.006000|5.004000|p -sv_vsetpvfn||5.004000| -sv_vsetpvf|5.006000|5.004000|p -sv_xmlpeek||| -svtype||| -swallow_bom||| -swap_match_buff||| -swash_fetch||5.007002| -swash_get||| -swash_init||5.006000| -sys_init3||5.010000|n -sys_init||5.010000|n -sys_intern_clear||| -sys_intern_dup||| -sys_intern_init||| -sys_term||5.010000|n -taint_env||| -taint_proper||| -tmps_grow||5.006000| -toLOWER||| -toUPPER||| -to_byte_substr||| -to_uni_fold||5.007003| -to_uni_lower_lc||5.006000| -to_uni_lower||5.007003| -to_uni_title_lc||5.006000| -to_uni_title||5.007003| -to_uni_upper_lc||5.006000| -to_uni_upper||5.007003| -to_utf8_case||5.007003| -to_utf8_fold||5.007003| -to_utf8_lower||5.007003| -to_utf8_substr||| -to_utf8_title||5.007003| -to_utf8_upper||5.007003| -token_free||| -token_getmad||| -tokenize_use||| -tokeq||| -tokereport||| -too_few_arguments||| -too_many_arguments||| -uiv_2buf|||n -unlnk||| -unpack_rec||| -unpack_str||5.007003| -unpackstring||5.008001| -unshare_hek_or_pvn||| -unshare_hek||| -unsharepvn||5.004000| -unwind_handler_stack||| -update_debugger_info||| -upg_version||5.009005| -usage||| -utf16_to_utf8_reversed||5.006001| -utf16_to_utf8||5.006001| -utf8_distance||5.006000| -utf8_hop||5.006000| -utf8_length||5.007001| -utf8_mg_pos_cache_update||| -utf8_to_bytes||5.006001| -utf8_to_uvchr||5.007001| -utf8_to_uvuni||5.007001| -utf8n_to_uvchr||| -utf8n_to_uvuni||5.007001| -utilize||| -uvchr_to_utf8_flags||5.007003| -uvchr_to_utf8||| -uvuni_to_utf8_flags||5.007003| -uvuni_to_utf8||5.007001| -validate_suid||| -varname||| -vcmp||5.009000| -vcroak||5.006000| -vdeb||5.007003| -vdie_common||| -vdie_croak_common||| -vdie||| -vform||5.006000| -visit||| -vivify_defelem||| -vivify_ref||| -vload_module|5.006000||p -vmess||5.006000| -vnewSVpvf|5.006000|5.004000|p -vnormal||5.009002| -vnumify||5.009000| -vstringify||5.009000| -vverify||5.009003| -vwarner||5.006000| -vwarn||5.006000| -wait4pid||| -warn_nocontext|||vn -warner_nocontext|||vn -warner|5.006000|5.004000|pv -warn|||v -watch||| -whichsig||| -write_no_mem||| -write_to_stderr||| -xmldump_all||| -xmldump_attr||| -xmldump_eval||| -xmldump_form||| -xmldump_indent|||v -xmldump_packsubs||| -xmldump_sub||| -xmldump_vindent||| -yyerror||| -yylex||| -yyparse||| -yywarn||| -); - -if (exists $opt{'list-unsupported'}) { - my $f; - for $f (sort { lc $a cmp lc $b } keys %API) { - next unless $API{$f}{todo}; - print "$f ", '.'x(40-length($f)), " ", format_version($API{$f}{todo}), "\n"; - } - exit 0; -} - -# Scan for possible replacement candidates - -my(%replace, %need, %hints, %warnings, %depends); -my $replace = 0; -my($hint, $define, $function); - -sub find_api -{ - my $code = shift; - $code =~ s{ - / (?: \*[^*]*\*+(?:[^$ccs][^*]*\*+)* / | /[^\r\n]*) - | "[^"\\]*(?:\\.[^"\\]*)*" - | '[^'\\]*(?:\\.[^'\\]*)*' }{}egsx; - grep { exists $API{$_} } $code =~ /(\w+)/mg; -} - -while () { - if ($hint) { - my $h = $hint->[0] eq 'Hint' ? \%hints : \%warnings; - if (m{^\s*\*\s(.*?)\s*$}) { - for (@{$hint->[1]}) { - $h->{$_} ||= ''; # suppress warning with older perls - $h->{$_} .= "$1\n"; - } - } - else { undef $hint } - } - - $hint = [$1, [split /,?\s+/, $2]] - if m{^\s*$rccs\s+(Hint|Warning):\s+(\w+(?:,?\s+\w+)*)\s*$}; - - if ($define) { - if ($define->[1] =~ /\\$/) { - $define->[1] .= $_; - } - else { - if (exists $API{$define->[0]} && $define->[1] !~ /^DPPP_\(/) { - my @n = find_api($define->[1]); - push @{$depends{$define->[0]}}, @n if @n - } - undef $define; - } - } - - $define = [$1, $2] if m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(.*)}; - - if ($function) { - if (/^}/) { - if (exists $API{$function->[0]}) { - my @n = find_api($function->[1]); - push @{$depends{$function->[0]}}, @n if @n - } - undef $function; - } - else { - $function->[1] .= $_; - } - } - - $function = [$1, ''] if m{^DPPP_\(my_(\w+)\)}; - - $replace = $1 if m{^\s*$rccs\s+Replace:\s+(\d+)\s+$rcce\s*$}; - $replace{$2} = $1 if $replace and m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(\w+)}; - $replace{$2} = $1 if m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(\w+).*$rccs\s+Replace\s+$rcce}; - $replace{$1} = $2 if m{^\s*$rccs\s+Replace (\w+) with (\w+)\s+$rcce\s*$}; - - if (m{^\s*$rccs\s+(\w+(\s*,\s*\w+)*)\s+depends\s+on\s+(\w+(\s*,\s*\w+)*)\s+$rcce\s*$}) { - my @deps = map { s/\s+//g; $_ } split /,/, $3; - my $d; - for $d (map { s/\s+//g; $_ } split /,/, $1) { - push @{$depends{$d}}, @deps; - } - } - - $need{$1} = 1 if m{^#if\s+defined\(NEED_(\w+)(?:_GLOBAL)?\)}; -} - -for (values %depends) { - my %s; - $_ = [sort grep !$s{$_}++, @$_]; -} - -if (exists $opt{'api-info'}) { - my $f; - my $count = 0; - my $match = $opt{'api-info'} =~ m!^/(.*)/$! ? $1 : "^\Q$opt{'api-info'}\E\$"; - for $f (sort { lc $a cmp lc $b } keys %API) { - next unless $f =~ /$match/; - print "\n=== $f ===\n\n"; - my $info = 0; - if ($API{$f}{base} || $API{$f}{todo}) { - my $base = format_version($API{$f}{base} || $API{$f}{todo}); - print "Supported at least starting from perl-$base.\n"; - $info++; - } - if ($API{$f}{provided}) { - my $todo = $API{$f}{todo} ? format_version($API{$f}{todo}) : "5.003"; - print "Support by $ppport provided back to perl-$todo.\n"; - print "Support needs to be explicitly requested by NEED_$f.\n" if exists $need{$f}; - print "Depends on: ", join(', ', @{$depends{$f}}), ".\n" if exists $depends{$f}; - print "\n$hints{$f}" if exists $hints{$f}; - print "\nWARNING:\n$warnings{$f}" if exists $warnings{$f}; - $info++; - } - print "No portability information available.\n" unless $info; - $count++; - } - $count or print "Found no API matching '$opt{'api-info'}'."; - print "\n"; - exit 0; -} - -if (exists $opt{'list-provided'}) { - my $f; - for $f (sort { lc $a cmp lc $b } keys %API) { - next unless $API{$f}{provided}; - my @flags; - push @flags, 'explicit' if exists $need{$f}; - push @flags, 'depend' if exists $depends{$f}; - push @flags, 'hint' if exists $hints{$f}; - push @flags, 'warning' if exists $warnings{$f}; - my $flags = @flags ? ' ['.join(', ', @flags).']' : ''; - print "$f$flags\n"; - } - exit 0; -} - -my @files; -my @srcext = qw( .xs .c .h .cc .cpp -c.inc -xs.inc ); -my $srcext = join '|', map { quotemeta $_ } @srcext; - -if (@ARGV) { - my %seen; - for (@ARGV) { - if (-e) { - if (-f) { - push @files, $_ unless $seen{$_}++; - } - else { warn "'$_' is not a file.\n" } - } - else { - my @new = grep { -f } glob $_ - or warn "'$_' does not exist.\n"; - push @files, grep { !$seen{$_}++ } @new; - } - } -} -else { - eval { - require File::Find; - File::Find::find(sub { - $File::Find::name =~ /($srcext)$/i - and push @files, $File::Find::name; - }, '.'); - }; - if ($@) { - @files = map { glob "*$_" } @srcext; - } -} - -if (!@ARGV || $opt{filter}) { - my(@in, @out); - my %xsc = map { /(.*)\.xs$/ ? ("$1.c" => 1, "$1.cc" => 1) : () } @files; - for (@files) { - my $out = exists $xsc{$_} || /\b\Q$ppport\E$/i || !/($srcext)$/i; - push @{ $out ? \@out : \@in }, $_; - } - if (@ARGV && @out) { - warning("Skipping the following files (use --nofilter to avoid this):\n| ", join "\n| ", @out); - } - @files = @in; -} - -die "No input files given!\n" unless @files; - -my(%files, %global, %revreplace); -%revreplace = reverse %replace; -my $filename; -my $patch_opened = 0; - -for $filename (@files) { - unless (open IN, "<$filename") { - warn "Unable to read from $filename: $!\n"; - next; - } - - info("Scanning $filename ..."); - - my $c = do { local $/; }; - close IN; - - my %file = (orig => $c, changes => 0); - - # Temporarily remove C/XS comments and strings from the code - my @ccom; - - $c =~ s{ - ( ^$HS*\#$HS*include\b[^\r\n]+\b(?:\Q$ppport\E|XSUB\.h)\b[^\r\n]* - | ^$HS*\#$HS*(?:define|elif|if(?:def)?)\b[^\r\n]* ) - | ( ^$HS*\#[^\r\n]* - | "[^"\\]*(?:\\.[^"\\]*)*" - | '[^'\\]*(?:\\.[^'\\]*)*' - | / (?: \*[^*]*\*+(?:[^$ccs][^*]*\*+)* / | /[^\r\n]* ) ) - }{ defined $2 and push @ccom, $2; - defined $1 ? $1 : "$ccs$#ccom$cce" }mgsex; - - $file{ccom} = \@ccom; - $file{code} = $c; - $file{has_inc_ppport} = $c =~ /^$HS*#$HS*include[^\r\n]+\b\Q$ppport\E\b/m; - - my $func; - - for $func (keys %API) { - my $match = $func; - $match .= "|$revreplace{$func}" if exists $revreplace{$func}; - if ($c =~ /\b(?:Perl_)?($match)\b/) { - $file{uses_replace}{$1}++ if exists $revreplace{$func} && $1 eq $revreplace{$func}; - $file{uses_Perl}{$func}++ if $c =~ /\bPerl_$func\b/; - if (exists $API{$func}{provided}) { - $file{uses_provided}{$func}++; - if (!exists $API{$func}{base} || $API{$func}{base} > $opt{'compat-version'}) { - $file{uses}{$func}++; - my @deps = rec_depend($func); - if (@deps) { - $file{uses_deps}{$func} = \@deps; - for (@deps) { - $file{uses}{$_} = 0 unless exists $file{uses}{$_}; - } - } - for ($func, @deps) { - $file{needs}{$_} = 'static' if exists $need{$_}; - } - } - } - if (exists $API{$func}{todo} && $API{$func}{todo} > $opt{'compat-version'}) { - if ($c =~ /\b$func\b/) { - $file{uses_todo}{$func}++; - } - } - } - } - - while ($c =~ /^$HS*#$HS*define$HS+(NEED_(\w+?)(_GLOBAL)?)\b/mg) { - if (exists $need{$2}) { - $file{defined $3 ? 'needed_global' : 'needed_static'}{$2}++; - } - else { warning("Possibly wrong #define $1 in $filename") } - } - - for (qw(uses needs uses_todo needed_global needed_static)) { - for $func (keys %{$file{$_}}) { - push @{$global{$_}{$func}}, $filename; - } - } - - $files{$filename} = \%file; -} - -# Globally resolve NEED_'s -my $need; -for $need (keys %{$global{needs}}) { - if (@{$global{needs}{$need}} > 1) { - my @targets = @{$global{needs}{$need}}; - my @t = grep $files{$_}{needed_global}{$need}, @targets; - @targets = @t if @t; - @t = grep /\.xs$/i, @targets; - @targets = @t if @t; - my $target = shift @targets; - $files{$target}{needs}{$need} = 'global'; - for (@{$global{needs}{$need}}) { - $files{$_}{needs}{$need} = 'extern' if $_ ne $target; - } - } -} - -for $filename (@files) { - exists $files{$filename} or next; - - info("=== Analyzing $filename ==="); - - my %file = %{$files{$filename}}; - my $func; - my $c = $file{code}; - my $warnings = 0; - - for $func (sort keys %{$file{uses_Perl}}) { - if ($API{$func}{varargs}) { - unless ($API{$func}{nothxarg}) { - my $changes = ($c =~ s{\b(Perl_$func\s*\(\s*)(?!aTHX_?)(\)|[^\s)]*\))} - { $1 . ($2 eq ')' ? 'aTHX' : 'aTHX_ ') . $2 }ge); - if ($changes) { - warning("Doesn't pass interpreter argument aTHX to Perl_$func"); - $file{changes} += $changes; - } - } - } - else { - warning("Uses Perl_$func instead of $func"); - $file{changes} += ($c =~ s{\bPerl_$func(\s*)\((\s*aTHX_?)?\s*} - {$func$1(}g); - } - } - - for $func (sort keys %{$file{uses_replace}}) { - warning("Uses $func instead of $replace{$func}"); - $file{changes} += ($c =~ s/\b$func\b/$replace{$func}/g); - } - - for $func (sort keys %{$file{uses_provided}}) { - if ($file{uses}{$func}) { - if (exists $file{uses_deps}{$func}) { - diag("Uses $func, which depends on ", join(', ', @{$file{uses_deps}{$func}})); - } - else { - diag("Uses $func"); - } - } - $warnings += hint($func); - } - - unless ($opt{quiet}) { - for $func (sort keys %{$file{uses_todo}}) { - print "*** WARNING: Uses $func, which may not be portable below perl ", - format_version($API{$func}{todo}), ", even with '$ppport'\n"; - $warnings++; - } - } - - for $func (sort keys %{$file{needed_static}}) { - my $message = ''; - if (not exists $file{uses}{$func}) { - $message = "No need to define NEED_$func if $func is never used"; - } - elsif (exists $file{needs}{$func} && $file{needs}{$func} ne 'static') { - $message = "No need to define NEED_$func when already needed globally"; - } - if ($message) { - diag($message); - $file{changes} += ($c =~ s/^$HS*#$HS*define$HS+NEED_$func\b.*$LF//mg); - } - } - - for $func (sort keys %{$file{needed_global}}) { - my $message = ''; - if (not exists $global{uses}{$func}) { - $message = "No need to define NEED_${func}_GLOBAL if $func is never used"; - } - elsif (exists $file{needs}{$func}) { - if ($file{needs}{$func} eq 'extern') { - $message = "No need to define NEED_${func}_GLOBAL when already needed globally"; - } - elsif ($file{needs}{$func} eq 'static') { - $message = "No need to define NEED_${func}_GLOBAL when only used in this file"; - } - } - if ($message) { - diag($message); - $file{changes} += ($c =~ s/^$HS*#$HS*define$HS+NEED_${func}_GLOBAL\b.*$LF//mg); - } - } - - $file{needs_inc_ppport} = keys %{$file{uses}}; - - if ($file{needs_inc_ppport}) { - my $pp = ''; - - for $func (sort keys %{$file{needs}}) { - my $type = $file{needs}{$func}; - next if $type eq 'extern'; - my $suffix = $type eq 'global' ? '_GLOBAL' : ''; - unless (exists $file{"needed_$type"}{$func}) { - if ($type eq 'global') { - diag("Files [@{$global{needs}{$func}}] need $func, adding global request"); - } - else { - diag("File needs $func, adding static request"); - } - $pp .= "#define NEED_$func$suffix\n"; - } - } - - if ($pp && ($c =~ s/^(?=$HS*#$HS*define$HS+NEED_\w+)/$pp/m)) { - $pp = ''; - $file{changes}++; - } - - unless ($file{has_inc_ppport}) { - diag("Needs to include '$ppport'"); - $pp .= qq(#include "$ppport"\n) - } - - if ($pp) { - $file{changes} += ($c =~ s/^($HS*#$HS*define$HS+NEED_\w+.*?)^/$1$pp/ms) - || ($c =~ s/^(?=$HS*#$HS*include.*\Q$ppport\E)/$pp/m) - || ($c =~ s/^($HS*#$HS*include.*XSUB.*\s*?)^/$1$pp/m) - || ($c =~ s/^/$pp/); - } - } - else { - if ($file{has_inc_ppport}) { - diag("No need to include '$ppport'"); - $file{changes} += ($c =~ s/^$HS*?#$HS*include.*\Q$ppport\E.*?$LF//m); - } - } - - # put back in our C comments - my $ix; - my $cppc = 0; - my @ccom = @{$file{ccom}}; - for $ix (0 .. $#ccom) { - if (!$opt{cplusplus} && $ccom[$ix] =~ s!^//!!) { - $cppc++; - $file{changes} += $c =~ s/$rccs$ix$rcce/$ccs$ccom[$ix] $cce/; - } - else { - $c =~ s/$rccs$ix$rcce/$ccom[$ix]/; - } - } - - if ($cppc) { - my $s = $cppc != 1 ? 's' : ''; - warning("Uses $cppc C++ style comment$s, which is not portable"); - } - - my $s = $warnings != 1 ? 's' : ''; - my $warn = $warnings ? " ($warnings warning$s)" : ''; - info("Analysis completed$warn"); - - if ($file{changes}) { - if (exists $opt{copy}) { - my $newfile = "$filename$opt{copy}"; - if (-e $newfile) { - error("'$newfile' already exists, refusing to write copy of '$filename'"); - } - else { - local *F; - if (open F, ">$newfile") { - info("Writing copy of '$filename' with changes to '$newfile'"); - print F $c; - close F; - } - else { - error("Cannot open '$newfile' for writing: $!"); - } - } - } - elsif (exists $opt{patch} || $opt{changes}) { - if (exists $opt{patch}) { - unless ($patch_opened) { - if (open PATCH, ">$opt{patch}") { - $patch_opened = 1; - } - else { - error("Cannot open '$opt{patch}' for writing: $!"); - delete $opt{patch}; - $opt{changes} = 1; - goto fallback; - } - } - mydiff(\*PATCH, $filename, $c); - } - else { -fallback: - info("Suggested changes:"); - mydiff(\*STDOUT, $filename, $c); - } - } - else { - my $s = $file{changes} == 1 ? '' : 's'; - info("$file{changes} potentially required change$s detected"); - } - } - else { - info("Looks good"); - } -} - -close PATCH if $patch_opened; - -exit 0; - - -sub try_use { eval "use @_;"; return $@ eq '' } - -sub mydiff -{ - local *F = shift; - my($file, $str) = @_; - my $diff; - - if (exists $opt{diff}) { - $diff = run_diff($opt{diff}, $file, $str); - } - - if (!defined $diff and try_use('Text::Diff')) { - $diff = Text::Diff::diff($file, \$str, { STYLE => 'Unified' }); - $diff = <
$tmp") { - print F $str; - close F; - - if (open F, "$prog $file $tmp |") { - while () { - s/\Q$tmp\E/$file.patched/; - $diff .= $_; - } - close F; - unlink $tmp; - return $diff; - } - - unlink $tmp; - } - else { - error("Cannot open '$tmp' for writing: $!"); - } - - return undef; -} - -sub rec_depend -{ - my($func, $seen) = @_; - return () unless exists $depends{$func}; - $seen = {%{$seen||{}}}; - return () if $seen->{$func}++; - my %s; - grep !$s{$_}++, map { ($_, rec_depend($_, $seen)) } @{$depends{$func}}; -} - -sub parse_version -{ - my $ver = shift; - - if ($ver =~ /^(\d+)\.(\d+)\.(\d+)$/) { - return ($1, $2, $3); - } - elsif ($ver !~ /^\d+\.[\d_]+$/) { - die "cannot parse version '$ver'\n"; - } - - $ver =~ s/_//g; - $ver =~ s/$/000000/; - - my($r,$v,$s) = $ver =~ /(\d+)\.(\d{3})(\d{3})/; - - $v = int $v; - $s = int $s; - - if ($r < 5 || ($r == 5 && $v < 6)) { - if ($s % 10) { - die "cannot parse version '$ver'\n"; - } - } - - return ($r, $v, $s); -} - -sub format_version -{ - my $ver = shift; - - $ver =~ s/$/000000/; - my($r,$v,$s) = $ver =~ /(\d+)\.(\d{3})(\d{3})/; - - $v = int $v; - $s = int $s; - - if ($r < 5 || ($r == 5 && $v < 6)) { - if ($s % 10) { - die "invalid version '$ver'\n"; - } - $s /= 10; - - $ver = sprintf "%d.%03d", $r, $v; - $s > 0 and $ver .= sprintf "_%02d", $s; - - return $ver; - } - - return sprintf "%d.%d.%d", $r, $v, $s; -} - -sub info -{ - $opt{quiet} and return; - print @_, "\n"; -} - -sub diag -{ - $opt{quiet} and return; - $opt{diag} and print @_, "\n"; -} - -sub warning -{ - $opt{quiet} and return; - print "*** ", @_, "\n"; -} - -sub error -{ - print "*** ERROR: ", @_, "\n"; -} - -my %given_hints; -my %given_warnings; -sub hint -{ - $opt{quiet} and return; - my $func = shift; - my $rv = 0; - if (exists $warnings{$func} && !$given_warnings{$func}++) { - my $warn = $warnings{$func}; - $warn =~ s!^!*** !mg; - print "*** WARNING: $func\n", $warn; - $rv++; - } - if ($opt{hints} && exists $hints{$func} && !$given_hints{$func}++) { - my $hint = $hints{$func}; - $hint =~ s/^/ /mg; - print " --- hint for $func ---\n", $hint; - } - $rv; -} - -sub usage -{ - my($usage) = do { local(@ARGV,$/)=($0); <> } =~ /^=head\d$HS+SYNOPSIS\s*^(.*?)\s*^=/ms; - my %M = ( 'I' => '*' ); - $usage =~ s/^\s*perl\s+\S+/$^X $0/; - $usage =~ s/([A-Z])<([^>]+)>/$M{$1}$2$M{$1}/g; - - print < }; - my($copy) = $self =~ /^=head\d\s+COPYRIGHT\s*^(.*?)^=\w+/ms; - $copy =~ s/^(?=\S+)/ /gms; - $self =~ s/^$HS+Do NOT edit.*?(?=^-)/$copy/ms; - $self =~ s/^SKIP.*(?=^__DATA__)/SKIP -if (\@ARGV && \$ARGV[0] eq '--unstrip') { - eval { require Devel::PPPort }; - \$@ and die "Cannot require Devel::PPPort, please install.\\n"; - if (eval \$Devel::PPPort::VERSION < $VERSION) { - die "$0 was originally generated with Devel::PPPort $VERSION.\\n" - . "Your Devel::PPPort is only version \$Devel::PPPort::VERSION.\\n" - . "Please install a newer version, or --unstrip will not work.\\n"; - } - Devel::PPPort::WriteFile(\$0); - exit 0; -} -print <$0" or die "cannot strip $0: $!\n"; - print OUT "$pl$c\n"; - - exit 0; -} - -__DATA__ -*/ - -#ifndef _P_P_PORTABILITY_H_ -#define _P_P_PORTABILITY_H_ - -#ifndef DPPP_NAMESPACE -# define DPPP_NAMESPACE DPPP_ -#endif - -#define DPPP_CAT2(x,y) CAT2(x,y) -#define DPPP_(name) DPPP_CAT2(DPPP_NAMESPACE, name) - -#ifndef PERL_REVISION -# if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION)) -# define PERL_PATCHLEVEL_H_IMPLICIT -# include -# endif -# if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL))) -# include -# endif -# ifndef PERL_REVISION -# define PERL_REVISION (5) - /* Replace: 1 */ -# define PERL_VERSION PATCHLEVEL -# define PERL_SUBVERSION SUBVERSION - /* Replace PERL_PATCHLEVEL with PERL_VERSION */ - /* Replace: 0 */ -# endif -#endif - -#define _dpppDEC2BCD(dec) ((((dec)/100)<<8)|((((dec)%100)/10)<<4)|((dec)%10)) -#define PERL_BCDVERSION ((_dpppDEC2BCD(PERL_REVISION)<<24)|(_dpppDEC2BCD(PERL_VERSION)<<12)|_dpppDEC2BCD(PERL_SUBVERSION)) - -/* It is very unlikely that anyone will try to use this with Perl 6 - (or greater), but who knows. - */ -#if PERL_REVISION != 5 -# error ppport.h only works with Perl version 5 -#endif /* PERL_REVISION != 5 */ -#ifndef dTHR -# define dTHR dNOOP -#endif -#ifndef dTHX -# define dTHX dNOOP -#endif - -#ifndef dTHXa -# define dTHXa(x) dNOOP -#endif -#ifndef pTHX -# define pTHX void -#endif - -#ifndef pTHX_ -# define pTHX_ -#endif - -#ifndef aTHX -# define aTHX -#endif - -#ifndef aTHX_ -# define aTHX_ -#endif - -#if (PERL_BCDVERSION < 0x5006000) -# ifdef USE_THREADS -# define aTHXR thr -# define aTHXR_ thr, -# else -# define aTHXR -# define aTHXR_ -# endif -# define dTHXR dTHR -#else -# define aTHXR aTHX -# define aTHXR_ aTHX_ -# define dTHXR dTHX -#endif -#ifndef dTHXoa -# define dTHXoa(x) dTHXa(x) -#endif - -#ifdef I_LIMITS -# include -#endif - -#ifndef PERL_UCHAR_MIN -# define PERL_UCHAR_MIN ((unsigned char)0) -#endif - -#ifndef PERL_UCHAR_MAX -# ifdef UCHAR_MAX -# define PERL_UCHAR_MAX ((unsigned char)UCHAR_MAX) -# else -# ifdef MAXUCHAR -# define PERL_UCHAR_MAX ((unsigned char)MAXUCHAR) -# else -# define PERL_UCHAR_MAX ((unsigned char)~(unsigned)0) -# endif -# endif -#endif - -#ifndef PERL_USHORT_MIN -# define PERL_USHORT_MIN ((unsigned short)0) -#endif - -#ifndef PERL_USHORT_MAX -# ifdef USHORT_MAX -# define PERL_USHORT_MAX ((unsigned short)USHORT_MAX) -# else -# ifdef MAXUSHORT -# define PERL_USHORT_MAX ((unsigned short)MAXUSHORT) -# else -# ifdef USHRT_MAX -# define PERL_USHORT_MAX ((unsigned short)USHRT_MAX) -# else -# define PERL_USHORT_MAX ((unsigned short)~(unsigned)0) -# endif -# endif -# endif -#endif - -#ifndef PERL_SHORT_MAX -# ifdef SHORT_MAX -# define PERL_SHORT_MAX ((short)SHORT_MAX) -# else -# ifdef MAXSHORT /* Often used in */ -# define PERL_SHORT_MAX ((short)MAXSHORT) -# else -# ifdef SHRT_MAX -# define PERL_SHORT_MAX ((short)SHRT_MAX) -# else -# define PERL_SHORT_MAX ((short) (PERL_USHORT_MAX >> 1)) -# endif -# endif -# endif -#endif - -#ifndef PERL_SHORT_MIN -# ifdef SHORT_MIN -# define PERL_SHORT_MIN ((short)SHORT_MIN) -# else -# ifdef MINSHORT -# define PERL_SHORT_MIN ((short)MINSHORT) -# else -# ifdef SHRT_MIN -# define PERL_SHORT_MIN ((short)SHRT_MIN) -# else -# define PERL_SHORT_MIN (-PERL_SHORT_MAX - ((3 & -1) == 3)) -# endif -# endif -# endif -#endif - -#ifndef PERL_UINT_MAX -# ifdef UINT_MAX -# define PERL_UINT_MAX ((unsigned int)UINT_MAX) -# else -# ifdef MAXUINT -# define PERL_UINT_MAX ((unsigned int)MAXUINT) -# else -# define PERL_UINT_MAX (~(unsigned int)0) -# endif -# endif -#endif - -#ifndef PERL_UINT_MIN -# define PERL_UINT_MIN ((unsigned int)0) -#endif - -#ifndef PERL_INT_MAX -# ifdef INT_MAX -# define PERL_INT_MAX ((int)INT_MAX) -# else -# ifdef MAXINT /* Often used in */ -# define PERL_INT_MAX ((int)MAXINT) -# else -# define PERL_INT_MAX ((int)(PERL_UINT_MAX >> 1)) -# endif -# endif -#endif - -#ifndef PERL_INT_MIN -# ifdef INT_MIN -# define PERL_INT_MIN ((int)INT_MIN) -# else -# ifdef MININT -# define PERL_INT_MIN ((int)MININT) -# else -# define PERL_INT_MIN (-PERL_INT_MAX - ((3 & -1) == 3)) -# endif -# endif -#endif - -#ifndef PERL_ULONG_MAX -# ifdef ULONG_MAX -# define PERL_ULONG_MAX ((unsigned long)ULONG_MAX) -# else -# ifdef MAXULONG -# define PERL_ULONG_MAX ((unsigned long)MAXULONG) -# else -# define PERL_ULONG_MAX (~(unsigned long)0) -# endif -# endif -#endif - -#ifndef PERL_ULONG_MIN -# define PERL_ULONG_MIN ((unsigned long)0L) -#endif - -#ifndef PERL_LONG_MAX -# ifdef LONG_MAX -# define PERL_LONG_MAX ((long)LONG_MAX) -# else -# ifdef MAXLONG -# define PERL_LONG_MAX ((long)MAXLONG) -# else -# define PERL_LONG_MAX ((long) (PERL_ULONG_MAX >> 1)) -# endif -# endif -#endif - -#ifndef PERL_LONG_MIN -# ifdef LONG_MIN -# define PERL_LONG_MIN ((long)LONG_MIN) -# else -# ifdef MINLONG -# define PERL_LONG_MIN ((long)MINLONG) -# else -# define PERL_LONG_MIN (-PERL_LONG_MAX - ((3 & -1) == 3)) -# endif -# endif -#endif - -#if defined(HAS_QUAD) && (defined(convex) || defined(uts)) -# ifndef PERL_UQUAD_MAX -# ifdef ULONGLONG_MAX -# define PERL_UQUAD_MAX ((unsigned long long)ULONGLONG_MAX) -# else -# ifdef MAXULONGLONG -# define PERL_UQUAD_MAX ((unsigned long long)MAXULONGLONG) -# else -# define PERL_UQUAD_MAX (~(unsigned long long)0) -# endif -# endif -# endif - -# ifndef PERL_UQUAD_MIN -# define PERL_UQUAD_MIN ((unsigned long long)0L) -# endif - -# ifndef PERL_QUAD_MAX -# ifdef LONGLONG_MAX -# define PERL_QUAD_MAX ((long long)LONGLONG_MAX) -# else -# ifdef MAXLONGLONG -# define PERL_QUAD_MAX ((long long)MAXLONGLONG) -# else -# define PERL_QUAD_MAX ((long long) (PERL_UQUAD_MAX >> 1)) -# endif -# endif -# endif - -# ifndef PERL_QUAD_MIN -# ifdef LONGLONG_MIN -# define PERL_QUAD_MIN ((long long)LONGLONG_MIN) -# else -# ifdef MINLONGLONG -# define PERL_QUAD_MIN ((long long)MINLONGLONG) -# else -# define PERL_QUAD_MIN (-PERL_QUAD_MAX - ((3 & -1) == 3)) -# endif -# endif -# endif -#endif - -/* This is based on code from 5.003 perl.h */ -#ifdef HAS_QUAD -# ifdef cray -#ifndef IVTYPE -# define IVTYPE int -#endif - -#ifndef IV_MIN -# define IV_MIN PERL_INT_MIN -#endif - -#ifndef IV_MAX -# define IV_MAX PERL_INT_MAX -#endif - -#ifndef UV_MIN -# define UV_MIN PERL_UINT_MIN -#endif - -#ifndef UV_MAX -# define UV_MAX PERL_UINT_MAX -#endif - -# ifdef INTSIZE -#ifndef IVSIZE -# define IVSIZE INTSIZE -#endif - -# endif -# else -# if defined(convex) || defined(uts) -#ifndef IVTYPE -# define IVTYPE long long -#endif - -#ifndef IV_MIN -# define IV_MIN PERL_QUAD_MIN -#endif - -#ifndef IV_MAX -# define IV_MAX PERL_QUAD_MAX -#endif - -#ifndef UV_MIN -# define UV_MIN PERL_UQUAD_MIN -#endif - -#ifndef UV_MAX -# define UV_MAX PERL_UQUAD_MAX -#endif - -# ifdef LONGLONGSIZE -#ifndef IVSIZE -# define IVSIZE LONGLONGSIZE -#endif - -# endif -# else -#ifndef IVTYPE -# define IVTYPE long -#endif - -#ifndef IV_MIN -# define IV_MIN PERL_LONG_MIN -#endif - -#ifndef IV_MAX -# define IV_MAX PERL_LONG_MAX -#endif - -#ifndef UV_MIN -# define UV_MIN PERL_ULONG_MIN -#endif - -#ifndef UV_MAX -# define UV_MAX PERL_ULONG_MAX -#endif - -# ifdef LONGSIZE -#ifndef IVSIZE -# define IVSIZE LONGSIZE -#endif - -# endif -# endif -# endif -#ifndef IVSIZE -# define IVSIZE 8 -#endif - -#ifndef PERL_QUAD_MIN -# define PERL_QUAD_MIN IV_MIN -#endif - -#ifndef PERL_QUAD_MAX -# define PERL_QUAD_MAX IV_MAX -#endif - -#ifndef PERL_UQUAD_MIN -# define PERL_UQUAD_MIN UV_MIN -#endif - -#ifndef PERL_UQUAD_MAX -# define PERL_UQUAD_MAX UV_MAX -#endif - -#else -#ifndef IVTYPE -# define IVTYPE long -#endif - -#ifndef IV_MIN -# define IV_MIN PERL_LONG_MIN -#endif - -#ifndef IV_MAX -# define IV_MAX PERL_LONG_MAX -#endif - -#ifndef UV_MIN -# define UV_MIN PERL_ULONG_MIN -#endif - -#ifndef UV_MAX -# define UV_MAX PERL_ULONG_MAX -#endif - -#endif - -#ifndef IVSIZE -# ifdef LONGSIZE -# define IVSIZE LONGSIZE -# else -# define IVSIZE 4 /* A bold guess, but the best we can make. */ -# endif -#endif -#ifndef UVTYPE -# define UVTYPE unsigned IVTYPE -#endif - -#ifndef UVSIZE -# define UVSIZE IVSIZE -#endif -#ifndef sv_setuv -# define sv_setuv(sv, uv) \ - STMT_START { \ - UV TeMpUv = uv; \ - if (TeMpUv <= IV_MAX) \ - sv_setiv(sv, TeMpUv); \ - else \ - sv_setnv(sv, (double)TeMpUv); \ - } STMT_END -#endif -#ifndef newSVuv -# define newSVuv(uv) ((uv) <= IV_MAX ? newSViv((IV)uv) : newSVnv((NV)uv)) -#endif -#ifndef sv_2uv -# define sv_2uv(sv) ((PL_Sv = (sv)), (UV) (SvNOK(PL_Sv) ? SvNV(PL_Sv) : sv_2nv(PL_Sv))) -#endif - -#ifndef SvUVX -# define SvUVX(sv) ((UV)SvIVX(sv)) -#endif - -#ifndef SvUVXx -# define SvUVXx(sv) SvUVX(sv) -#endif - -#ifndef SvUV -# define SvUV(sv) (SvIOK(sv) ? SvUVX(sv) : sv_2uv(sv)) -#endif - -#ifndef SvUVx -# define SvUVx(sv) ((PL_Sv = (sv)), SvUV(PL_Sv)) -#endif - -/* Hint: sv_uv - * Always use the SvUVx() macro instead of sv_uv(). - */ -#ifndef sv_uv -# define sv_uv(sv) SvUVx(sv) -#endif - -#if !defined(SvUOK) && defined(SvIOK_UV) -# define SvUOK(sv) SvIOK_UV(sv) -#endif -#ifndef XST_mUV -# define XST_mUV(i,v) (ST(i) = sv_2mortal(newSVuv(v)) ) -#endif - -#ifndef XSRETURN_UV -# define XSRETURN_UV(v) STMT_START { XST_mUV(0,v); XSRETURN(1); } STMT_END -#endif -#ifndef PUSHu -# define PUSHu(u) STMT_START { sv_setuv(TARG, (UV)(u)); PUSHTARG; } STMT_END -#endif - -#ifndef XPUSHu -# define XPUSHu(u) STMT_START { sv_setuv(TARG, (UV)(u)); XPUSHTARG; } STMT_END -#endif - -#ifdef HAS_MEMCMP -#ifndef memNE -# define memNE(s1,s2,l) (memcmp(s1,s2,l)) -#endif - -#ifndef memEQ -# define memEQ(s1,s2,l) (!memcmp(s1,s2,l)) -#endif - -#else -#ifndef memNE -# define memNE(s1,s2,l) (bcmp(s1,s2,l)) -#endif - -#ifndef memEQ -# define memEQ(s1,s2,l) (!bcmp(s1,s2,l)) -#endif - -#endif -#ifndef MoveD -# define MoveD(s,d,n,t) memmove((char*)(d),(char*)(s), (n) * sizeof(t)) -#endif - -#ifndef CopyD -# define CopyD(s,d,n,t) memcpy((char*)(d),(char*)(s), (n) * sizeof(t)) -#endif - -#ifdef HAS_MEMSET -#ifndef ZeroD -# define ZeroD(d,n,t) memzero((char*)(d), (n) * sizeof(t)) -#endif - -#else -#ifndef ZeroD -# define ZeroD(d,n,t) ((void)memzero((char*)(d), (n) * sizeof(t)), d) -#endif - -#endif -#ifndef PoisonWith -# define PoisonWith(d,n,t,b) (void)memset((char*)(d), (U8)(b), (n) * sizeof(t)) -#endif - -#ifndef PoisonNew -# define PoisonNew(d,n,t) PoisonWith(d,n,t,0xAB) -#endif - -#ifndef PoisonFree -# define PoisonFree(d,n,t) PoisonWith(d,n,t,0xEF) -#endif - -#ifndef Poison -# define Poison(d,n,t) PoisonFree(d,n,t) -#endif -#ifndef Newx -# define Newx(v,n,t) New(0,v,n,t) -#endif - -#ifndef Newxc -# define Newxc(v,n,t,c) Newc(0,v,n,t,c) -#endif - -#ifndef Newxz -# define Newxz(v,n,t) Newz(0,v,n,t) -#endif - -#ifndef PERL_UNUSED_DECL -# ifdef HASATTRIBUTE -# if (defined(__GNUC__) && defined(__cplusplus)) || defined(__INTEL_COMPILER) -# define PERL_UNUSED_DECL -# else -# define PERL_UNUSED_DECL __attribute__((unused)) -# endif -# else -# define PERL_UNUSED_DECL -# endif -#endif - -#ifndef PERL_UNUSED_ARG -# if defined(lint) && defined(S_SPLINT_S) /* www.splint.org */ -# include -# define PERL_UNUSED_ARG(x) NOTE(ARGUNUSED(x)) -# else -# define PERL_UNUSED_ARG(x) ((void)x) -# endif -#endif - -#ifndef PERL_UNUSED_VAR -# define PERL_UNUSED_VAR(x) ((void)x) -#endif - -#ifndef PERL_UNUSED_CONTEXT -# ifdef USE_ITHREADS -# define PERL_UNUSED_CONTEXT PERL_UNUSED_ARG(my_perl) -# else -# define PERL_UNUSED_CONTEXT -# endif -#endif -#ifndef NOOP -# define NOOP /*EMPTY*/(void)0 -#endif - -#ifndef dNOOP -# define dNOOP extern int /*@unused@*/ Perl___notused PERL_UNUSED_DECL -#endif - -#ifndef NVTYPE -# if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) -# define NVTYPE long double -# else -# define NVTYPE double -# endif -typedef NVTYPE NV; -#endif - -#ifndef INT2PTR -# if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE) -# define PTRV UV -# define INT2PTR(any,d) (any)(d) -# else -# if PTRSIZE == LONGSIZE -# define PTRV unsigned long -# else -# define PTRV unsigned -# endif -# define INT2PTR(any,d) (any)(PTRV)(d) -# endif -#endif - -#ifndef PTR2ul -# if PTRSIZE == LONGSIZE -# define PTR2ul(p) (unsigned long)(p) -# else -# define PTR2ul(p) INT2PTR(unsigned long,p) -# endif -#endif -#ifndef PTR2nat -# define PTR2nat(p) (PTRV)(p) -#endif - -#ifndef NUM2PTR -# define NUM2PTR(any,d) (any)PTR2nat(d) -#endif - -#ifndef PTR2IV -# define PTR2IV(p) INT2PTR(IV,p) -#endif - -#ifndef PTR2UV -# define PTR2UV(p) INT2PTR(UV,p) -#endif - -#ifndef PTR2NV -# define PTR2NV(p) NUM2PTR(NV,p) -#endif - -#undef START_EXTERN_C -#undef END_EXTERN_C -#undef EXTERN_C -#ifdef __cplusplus -# define START_EXTERN_C extern "C" { -# define END_EXTERN_C } -# define EXTERN_C extern "C" -#else -# define START_EXTERN_C -# define END_EXTERN_C -# define EXTERN_C extern -#endif - -#if defined(PERL_GCC_PEDANTIC) -# ifndef PERL_GCC_BRACE_GROUPS_FORBIDDEN -# define PERL_GCC_BRACE_GROUPS_FORBIDDEN -# endif -#endif - -#if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) && !defined(__cplusplus) -# ifndef PERL_USE_GCC_BRACE_GROUPS -# define PERL_USE_GCC_BRACE_GROUPS -# endif -#endif - -#undef STMT_START -#undef STMT_END -#ifdef PERL_USE_GCC_BRACE_GROUPS -# define STMT_START (void)( /* gcc supports ``({ STATEMENTS; })'' */ -# define STMT_END ) -#else -# if defined(VOIDFLAGS) && (VOIDFLAGS) && (defined(sun) || defined(__sun__)) && !defined(__GNUC__) -# define STMT_START if (1) -# define STMT_END else (void)0 -# else -# define STMT_START do -# define STMT_END while (0) -# endif -#endif -#ifndef boolSV -# define boolSV(b) ((b) ? &PL_sv_yes : &PL_sv_no) -#endif - -/* DEFSV appears first in 5.004_56 */ -#ifndef DEFSV -# define DEFSV GvSV(PL_defgv) -#endif - -#ifndef SAVE_DEFSV -# define SAVE_DEFSV SAVESPTR(GvSV(PL_defgv)) -#endif - -#ifndef DEFSV_set -# define DEFSV_set(sv) (DEFSV = (sv)) -#endif - -/* Older perls (<=5.003) lack AvFILLp */ -#ifndef AvFILLp -# define AvFILLp AvFILL -#endif -#ifndef ERRSV -# define ERRSV get_sv("@",FALSE) -#endif - -/* Hint: gv_stashpvn - * This function's backport doesn't support the length parameter, but - * rather ignores it. Portability can only be ensured if the length - * parameter is used for speed reasons, but the length can always be - * correctly computed from the string argument. - */ -#ifndef gv_stashpvn -# define gv_stashpvn(str,len,create) gv_stashpv(str,create) -#endif - -/* Replace: 1 */ -#ifndef get_cv -# define get_cv perl_get_cv -#endif - -#ifndef get_sv -# define get_sv perl_get_sv -#endif - -#ifndef get_av -# define get_av perl_get_av -#endif - -#ifndef get_hv -# define get_hv perl_get_hv -#endif - -/* Replace: 0 */ -#ifndef dUNDERBAR -# define dUNDERBAR dNOOP -#endif - -#ifndef UNDERBAR -# define UNDERBAR DEFSV -#endif -#ifndef dAX -# define dAX I32 ax = MARK - PL_stack_base + 1 -#endif - -#ifndef dITEMS -# define dITEMS I32 items = SP - MARK -#endif -#ifndef dXSTARG -# define dXSTARG SV * targ = sv_newmortal() -#endif -#ifndef dAXMARK -# define dAXMARK I32 ax = POPMARK; \ - register SV ** const mark = PL_stack_base + ax++ -#endif -#ifndef XSprePUSH -# define XSprePUSH (sp = PL_stack_base + ax - 1) -#endif - -#if (PERL_BCDVERSION < 0x5005000) -# undef XSRETURN -# define XSRETURN(off) \ - STMT_START { \ - PL_stack_sp = PL_stack_base + ax + ((off) - 1); \ - return; \ - } STMT_END -#endif -#ifndef PERL_ABS -# define PERL_ABS(x) ((x) < 0 ? -(x) : (x)) -#endif -#ifndef dVAR -# define dVAR dNOOP -#endif -#ifndef SVf -# define SVf "_" -#endif -#ifndef UTF8_MAXBYTES -# define UTF8_MAXBYTES UTF8_MAXLEN -#endif -#ifndef CPERLscope -# define CPERLscope(x) x -#endif -#ifndef PERL_HASH -# define PERL_HASH(hash,str,len) \ - STMT_START { \ - const char *s_PeRlHaSh = str; \ - I32 i_PeRlHaSh = len; \ - U32 hash_PeRlHaSh = 0; \ - while (i_PeRlHaSh--) \ - hash_PeRlHaSh = hash_PeRlHaSh * 33 + *s_PeRlHaSh++; \ - (hash) = hash_PeRlHaSh; \ - } STMT_END -#endif - -#ifndef PERLIO_FUNCS_DECL -# ifdef PERLIO_FUNCS_CONST -# define PERLIO_FUNCS_DECL(funcs) const PerlIO_funcs funcs -# define PERLIO_FUNCS_CAST(funcs) (PerlIO_funcs*)(funcs) -# else -# define PERLIO_FUNCS_DECL(funcs) PerlIO_funcs funcs -# define PERLIO_FUNCS_CAST(funcs) (funcs) -# endif -#endif - -/* provide these typedefs for older perls */ -#if (PERL_BCDVERSION < 0x5009003) - -# ifdef ARGSproto -typedef OP* (CPERLscope(*Perl_ppaddr_t))(ARGSproto); -# else -typedef OP* (CPERLscope(*Perl_ppaddr_t))(pTHX); -# endif - -typedef OP* (CPERLscope(*Perl_check_t)) (pTHX_ OP*); - -#endif -#ifndef isPSXSPC -# define isPSXSPC(c) (isSPACE(c) || (c) == '\v') -#endif - -#ifndef isBLANK -# define isBLANK(c) ((c) == ' ' || (c) == '\t') -#endif - -#ifdef EBCDIC -#ifndef isALNUMC -# define isALNUMC(c) isalnum(c) -#endif - -#ifndef isASCII -# define isASCII(c) isascii(c) -#endif - -#ifndef isCNTRL -# define isCNTRL(c) iscntrl(c) -#endif - -#ifndef isGRAPH -# define isGRAPH(c) isgraph(c) -#endif - -#ifndef isPRINT -# define isPRINT(c) isprint(c) -#endif - -#ifndef isPUNCT -# define isPUNCT(c) ispunct(c) -#endif - -#ifndef isXDIGIT -# define isXDIGIT(c) isxdigit(c) -#endif - -#else -# if (PERL_BCDVERSION < 0x5010000) -/* Hint: isPRINT - * The implementation in older perl versions includes all of the - * isSPACE() characters, which is wrong. The version provided by - * Devel::PPPort always overrides a present buggy version. - */ -# undef isPRINT -# endif -#ifndef isALNUMC -# define isALNUMC(c) (isALPHA(c) || isDIGIT(c)) -#endif - -#ifndef isASCII -# define isASCII(c) ((c) <= 127) -#endif - -#ifndef isCNTRL -# define isCNTRL(c) ((c) < ' ' || (c) == 127) -#endif - -#ifndef isGRAPH -# define isGRAPH(c) (isALNUM(c) || isPUNCT(c)) -#endif - -#ifndef isPRINT -# define isPRINT(c) (((c) >= 32 && (c) < 127)) -#endif - -#ifndef isPUNCT -# define isPUNCT(c) (((c) >= 33 && (c) <= 47) || ((c) >= 58 && (c) <= 64) || ((c) >= 91 && (c) <= 96) || ((c) >= 123 && (c) <= 126)) -#endif - -#ifndef isXDIGIT -# define isXDIGIT(c) (isDIGIT(c) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F')) -#endif - -#endif - -#ifndef PERL_SIGNALS_UNSAFE_FLAG - -#define PERL_SIGNALS_UNSAFE_FLAG 0x0001 - -#if (PERL_BCDVERSION < 0x5008000) -# define D_PPP_PERL_SIGNALS_INIT PERL_SIGNALS_UNSAFE_FLAG -#else -# define D_PPP_PERL_SIGNALS_INIT 0 -#endif - -#if defined(NEED_PL_signals) -static U32 DPPP_(my_PL_signals) = D_PPP_PERL_SIGNALS_INIT; -#elif defined(NEED_PL_signals_GLOBAL) -U32 DPPP_(my_PL_signals) = D_PPP_PERL_SIGNALS_INIT; -#else -extern U32 DPPP_(my_PL_signals); -#endif -#define PL_signals DPPP_(my_PL_signals) - -#endif - -/* Hint: PL_ppaddr - * Calling an op via PL_ppaddr requires passing a context argument - * for threaded builds. Since the context argument is different for - * 5.005 perls, you can use aTHXR (supplied by ppport.h), which will - * automatically be defined as the correct argument. - */ - -#if (PERL_BCDVERSION <= 0x5005005) -/* Replace: 1 */ -# define PL_ppaddr ppaddr -# define PL_no_modify no_modify -/* Replace: 0 */ -#endif - -#if (PERL_BCDVERSION <= 0x5004005) -/* Replace: 1 */ -# define PL_DBsignal DBsignal -# define PL_DBsingle DBsingle -# define PL_DBsub DBsub -# define PL_DBtrace DBtrace -# define PL_Sv Sv -# define PL_bufend bufend -# define PL_bufptr bufptr -# define PL_compiling compiling -# define PL_copline copline -# define PL_curcop curcop -# define PL_curstash curstash -# define PL_debstash debstash -# define PL_defgv defgv -# define PL_diehook diehook -# define PL_dirty dirty -# define PL_dowarn dowarn -# define PL_errgv errgv -# define PL_expect expect -# define PL_hexdigit hexdigit -# define PL_hints hints -# define PL_laststatval laststatval -# define PL_lex_state lex_state -# define PL_lex_stuff lex_stuff -# define PL_linestr linestr -# define PL_na na -# define PL_perl_destruct_level perl_destruct_level -# define PL_perldb perldb -# define PL_rsfp_filters rsfp_filters -# define PL_rsfp rsfp -# define PL_stack_base stack_base -# define PL_stack_sp stack_sp -# define PL_statcache statcache -# define PL_stdingv stdingv -# define PL_sv_arenaroot sv_arenaroot -# define PL_sv_no sv_no -# define PL_sv_undef sv_undef -# define PL_sv_yes sv_yes -# define PL_tainted tainted -# define PL_tainting tainting -# define PL_tokenbuf tokenbuf -/* Replace: 0 */ -#endif - -/* Warning: PL_parser - * For perl versions earlier than 5.9.5, this is an always - * non-NULL dummy. Also, it cannot be dereferenced. Don't - * use it if you can avoid is and unless you absolutely know - * what you're doing. - * If you always check that PL_parser is non-NULL, you can - * define DPPP_PL_parser_NO_DUMMY to avoid the creation of - * a dummy parser structure. - */ - -#if (PERL_BCDVERSION >= 0x5009005) -# ifdef DPPP_PL_parser_NO_DUMMY -# define D_PPP_my_PL_parser_var(var) ((PL_parser ? PL_parser : \ - (croak("panic: PL_parser == NULL in %s:%d", \ - __FILE__, __LINE__), (yy_parser *) NULL))->var) -# else -# ifdef DPPP_PL_parser_NO_DUMMY_WARNING -# define D_PPP_parser_dummy_warning(var) -# else -# define D_PPP_parser_dummy_warning(var) \ - warn("warning: dummy PL_" #var " used in %s:%d", __FILE__, __LINE__), -# endif -# define D_PPP_my_PL_parser_var(var) ((PL_parser ? PL_parser : \ - (D_PPP_parser_dummy_warning(var) &DPPP_(dummy_PL_parser)))->var) -#if defined(NEED_PL_parser) -static yy_parser DPPP_(dummy_PL_parser); -#elif defined(NEED_PL_parser_GLOBAL) -yy_parser DPPP_(dummy_PL_parser); -#else -extern yy_parser DPPP_(dummy_PL_parser); -#endif - -# endif - -/* PL_expect, PL_copline, PL_rsfp, PL_rsfp_filters, PL_linestr, PL_bufptr, PL_bufend, PL_lex_state, PL_lex_stuff, PL_tokenbuf depends on PL_parser */ -/* Warning: PL_expect, PL_copline, PL_rsfp, PL_rsfp_filters, PL_linestr, PL_bufptr, PL_bufend, PL_lex_state, PL_lex_stuff, PL_tokenbuf - * Do not use this variable unless you know exactly what you're - * doint. It is internal to the perl parser and may change or even - * be removed in the future. As of perl 5.9.5, you have to check - * for (PL_parser != NULL) for this variable to have any effect. - * An always non-NULL PL_parser dummy is provided for earlier - * perl versions. - * If PL_parser is NULL when you try to access this variable, a - * dummy is being accessed instead and a warning is issued unless - * you define DPPP_PL_parser_NO_DUMMY_WARNING. - * If DPPP_PL_parser_NO_DUMMY is defined, the code trying to access - * this variable will croak with a panic message. - */ - -# define PL_expect D_PPP_my_PL_parser_var(expect) -# define PL_copline D_PPP_my_PL_parser_var(copline) -# define PL_rsfp D_PPP_my_PL_parser_var(rsfp) -# define PL_rsfp_filters D_PPP_my_PL_parser_var(rsfp_filters) -# define PL_linestr D_PPP_my_PL_parser_var(linestr) -# define PL_bufptr D_PPP_my_PL_parser_var(bufptr) -# define PL_bufend D_PPP_my_PL_parser_var(bufend) -# define PL_lex_state D_PPP_my_PL_parser_var(lex_state) -# define PL_lex_stuff D_PPP_my_PL_parser_var(lex_stuff) -# define PL_tokenbuf D_PPP_my_PL_parser_var(tokenbuf) - -#else - -/* ensure that PL_parser != NULL and cannot be dereferenced */ -# define PL_parser ((void *) 1) - -#endif -#ifndef mPUSHs -# define mPUSHs(s) PUSHs(sv_2mortal(s)) -#endif - -#ifndef PUSHmortal -# define PUSHmortal PUSHs(sv_newmortal()) -#endif - -#ifndef mPUSHp -# define mPUSHp(p,l) sv_setpvn(PUSHmortal, (p), (l)) -#endif - -#ifndef mPUSHn -# define mPUSHn(n) sv_setnv(PUSHmortal, (NV)(n)) -#endif - -#ifndef mPUSHi -# define mPUSHi(i) sv_setiv(PUSHmortal, (IV)(i)) -#endif - -#ifndef mPUSHu -# define mPUSHu(u) sv_setuv(PUSHmortal, (UV)(u)) -#endif -#ifndef mXPUSHs -# define mXPUSHs(s) XPUSHs(sv_2mortal(s)) -#endif - -#ifndef XPUSHmortal -# define XPUSHmortal XPUSHs(sv_newmortal()) -#endif - -#ifndef mXPUSHp -# define mXPUSHp(p,l) STMT_START { EXTEND(sp,1); sv_setpvn(PUSHmortal, (p), (l)); } STMT_END -#endif - -#ifndef mXPUSHn -# define mXPUSHn(n) STMT_START { EXTEND(sp,1); sv_setnv(PUSHmortal, (NV)(n)); } STMT_END -#endif - -#ifndef mXPUSHi -# define mXPUSHi(i) STMT_START { EXTEND(sp,1); sv_setiv(PUSHmortal, (IV)(i)); } STMT_END -#endif - -#ifndef mXPUSHu -# define mXPUSHu(u) STMT_START { EXTEND(sp,1); sv_setuv(PUSHmortal, (UV)(u)); } STMT_END -#endif - -/* Replace: 1 */ -#ifndef call_sv -# define call_sv perl_call_sv -#endif - -#ifndef call_pv -# define call_pv perl_call_pv -#endif - -#ifndef call_argv -# define call_argv perl_call_argv -#endif - -#ifndef call_method -# define call_method perl_call_method -#endif -#ifndef eval_sv -# define eval_sv perl_eval_sv -#endif - -/* Replace: 0 */ -#ifndef PERL_LOADMOD_DENY -# define PERL_LOADMOD_DENY 0x1 -#endif - -#ifndef PERL_LOADMOD_NOIMPORT -# define PERL_LOADMOD_NOIMPORT 0x2 -#endif - -#ifndef PERL_LOADMOD_IMPORT_OPS -# define PERL_LOADMOD_IMPORT_OPS 0x4 -#endif - -#ifndef G_METHOD -# define G_METHOD 64 -# ifdef call_sv -# undef call_sv -# endif -# if (PERL_BCDVERSION < 0x5006000) -# define call_sv(sv, flags) ((flags) & G_METHOD ? perl_call_method((char *) SvPV_nolen_const(sv), \ - (flags) & ~G_METHOD) : perl_call_sv(sv, flags)) -# else -# define call_sv(sv, flags) ((flags) & G_METHOD ? Perl_call_method(aTHX_ (char *) SvPV_nolen_const(sv), \ - (flags) & ~G_METHOD) : Perl_call_sv(aTHX_ sv, flags)) -# endif -#endif - -/* Replace perl_eval_pv with eval_pv */ - -#ifndef eval_pv -#if defined(NEED_eval_pv) -static SV* DPPP_(my_eval_pv)(char *p, I32 croak_on_error); -static -#else -extern SV* DPPP_(my_eval_pv)(char *p, I32 croak_on_error); -#endif - -#ifdef eval_pv -# undef eval_pv -#endif -#define eval_pv(a,b) DPPP_(my_eval_pv)(aTHX_ a,b) -#define Perl_eval_pv DPPP_(my_eval_pv) - -#if defined(NEED_eval_pv) || defined(NEED_eval_pv_GLOBAL) - -SV* -DPPP_(my_eval_pv)(char *p, I32 croak_on_error) -{ - dSP; - SV* sv = newSVpv(p, 0); - - PUSHMARK(sp); - eval_sv(sv, G_SCALAR); - SvREFCNT_dec(sv); - - SPAGAIN; - sv = POPs; - PUTBACK; - - if (croak_on_error && SvTRUE(GvSV(errgv))) - croak(SvPVx(GvSV(errgv), na)); - - return sv; -} - -#endif -#endif - -#ifndef vload_module -#if defined(NEED_vload_module) -static void DPPP_(my_vload_module)(U32 flags, SV *name, SV *ver, va_list *args); -static -#else -extern void DPPP_(my_vload_module)(U32 flags, SV *name, SV *ver, va_list *args); -#endif - -#ifdef vload_module -# undef vload_module -#endif -#define vload_module(a,b,c,d) DPPP_(my_vload_module)(aTHX_ a,b,c,d) -#define Perl_vload_module DPPP_(my_vload_module) - -#if defined(NEED_vload_module) || defined(NEED_vload_module_GLOBAL) - -void -DPPP_(my_vload_module)(U32 flags, SV *name, SV *ver, va_list *args) -{ - dTHR; - dVAR; - OP *veop, *imop; - - OP * const modname = newSVOP(OP_CONST, 0, name); - /* 5.005 has a somewhat hacky force_normal that doesn't croak on - SvREADONLY() if PL_compling is true. Current perls take care in - ck_require() to correctly turn off SvREADONLY before calling - force_normal_flags(). This seems a better fix than fudging PL_compling - */ - SvREADONLY_off(((SVOP*)modname)->op_sv); - modname->op_private |= OPpCONST_BARE; - if (ver) { - veop = newSVOP(OP_CONST, 0, ver); - } - else - veop = NULL; - if (flags & PERL_LOADMOD_NOIMPORT) { - imop = sawparens(newNULLLIST()); - } - else if (flags & PERL_LOADMOD_IMPORT_OPS) { - imop = va_arg(*args, OP*); - } - else { - SV *sv; - imop = NULL; - sv = va_arg(*args, SV*); - while (sv) { - imop = append_elem(OP_LIST, imop, newSVOP(OP_CONST, 0, sv)); - sv = va_arg(*args, SV*); - } - } - { - const line_t ocopline = PL_copline; - COP * const ocurcop = PL_curcop; - const int oexpect = PL_expect; - -#if (PERL_BCDVERSION >= 0x5004000) - utilize(!(flags & PERL_LOADMOD_DENY), start_subparse(FALSE, 0), - veop, modname, imop); -#else - utilize(!(flags & PERL_LOADMOD_DENY), start_subparse(), - modname, imop); -#endif - PL_expect = oexpect; - PL_copline = ocopline; - PL_curcop = ocurcop; - } -} - -#endif -#endif - -#ifndef load_module -#if defined(NEED_load_module) -static void DPPP_(my_load_module)(U32 flags, SV *name, SV *ver, ...); -static -#else -extern void DPPP_(my_load_module)(U32 flags, SV *name, SV *ver, ...); -#endif - -#ifdef load_module -# undef load_module -#endif -#define load_module DPPP_(my_load_module) -#define Perl_load_module DPPP_(my_load_module) - -#if defined(NEED_load_module) || defined(NEED_load_module_GLOBAL) - -void -DPPP_(my_load_module)(U32 flags, SV *name, SV *ver, ...) -{ - va_list args; - va_start(args, ver); - vload_module(flags, name, ver, &args); - va_end(args); -} - -#endif -#endif -#ifndef newRV_inc -# define newRV_inc(sv) newRV(sv) /* Replace */ -#endif - -#ifndef newRV_noinc -#if defined(NEED_newRV_noinc) -static SV * DPPP_(my_newRV_noinc)(SV *sv); -static -#else -extern SV * DPPP_(my_newRV_noinc)(SV *sv); -#endif - -#ifdef newRV_noinc -# undef newRV_noinc -#endif -#define newRV_noinc(a) DPPP_(my_newRV_noinc)(aTHX_ a) -#define Perl_newRV_noinc DPPP_(my_newRV_noinc) - -#if defined(NEED_newRV_noinc) || defined(NEED_newRV_noinc_GLOBAL) -SV * -DPPP_(my_newRV_noinc)(SV *sv) -{ - SV *rv = (SV *)newRV(sv); - SvREFCNT_dec(sv); - return rv; -} -#endif -#endif - -/* Hint: newCONSTSUB - * Returns a CV* as of perl-5.7.1. This return value is not supported - * by Devel::PPPort. - */ - -/* newCONSTSUB from IO.xs is in the core starting with 5.004_63 */ -#if (PERL_BCDVERSION < 0x5004063) && (PERL_BCDVERSION != 0x5004005) -#if defined(NEED_newCONSTSUB) -static void DPPP_(my_newCONSTSUB)(HV *stash, const char *name, SV *sv); -static -#else -extern void DPPP_(my_newCONSTSUB)(HV *stash, const char *name, SV *sv); -#endif - -#ifdef newCONSTSUB -# undef newCONSTSUB -#endif -#define newCONSTSUB(a,b,c) DPPP_(my_newCONSTSUB)(aTHX_ a,b,c) -#define Perl_newCONSTSUB DPPP_(my_newCONSTSUB) - -#if defined(NEED_newCONSTSUB) || defined(NEED_newCONSTSUB_GLOBAL) - -/* This is just a trick to avoid a dependency of newCONSTSUB on PL_parser */ -/* (There's no PL_parser in perl < 5.005, so this is completely safe) */ -#define D_PPP_PL_copline PL_copline - -void -DPPP_(my_newCONSTSUB)(HV *stash, const char *name, SV *sv) -{ - U32 oldhints = PL_hints; - HV *old_cop_stash = PL_curcop->cop_stash; - HV *old_curstash = PL_curstash; - line_t oldline = PL_curcop->cop_line; - PL_curcop->cop_line = D_PPP_PL_copline; - - PL_hints &= ~HINT_BLOCK_SCOPE; - if (stash) - PL_curstash = PL_curcop->cop_stash = stash; - - newSUB( - -#if (PERL_BCDVERSION < 0x5003022) - start_subparse(), -#elif (PERL_BCDVERSION == 0x5003022) - start_subparse(0), -#else /* 5.003_23 onwards */ - start_subparse(FALSE, 0), -#endif - - newSVOP(OP_CONST, 0, newSVpv((char *) name, 0)), - newSVOP(OP_CONST, 0, &PL_sv_no), /* SvPV(&PL_sv_no) == "" -- GMB */ - newSTATEOP(0, Nullch, newSVOP(OP_CONST, 0, sv)) - ); - - PL_hints = oldhints; - PL_curcop->cop_stash = old_cop_stash; - PL_curstash = old_curstash; - PL_curcop->cop_line = oldline; -} -#endif -#endif - -/* - * Boilerplate macros for initializing and accessing interpreter-local - * data from C. All statics in extensions should be reworked to use - * this, if you want to make the extension thread-safe. See ext/re/re.xs - * for an example of the use of these macros. - * - * Code that uses these macros is responsible for the following: - * 1. #define MY_CXT_KEY to a unique string, e.g. "DynaLoader_guts" - * 2. Declare a typedef named my_cxt_t that is a structure that contains - * all the data that needs to be interpreter-local. - * 3. Use the START_MY_CXT macro after the declaration of my_cxt_t. - * 4. Use the MY_CXT_INIT macro such that it is called exactly once - * (typically put in the BOOT: section). - * 5. Use the members of the my_cxt_t structure everywhere as - * MY_CXT.member. - * 6. Use the dMY_CXT macro (a declaration) in all the functions that - * access MY_CXT. - */ - -#if defined(MULTIPLICITY) || defined(PERL_OBJECT) || \ - defined(PERL_CAPI) || defined(PERL_IMPLICIT_CONTEXT) - -#ifndef START_MY_CXT - -/* This must appear in all extensions that define a my_cxt_t structure, - * right after the definition (i.e. at file scope). The non-threads - * case below uses it to declare the data as static. */ -#define START_MY_CXT - -#if (PERL_BCDVERSION < 0x5004068) -/* Fetches the SV that keeps the per-interpreter data. */ -#define dMY_CXT_SV \ - SV *my_cxt_sv = get_sv(MY_CXT_KEY, FALSE) -#else /* >= perl5.004_68 */ -#define dMY_CXT_SV \ - SV *my_cxt_sv = *hv_fetch(PL_modglobal, MY_CXT_KEY, \ - sizeof(MY_CXT_KEY)-1, TRUE) -#endif /* < perl5.004_68 */ - -/* This declaration should be used within all functions that use the - * interpreter-local data. */ -#define dMY_CXT \ - dMY_CXT_SV; \ - my_cxt_t *my_cxtp = INT2PTR(my_cxt_t*,SvUV(my_cxt_sv)) - -/* Creates and zeroes the per-interpreter data. - * (We allocate my_cxtp in a Perl SV so that it will be released when - * the interpreter goes away.) */ -#define MY_CXT_INIT \ - dMY_CXT_SV; \ - /* newSV() allocates one more than needed */ \ - my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\ - Zero(my_cxtp, 1, my_cxt_t); \ - sv_setuv(my_cxt_sv, PTR2UV(my_cxtp)) - -/* This macro must be used to access members of the my_cxt_t structure. - * e.g. MYCXT.some_data */ -#define MY_CXT (*my_cxtp) - -/* Judicious use of these macros can reduce the number of times dMY_CXT - * is used. Use is similar to pTHX, aTHX etc. */ -#define pMY_CXT my_cxt_t *my_cxtp -#define pMY_CXT_ pMY_CXT, -#define _pMY_CXT ,pMY_CXT -#define aMY_CXT my_cxtp -#define aMY_CXT_ aMY_CXT, -#define _aMY_CXT ,aMY_CXT - -#endif /* START_MY_CXT */ - -#ifndef MY_CXT_CLONE -/* Clones the per-interpreter data. */ -#define MY_CXT_CLONE \ - dMY_CXT_SV; \ - my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\ - Copy(INT2PTR(my_cxt_t*, SvUV(my_cxt_sv)), my_cxtp, 1, my_cxt_t);\ - sv_setuv(my_cxt_sv, PTR2UV(my_cxtp)) -#endif - -#else /* single interpreter */ - -#ifndef START_MY_CXT - -#define START_MY_CXT static my_cxt_t my_cxt; -#define dMY_CXT_SV dNOOP -#define dMY_CXT dNOOP -#define MY_CXT_INIT NOOP -#define MY_CXT my_cxt - -#define pMY_CXT void -#define pMY_CXT_ -#define _pMY_CXT -#define aMY_CXT -#define aMY_CXT_ -#define _aMY_CXT - -#endif /* START_MY_CXT */ - -#ifndef MY_CXT_CLONE -#define MY_CXT_CLONE NOOP -#endif - -#endif - -#ifndef IVdf -# if IVSIZE == LONGSIZE -# define IVdf "ld" -# define UVuf "lu" -# define UVof "lo" -# define UVxf "lx" -# define UVXf "lX" -# else -# if IVSIZE == INTSIZE -# define IVdf "d" -# define UVuf "u" -# define UVof "o" -# define UVxf "x" -# define UVXf "X" -# endif -# endif -#endif - -#ifndef NVef -# if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && \ - defined(PERL_PRIfldbl) && (PERL_BCDVERSION != 0x5006000) - /* Not very likely, but let's try anyway. */ -# define NVef PERL_PRIeldbl -# define NVff PERL_PRIfldbl -# define NVgf PERL_PRIgldbl -# else -# define NVef "e" -# define NVff "f" -# define NVgf "g" -# endif -#endif - -#ifndef SvREFCNT_inc -# ifdef PERL_USE_GCC_BRACE_GROUPS -# define SvREFCNT_inc(sv) \ - ({ \ - SV * const _sv = (SV*)(sv); \ - if (_sv) \ - (SvREFCNT(_sv))++; \ - _sv; \ - }) -# else -# define SvREFCNT_inc(sv) \ - ((PL_Sv=(SV*)(sv)) ? (++(SvREFCNT(PL_Sv)),PL_Sv) : NULL) -# endif -#endif - -#ifndef SvREFCNT_inc_simple -# ifdef PERL_USE_GCC_BRACE_GROUPS -# define SvREFCNT_inc_simple(sv) \ - ({ \ - if (sv) \ - (SvREFCNT(sv))++; \ - (SV *)(sv); \ - }) -# else -# define SvREFCNT_inc_simple(sv) \ - ((sv) ? (SvREFCNT(sv)++,(SV*)(sv)) : NULL) -# endif -#endif - -#ifndef SvREFCNT_inc_NN -# ifdef PERL_USE_GCC_BRACE_GROUPS -# define SvREFCNT_inc_NN(sv) \ - ({ \ - SV * const _sv = (SV*)(sv); \ - SvREFCNT(_sv)++; \ - _sv; \ - }) -# else -# define SvREFCNT_inc_NN(sv) \ - (PL_Sv=(SV*)(sv),++(SvREFCNT(PL_Sv)),PL_Sv) -# endif -#endif - -#ifndef SvREFCNT_inc_void -# ifdef PERL_USE_GCC_BRACE_GROUPS -# define SvREFCNT_inc_void(sv) \ - ({ \ - SV * const _sv = (SV*)(sv); \ - if (_sv) \ - (void)(SvREFCNT(_sv)++); \ - }) -# else -# define SvREFCNT_inc_void(sv) \ - (void)((PL_Sv=(SV*)(sv)) ? ++(SvREFCNT(PL_Sv)) : 0) -# endif -#endif -#ifndef SvREFCNT_inc_simple_void -# define SvREFCNT_inc_simple_void(sv) STMT_START { if (sv) SvREFCNT(sv)++; } STMT_END -#endif - -#ifndef SvREFCNT_inc_simple_NN -# define SvREFCNT_inc_simple_NN(sv) (++SvREFCNT(sv), (SV*)(sv)) -#endif - -#ifndef SvREFCNT_inc_void_NN -# define SvREFCNT_inc_void_NN(sv) (void)(++SvREFCNT((SV*)(sv))) -#endif - -#ifndef SvREFCNT_inc_simple_void_NN -# define SvREFCNT_inc_simple_void_NN(sv) (void)(++SvREFCNT((SV*)(sv))) -#endif - -#if (PERL_BCDVERSION < 0x5006000) -# define D_PPP_CONSTPV_ARG(x) ((char *) (x)) -#else -# define D_PPP_CONSTPV_ARG(x) (x) -#endif -#ifndef newSVpvn -# define newSVpvn(data,len) ((data) \ - ? ((len) ? newSVpv((data), (len)) : newSVpv("", 0)) \ - : newSV(0)) -#endif -#ifndef newSVpvn_utf8 -# define newSVpvn_utf8(s, len, u) newSVpvn_flags((s), (len), (u) ? SVf_UTF8 : 0) -#endif -#ifndef SVf_UTF8 -# define SVf_UTF8 0 -#endif - -#ifndef newSVpvn_flags - -#if defined(NEED_newSVpvn_flags) -static SV * DPPP_(my_newSVpvn_flags)(pTHX_ const char *s, STRLEN len, U32 flags); -static -#else -extern SV * DPPP_(my_newSVpvn_flags)(pTHX_ const char *s, STRLEN len, U32 flags); -#endif - -#ifdef newSVpvn_flags -# undef newSVpvn_flags -#endif -#define newSVpvn_flags(a,b,c) DPPP_(my_newSVpvn_flags)(aTHX_ a,b,c) -#define Perl_newSVpvn_flags DPPP_(my_newSVpvn_flags) - -#if defined(NEED_newSVpvn_flags) || defined(NEED_newSVpvn_flags_GLOBAL) - -SV * -DPPP_(my_newSVpvn_flags)(pTHX_ const char *s, STRLEN len, U32 flags) -{ - SV *sv = newSVpvn(D_PPP_CONSTPV_ARG(s), len); - SvFLAGS(sv) |= (flags & SVf_UTF8); - return (flags & SVs_TEMP) ? sv_2mortal(sv) : sv; -} - -#endif - -#endif - -/* Backwards compatibility stuff... :-( */ -#if !defined(NEED_sv_2pv_flags) && defined(NEED_sv_2pv_nolen) -# define NEED_sv_2pv_flags -#endif -#if !defined(NEED_sv_2pv_flags_GLOBAL) && defined(NEED_sv_2pv_nolen_GLOBAL) -# define NEED_sv_2pv_flags_GLOBAL -#endif - -/* Hint: sv_2pv_nolen - * Use the SvPV_nolen() or SvPV_nolen_const() macros instead of sv_2pv_nolen(). - */ -#ifndef sv_2pv_nolen -# define sv_2pv_nolen(sv) SvPV_nolen(sv) -#endif - -#ifdef SvPVbyte - -/* Hint: SvPVbyte - * Does not work in perl-5.6.1, ppport.h implements a version - * borrowed from perl-5.7.3. - */ - -#if (PERL_BCDVERSION < 0x5007000) - -#if defined(NEED_sv_2pvbyte) -static char * DPPP_(my_sv_2pvbyte)(pTHX_ SV *sv, STRLEN *lp); -static -#else -extern char * DPPP_(my_sv_2pvbyte)(pTHX_ SV *sv, STRLEN *lp); -#endif - -#ifdef sv_2pvbyte -# undef sv_2pvbyte -#endif -#define sv_2pvbyte(a,b) DPPP_(my_sv_2pvbyte)(aTHX_ a,b) -#define Perl_sv_2pvbyte DPPP_(my_sv_2pvbyte) - -#if defined(NEED_sv_2pvbyte) || defined(NEED_sv_2pvbyte_GLOBAL) - -char * -DPPP_(my_sv_2pvbyte)(pTHX_ SV *sv, STRLEN *lp) -{ - sv_utf8_downgrade(sv,0); - return SvPV(sv,*lp); -} - -#endif - -/* Hint: sv_2pvbyte - * Use the SvPVbyte() macro instead of sv_2pvbyte(). - */ - -#undef SvPVbyte - -#define SvPVbyte(sv, lp) \ - ((SvFLAGS(sv) & (SVf_POK|SVf_UTF8)) == (SVf_POK) \ - ? ((lp = SvCUR(sv)), SvPVX(sv)) : sv_2pvbyte(sv, &lp)) - -#endif - -#else - -# define SvPVbyte SvPV -# define sv_2pvbyte sv_2pv - -#endif -#ifndef sv_2pvbyte_nolen -# define sv_2pvbyte_nolen(sv) sv_2pv_nolen(sv) -#endif - -/* Hint: sv_pvn - * Always use the SvPV() macro instead of sv_pvn(). - */ - -/* Hint: sv_pvn_force - * Always use the SvPV_force() macro instead of sv_pvn_force(). - */ - -/* If these are undefined, they're not handled by the core anyway */ -#ifndef SV_IMMEDIATE_UNREF -# define SV_IMMEDIATE_UNREF 0 -#endif - -#ifndef SV_GMAGIC -# define SV_GMAGIC 0 -#endif - -#ifndef SV_COW_DROP_PV -# define SV_COW_DROP_PV 0 -#endif - -#ifndef SV_UTF8_NO_ENCODING -# define SV_UTF8_NO_ENCODING 0 -#endif - -#ifndef SV_NOSTEAL -# define SV_NOSTEAL 0 -#endif - -#ifndef SV_CONST_RETURN -# define SV_CONST_RETURN 0 -#endif - -#ifndef SV_MUTABLE_RETURN -# define SV_MUTABLE_RETURN 0 -#endif - -#ifndef SV_SMAGIC -# define SV_SMAGIC 0 -#endif - -#ifndef SV_HAS_TRAILING_NUL -# define SV_HAS_TRAILING_NUL 0 -#endif - -#ifndef SV_COW_SHARED_HASH_KEYS -# define SV_COW_SHARED_HASH_KEYS 0 -#endif - -#if (PERL_BCDVERSION < 0x5007002) - -#if defined(NEED_sv_2pv_flags) -static char * DPPP_(my_sv_2pv_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags); -static -#else -extern char * DPPP_(my_sv_2pv_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags); -#endif - -#ifdef sv_2pv_flags -# undef sv_2pv_flags -#endif -#define sv_2pv_flags(a,b,c) DPPP_(my_sv_2pv_flags)(aTHX_ a,b,c) -#define Perl_sv_2pv_flags DPPP_(my_sv_2pv_flags) - -#if defined(NEED_sv_2pv_flags) || defined(NEED_sv_2pv_flags_GLOBAL) - -char * -DPPP_(my_sv_2pv_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags) -{ - STRLEN n_a = (STRLEN) flags; - return sv_2pv(sv, lp ? lp : &n_a); -} - -#endif - -#if defined(NEED_sv_pvn_force_flags) -static char * DPPP_(my_sv_pvn_force_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags); -static -#else -extern char * DPPP_(my_sv_pvn_force_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags); -#endif - -#ifdef sv_pvn_force_flags -# undef sv_pvn_force_flags -#endif -#define sv_pvn_force_flags(a,b,c) DPPP_(my_sv_pvn_force_flags)(aTHX_ a,b,c) -#define Perl_sv_pvn_force_flags DPPP_(my_sv_pvn_force_flags) - -#if defined(NEED_sv_pvn_force_flags) || defined(NEED_sv_pvn_force_flags_GLOBAL) - -char * -DPPP_(my_sv_pvn_force_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags) -{ - STRLEN n_a = (STRLEN) flags; - return sv_pvn_force(sv, lp ? lp : &n_a); -} - -#endif - -#endif - -#if (PERL_BCDVERSION < 0x5008008) || ( (PERL_BCDVERSION >= 0x5009000) && (PERL_BCDVERSION < 0x5009003) ) -# define DPPP_SVPV_NOLEN_LP_ARG &PL_na -#else -# define DPPP_SVPV_NOLEN_LP_ARG 0 -#endif -#ifndef SvPV_const -# define SvPV_const(sv, lp) SvPV_flags_const(sv, lp, SV_GMAGIC) -#endif - -#ifndef SvPV_mutable -# define SvPV_mutable(sv, lp) SvPV_flags_mutable(sv, lp, SV_GMAGIC) -#endif -#ifndef SvPV_flags -# define SvPV_flags(sv, lp, flags) \ - ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ - ? ((lp = SvCUR(sv)), SvPVX(sv)) : sv_2pv_flags(sv, &lp, flags)) -#endif -#ifndef SvPV_flags_const -# define SvPV_flags_const(sv, lp, flags) \ - ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ - ? ((lp = SvCUR(sv)), SvPVX_const(sv)) : \ - (const char*) sv_2pv_flags(sv, &lp, flags|SV_CONST_RETURN)) -#endif -#ifndef SvPV_flags_const_nolen -# define SvPV_flags_const_nolen(sv, flags) \ - ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ - ? SvPVX_const(sv) : \ - (const char*) sv_2pv_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, flags|SV_CONST_RETURN)) -#endif -#ifndef SvPV_flags_mutable -# define SvPV_flags_mutable(sv, lp, flags) \ - ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ - ? ((lp = SvCUR(sv)), SvPVX_mutable(sv)) : \ - sv_2pv_flags(sv, &lp, flags|SV_MUTABLE_RETURN)) -#endif -#ifndef SvPV_force -# define SvPV_force(sv, lp) SvPV_force_flags(sv, lp, SV_GMAGIC) -#endif - -#ifndef SvPV_force_nolen -# define SvPV_force_nolen(sv) SvPV_force_flags_nolen(sv, SV_GMAGIC) -#endif - -#ifndef SvPV_force_mutable -# define SvPV_force_mutable(sv, lp) SvPV_force_flags_mutable(sv, lp, SV_GMAGIC) -#endif - -#ifndef SvPV_force_nomg -# define SvPV_force_nomg(sv, lp) SvPV_force_flags(sv, lp, 0) -#endif - -#ifndef SvPV_force_nomg_nolen -# define SvPV_force_nomg_nolen(sv) SvPV_force_flags_nolen(sv, 0) -#endif -#ifndef SvPV_force_flags -# define SvPV_force_flags(sv, lp, flags) \ - ((SvFLAGS(sv) & (SVf_POK|SVf_THINKFIRST)) == SVf_POK \ - ? ((lp = SvCUR(sv)), SvPVX(sv)) : sv_pvn_force_flags(sv, &lp, flags)) -#endif -#ifndef SvPV_force_flags_nolen -# define SvPV_force_flags_nolen(sv, flags) \ - ((SvFLAGS(sv) & (SVf_POK|SVf_THINKFIRST)) == SVf_POK \ - ? SvPVX(sv) : sv_pvn_force_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, flags)) -#endif -#ifndef SvPV_force_flags_mutable -# define SvPV_force_flags_mutable(sv, lp, flags) \ - ((SvFLAGS(sv) & (SVf_POK|SVf_THINKFIRST)) == SVf_POK \ - ? ((lp = SvCUR(sv)), SvPVX_mutable(sv)) \ - : sv_pvn_force_flags(sv, &lp, flags|SV_MUTABLE_RETURN)) -#endif -#ifndef SvPV_nolen -# define SvPV_nolen(sv) \ - ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ - ? SvPVX(sv) : sv_2pv_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, SV_GMAGIC)) -#endif -#ifndef SvPV_nolen_const -# define SvPV_nolen_const(sv) \ - ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ - ? SvPVX_const(sv) : sv_2pv_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, SV_GMAGIC|SV_CONST_RETURN)) -#endif -#ifndef SvPV_nomg -# define SvPV_nomg(sv, lp) SvPV_flags(sv, lp, 0) -#endif - -#ifndef SvPV_nomg_const -# define SvPV_nomg_const(sv, lp) SvPV_flags_const(sv, lp, 0) -#endif - -#ifndef SvPV_nomg_const_nolen -# define SvPV_nomg_const_nolen(sv) SvPV_flags_const_nolen(sv, 0) -#endif -#ifndef SvPV_renew -# define SvPV_renew(sv,n) STMT_START { SvLEN_set(sv, n); \ - SvPV_set((sv), (char *) saferealloc( \ - (Malloc_t)SvPVX(sv), (MEM_SIZE)((n)))); \ - } STMT_END -#endif -#ifndef SvMAGIC_set -# define SvMAGIC_set(sv, val) \ - STMT_START { assert(SvTYPE(sv) >= SVt_PVMG); \ - (((XPVMG*) SvANY(sv))->xmg_magic = (val)); } STMT_END -#endif - -#if (PERL_BCDVERSION < 0x5009003) -#ifndef SvPVX_const -# define SvPVX_const(sv) ((const char*) (0 + SvPVX(sv))) -#endif - -#ifndef SvPVX_mutable -# define SvPVX_mutable(sv) (0 + SvPVX(sv)) -#endif -#ifndef SvRV_set -# define SvRV_set(sv, val) \ - STMT_START { assert(SvTYPE(sv) >= SVt_RV); \ - (((XRV*) SvANY(sv))->xrv_rv = (val)); } STMT_END -#endif - -#else -#ifndef SvPVX_const -# define SvPVX_const(sv) ((const char*)((sv)->sv_u.svu_pv)) -#endif - -#ifndef SvPVX_mutable -# define SvPVX_mutable(sv) ((sv)->sv_u.svu_pv) -#endif -#ifndef SvRV_set -# define SvRV_set(sv, val) \ - STMT_START { assert(SvTYPE(sv) >= SVt_RV); \ - ((sv)->sv_u.svu_rv = (val)); } STMT_END -#endif - -#endif -#ifndef SvSTASH_set -# define SvSTASH_set(sv, val) \ - STMT_START { assert(SvTYPE(sv) >= SVt_PVMG); \ - (((XPVMG*) SvANY(sv))->xmg_stash = (val)); } STMT_END -#endif - -#if (PERL_BCDVERSION < 0x5004000) -#ifndef SvUV_set -# define SvUV_set(sv, val) \ - STMT_START { assert(SvTYPE(sv) == SVt_IV || SvTYPE(sv) >= SVt_PVIV); \ - (((XPVIV*) SvANY(sv))->xiv_iv = (IV) (val)); } STMT_END -#endif - -#else -#ifndef SvUV_set -# define SvUV_set(sv, val) \ - STMT_START { assert(SvTYPE(sv) == SVt_IV || SvTYPE(sv) >= SVt_PVIV); \ - (((XPVUV*) SvANY(sv))->xuv_uv = (val)); } STMT_END -#endif - -#endif - -#if (PERL_BCDVERSION >= 0x5004000) && !defined(vnewSVpvf) -#if defined(NEED_vnewSVpvf) -static SV * DPPP_(my_vnewSVpvf)(pTHX_ const char *pat, va_list *args); -static -#else -extern SV * DPPP_(my_vnewSVpvf)(pTHX_ const char *pat, va_list *args); -#endif - -#ifdef vnewSVpvf -# undef vnewSVpvf -#endif -#define vnewSVpvf(a,b) DPPP_(my_vnewSVpvf)(aTHX_ a,b) -#define Perl_vnewSVpvf DPPP_(my_vnewSVpvf) - -#if defined(NEED_vnewSVpvf) || defined(NEED_vnewSVpvf_GLOBAL) - -SV * -DPPP_(my_vnewSVpvf)(pTHX_ const char *pat, va_list *args) -{ - register SV *sv = newSV(0); - sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)); - return sv; -} - -#endif -#endif - -#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_vcatpvf) -# define sv_vcatpvf(sv, pat, args) sv_vcatpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)) -#endif - -#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_vsetpvf) -# define sv_vsetpvf(sv, pat, args) sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)) -#endif - -#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_catpvf_mg) -#if defined(NEED_sv_catpvf_mg) -static void DPPP_(my_sv_catpvf_mg)(pTHX_ SV *sv, const char *pat, ...); -static -#else -extern void DPPP_(my_sv_catpvf_mg)(pTHX_ SV *sv, const char *pat, ...); -#endif - -#define Perl_sv_catpvf_mg DPPP_(my_sv_catpvf_mg) - -#if defined(NEED_sv_catpvf_mg) || defined(NEED_sv_catpvf_mg_GLOBAL) - -void -DPPP_(my_sv_catpvf_mg)(pTHX_ SV *sv, const char *pat, ...) -{ - va_list args; - va_start(args, pat); - sv_vcatpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); - SvSETMAGIC(sv); - va_end(args); -} - -#endif -#endif - -#ifdef PERL_IMPLICIT_CONTEXT -#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_catpvf_mg_nocontext) -#if defined(NEED_sv_catpvf_mg_nocontext) -static void DPPP_(my_sv_catpvf_mg_nocontext)(SV *sv, const char *pat, ...); -static -#else -extern void DPPP_(my_sv_catpvf_mg_nocontext)(SV *sv, const char *pat, ...); -#endif - -#define sv_catpvf_mg_nocontext DPPP_(my_sv_catpvf_mg_nocontext) -#define Perl_sv_catpvf_mg_nocontext DPPP_(my_sv_catpvf_mg_nocontext) - -#if defined(NEED_sv_catpvf_mg_nocontext) || defined(NEED_sv_catpvf_mg_nocontext_GLOBAL) - -void -DPPP_(my_sv_catpvf_mg_nocontext)(SV *sv, const char *pat, ...) -{ - dTHX; - va_list args; - va_start(args, pat); - sv_vcatpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); - SvSETMAGIC(sv); - va_end(args); -} - -#endif -#endif -#endif - -/* sv_catpvf_mg depends on sv_catpvf_mg_nocontext */ -#ifndef sv_catpvf_mg -# ifdef PERL_IMPLICIT_CONTEXT -# define sv_catpvf_mg Perl_sv_catpvf_mg_nocontext -# else -# define sv_catpvf_mg Perl_sv_catpvf_mg -# endif -#endif - -#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_vcatpvf_mg) -# define sv_vcatpvf_mg(sv, pat, args) \ - STMT_START { \ - sv_vcatpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)); \ - SvSETMAGIC(sv); \ - } STMT_END -#endif - -#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_setpvf_mg) -#if defined(NEED_sv_setpvf_mg) -static void DPPP_(my_sv_setpvf_mg)(pTHX_ SV *sv, const char *pat, ...); -static -#else -extern void DPPP_(my_sv_setpvf_mg)(pTHX_ SV *sv, const char *pat, ...); -#endif - -#define Perl_sv_setpvf_mg DPPP_(my_sv_setpvf_mg) - -#if defined(NEED_sv_setpvf_mg) || defined(NEED_sv_setpvf_mg_GLOBAL) - -void -DPPP_(my_sv_setpvf_mg)(pTHX_ SV *sv, const char *pat, ...) -{ - va_list args; - va_start(args, pat); - sv_vsetpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); - SvSETMAGIC(sv); - va_end(args); -} - -#endif -#endif - -#ifdef PERL_IMPLICIT_CONTEXT -#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_setpvf_mg_nocontext) -#if defined(NEED_sv_setpvf_mg_nocontext) -static void DPPP_(my_sv_setpvf_mg_nocontext)(SV *sv, const char *pat, ...); -static -#else -extern void DPPP_(my_sv_setpvf_mg_nocontext)(SV *sv, const char *pat, ...); -#endif - -#define sv_setpvf_mg_nocontext DPPP_(my_sv_setpvf_mg_nocontext) -#define Perl_sv_setpvf_mg_nocontext DPPP_(my_sv_setpvf_mg_nocontext) - -#if defined(NEED_sv_setpvf_mg_nocontext) || defined(NEED_sv_setpvf_mg_nocontext_GLOBAL) - -void -DPPP_(my_sv_setpvf_mg_nocontext)(SV *sv, const char *pat, ...) -{ - dTHX; - va_list args; - va_start(args, pat); - sv_vsetpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); - SvSETMAGIC(sv); - va_end(args); -} - -#endif -#endif -#endif - -/* sv_setpvf_mg depends on sv_setpvf_mg_nocontext */ -#ifndef sv_setpvf_mg -# ifdef PERL_IMPLICIT_CONTEXT -# define sv_setpvf_mg Perl_sv_setpvf_mg_nocontext -# else -# define sv_setpvf_mg Perl_sv_setpvf_mg -# endif -#endif - -#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_vsetpvf_mg) -# define sv_vsetpvf_mg(sv, pat, args) \ - STMT_START { \ - sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)); \ - SvSETMAGIC(sv); \ - } STMT_END -#endif - -#ifndef newSVpvn_share - -#if defined(NEED_newSVpvn_share) -static SV * DPPP_(my_newSVpvn_share)(pTHX_ const char *src, I32 len, U32 hash); -static -#else -extern SV * DPPP_(my_newSVpvn_share)(pTHX_ const char *src, I32 len, U32 hash); -#endif - -#ifdef newSVpvn_share -# undef newSVpvn_share -#endif -#define newSVpvn_share(a,b,c) DPPP_(my_newSVpvn_share)(aTHX_ a,b,c) -#define Perl_newSVpvn_share DPPP_(my_newSVpvn_share) - -#if defined(NEED_newSVpvn_share) || defined(NEED_newSVpvn_share_GLOBAL) - -SV * -DPPP_(my_newSVpvn_share)(pTHX_ const char *src, I32 len, U32 hash) -{ - SV *sv; - if (len < 0) - len = -len; - if (!hash) - PERL_HASH(hash, (char*) src, len); - sv = newSVpvn((char *) src, len); - sv_upgrade(sv, SVt_PVIV); - SvIVX(sv) = hash; - SvREADONLY_on(sv); - SvPOK_on(sv); - return sv; -} - -#endif - -#endif -#ifndef SvSHARED_HASH -# define SvSHARED_HASH(sv) (0 + SvUVX(sv)) -#endif -#ifndef WARN_ALL -# define WARN_ALL 0 -#endif - -#ifndef WARN_CLOSURE -# define WARN_CLOSURE 1 -#endif - -#ifndef WARN_DEPRECATED -# define WARN_DEPRECATED 2 -#endif - -#ifndef WARN_EXITING -# define WARN_EXITING 3 -#endif - -#ifndef WARN_GLOB -# define WARN_GLOB 4 -#endif - -#ifndef WARN_IO -# define WARN_IO 5 -#endif - -#ifndef WARN_CLOSED -# define WARN_CLOSED 6 -#endif - -#ifndef WARN_EXEC -# define WARN_EXEC 7 -#endif - -#ifndef WARN_LAYER -# define WARN_LAYER 8 -#endif - -#ifndef WARN_NEWLINE -# define WARN_NEWLINE 9 -#endif - -#ifndef WARN_PIPE -# define WARN_PIPE 10 -#endif - -#ifndef WARN_UNOPENED -# define WARN_UNOPENED 11 -#endif - -#ifndef WARN_MISC -# define WARN_MISC 12 -#endif - -#ifndef WARN_NUMERIC -# define WARN_NUMERIC 13 -#endif - -#ifndef WARN_ONCE -# define WARN_ONCE 14 -#endif - -#ifndef WARN_OVERFLOW -# define WARN_OVERFLOW 15 -#endif - -#ifndef WARN_PACK -# define WARN_PACK 16 -#endif - -#ifndef WARN_PORTABLE -# define WARN_PORTABLE 17 -#endif - -#ifndef WARN_RECURSION -# define WARN_RECURSION 18 -#endif - -#ifndef WARN_REDEFINE -# define WARN_REDEFINE 19 -#endif - -#ifndef WARN_REGEXP -# define WARN_REGEXP 20 -#endif - -#ifndef WARN_SEVERE -# define WARN_SEVERE 21 -#endif - -#ifndef WARN_DEBUGGING -# define WARN_DEBUGGING 22 -#endif - -#ifndef WARN_INPLACE -# define WARN_INPLACE 23 -#endif - -#ifndef WARN_INTERNAL -# define WARN_INTERNAL 24 -#endif - -#ifndef WARN_MALLOC -# define WARN_MALLOC 25 -#endif - -#ifndef WARN_SIGNAL -# define WARN_SIGNAL 26 -#endif - -#ifndef WARN_SUBSTR -# define WARN_SUBSTR 27 -#endif - -#ifndef WARN_SYNTAX -# define WARN_SYNTAX 28 -#endif - -#ifndef WARN_AMBIGUOUS -# define WARN_AMBIGUOUS 29 -#endif - -#ifndef WARN_BAREWORD -# define WARN_BAREWORD 30 -#endif - -#ifndef WARN_DIGIT -# define WARN_DIGIT 31 -#endif - -#ifndef WARN_PARENTHESIS -# define WARN_PARENTHESIS 32 -#endif - -#ifndef WARN_PRECEDENCE -# define WARN_PRECEDENCE 33 -#endif - -#ifndef WARN_PRINTF -# define WARN_PRINTF 34 -#endif - -#ifndef WARN_PROTOTYPE -# define WARN_PROTOTYPE 35 -#endif - -#ifndef WARN_QW -# define WARN_QW 36 -#endif - -#ifndef WARN_RESERVED -# define WARN_RESERVED 37 -#endif - -#ifndef WARN_SEMICOLON -# define WARN_SEMICOLON 38 -#endif - -#ifndef WARN_TAINT -# define WARN_TAINT 39 -#endif - -#ifndef WARN_THREADS -# define WARN_THREADS 40 -#endif - -#ifndef WARN_UNINITIALIZED -# define WARN_UNINITIALIZED 41 -#endif - -#ifndef WARN_UNPACK -# define WARN_UNPACK 42 -#endif - -#ifndef WARN_UNTIE -# define WARN_UNTIE 43 -#endif - -#ifndef WARN_UTF8 -# define WARN_UTF8 44 -#endif - -#ifndef WARN_VOID -# define WARN_VOID 45 -#endif - -#ifndef WARN_ASSERTIONS -# define WARN_ASSERTIONS 46 -#endif -#ifndef packWARN -# define packWARN(a) (a) -#endif - -#ifndef ckWARN -# ifdef G_WARN_ON -# define ckWARN(a) (PL_dowarn & G_WARN_ON) -# else -# define ckWARN(a) PL_dowarn -# endif -#endif - -#if (PERL_BCDVERSION >= 0x5004000) && !defined(warner) -#if defined(NEED_warner) -static void DPPP_(my_warner)(U32 err, const char *pat, ...); -static -#else -extern void DPPP_(my_warner)(U32 err, const char *pat, ...); -#endif - -#define Perl_warner DPPP_(my_warner) - -#if defined(NEED_warner) || defined(NEED_warner_GLOBAL) - -void -DPPP_(my_warner)(U32 err, const char *pat, ...) -{ - SV *sv; - va_list args; - - PERL_UNUSED_ARG(err); - - va_start(args, pat); - sv = vnewSVpvf(pat, &args); - va_end(args); - sv_2mortal(sv); - warn("%s", SvPV_nolen(sv)); -} - -#define warner Perl_warner - -#define Perl_warner_nocontext Perl_warner - -#endif -#endif - -/* concatenating with "" ensures that only literal strings are accepted as argument - * note that STR_WITH_LEN() can't be used as argument to macros or functions that - * under some configurations might be macros - */ -#ifndef STR_WITH_LEN -# define STR_WITH_LEN(s) (s ""), (sizeof(s)-1) -#endif -#ifndef newSVpvs -# define newSVpvs(str) newSVpvn(str "", sizeof(str) - 1) -#endif - -#ifndef newSVpvs_flags -# define newSVpvs_flags(str, flags) newSVpvn_flags(str "", sizeof(str) - 1, flags) -#endif - -#ifndef sv_catpvs -# define sv_catpvs(sv, str) sv_catpvn(sv, str "", sizeof(str) - 1) -#endif - -#ifndef sv_setpvs -# define sv_setpvs(sv, str) sv_setpvn(sv, str "", sizeof(str) - 1) -#endif - -#ifndef hv_fetchs -# define hv_fetchs(hv, key, lval) hv_fetch(hv, key "", sizeof(key) - 1, lval) -#endif - -#ifndef hv_stores -# define hv_stores(hv, key, val) hv_store(hv, key "", sizeof(key) - 1, val, 0) -#endif -#ifndef SvGETMAGIC -# define SvGETMAGIC(x) STMT_START { if (SvGMAGICAL(x)) mg_get(x); } STMT_END -#endif -#ifndef PERL_MAGIC_sv -# define PERL_MAGIC_sv '\0' -#endif - -#ifndef PERL_MAGIC_overload -# define PERL_MAGIC_overload 'A' -#endif - -#ifndef PERL_MAGIC_overload_elem -# define PERL_MAGIC_overload_elem 'a' -#endif - -#ifndef PERL_MAGIC_overload_table -# define PERL_MAGIC_overload_table 'c' -#endif - -#ifndef PERL_MAGIC_bm -# define PERL_MAGIC_bm 'B' -#endif - -#ifndef PERL_MAGIC_regdata -# define PERL_MAGIC_regdata 'D' -#endif - -#ifndef PERL_MAGIC_regdatum -# define PERL_MAGIC_regdatum 'd' -#endif - -#ifndef PERL_MAGIC_env -# define PERL_MAGIC_env 'E' -#endif - -#ifndef PERL_MAGIC_envelem -# define PERL_MAGIC_envelem 'e' -#endif - -#ifndef PERL_MAGIC_fm -# define PERL_MAGIC_fm 'f' -#endif - -#ifndef PERL_MAGIC_regex_global -# define PERL_MAGIC_regex_global 'g' -#endif - -#ifndef PERL_MAGIC_isa -# define PERL_MAGIC_isa 'I' -#endif - -#ifndef PERL_MAGIC_isaelem -# define PERL_MAGIC_isaelem 'i' -#endif - -#ifndef PERL_MAGIC_nkeys -# define PERL_MAGIC_nkeys 'k' -#endif - -#ifndef PERL_MAGIC_dbfile -# define PERL_MAGIC_dbfile 'L' -#endif - -#ifndef PERL_MAGIC_dbline -# define PERL_MAGIC_dbline 'l' -#endif - -#ifndef PERL_MAGIC_mutex -# define PERL_MAGIC_mutex 'm' -#endif - -#ifndef PERL_MAGIC_shared -# define PERL_MAGIC_shared 'N' -#endif - -#ifndef PERL_MAGIC_shared_scalar -# define PERL_MAGIC_shared_scalar 'n' -#endif - -#ifndef PERL_MAGIC_collxfrm -# define PERL_MAGIC_collxfrm 'o' -#endif - -#ifndef PERL_MAGIC_tied -# define PERL_MAGIC_tied 'P' -#endif - -#ifndef PERL_MAGIC_tiedelem -# define PERL_MAGIC_tiedelem 'p' -#endif - -#ifndef PERL_MAGIC_tiedscalar -# define PERL_MAGIC_tiedscalar 'q' -#endif - -#ifndef PERL_MAGIC_qr -# define PERL_MAGIC_qr 'r' -#endif - -#ifndef PERL_MAGIC_sig -# define PERL_MAGIC_sig 'S' -#endif - -#ifndef PERL_MAGIC_sigelem -# define PERL_MAGIC_sigelem 's' -#endif - -#ifndef PERL_MAGIC_taint -# define PERL_MAGIC_taint 't' -#endif - -#ifndef PERL_MAGIC_uvar -# define PERL_MAGIC_uvar 'U' -#endif - -#ifndef PERL_MAGIC_uvar_elem -# define PERL_MAGIC_uvar_elem 'u' -#endif - -#ifndef PERL_MAGIC_vstring -# define PERL_MAGIC_vstring 'V' -#endif - -#ifndef PERL_MAGIC_vec -# define PERL_MAGIC_vec 'v' -#endif - -#ifndef PERL_MAGIC_utf8 -# define PERL_MAGIC_utf8 'w' -#endif - -#ifndef PERL_MAGIC_substr -# define PERL_MAGIC_substr 'x' -#endif - -#ifndef PERL_MAGIC_defelem -# define PERL_MAGIC_defelem 'y' -#endif - -#ifndef PERL_MAGIC_glob -# define PERL_MAGIC_glob '*' -#endif - -#ifndef PERL_MAGIC_arylen -# define PERL_MAGIC_arylen '#' -#endif - -#ifndef PERL_MAGIC_pos -# define PERL_MAGIC_pos '.' -#endif - -#ifndef PERL_MAGIC_backref -# define PERL_MAGIC_backref '<' -#endif - -#ifndef PERL_MAGIC_ext -# define PERL_MAGIC_ext '~' -#endif - -/* That's the best we can do... */ -#ifndef sv_catpvn_nomg -# define sv_catpvn_nomg sv_catpvn -#endif - -#ifndef sv_catsv_nomg -# define sv_catsv_nomg sv_catsv -#endif - -#ifndef sv_setsv_nomg -# define sv_setsv_nomg sv_setsv -#endif - -#ifndef sv_pvn_nomg -# define sv_pvn_nomg sv_pvn -#endif - -#ifndef SvIV_nomg -# define SvIV_nomg SvIV -#endif - -#ifndef SvUV_nomg -# define SvUV_nomg SvUV -#endif - -#ifndef sv_catpv_mg -# define sv_catpv_mg(sv, ptr) \ - STMT_START { \ - SV *TeMpSv = sv; \ - sv_catpv(TeMpSv,ptr); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifndef sv_catpvn_mg -# define sv_catpvn_mg(sv, ptr, len) \ - STMT_START { \ - SV *TeMpSv = sv; \ - sv_catpvn(TeMpSv,ptr,len); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifndef sv_catsv_mg -# define sv_catsv_mg(dsv, ssv) \ - STMT_START { \ - SV *TeMpSv = dsv; \ - sv_catsv(TeMpSv,ssv); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifndef sv_setiv_mg -# define sv_setiv_mg(sv, i) \ - STMT_START { \ - SV *TeMpSv = sv; \ - sv_setiv(TeMpSv,i); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifndef sv_setnv_mg -# define sv_setnv_mg(sv, num) \ - STMT_START { \ - SV *TeMpSv = sv; \ - sv_setnv(TeMpSv,num); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifndef sv_setpv_mg -# define sv_setpv_mg(sv, ptr) \ - STMT_START { \ - SV *TeMpSv = sv; \ - sv_setpv(TeMpSv,ptr); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifndef sv_setpvn_mg -# define sv_setpvn_mg(sv, ptr, len) \ - STMT_START { \ - SV *TeMpSv = sv; \ - sv_setpvn(TeMpSv,ptr,len); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifndef sv_setsv_mg -# define sv_setsv_mg(dsv, ssv) \ - STMT_START { \ - SV *TeMpSv = dsv; \ - sv_setsv(TeMpSv,ssv); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifndef sv_setuv_mg -# define sv_setuv_mg(sv, i) \ - STMT_START { \ - SV *TeMpSv = sv; \ - sv_setuv(TeMpSv,i); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifndef sv_usepvn_mg -# define sv_usepvn_mg(sv, ptr, len) \ - STMT_START { \ - SV *TeMpSv = sv; \ - sv_usepvn(TeMpSv,ptr,len); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif -#ifndef SvVSTRING_mg -# define SvVSTRING_mg(sv) (SvMAGICAL(sv) ? mg_find(sv, PERL_MAGIC_vstring) : NULL) -#endif - -/* Hint: sv_magic_portable - * This is a compatibility function that is only available with - * Devel::PPPort. It is NOT in the perl core. - * Its purpose is to mimic the 5.8.0 behaviour of sv_magic() when - * it is being passed a name pointer with namlen == 0. In that - * case, perl 5.8.0 and later store the pointer, not a copy of it. - * The compatibility can be provided back to perl 5.004. With - * earlier versions, the code will not compile. - */ - -#if (PERL_BCDVERSION < 0x5004000) - - /* code that uses sv_magic_portable will not compile */ - -#elif (PERL_BCDVERSION < 0x5008000) - -# define sv_magic_portable(sv, obj, how, name, namlen) \ - STMT_START { \ - SV *SvMp_sv = (sv); \ - char *SvMp_name = (char *) (name); \ - I32 SvMp_namlen = (namlen); \ - if (SvMp_name && SvMp_namlen == 0) \ - { \ - MAGIC *mg; \ - sv_magic(SvMp_sv, obj, how, 0, 0); \ - mg = SvMAGIC(SvMp_sv); \ - mg->mg_len = -42; /* XXX: this is the tricky part */ \ - mg->mg_ptr = SvMp_name; \ - } \ - else \ - { \ - sv_magic(SvMp_sv, obj, how, SvMp_name, SvMp_namlen); \ - } \ - } STMT_END - -#else - -# define sv_magic_portable(a, b, c, d, e) sv_magic(a, b, c, d, e) - -#endif - -#ifdef USE_ITHREADS -#ifndef CopFILE -# define CopFILE(c) ((c)->cop_file) -#endif - -#ifndef CopFILEGV -# define CopFILEGV(c) (CopFILE(c) ? gv_fetchfile(CopFILE(c)) : Nullgv) -#endif - -#ifndef CopFILE_set -# define CopFILE_set(c,pv) ((c)->cop_file = savepv(pv)) -#endif - -#ifndef CopFILESV -# define CopFILESV(c) (CopFILE(c) ? GvSV(gv_fetchfile(CopFILE(c))) : Nullsv) -#endif - -#ifndef CopFILEAV -# define CopFILEAV(c) (CopFILE(c) ? GvAV(gv_fetchfile(CopFILE(c))) : Nullav) -#endif - -#ifndef CopSTASHPV -# define CopSTASHPV(c) ((c)->cop_stashpv) -#endif - -#ifndef CopSTASHPV_set -# define CopSTASHPV_set(c,pv) ((c)->cop_stashpv = ((pv) ? savepv(pv) : Nullch)) -#endif - -#ifndef CopSTASH -# define CopSTASH(c) (CopSTASHPV(c) ? gv_stashpv(CopSTASHPV(c),GV_ADD) : Nullhv) -#endif - -#ifndef CopSTASH_set -# define CopSTASH_set(c,hv) CopSTASHPV_set(c, (hv) ? HvNAME(hv) : Nullch) -#endif - -#ifndef CopSTASH_eq -# define CopSTASH_eq(c,hv) ((hv) && (CopSTASHPV(c) == HvNAME(hv) \ - || (CopSTASHPV(c) && HvNAME(hv) \ - && strEQ(CopSTASHPV(c), HvNAME(hv))))) -#endif - -#else -#ifndef CopFILEGV -# define CopFILEGV(c) ((c)->cop_filegv) -#endif - -#ifndef CopFILEGV_set -# define CopFILEGV_set(c,gv) ((c)->cop_filegv = (GV*)SvREFCNT_inc(gv)) -#endif - -#ifndef CopFILE_set -# define CopFILE_set(c,pv) CopFILEGV_set((c), gv_fetchfile(pv)) -#endif - -#ifndef CopFILESV -# define CopFILESV(c) (CopFILEGV(c) ? GvSV(CopFILEGV(c)) : Nullsv) -#endif - -#ifndef CopFILEAV -# define CopFILEAV(c) (CopFILEGV(c) ? GvAV(CopFILEGV(c)) : Nullav) -#endif - -#ifndef CopFILE -# define CopFILE(c) (CopFILESV(c) ? SvPVX(CopFILESV(c)) : Nullch) -#endif - -#ifndef CopSTASH -# define CopSTASH(c) ((c)->cop_stash) -#endif - -#ifndef CopSTASH_set -# define CopSTASH_set(c,hv) ((c)->cop_stash = (hv)) -#endif - -#ifndef CopSTASHPV -# define CopSTASHPV(c) (CopSTASH(c) ? HvNAME(CopSTASH(c)) : Nullch) -#endif - -#ifndef CopSTASHPV_set -# define CopSTASHPV_set(c,pv) CopSTASH_set((c), gv_stashpv(pv,GV_ADD)) -#endif - -#ifndef CopSTASH_eq -# define CopSTASH_eq(c,hv) (CopSTASH(c) == (hv)) -#endif - -#endif /* USE_ITHREADS */ -#ifndef IN_PERL_COMPILETIME -# define IN_PERL_COMPILETIME (PL_curcop == &PL_compiling) -#endif - -#ifndef IN_LOCALE_RUNTIME -# define IN_LOCALE_RUNTIME (PL_curcop->op_private & HINT_LOCALE) -#endif - -#ifndef IN_LOCALE_COMPILETIME -# define IN_LOCALE_COMPILETIME (PL_hints & HINT_LOCALE) -#endif - -#ifndef IN_LOCALE -# define IN_LOCALE (IN_PERL_COMPILETIME ? IN_LOCALE_COMPILETIME : IN_LOCALE_RUNTIME) -#endif -#ifndef IS_NUMBER_IN_UV -# define IS_NUMBER_IN_UV 0x01 -#endif - -#ifndef IS_NUMBER_GREATER_THAN_UV_MAX -# define IS_NUMBER_GREATER_THAN_UV_MAX 0x02 -#endif - -#ifndef IS_NUMBER_NOT_INT -# define IS_NUMBER_NOT_INT 0x04 -#endif - -#ifndef IS_NUMBER_NEG -# define IS_NUMBER_NEG 0x08 -#endif - -#ifndef IS_NUMBER_INFINITY -# define IS_NUMBER_INFINITY 0x10 -#endif - -#ifndef IS_NUMBER_NAN -# define IS_NUMBER_NAN 0x20 -#endif -#ifndef GROK_NUMERIC_RADIX -# define GROK_NUMERIC_RADIX(sp, send) grok_numeric_radix(sp, send) -#endif -#ifndef PERL_SCAN_GREATER_THAN_UV_MAX -# define PERL_SCAN_GREATER_THAN_UV_MAX 0x02 -#endif - -#ifndef PERL_SCAN_SILENT_ILLDIGIT -# define PERL_SCAN_SILENT_ILLDIGIT 0x04 -#endif - -#ifndef PERL_SCAN_ALLOW_UNDERSCORES -# define PERL_SCAN_ALLOW_UNDERSCORES 0x01 -#endif - -#ifndef PERL_SCAN_DISALLOW_PREFIX -# define PERL_SCAN_DISALLOW_PREFIX 0x02 -#endif - -#ifndef grok_numeric_radix -#if defined(NEED_grok_numeric_radix) -static bool DPPP_(my_grok_numeric_radix)(pTHX_ const char ** sp, const char * send); -static -#else -extern bool DPPP_(my_grok_numeric_radix)(pTHX_ const char ** sp, const char * send); -#endif - -#ifdef grok_numeric_radix -# undef grok_numeric_radix -#endif -#define grok_numeric_radix(a,b) DPPP_(my_grok_numeric_radix)(aTHX_ a,b) -#define Perl_grok_numeric_radix DPPP_(my_grok_numeric_radix) - -#if defined(NEED_grok_numeric_radix) || defined(NEED_grok_numeric_radix_GLOBAL) -bool -DPPP_(my_grok_numeric_radix)(pTHX_ const char **sp, const char *send) -{ -#ifdef USE_LOCALE_NUMERIC -#ifdef PL_numeric_radix_sv - if (PL_numeric_radix_sv && IN_LOCALE) { - STRLEN len; - char* radix = SvPV(PL_numeric_radix_sv, len); - if (*sp + len <= send && memEQ(*sp, radix, len)) { - *sp += len; - return TRUE; - } - } -#else - /* older perls don't have PL_numeric_radix_sv so the radix - * must manually be requested from locale.h - */ -#include - dTHR; /* needed for older threaded perls */ - struct lconv *lc = localeconv(); - char *radix = lc->decimal_point; - if (radix && IN_LOCALE) { - STRLEN len = strlen(radix); - if (*sp + len <= send && memEQ(*sp, radix, len)) { - *sp += len; - return TRUE; - } - } -#endif -#endif /* USE_LOCALE_NUMERIC */ - /* always try "." if numeric radix didn't match because - * we may have data from different locales mixed */ - if (*sp < send && **sp == '.') { - ++*sp; - return TRUE; - } - return FALSE; -} -#endif -#endif - -#ifndef grok_number -#if defined(NEED_grok_number) -static int DPPP_(my_grok_number)(pTHX_ const char * pv, STRLEN len, UV * valuep); -static -#else -extern int DPPP_(my_grok_number)(pTHX_ const char * pv, STRLEN len, UV * valuep); -#endif - -#ifdef grok_number -# undef grok_number -#endif -#define grok_number(a,b,c) DPPP_(my_grok_number)(aTHX_ a,b,c) -#define Perl_grok_number DPPP_(my_grok_number) - -#if defined(NEED_grok_number) || defined(NEED_grok_number_GLOBAL) -int -DPPP_(my_grok_number)(pTHX_ const char *pv, STRLEN len, UV *valuep) -{ - const char *s = pv; - const char *send = pv + len; - const UV max_div_10 = UV_MAX / 10; - const char max_mod_10 = UV_MAX % 10; - int numtype = 0; - int sawinf = 0; - int sawnan = 0; - - while (s < send && isSPACE(*s)) - s++; - if (s == send) { - return 0; - } else if (*s == '-') { - s++; - numtype = IS_NUMBER_NEG; - } - else if (*s == '+') - s++; - - if (s == send) - return 0; - - /* next must be digit or the radix separator or beginning of infinity */ - if (isDIGIT(*s)) { - /* UVs are at least 32 bits, so the first 9 decimal digits cannot - overflow. */ - UV value = *s - '0'; - /* This construction seems to be more optimiser friendly. - (without it gcc does the isDIGIT test and the *s - '0' separately) - With it gcc on arm is managing 6 instructions (6 cycles) per digit. - In theory the optimiser could deduce how far to unroll the loop - before checking for overflow. */ - if (++s < send) { - int digit = *s - '0'; - if (digit >= 0 && digit <= 9) { - value = value * 10 + digit; - if (++s < send) { - digit = *s - '0'; - if (digit >= 0 && digit <= 9) { - value = value * 10 + digit; - if (++s < send) { - digit = *s - '0'; - if (digit >= 0 && digit <= 9) { - value = value * 10 + digit; - if (++s < send) { - digit = *s - '0'; - if (digit >= 0 && digit <= 9) { - value = value * 10 + digit; - if (++s < send) { - digit = *s - '0'; - if (digit >= 0 && digit <= 9) { - value = value * 10 + digit; - if (++s < send) { - digit = *s - '0'; - if (digit >= 0 && digit <= 9) { - value = value * 10 + digit; - if (++s < send) { - digit = *s - '0'; - if (digit >= 0 && digit <= 9) { - value = value * 10 + digit; - if (++s < send) { - digit = *s - '0'; - if (digit >= 0 && digit <= 9) { - value = value * 10 + digit; - if (++s < send) { - /* Now got 9 digits, so need to check - each time for overflow. */ - digit = *s - '0'; - while (digit >= 0 && digit <= 9 - && (value < max_div_10 - || (value == max_div_10 - && digit <= max_mod_10))) { - value = value * 10 + digit; - if (++s < send) - digit = *s - '0'; - else - break; - } - if (digit >= 0 && digit <= 9 - && (s < send)) { - /* value overflowed. - skip the remaining digits, don't - worry about setting *valuep. */ - do { - s++; - } while (s < send && isDIGIT(*s)); - numtype |= - IS_NUMBER_GREATER_THAN_UV_MAX; - goto skip_value; - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - numtype |= IS_NUMBER_IN_UV; - if (valuep) - *valuep = value; - - skip_value: - if (GROK_NUMERIC_RADIX(&s, send)) { - numtype |= IS_NUMBER_NOT_INT; - while (s < send && isDIGIT(*s)) /* optional digits after the radix */ - s++; - } - } - else if (GROK_NUMERIC_RADIX(&s, send)) { - numtype |= IS_NUMBER_NOT_INT | IS_NUMBER_IN_UV; /* valuep assigned below */ - /* no digits before the radix means we need digits after it */ - if (s < send && isDIGIT(*s)) { - do { - s++; - } while (s < send && isDIGIT(*s)); - if (valuep) { - /* integer approximation is valid - it's 0. */ - *valuep = 0; - } - } - else - return 0; - } else if (*s == 'I' || *s == 'i') { - s++; if (s == send || (*s != 'N' && *s != 'n')) return 0; - s++; if (s == send || (*s != 'F' && *s != 'f')) return 0; - s++; if (s < send && (*s == 'I' || *s == 'i')) { - s++; if (s == send || (*s != 'N' && *s != 'n')) return 0; - s++; if (s == send || (*s != 'I' && *s != 'i')) return 0; - s++; if (s == send || (*s != 'T' && *s != 't')) return 0; - s++; if (s == send || (*s != 'Y' && *s != 'y')) return 0; - s++; - } - sawinf = 1; - } else if (*s == 'N' || *s == 'n') { - /* XXX TODO: There are signaling NaNs and quiet NaNs. */ - s++; if (s == send || (*s != 'A' && *s != 'a')) return 0; - s++; if (s == send || (*s != 'N' && *s != 'n')) return 0; - s++; - sawnan = 1; - } else - return 0; - - if (sawinf) { - numtype &= IS_NUMBER_NEG; /* Keep track of sign */ - numtype |= IS_NUMBER_INFINITY | IS_NUMBER_NOT_INT; - } else if (sawnan) { - numtype &= IS_NUMBER_NEG; /* Keep track of sign */ - numtype |= IS_NUMBER_NAN | IS_NUMBER_NOT_INT; - } else if (s < send) { - /* we can have an optional exponent part */ - if (*s == 'e' || *s == 'E') { - /* The only flag we keep is sign. Blow away any "it's UV" */ - numtype &= IS_NUMBER_NEG; - numtype |= IS_NUMBER_NOT_INT; - s++; - if (s < send && (*s == '-' || *s == '+')) - s++; - if (s < send && isDIGIT(*s)) { - do { - s++; - } while (s < send && isDIGIT(*s)); - } - else - return 0; - } - } - while (s < send && isSPACE(*s)) - s++; - if (s >= send) - return numtype; - if (len == 10 && memEQ(pv, "0 but true", 10)) { - if (valuep) - *valuep = 0; - return IS_NUMBER_IN_UV; - } - return 0; -} -#endif -#endif - -/* - * The grok_* routines have been modified to use warn() instead of - * Perl_warner(). Also, 'hexdigit' was the former name of PL_hexdigit, - * which is why the stack variable has been renamed to 'xdigit'. - */ - -#ifndef grok_bin -#if defined(NEED_grok_bin) -static UV DPPP_(my_grok_bin)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result); -static -#else -extern UV DPPP_(my_grok_bin)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result); -#endif - -#ifdef grok_bin -# undef grok_bin -#endif -#define grok_bin(a,b,c,d) DPPP_(my_grok_bin)(aTHX_ a,b,c,d) -#define Perl_grok_bin DPPP_(my_grok_bin) - -#if defined(NEED_grok_bin) || defined(NEED_grok_bin_GLOBAL) -UV -DPPP_(my_grok_bin)(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) -{ - const char *s = start; - STRLEN len = *len_p; - UV value = 0; - NV value_nv = 0; - - const UV max_div_2 = UV_MAX / 2; - bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES; - bool overflowed = FALSE; - - if (!(*flags & PERL_SCAN_DISALLOW_PREFIX)) { - /* strip off leading b or 0b. - for compatibility silently suffer "b" and "0b" as valid binary - numbers. */ - if (len >= 1) { - if (s[0] == 'b') { - s++; - len--; - } - else if (len >= 2 && s[0] == '0' && s[1] == 'b') { - s+=2; - len-=2; - } - } - } - - for (; len-- && *s; s++) { - char bit = *s; - if (bit == '0' || bit == '1') { - /* Write it in this wonky order with a goto to attempt to get the - compiler to make the common case integer-only loop pretty tight. - With gcc seems to be much straighter code than old scan_bin. */ - redo: - if (!overflowed) { - if (value <= max_div_2) { - value = (value << 1) | (bit - '0'); - continue; - } - /* Bah. We're just overflowed. */ - warn("Integer overflow in binary number"); - overflowed = TRUE; - value_nv = (NV) value; - } - value_nv *= 2.0; - /* If an NV has not enough bits in its mantissa to - * represent a UV this summing of small low-order numbers - * is a waste of time (because the NV cannot preserve - * the low-order bits anyway): we could just remember when - * did we overflow and in the end just multiply value_nv by the - * right amount. */ - value_nv += (NV)(bit - '0'); - continue; - } - if (bit == '_' && len && allow_underscores && (bit = s[1]) - && (bit == '0' || bit == '1')) - { - --len; - ++s; - goto redo; - } - if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT)) - warn("Illegal binary digit '%c' ignored", *s); - break; - } - - if ( ( overflowed && value_nv > 4294967295.0) -#if UVSIZE > 4 - || (!overflowed && value > 0xffffffff ) -#endif - ) { - warn("Binary number > 0b11111111111111111111111111111111 non-portable"); - } - *len_p = s - start; - if (!overflowed) { - *flags = 0; - return value; - } - *flags = PERL_SCAN_GREATER_THAN_UV_MAX; - if (result) - *result = value_nv; - return UV_MAX; -} -#endif -#endif - -#ifndef grok_hex -#if defined(NEED_grok_hex) -static UV DPPP_(my_grok_hex)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result); -static -#else -extern UV DPPP_(my_grok_hex)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result); -#endif - -#ifdef grok_hex -# undef grok_hex -#endif -#define grok_hex(a,b,c,d) DPPP_(my_grok_hex)(aTHX_ a,b,c,d) -#define Perl_grok_hex DPPP_(my_grok_hex) - -#if defined(NEED_grok_hex) || defined(NEED_grok_hex_GLOBAL) -UV -DPPP_(my_grok_hex)(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) -{ - const char *s = start; - STRLEN len = *len_p; - UV value = 0; - NV value_nv = 0; - - const UV max_div_16 = UV_MAX / 16; - bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES; - bool overflowed = FALSE; - const char *xdigit; - - if (!(*flags & PERL_SCAN_DISALLOW_PREFIX)) { - /* strip off leading x or 0x. - for compatibility silently suffer "x" and "0x" as valid hex numbers. - */ - if (len >= 1) { - if (s[0] == 'x') { - s++; - len--; - } - else if (len >= 2 && s[0] == '0' && s[1] == 'x') { - s+=2; - len-=2; - } - } - } - - for (; len-- && *s; s++) { - xdigit = strchr((char *) PL_hexdigit, *s); - if (xdigit) { - /* Write it in this wonky order with a goto to attempt to get the - compiler to make the common case integer-only loop pretty tight. - With gcc seems to be much straighter code than old scan_hex. */ - redo: - if (!overflowed) { - if (value <= max_div_16) { - value = (value << 4) | ((xdigit - PL_hexdigit) & 15); - continue; - } - warn("Integer overflow in hexadecimal number"); - overflowed = TRUE; - value_nv = (NV) value; - } - value_nv *= 16.0; - /* If an NV has not enough bits in its mantissa to - * represent a UV this summing of small low-order numbers - * is a waste of time (because the NV cannot preserve - * the low-order bits anyway): we could just remember when - * did we overflow and in the end just multiply value_nv by the - * right amount of 16-tuples. */ - value_nv += (NV)((xdigit - PL_hexdigit) & 15); - continue; - } - if (*s == '_' && len && allow_underscores && s[1] - && (xdigit = strchr((char *) PL_hexdigit, s[1]))) - { - --len; - ++s; - goto redo; - } - if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT)) - warn("Illegal hexadecimal digit '%c' ignored", *s); - break; - } - - if ( ( overflowed && value_nv > 4294967295.0) -#if UVSIZE > 4 - || (!overflowed && value > 0xffffffff ) -#endif - ) { - warn("Hexadecimal number > 0xffffffff non-portable"); - } - *len_p = s - start; - if (!overflowed) { - *flags = 0; - return value; - } - *flags = PERL_SCAN_GREATER_THAN_UV_MAX; - if (result) - *result = value_nv; - return UV_MAX; -} -#endif -#endif - -#ifndef grok_oct -#if defined(NEED_grok_oct) -static UV DPPP_(my_grok_oct)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result); -static -#else -extern UV DPPP_(my_grok_oct)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result); -#endif - -#ifdef grok_oct -# undef grok_oct -#endif -#define grok_oct(a,b,c,d) DPPP_(my_grok_oct)(aTHX_ a,b,c,d) -#define Perl_grok_oct DPPP_(my_grok_oct) - -#if defined(NEED_grok_oct) || defined(NEED_grok_oct_GLOBAL) -UV -DPPP_(my_grok_oct)(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) -{ - const char *s = start; - STRLEN len = *len_p; - UV value = 0; - NV value_nv = 0; - - const UV max_div_8 = UV_MAX / 8; - bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES; - bool overflowed = FALSE; - - for (; len-- && *s; s++) { - /* gcc 2.95 optimiser not smart enough to figure that this subtraction - out front allows slicker code. */ - int digit = *s - '0'; - if (digit >= 0 && digit <= 7) { - /* Write it in this wonky order with a goto to attempt to get the - compiler to make the common case integer-only loop pretty tight. - */ - redo: - if (!overflowed) { - if (value <= max_div_8) { - value = (value << 3) | digit; - continue; - } - /* Bah. We're just overflowed. */ - warn("Integer overflow in octal number"); - overflowed = TRUE; - value_nv = (NV) value; - } - value_nv *= 8.0; - /* If an NV has not enough bits in its mantissa to - * represent a UV this summing of small low-order numbers - * is a waste of time (because the NV cannot preserve - * the low-order bits anyway): we could just remember when - * did we overflow and in the end just multiply value_nv by the - * right amount of 8-tuples. */ - value_nv += (NV)digit; - continue; - } - if (digit == ('_' - '0') && len && allow_underscores - && (digit = s[1] - '0') && (digit >= 0 && digit <= 7)) - { - --len; - ++s; - goto redo; - } - /* Allow \octal to work the DWIM way (that is, stop scanning - * as soon as non-octal characters are seen, complain only iff - * someone seems to want to use the digits eight and nine). */ - if (digit == 8 || digit == 9) { - if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT)) - warn("Illegal octal digit '%c' ignored", *s); - } - break; - } - - if ( ( overflowed && value_nv > 4294967295.0) -#if UVSIZE > 4 - || (!overflowed && value > 0xffffffff ) -#endif - ) { - warn("Octal number > 037777777777 non-portable"); - } - *len_p = s - start; - if (!overflowed) { - *flags = 0; - return value; - } - *flags = PERL_SCAN_GREATER_THAN_UV_MAX; - if (result) - *result = value_nv; - return UV_MAX; -} -#endif -#endif - -#if !defined(my_snprintf) -#if defined(NEED_my_snprintf) -static int DPPP_(my_my_snprintf)(char * buffer, const Size_t len, const char * format, ...); -static -#else -extern int DPPP_(my_my_snprintf)(char * buffer, const Size_t len, const char * format, ...); -#endif - -#define my_snprintf DPPP_(my_my_snprintf) -#define Perl_my_snprintf DPPP_(my_my_snprintf) - -#if defined(NEED_my_snprintf) || defined(NEED_my_snprintf_GLOBAL) - -int -DPPP_(my_my_snprintf)(char *buffer, const Size_t len, const char *format, ...) -{ - dTHX; - int retval; - va_list ap; - va_start(ap, format); -#ifdef HAS_VSNPRINTF - retval = vsnprintf(buffer, len, format, ap); -#else - retval = vsprintf(buffer, format, ap); -#endif - va_end(ap); - if (retval < 0 || (len > 0 && (Size_t)retval >= len)) - Perl_croak(aTHX_ "panic: my_snprintf buffer overflow"); - return retval; -} - -#endif -#endif - -#if !defined(my_sprintf) -#if defined(NEED_my_sprintf) -static int DPPP_(my_my_sprintf)(char * buffer, const char * pat, ...); -static -#else -extern int DPPP_(my_my_sprintf)(char * buffer, const char * pat, ...); -#endif - -#define my_sprintf DPPP_(my_my_sprintf) -#define Perl_my_sprintf DPPP_(my_my_sprintf) - -#if defined(NEED_my_sprintf) || defined(NEED_my_sprintf_GLOBAL) - -int -DPPP_(my_my_sprintf)(char *buffer, const char* pat, ...) -{ - va_list args; - va_start(args, pat); - vsprintf(buffer, pat, args); - va_end(args); - return strlen(buffer); -} - -#endif -#endif - -#ifdef NO_XSLOCKS -# ifdef dJMPENV -# define dXCPT dJMPENV; int rEtV = 0 -# define XCPT_TRY_START JMPENV_PUSH(rEtV); if (rEtV == 0) -# define XCPT_TRY_END JMPENV_POP; -# define XCPT_CATCH if (rEtV != 0) -# define XCPT_RETHROW JMPENV_JUMP(rEtV) -# else -# define dXCPT Sigjmp_buf oldTOP; int rEtV = 0 -# define XCPT_TRY_START Copy(top_env, oldTOP, 1, Sigjmp_buf); rEtV = Sigsetjmp(top_env, 1); if (rEtV == 0) -# define XCPT_TRY_END Copy(oldTOP, top_env, 1, Sigjmp_buf); -# define XCPT_CATCH if (rEtV != 0) -# define XCPT_RETHROW Siglongjmp(top_env, rEtV) -# endif -#endif - -#if !defined(my_strlcat) -#if defined(NEED_my_strlcat) -static Size_t DPPP_(my_my_strlcat)(char * dst, const char * src, Size_t size); -static -#else -extern Size_t DPPP_(my_my_strlcat)(char * dst, const char * src, Size_t size); -#endif - -#define my_strlcat DPPP_(my_my_strlcat) -#define Perl_my_strlcat DPPP_(my_my_strlcat) - -#if defined(NEED_my_strlcat) || defined(NEED_my_strlcat_GLOBAL) - -Size_t -DPPP_(my_my_strlcat)(char *dst, const char *src, Size_t size) -{ - Size_t used, length, copy; - - used = strlen(dst); - length = strlen(src); - if (size > 0 && used < size - 1) { - copy = (length >= size - used) ? size - used - 1 : length; - memcpy(dst + used, src, copy); - dst[used + copy] = '\0'; - } - return used + length; -} -#endif -#endif - -#if !defined(my_strlcpy) -#if defined(NEED_my_strlcpy) -static Size_t DPPP_(my_my_strlcpy)(char * dst, const char * src, Size_t size); -static -#else -extern Size_t DPPP_(my_my_strlcpy)(char * dst, const char * src, Size_t size); -#endif - -#define my_strlcpy DPPP_(my_my_strlcpy) -#define Perl_my_strlcpy DPPP_(my_my_strlcpy) - -#if defined(NEED_my_strlcpy) || defined(NEED_my_strlcpy_GLOBAL) - -Size_t -DPPP_(my_my_strlcpy)(char *dst, const char *src, Size_t size) -{ - Size_t length, copy; - - length = strlen(src); - if (size > 0) { - copy = (length >= size) ? size - 1 : length; - memcpy(dst, src, copy); - dst[copy] = '\0'; - } - return length; -} - -#endif -#endif -#ifndef PERL_PV_ESCAPE_QUOTE -# define PERL_PV_ESCAPE_QUOTE 0x0001 -#endif - -#ifndef PERL_PV_PRETTY_QUOTE -# define PERL_PV_PRETTY_QUOTE PERL_PV_ESCAPE_QUOTE -#endif - -#ifndef PERL_PV_PRETTY_ELLIPSES -# define PERL_PV_PRETTY_ELLIPSES 0x0002 -#endif - -#ifndef PERL_PV_PRETTY_LTGT -# define PERL_PV_PRETTY_LTGT 0x0004 -#endif - -#ifndef PERL_PV_ESCAPE_FIRSTCHAR -# define PERL_PV_ESCAPE_FIRSTCHAR 0x0008 -#endif - -#ifndef PERL_PV_ESCAPE_UNI -# define PERL_PV_ESCAPE_UNI 0x0100 -#endif - -#ifndef PERL_PV_ESCAPE_UNI_DETECT -# define PERL_PV_ESCAPE_UNI_DETECT 0x0200 -#endif - -#ifndef PERL_PV_ESCAPE_ALL -# define PERL_PV_ESCAPE_ALL 0x1000 -#endif - -#ifndef PERL_PV_ESCAPE_NOBACKSLASH -# define PERL_PV_ESCAPE_NOBACKSLASH 0x2000 -#endif - -#ifndef PERL_PV_ESCAPE_NOCLEAR -# define PERL_PV_ESCAPE_NOCLEAR 0x4000 -#endif - -#ifndef PERL_PV_ESCAPE_RE -# define PERL_PV_ESCAPE_RE 0x8000 -#endif - -#ifndef PERL_PV_PRETTY_NOCLEAR -# define PERL_PV_PRETTY_NOCLEAR PERL_PV_ESCAPE_NOCLEAR -#endif -#ifndef PERL_PV_PRETTY_DUMP -# define PERL_PV_PRETTY_DUMP PERL_PV_PRETTY_ELLIPSES|PERL_PV_PRETTY_QUOTE -#endif - -#ifndef PERL_PV_PRETTY_REGPROP -# define PERL_PV_PRETTY_REGPROP PERL_PV_PRETTY_ELLIPSES|PERL_PV_PRETTY_LTGT|PERL_PV_ESCAPE_RE -#endif - -/* Hint: pv_escape - * Note that unicode functionality is only backported to - * those perl versions that support it. For older perl - * versions, the implementation will fall back to bytes. - */ - -#ifndef pv_escape -#if defined(NEED_pv_escape) -static char * DPPP_(my_pv_escape)(pTHX_ SV * dsv, char const * const str, const STRLEN count, const STRLEN max, STRLEN * const escaped, const U32 flags); -static -#else -extern char * DPPP_(my_pv_escape)(pTHX_ SV * dsv, char const * const str, const STRLEN count, const STRLEN max, STRLEN * const escaped, const U32 flags); -#endif - -#ifdef pv_escape -# undef pv_escape -#endif -#define pv_escape(a,b,c,d,e,f) DPPP_(my_pv_escape)(aTHX_ a,b,c,d,e,f) -#define Perl_pv_escape DPPP_(my_pv_escape) - -#if defined(NEED_pv_escape) || defined(NEED_pv_escape_GLOBAL) - -char * -DPPP_(my_pv_escape)(pTHX_ SV *dsv, char const * const str, - const STRLEN count, const STRLEN max, - STRLEN * const escaped, const U32 flags) -{ - const char esc = flags & PERL_PV_ESCAPE_RE ? '%' : '\\'; - const char dq = flags & PERL_PV_ESCAPE_QUOTE ? '"' : esc; - char octbuf[32] = "%123456789ABCDF"; - STRLEN wrote = 0; - STRLEN chsize = 0; - STRLEN readsize = 1; -#if defined(is_utf8_string) && defined(utf8_to_uvchr) - bool isuni = flags & PERL_PV_ESCAPE_UNI ? 1 : 0; -#endif - const char *pv = str; - const char * const end = pv + count; - octbuf[0] = esc; - - if (!(flags & PERL_PV_ESCAPE_NOCLEAR)) - sv_setpvs(dsv, ""); - -#if defined(is_utf8_string) && defined(utf8_to_uvchr) - if ((flags & PERL_PV_ESCAPE_UNI_DETECT) && is_utf8_string((U8*)pv, count)) - isuni = 1; -#endif - - for (; pv < end && (!max || wrote < max) ; pv += readsize) { - const UV u = -#if defined(is_utf8_string) && defined(utf8_to_uvchr) - isuni ? utf8_to_uvchr((U8*)pv, &readsize) : -#endif - (U8)*pv; - const U8 c = (U8)u & 0xFF; - - if (u > 255 || (flags & PERL_PV_ESCAPE_ALL)) { - if (flags & PERL_PV_ESCAPE_FIRSTCHAR) - chsize = my_snprintf(octbuf, sizeof octbuf, - "%"UVxf, u); - else - chsize = my_snprintf(octbuf, sizeof octbuf, - "%cx{%"UVxf"}", esc, u); - } else if (flags & PERL_PV_ESCAPE_NOBACKSLASH) { - chsize = 1; - } else { - if (c == dq || c == esc || !isPRINT(c)) { - chsize = 2; - switch (c) { - case '\\' : /* fallthrough */ - case '%' : if (c == esc) - octbuf[1] = esc; - else - chsize = 1; - break; - case '\v' : octbuf[1] = 'v'; break; - case '\t' : octbuf[1] = 't'; break; - case '\r' : octbuf[1] = 'r'; break; - case '\n' : octbuf[1] = 'n'; break; - case '\f' : octbuf[1] = 'f'; break; - case '"' : if (dq == '"') - octbuf[1] = '"'; - else - chsize = 1; - break; - default: chsize = my_snprintf(octbuf, sizeof octbuf, - pv < end && isDIGIT((U8)*(pv+readsize)) - ? "%c%03o" : "%c%o", esc, c); - } - } else { - chsize = 1; - } - } - if (max && wrote + chsize > max) { - break; - } else if (chsize > 1) { - sv_catpvn(dsv, octbuf, chsize); - wrote += chsize; - } else { - char tmp[2]; - my_snprintf(tmp, sizeof tmp, "%c", c); - sv_catpvn(dsv, tmp, 1); - wrote++; - } - if (flags & PERL_PV_ESCAPE_FIRSTCHAR) - break; - } - if (escaped != NULL) - *escaped= pv - str; - return SvPVX(dsv); -} - -#endif -#endif - -#ifndef pv_pretty -#if defined(NEED_pv_pretty) -static char * DPPP_(my_pv_pretty)(pTHX_ SV * dsv, char const * const str, const STRLEN count, const STRLEN max, char const * const start_color, char const * const end_color, const U32 flags); -static -#else -extern char * DPPP_(my_pv_pretty)(pTHX_ SV * dsv, char const * const str, const STRLEN count, const STRLEN max, char const * const start_color, char const * const end_color, const U32 flags); -#endif - -#ifdef pv_pretty -# undef pv_pretty -#endif -#define pv_pretty(a,b,c,d,e,f,g) DPPP_(my_pv_pretty)(aTHX_ a,b,c,d,e,f,g) -#define Perl_pv_pretty DPPP_(my_pv_pretty) - -#if defined(NEED_pv_pretty) || defined(NEED_pv_pretty_GLOBAL) - -char * -DPPP_(my_pv_pretty)(pTHX_ SV *dsv, char const * const str, const STRLEN count, - const STRLEN max, char const * const start_color, char const * const end_color, - const U32 flags) -{ - const U8 dq = (flags & PERL_PV_PRETTY_QUOTE) ? '"' : '%'; - STRLEN escaped; - - if (!(flags & PERL_PV_PRETTY_NOCLEAR)) - sv_setpvs(dsv, ""); - - if (dq == '"') - sv_catpvs(dsv, "\""); - else if (flags & PERL_PV_PRETTY_LTGT) - sv_catpvs(dsv, "<"); - - if (start_color != NULL) - sv_catpv(dsv, D_PPP_CONSTPV_ARG(start_color)); - - pv_escape(dsv, str, count, max, &escaped, flags | PERL_PV_ESCAPE_NOCLEAR); - - if (end_color != NULL) - sv_catpv(dsv, D_PPP_CONSTPV_ARG(end_color)); - - if (dq == '"') - sv_catpvs(dsv, "\""); - else if (flags & PERL_PV_PRETTY_LTGT) - sv_catpvs(dsv, ">"); - - if ((flags & PERL_PV_PRETTY_ELLIPSES) && escaped < count) - sv_catpvs(dsv, "..."); - - return SvPVX(dsv); -} - -#endif -#endif - -#ifndef pv_display -#if defined(NEED_pv_display) -static char * DPPP_(my_pv_display)(pTHX_ SV * dsv, const char * pv, STRLEN cur, STRLEN len, STRLEN pvlim); -static -#else -extern char * DPPP_(my_pv_display)(pTHX_ SV * dsv, const char * pv, STRLEN cur, STRLEN len, STRLEN pvlim); -#endif - -#ifdef pv_display -# undef pv_display -#endif -#define pv_display(a,b,c,d,e) DPPP_(my_pv_display)(aTHX_ a,b,c,d,e) -#define Perl_pv_display DPPP_(my_pv_display) - -#if defined(NEED_pv_display) || defined(NEED_pv_display_GLOBAL) - -char * -DPPP_(my_pv_display)(pTHX_ SV *dsv, const char *pv, STRLEN cur, STRLEN len, STRLEN pvlim) -{ - pv_pretty(dsv, pv, cur, pvlim, NULL, NULL, PERL_PV_PRETTY_DUMP); - if (len > cur && pv[cur] == '\0') - sv_catpvs(dsv, "\\0"); - return SvPVX(dsv); -} - -#endif -#endif - -#endif /* _P_P_PORTABILITY_H_ */ - -/* End of File ppport.h */ diff --git a/deps/Language-K20/.svn/text-base/stubs_dl.c.svn-base b/deps/Language-K20/.svn/text-base/stubs_dl.c.svn-base deleted file mode 100644 index beb4295..0000000 --- a/deps/Language-K20/.svn/text-base/stubs_dl.c.svn-base +++ /dev/null @@ -1,3 +0,0 @@ -void dlerror(){} -void dlopen(){} -void dlsym(){} diff --git a/deps/Language-K20/.svn/text-base/stubs_xs.c.svn-base b/deps/Language-K20/.svn/text-base/stubs_xs.c.svn-base deleted file mode 100644 index 0f0beb7..0000000 --- a/deps/Language-K20/.svn/text-base/stubs_xs.c.svn-base +++ /dev/null @@ -1,47 +0,0 @@ -void XAllocColor(){} -void XAllocNamedColor(){} -void XBell(){} -void XChangeProperty(){} -void XCheckMaskEvent(){} -void XClearArea(){} -void XClearWindow(){} -void XCloseDisplay(){} -void XCopyArea(){} -void XCreateFontCursor(){} -void XCreateGC(){} -void XCreatePixmap(){} -void XCreateWindow(){} -void XDefineCursor(){} -void XDestroyWindow(){} -void XDrawArc(){} -void XDrawImageString(){} -void XDrawLine(){} -void XDrawLines(){} -void XDrawRectangle(){} -void XFillArc(){} -void XFillRectangle(){} -void XFlush(){} -void XFreeFontNames(){} -void XGrabPointer(){} -void XInternAtom(){} -void XListFonts(){} -void XLoadQueryFont(){} -void XLookupString(){} -void XMapRaised(){} -void XMoveResizeWindow(){} -void XNextEvent(){} -void XOpenDisplay(){} -void XPending(){} -void XQueryPointer(){} -void XResizeWindow(){} -void XSelectInput(){} -void XSetBackground(){} -void XSetFont(){} -void XSetForeground(){} -void XSetIconName(){} -void XSetNormalHints(){} -void XStoreName(){} -void XTextWidth(){} -void XUndefineCursor(){} -void XUngrabPointer(){} -void XUnmapWindow(){} diff --git a/deps/Language-K20/Changes b/deps/Language-K20/Changes deleted file mode 100644 index 3a4f41d..0000000 --- a/deps/Language-K20/Changes +++ /dev/null @@ -1,6 +0,0 @@ -Revision history for Perl extension Language::K20. - -0.01 Thu May 28 16:42:04 2009 - - original version; created by h2xs 1.23 with options - -b 5.6.0 -n Language::K20 - diff --git a/deps/Language-K20/K20.xs b/deps/Language-K20/K20.xs deleted file mode 100644 index ed59d51..0000000 --- a/deps/Language-K20/K20.xs +++ /dev/null @@ -1,36 +0,0 @@ -#include "EXTERN.h" -#include "perl.h" -#include "XSUB.h" - -#include "ppport.h" - -#include "const-c.inc" - -#include -#include - -MODULE = Language::K20 PACKAGE = Language::K20 - -INCLUDE: const-xs.inc - -void -k20eval(x) - char* x - CODE: - cd(ksk("",0)); - - int fd = dup(fileno(stderr)); - freopen("/dev/null", "w", stderr); - K foo = ksk(x, 0); - if(foo->t != 6){ - K s = ksk("{_ssr[5:x;\"\\n\";\";\"]}",gnk(1,foo)); - printf("%s\n", KC(s)); - cd(s); - } - else if(foo->n != 0) - printf("%s error\n", (S)foo->n); - cd(foo); - dup2(fd, fileno(stderr)); - close(fd); - clearerr(stderr); - diff --git a/deps/Language-K20/MANIFEST b/deps/Language-K20/MANIFEST deleted file mode 100644 index 035467d..0000000 --- a/deps/Language-K20/MANIFEST +++ /dev/null @@ -1,10 +0,0 @@ -Changes -K20.xs -Makefile.PL -MANIFEST -ppport.h -README -t/Language-K20.t -fallback/const-c.inc -fallback/const-xs.inc -lib/Language/K20.pm diff --git a/deps/Language-K20/Makefile.PL b/deps/Language-K20/Makefile.PL deleted file mode 100644 index 769f545..0000000 --- a/deps/Language-K20/Makefile.PL +++ /dev/null @@ -1,41 +0,0 @@ -use 5.006000; -use ExtUtils::MakeMaker; -# See lib/ExtUtils/MakeMaker.pm for details of how to influence -# the contents of the Makefile that is written. -WriteMakefile( - NAME => 'Language::K20', - VERSION_FROM => 'lib/Language/K20.pm', # finds $VERSION - PREREQ_PM => {}, # e.g., Module::Name => 1.1 - ($] >= 5.005 ? ## Add these new keywords supported since 5.005 - (ABSTRACT_FROM => 'lib/Language/K20.pm', # retrieve abstract from module - AUTHOR => 'A. U. Thor ') : ()), - LIBS => ['-lm -lk20'], # e.g., '-lm' - DEFINE => '', # e.g., '-DHAVE_SOMETHING' - INC => '-I.', # e.g., '-I. -I/usr/include/other' - NEEDS_LINKING => 1, - # Un-comment this if you add C files to link with later: - OBJECT => '$(O_FILES)', # link all the C files too -); -if (eval {require ExtUtils::Constant; 1}) { - # If you edit these definitions to change the constants used by this module, - # you will need to use the generated const-c.inc and const-xs.inc - # files to replace their "fallback" counterparts before distributing your - # changes. - my @names = (qw()); - ExtUtils::Constant::WriteConstants( - NAME => 'Language::K20', - NAMES => \@names, - DEFAULT_TYPE => 'IV', - C_FILE => 'const-c.inc', - XS_FILE => 'const-xs.inc', - ); - -} -else { - use File::Copy; - use File::Spec; - foreach my $file ('const-c.inc', 'const-xs.inc') { - my $fallback = File::Spec->catfile('fallback', $file); - copy ($fallback, $file) or die "Can't copy $fallback to $file: $!"; - } -} diff --git a/deps/Language-K20/Makefile.old b/deps/Language-K20/Makefile.old deleted file mode 100644 index 27e02bf..0000000 --- a/deps/Language-K20/Makefile.old +++ /dev/null @@ -1,969 +0,0 @@ -# This Makefile is for the Language::K20 extension to perl. -# -# It was generated automatically by MakeMaker version -# 6.50 (Revision: 65000) from the contents of -# Makefile.PL. Don't edit this file, edit Makefile.PL instead. -# -# ANY CHANGES MADE HERE WILL BE LOST! -# -# MakeMaker ARGV: () -# -# MakeMaker Parameters: - -# ABSTRACT_FROM => q[lib/Language/K20.pm] -# AUTHOR => q[A. U. Thor ] -# DEFINE => q[] -# INC => q[-I.] -# LIBS => [q[-lm -lk20]] -# NAME => q[Language::K20] -# NEEDS_LINKING => q[1] -# OBJECT => q[$(O_FILES)] -# PREREQ_PM => { } -# VERSION_FROM => q[lib/Language/K20.pm] - -# --- MakeMaker post_initialize section: - - -# --- MakeMaker const_config section: - -# These definitions are from config.sh (via /usr/lib/perl/5.10/Config.pm). -# They may have been overridden via Makefile.PL or on the command line. -AR = ar -CC = cc -CCCDLFLAGS = -fPIC -CCDLFLAGS = -Wl,-E -DLEXT = so -DLSRC = dl_dlopen.xs -EXE_EXT = -FULL_AR = /usr/bin/ar -LD = cc -LDDLFLAGS = -shared -O2 -g -L/usr/local/lib -LDFLAGS = -L/usr/local/lib -LIBC = /lib/libc-2.7.so -LIB_EXT = .a -OBJ_EXT = .o -OSNAME = linux -OSVERS = 2.6.26-1-686 -RANLIB = : -SITELIBEXP = /usr/local/share/perl/5.10.0 -SITEARCHEXP = /usr/local/lib/perl/5.10.0 -SO = so -VENDORARCHEXP = /usr/lib/perl5 -VENDORLIBEXP = /usr/share/perl5 - - -# --- MakeMaker constants section: -AR_STATIC_ARGS = cr -DIRFILESEP = / -DFSEP = $(DIRFILESEP) -NAME = Language::K20 -NAME_SYM = Language_K20 -VERSION = 0.01 -VERSION_MACRO = VERSION -VERSION_SYM = 0_01 -DEFINE_VERSION = -D$(VERSION_MACRO)=\"$(VERSION)\" -XS_VERSION = 0.01 -XS_VERSION_MACRO = XS_VERSION -XS_DEFINE_VERSION = -D$(XS_VERSION_MACRO)=\"$(XS_VERSION)\" -INST_ARCHLIB = blib/arch -INST_SCRIPT = blib/script -INST_BIN = blib/bin -INST_LIB = blib/lib -INST_MAN1DIR = blib/man1 -INST_MAN3DIR = blib/man3 -MAN1EXT = 1p -MAN3EXT = 3pm -INSTALLDIRS = site -DESTDIR = -PREFIX = $(SITEPREFIX) -PERLPREFIX = /usr -SITEPREFIX = /usr/local -VENDORPREFIX = /usr -INSTALLPRIVLIB = /usr/share/perl/5.10 -DESTINSTALLPRIVLIB = $(DESTDIR)$(INSTALLPRIVLIB) -INSTALLSITELIB = /usr/local/share/perl/5.10.0 -DESTINSTALLSITELIB = $(DESTDIR)$(INSTALLSITELIB) -INSTALLVENDORLIB = /usr/share/perl5 -DESTINSTALLVENDORLIB = $(DESTDIR)$(INSTALLVENDORLIB) -INSTALLARCHLIB = /usr/lib/perl/5.10 -DESTINSTALLARCHLIB = $(DESTDIR)$(INSTALLARCHLIB) -INSTALLSITEARCH = /usr/local/lib/perl/5.10.0 -DESTINSTALLSITEARCH = $(DESTDIR)$(INSTALLSITEARCH) -INSTALLVENDORARCH = /usr/lib/perl5 -DESTINSTALLVENDORARCH = $(DESTDIR)$(INSTALLVENDORARCH) -INSTALLBIN = /usr/bin -DESTINSTALLBIN = $(DESTDIR)$(INSTALLBIN) -INSTALLSITEBIN = /usr/local/bin -DESTINSTALLSITEBIN = $(DESTDIR)$(INSTALLSITEBIN) -INSTALLVENDORBIN = /usr/bin -DESTINSTALLVENDORBIN = $(DESTDIR)$(INSTALLVENDORBIN) -INSTALLSCRIPT = /usr/bin -DESTINSTALLSCRIPT = $(DESTDIR)$(INSTALLSCRIPT) -INSTALLSITESCRIPT = /usr/local/bin -DESTINSTALLSITESCRIPT = $(DESTDIR)$(INSTALLSITESCRIPT) -INSTALLVENDORSCRIPT = /usr/bin -DESTINSTALLVENDORSCRIPT = $(DESTDIR)$(INSTALLVENDORSCRIPT) -INSTALLMAN1DIR = /usr/share/man/man1 -DESTINSTALLMAN1DIR = $(DESTDIR)$(INSTALLMAN1DIR) -INSTALLSITEMAN1DIR = /usr/local/man/man1 -DESTINSTALLSITEMAN1DIR = $(DESTDIR)$(INSTALLSITEMAN1DIR) -INSTALLVENDORMAN1DIR = /usr/share/man/man1 -DESTINSTALLVENDORMAN1DIR = $(DESTDIR)$(INSTALLVENDORMAN1DIR) -INSTALLMAN3DIR = /usr/share/man/man3 -DESTINSTALLMAN3DIR = $(DESTDIR)$(INSTALLMAN3DIR) -INSTALLSITEMAN3DIR = /usr/local/man/man3 -DESTINSTALLSITEMAN3DIR = $(DESTDIR)$(INSTALLSITEMAN3DIR) -INSTALLVENDORMAN3DIR = /usr/share/man/man3 -DESTINSTALLVENDORMAN3DIR = $(DESTDIR)$(INSTALLVENDORMAN3DIR) -PERL_LIB = /usr/share/perl/5.10 -PERL_ARCHLIB = /usr/lib/perl/5.10 -LIBPERL_A = libperl.a -FIRST_MAKEFILE = Makefile -MAKEFILE_OLD = Makefile.old -MAKE_APERL_FILE = Makefile.aperl -PERLMAINCC = $(CC) -PERL_INC = /usr/lib/perl/5.10/CORE -PERL = /usr/bin/perl -FULLPERL = /usr/bin/perl -ABSPERL = $(PERL) -PERLRUN = $(PERL) -FULLPERLRUN = $(FULLPERL) -ABSPERLRUN = $(ABSPERL) -PERLRUNINST = $(PERLRUN) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" -FULLPERLRUNINST = $(FULLPERLRUN) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" -ABSPERLRUNINST = $(ABSPERLRUN) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" -PERL_CORE = 0 -PERM_RW = 644 -PERM_RWX = 755 - -MAKEMAKER = /usr/share/perl/5.10/ExtUtils/MakeMaker.pm -MM_VERSION = 6.50 -MM_REVISION = 65000 - -# FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle). -# BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle) -# PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar) -# DLBASE = Basename part of dynamic library. May be just equal BASEEXT. -MAKE = make -FULLEXT = Language/K20 -BASEEXT = K20 -PARENT_NAME = Language -DLBASE = $(BASEEXT) -VERSION_FROM = lib/Language/K20.pm -INC = -I. -DEFINE = -OBJECT = $(O_FILES) -LDFROM = $(OBJECT) -LINKTYPE = dynamic -BOOTDEP = - -# Handy lists of source code files: -XS_FILES = K20.xs -C_FILES = K20.c \ - stubs_dl.c \ - stubs_xs.c -O_FILES = K20.o \ - stubs_dl.o \ - stubs_xs.o -H_FILES = k20.h \ - ppport.h -MAN1PODS = -MAN3PODS = lib/Language/K20.pm - -# Where is the Config information that we are using/depend on -CONFIGDEP = $(PERL_ARCHLIB)$(DFSEP)Config.pm $(PERL_INC)$(DFSEP)config.h - -# Where to build things -INST_LIBDIR = $(INST_LIB)/Language -INST_ARCHLIBDIR = $(INST_ARCHLIB)/Language - -INST_AUTODIR = $(INST_LIB)/auto/$(FULLEXT) -INST_ARCHAUTODIR = $(INST_ARCHLIB)/auto/$(FULLEXT) - -INST_STATIC = $(INST_ARCHAUTODIR)/$(BASEEXT)$(LIB_EXT) -INST_DYNAMIC = $(INST_ARCHAUTODIR)/$(DLBASE).$(DLEXT) -INST_BOOT = $(INST_ARCHAUTODIR)/$(BASEEXT).bs - -# Extra linker info -EXPORT_LIST = -PERL_ARCHIVE = -PERL_ARCHIVE_AFTER = - - -TO_INST_PM = lib/Language/K20.pm - -PM_TO_BLIB = lib/Language/K20.pm \ - blib/lib/Language/K20.pm - - -# --- MakeMaker platform_constants section: -MM_Unix_VERSION = 6.50 -PERL_MALLOC_DEF = -DPERL_EXTMALLOC_DEF -Dmalloc=Perl_malloc -Dfree=Perl_mfree -Drealloc=Perl_realloc -Dcalloc=Perl_calloc - - -# --- MakeMaker tool_autosplit section: -# Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto -AUTOSPLITFILE = $(ABSPERLRUN) -e 'use AutoSplit; autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1)' -- - - - -# --- MakeMaker tool_xsubpp section: - -XSUBPPDIR = /usr/share/perl/5.10/ExtUtils -XSUBPP = $(XSUBPPDIR)$(DFSEP)xsubpp -XSUBPPRUN = $(PERLRUN) $(XSUBPP) -XSPROTOARG = -XSUBPPDEPS = /usr/share/perl/5.10/ExtUtils/typemap $(XSUBPP) -XSUBPPARGS = -typemap /usr/share/perl/5.10/ExtUtils/typemap -XSUBPP_EXTRA_ARGS = - - -# --- MakeMaker tools_other section: -SHELL = /bin/sh -CHMOD = chmod -CP = cp -MV = mv -NOOP = $(SHELL) -c true -NOECHO = @ -RM_F = rm -f -RM_RF = rm -rf -TEST_F = test -f -TOUCH = touch -UMASK_NULL = umask 0 -DEV_NULL = > /dev/null 2>&1 -MKPATH = $(ABSPERLRUN) "-MExtUtils::Command" -e mkpath -EQUALIZE_TIMESTAMP = $(ABSPERLRUN) "-MExtUtils::Command" -e eqtime -ECHO = echo -ECHO_N = echo -n -UNINST = 0 -VERBINST = 0 -MOD_INSTALL = $(ABSPERLRUN) -MExtUtils::Install -e 'install({@ARGV}, '\''$(VERBINST)'\'', 0, '\''$(UNINST)'\'');' -- -DOC_INSTALL = $(ABSPERLRUN) "-MExtUtils::Command::MM" -e perllocal_install -UNINSTALL = $(ABSPERLRUN) "-MExtUtils::Command::MM" -e uninstall -WARN_IF_OLD_PACKLIST = $(ABSPERLRUN) "-MExtUtils::Command::MM" -e warn_if_old_packlist -MACROSTART = -MACROEND = -USEMAKEFILE = -f -FIXIN = $(PERLRUN) "-MExtUtils::MY" -e "MY->fixin(shift)" - - -# --- MakeMaker makemakerdflt section: -makemakerdflt : all - $(NOECHO) $(NOOP) - - -# --- MakeMaker dist section: -TAR = tar -TARFLAGS = cvf -ZIP = zip -ZIPFLAGS = -r -COMPRESS = gzip --best -SUFFIX = .gz -SHAR = shar -PREOP = $(NOECHO) $(NOOP) -POSTOP = $(NOECHO) $(NOOP) -TO_UNIX = $(NOECHO) $(NOOP) -CI = ci -u -RCS_LABEL = rcs -Nv$(VERSION_SYM): -q -DIST_CP = best -DIST_DEFAULT = tardist -DISTNAME = Language-K20 -DISTVNAME = Language-K20-0.01 - - -# --- MakeMaker macro section: - - -# --- MakeMaker depend section: - - -# --- MakeMaker cflags section: - -CCFLAGS = -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -OPTIMIZE = -O2 -g -PERLTYPE = -MPOLLUTE = - - -# --- MakeMaker const_loadlibs section: - -# Language::K20 might depend on some other libraries: -# See ExtUtils::Liblist for details -# -EXTRALIBS = -lk20 -LDLOADLIBS = -lm -lk20 -BSLOADLIBS = -LD_RUN_PATH = /usr/lib - - -# --- MakeMaker const_cccmd section: -CCCMD = $(CC) -c $(PASTHRU_INC) $(INC) \ - $(CCFLAGS) $(OPTIMIZE) \ - $(PERLTYPE) $(MPOLLUTE) $(DEFINE_VERSION) \ - $(XS_DEFINE_VERSION) - -# --- MakeMaker post_constants section: - - -# --- MakeMaker pasthru section: - -PASTHRU = LIBPERL_A="$(LIBPERL_A)"\ - LINKTYPE="$(LINKTYPE)"\ - OPTIMIZE="$(OPTIMIZE)"\ - PREFIX="$(PREFIX)"\ - PASTHRU_DEFINE="$(PASTHRU_DEFINE)"\ - PASTHRU_INC="$(PASTHRU_INC)" - - -# --- MakeMaker special_targets section: -.SUFFIXES : .xs .c .C .cpp .i .s .cxx .cc $(OBJ_EXT) - -.PHONY: all config static dynamic test linkext manifest blibdirs clean realclean disttest distdir - - - -# --- MakeMaker c_o section: - -.c.i: - cc -E -c $(PASTHRU_INC) $(INC) \ - $(CCFLAGS) $(OPTIMIZE) \ - $(PERLTYPE) $(MPOLLUTE) $(DEFINE_VERSION) \ - $(XS_DEFINE_VERSION) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.c > $*.i - -.c.s: - $(CCCMD) -S $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.c - -.c$(OBJ_EXT): - $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.c - -.cpp$(OBJ_EXT): - $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.cpp - -.cxx$(OBJ_EXT): - $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.cxx - -.cc$(OBJ_EXT): - $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.cc - -.C$(OBJ_EXT): - $(CCCMD) $*.C - - -# --- MakeMaker xs_c section: - -.xs.c: - $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $(XSUBPP_EXTRA_ARGS) $*.xs > $*.xsc && $(MV) $*.xsc $*.c - - -# --- MakeMaker xs_o section: - -.xs$(OBJ_EXT): - $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.xsc && $(MV) $*.xsc $*.c - $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.c - - -# --- MakeMaker top_targets section: -all :: pure_all manifypods - $(NOECHO) $(NOOP) - - -pure_all :: config pm_to_blib subdirs linkext - $(NOECHO) $(NOOP) - -subdirs :: $(MYEXTLIB) - $(NOECHO) $(NOOP) - -config :: $(FIRST_MAKEFILE) blibdirs - $(NOECHO) $(NOOP) - -$(O_FILES): $(H_FILES) - -help : - perldoc ExtUtils::MakeMaker - - -# --- MakeMaker blibdirs section: -blibdirs : $(INST_LIBDIR)$(DFSEP).exists $(INST_ARCHLIB)$(DFSEP).exists $(INST_AUTODIR)$(DFSEP).exists $(INST_ARCHAUTODIR)$(DFSEP).exists $(INST_BIN)$(DFSEP).exists $(INST_SCRIPT)$(DFSEP).exists $(INST_MAN1DIR)$(DFSEP).exists $(INST_MAN3DIR)$(DFSEP).exists - $(NOECHO) $(NOOP) - -# Backwards compat with 6.18 through 6.25 -blibdirs.ts : blibdirs - $(NOECHO) $(NOOP) - -$(INST_LIBDIR)$(DFSEP).exists :: Makefile.PL - $(NOECHO) $(MKPATH) $(INST_LIBDIR) - $(NOECHO) $(CHMOD) 755 $(INST_LIBDIR) - $(NOECHO) $(TOUCH) $(INST_LIBDIR)$(DFSEP).exists - -$(INST_ARCHLIB)$(DFSEP).exists :: Makefile.PL - $(NOECHO) $(MKPATH) $(INST_ARCHLIB) - $(NOECHO) $(CHMOD) 755 $(INST_ARCHLIB) - $(NOECHO) $(TOUCH) $(INST_ARCHLIB)$(DFSEP).exists - -$(INST_AUTODIR)$(DFSEP).exists :: Makefile.PL - $(NOECHO) $(MKPATH) $(INST_AUTODIR) - $(NOECHO) $(CHMOD) 755 $(INST_AUTODIR) - $(NOECHO) $(TOUCH) $(INST_AUTODIR)$(DFSEP).exists - -$(INST_ARCHAUTODIR)$(DFSEP).exists :: Makefile.PL - $(NOECHO) $(MKPATH) $(INST_ARCHAUTODIR) - $(NOECHO) $(CHMOD) 755 $(INST_ARCHAUTODIR) - $(NOECHO) $(TOUCH) $(INST_ARCHAUTODIR)$(DFSEP).exists - -$(INST_BIN)$(DFSEP).exists :: Makefile.PL - $(NOECHO) $(MKPATH) $(INST_BIN) - $(NOECHO) $(CHMOD) 755 $(INST_BIN) - $(NOECHO) $(TOUCH) $(INST_BIN)$(DFSEP).exists - -$(INST_SCRIPT)$(DFSEP).exists :: Makefile.PL - $(NOECHO) $(MKPATH) $(INST_SCRIPT) - $(NOECHO) $(CHMOD) 755 $(INST_SCRIPT) - $(NOECHO) $(TOUCH) $(INST_SCRIPT)$(DFSEP).exists - -$(INST_MAN1DIR)$(DFSEP).exists :: Makefile.PL - $(NOECHO) $(MKPATH) $(INST_MAN1DIR) - $(NOECHO) $(CHMOD) 755 $(INST_MAN1DIR) - $(NOECHO) $(TOUCH) $(INST_MAN1DIR)$(DFSEP).exists - -$(INST_MAN3DIR)$(DFSEP).exists :: Makefile.PL - $(NOECHO) $(MKPATH) $(INST_MAN3DIR) - $(NOECHO) $(CHMOD) 755 $(INST_MAN3DIR) - $(NOECHO) $(TOUCH) $(INST_MAN3DIR)$(DFSEP).exists - - - -# --- MakeMaker linkext section: - -linkext :: $(LINKTYPE) - $(NOECHO) $(NOOP) - - -# --- MakeMaker dlsyms section: - - -# --- MakeMaker dynamic section: - -dynamic :: $(FIRST_MAKEFILE) $(INST_DYNAMIC) $(INST_BOOT) - $(NOECHO) $(NOOP) - - -# --- MakeMaker dynamic_bs section: -BOOTSTRAP = $(BASEEXT).bs - -# As Mkbootstrap might not write a file (if none is required) -# we use touch to prevent make continually trying to remake it. -# The DynaLoader only reads a non-empty file. -$(BOOTSTRAP) : $(FIRST_MAKEFILE) $(BOOTDEP) $(INST_ARCHAUTODIR)$(DFSEP).exists - $(NOECHO) $(ECHO) "Running Mkbootstrap for $(NAME) ($(BSLOADLIBS))" - $(NOECHO) $(PERLRUN) \ - "-MExtUtils::Mkbootstrap" \ - -e "Mkbootstrap('$(BASEEXT)','$(BSLOADLIBS)');" - $(NOECHO) $(TOUCH) $@ - $(CHMOD) $(PERM_RW) $@ - -$(INST_BOOT) : $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DFSEP).exists - $(NOECHO) $(RM_RF) $@ - - $(CP) $(BOOTSTRAP) $@ - $(CHMOD) $(PERM_RW) $@ - - -# --- MakeMaker dynamic_lib section: - -# This section creates the dynamically loadable $(INST_DYNAMIC) -# from $(OBJECT) and possibly $(MYEXTLIB). -ARMAYBE = : -OTHERLDFLAGS = -INST_DYNAMIC_DEP = -INST_DYNAMIC_FIX = - -$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DFSEP).exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(PERL_ARCHIVE_AFTER) $(INST_DYNAMIC_DEP) - $(RM_F) $@ - LD_RUN_PATH="$(LD_RUN_PATH)" $(LD) $(LDDLFLAGS) $(LDFROM) $(OTHERLDFLAGS) -o $@ $(MYEXTLIB) \ - $(PERL_ARCHIVE) $(LDLOADLIBS) $(PERL_ARCHIVE_AFTER) $(EXPORT_LIST) \ - $(INST_DYNAMIC_FIX) - $(CHMOD) $(PERM_RWX) $@ - - -# --- MakeMaker static section: - -## $(INST_PM) has been moved to the all: target. -## It remains here for awhile to allow for old usage: "make static" -static :: $(FIRST_MAKEFILE) $(INST_STATIC) - $(NOECHO) $(NOOP) - - -# --- MakeMaker static_lib section: - -$(INST_STATIC) : $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)$(DFSEP).exists - $(RM_RF) $@ - $(FULL_AR) $(AR_STATIC_ARGS) $@ $(OBJECT) && $(RANLIB) $@ - $(CHMOD) $(PERM_RWX) $@ - $(NOECHO) $(ECHO) "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)/extralibs.ld - - -# --- MakeMaker manifypods section: - -POD2MAN_EXE = $(PERLRUN) "-MExtUtils::Command::MM" -e pod2man "--" -POD2MAN = $(POD2MAN_EXE) - - -manifypods : pure_all \ - lib/Language/K20.pm - $(NOECHO) $(POD2MAN) --section=3 --perm_rw=$(PERM_RW) \ - lib/Language/K20.pm $(INST_MAN3DIR)/Language::K20.$(MAN3EXT) - - - - -# --- MakeMaker processPL section: - - -# --- MakeMaker installbin section: - - -# --- MakeMaker subdirs section: - -# none - -# --- MakeMaker clean_subdirs section: -clean_subdirs : - $(NOECHO) $(NOOP) - - -# --- MakeMaker clean section: - -# Delete temporary files but do not touch installed files. We don't delete -# the Makefile here so a later make realclean still has a makefile to use. - -clean :: clean_subdirs - - $(RM_F) \ - *$(LIB_EXT) core \ - K20.c core.[0-9] \ - $(INST_ARCHAUTODIR)/extralibs.all core.[0-9][0-9] \ - $(BASEEXT).bso pm_to_blib.ts \ - core.[0-9][0-9][0-9][0-9] $(BASEEXT).x \ - $(BOOTSTRAP) perl$(EXE_EXT) \ - tmon.out *$(OBJ_EXT) \ - pm_to_blib $(INST_ARCHAUTODIR)/extralibs.ld \ - blibdirs.ts core.[0-9][0-9][0-9][0-9][0-9] \ - *perl.core core.*perl.*.? \ - $(MAKE_APERL_FILE) perl \ - $(BASEEXT).def core.[0-9][0-9][0-9] \ - mon.out lib$(BASEEXT).def \ - perlmain.c perl.exe \ - so_locations $(BASEEXT).exp - - $(RM_RF) \ - blib - - $(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD) $(DEV_NULL) - - -# --- MakeMaker realclean_subdirs section: -realclean_subdirs : - $(NOECHO) $(NOOP) - - -# --- MakeMaker realclean section: -# Delete temporary files (via clean) and also delete dist files -realclean purge :: clean realclean_subdirs - - $(RM_F) \ - $(OBJECT) $(MAKEFILE_OLD) \ - $(FIRST_MAKEFILE) - - $(RM_RF) \ - $(DISTVNAME) - - -# --- MakeMaker metafile section: -metafile : create_distdir - $(NOECHO) $(ECHO) Generating META.yml - $(NOECHO) $(ECHO) '--- #YAML:1.0' > META_new.yml - $(NOECHO) $(ECHO) 'name: Language-K20' >> META_new.yml - $(NOECHO) $(ECHO) 'version: 0.01' >> META_new.yml - $(NOECHO) $(ECHO) 'abstract: Perl extension for blah blah blah' >> META_new.yml - $(NOECHO) $(ECHO) 'author:' >> META_new.yml - $(NOECHO) $(ECHO) ' - A. U. Thor ' >> META_new.yml - $(NOECHO) $(ECHO) 'license: unknown' >> META_new.yml - $(NOECHO) $(ECHO) 'distribution_type: module' >> META_new.yml - $(NOECHO) $(ECHO) 'configure_requires:' >> META_new.yml - $(NOECHO) $(ECHO) ' ExtUtils::MakeMaker: 0' >> META_new.yml - $(NOECHO) $(ECHO) 'build_requires:' >> META_new.yml - $(NOECHO) $(ECHO) ' ExtUtils::MakeMaker: 0' >> META_new.yml - $(NOECHO) $(ECHO) 'requires: {}' >> META_new.yml - $(NOECHO) $(ECHO) 'no_index:' >> META_new.yml - $(NOECHO) $(ECHO) ' directory:' >> META_new.yml - $(NOECHO) $(ECHO) ' - t' >> META_new.yml - $(NOECHO) $(ECHO) ' - inc' >> META_new.yml - $(NOECHO) $(ECHO) 'generated_by: ExtUtils::MakeMaker version 6.50' >> META_new.yml - $(NOECHO) $(ECHO) 'meta-spec:' >> META_new.yml - $(NOECHO) $(ECHO) ' url: http://module-build.sourceforge.net/META-spec-v1.4.html' >> META_new.yml - $(NOECHO) $(ECHO) ' version: 1.4' >> META_new.yml - -$(NOECHO) $(MV) META_new.yml $(DISTVNAME)/META.yml - - -# --- MakeMaker signature section: -signature : - cpansign -s - - -# --- MakeMaker dist_basics section: -distclean :: realclean distcheck - $(NOECHO) $(NOOP) - -distcheck : - $(PERLRUN) "-MExtUtils::Manifest=fullcheck" -e fullcheck - -skipcheck : - $(PERLRUN) "-MExtUtils::Manifest=skipcheck" -e skipcheck - -manifest : - $(PERLRUN) "-MExtUtils::Manifest=mkmanifest" -e mkmanifest - -veryclean : realclean - $(RM_F) *~ */*~ *.orig */*.orig *.bak */*.bak *.old */*.old - - - -# --- MakeMaker dist_core section: - -dist : $(DIST_DEFAULT) $(FIRST_MAKEFILE) - $(NOECHO) $(ABSPERLRUN) -l -e 'print '\''Warning: Makefile possibly out of date with $(VERSION_FROM)'\''' \ - -e ' if -e '\''$(VERSION_FROM)'\'' and -M '\''$(VERSION_FROM)'\'' < -M '\''$(FIRST_MAKEFILE)'\'';' -- - -tardist : $(DISTVNAME).tar$(SUFFIX) - $(NOECHO) $(NOOP) - -uutardist : $(DISTVNAME).tar$(SUFFIX) - uuencode $(DISTVNAME).tar$(SUFFIX) $(DISTVNAME).tar$(SUFFIX) > $(DISTVNAME).tar$(SUFFIX)_uu - -$(DISTVNAME).tar$(SUFFIX) : distdir - $(PREOP) - $(TO_UNIX) - $(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME) - $(RM_RF) $(DISTVNAME) - $(COMPRESS) $(DISTVNAME).tar - $(POSTOP) - -zipdist : $(DISTVNAME).zip - $(NOECHO) $(NOOP) - -$(DISTVNAME).zip : distdir - $(PREOP) - $(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME) - $(RM_RF) $(DISTVNAME) - $(POSTOP) - -shdist : distdir - $(PREOP) - $(SHAR) $(DISTVNAME) > $(DISTVNAME).shar - $(RM_RF) $(DISTVNAME) - $(POSTOP) - - -# --- MakeMaker distdir section: -create_distdir : - $(RM_RF) $(DISTVNAME) - $(PERLRUN) "-MExtUtils::Manifest=manicopy,maniread" \ - -e "manicopy(maniread(),'$(DISTVNAME)', '$(DIST_CP)');" - -distdir : create_distdir distmeta - $(NOECHO) $(NOOP) - - - -# --- MakeMaker dist_test section: -disttest : distdir - cd $(DISTVNAME) && $(ABSPERLRUN) Makefile.PL - cd $(DISTVNAME) && $(MAKE) $(PASTHRU) - cd $(DISTVNAME) && $(MAKE) test $(PASTHRU) - - - -# --- MakeMaker dist_ci section: - -ci : - $(PERLRUN) "-MExtUtils::Manifest=maniread" \ - -e "@all = keys %{ maniread() };" \ - -e "print(qq{Executing $(CI) @all\n}); system(qq{$(CI) @all});" \ - -e "print(qq{Executing $(RCS_LABEL) ...\n}); system(qq{$(RCS_LABEL) @all});" - - -# --- MakeMaker distmeta section: -distmeta : create_distdir metafile - $(NOECHO) cd $(DISTVNAME) && $(ABSPERLRUN) -MExtUtils::Manifest=maniadd -e 'eval { maniadd({q{META.yml} => q{Module meta-data (added by MakeMaker)}}) } ' \ - -e ' or print "Could not add META.yml to MANIFEST: $${'\''@'\''}\n"' -- - - - -# --- MakeMaker distsignature section: -distsignature : create_distdir - $(NOECHO) cd $(DISTVNAME) && $(ABSPERLRUN) -MExtUtils::Manifest=maniadd -e 'eval { maniadd({q{SIGNATURE} => q{Public-key signature (added by MakeMaker)}}) } ' \ - -e ' or print "Could not add SIGNATURE to MANIFEST: $${'\''@'\''}\n"' -- - $(NOECHO) cd $(DISTVNAME) && $(TOUCH) SIGNATURE - cd $(DISTVNAME) && cpansign -s - - - -# --- MakeMaker install section: - -install :: all pure_install doc_install - $(NOECHO) $(NOOP) - -install_perl :: all pure_perl_install doc_perl_install - $(NOECHO) $(NOOP) - -install_site :: all pure_site_install doc_site_install - $(NOECHO) $(NOOP) - -install_vendor :: all pure_vendor_install doc_vendor_install - $(NOECHO) $(NOOP) - -pure_install :: pure_$(INSTALLDIRS)_install - $(NOECHO) $(NOOP) - -doc_install :: doc_$(INSTALLDIRS)_install - $(NOECHO) $(NOOP) - -pure__install : pure_site_install - $(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site - -doc__install : doc_site_install - $(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site - -pure_perl_install :: - $(NOECHO) $(MOD_INSTALL) \ - read $(PERL_ARCHLIB)/auto/$(FULLEXT)/.packlist \ - write $(DESTINSTALLARCHLIB)/auto/$(FULLEXT)/.packlist \ - $(INST_LIB) $(DESTINSTALLPRIVLIB) \ - $(INST_ARCHLIB) $(DESTINSTALLARCHLIB) \ - $(INST_BIN) $(DESTINSTALLBIN) \ - $(INST_SCRIPT) $(DESTINSTALLSCRIPT) \ - $(INST_MAN1DIR) $(DESTINSTALLMAN1DIR) \ - $(INST_MAN3DIR) $(DESTINSTALLMAN3DIR) - $(NOECHO) $(WARN_IF_OLD_PACKLIST) \ - $(SITEARCHEXP)/auto/$(FULLEXT) - - -pure_site_install :: - $(NOECHO) $(MOD_INSTALL) \ - read $(SITEARCHEXP)/auto/$(FULLEXT)/.packlist \ - write $(DESTINSTALLSITEARCH)/auto/$(FULLEXT)/.packlist \ - $(INST_LIB) $(DESTINSTALLSITELIB) \ - $(INST_ARCHLIB) $(DESTINSTALLSITEARCH) \ - $(INST_BIN) $(DESTINSTALLSITEBIN) \ - $(INST_SCRIPT) $(DESTINSTALLSITESCRIPT) \ - $(INST_MAN1DIR) $(DESTINSTALLSITEMAN1DIR) \ - $(INST_MAN3DIR) $(DESTINSTALLSITEMAN3DIR) - $(NOECHO) $(WARN_IF_OLD_PACKLIST) \ - $(PERL_ARCHLIB)/auto/$(FULLEXT) - -pure_vendor_install :: - $(NOECHO) $(MOD_INSTALL) \ - read $(VENDORARCHEXP)/auto/$(FULLEXT)/.packlist \ - write $(DESTINSTALLVENDORARCH)/auto/$(FULLEXT)/.packlist \ - $(INST_LIB) $(DESTINSTALLVENDORLIB) \ - $(INST_ARCHLIB) $(DESTINSTALLVENDORARCH) \ - $(INST_BIN) $(DESTINSTALLVENDORBIN) \ - $(INST_SCRIPT) $(DESTINSTALLVENDORSCRIPT) \ - $(INST_MAN1DIR) $(DESTINSTALLVENDORMAN1DIR) \ - $(INST_MAN3DIR) $(DESTINSTALLVENDORMAN3DIR) - -doc_perl_install :: - $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod - -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB) - -$(NOECHO) $(DOC_INSTALL) \ - "Module" "$(NAME)" \ - "installed into" "$(INSTALLPRIVLIB)" \ - LINKTYPE "$(LINKTYPE)" \ - VERSION "$(VERSION)" \ - EXE_FILES "$(EXE_FILES)" \ - >> $(DESTINSTALLARCHLIB)/perllocal.pod - -doc_site_install :: - $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod - -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB) - -$(NOECHO) $(DOC_INSTALL) \ - "Module" "$(NAME)" \ - "installed into" "$(INSTALLSITELIB)" \ - LINKTYPE "$(LINKTYPE)" \ - VERSION "$(VERSION)" \ - EXE_FILES "$(EXE_FILES)" \ - >> $(DESTINSTALLARCHLIB)/perllocal.pod - -doc_vendor_install :: - $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod - -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB) - -$(NOECHO) $(DOC_INSTALL) \ - "Module" "$(NAME)" \ - "installed into" "$(INSTALLVENDORLIB)" \ - LINKTYPE "$(LINKTYPE)" \ - VERSION "$(VERSION)" \ - EXE_FILES "$(EXE_FILES)" \ - >> $(DESTINSTALLARCHLIB)/perllocal.pod - - -uninstall :: uninstall_from_$(INSTALLDIRS)dirs - $(NOECHO) $(NOOP) - -uninstall_from_perldirs :: - $(NOECHO) $(UNINSTALL) $(PERL_ARCHLIB)/auto/$(FULLEXT)/.packlist - -uninstall_from_sitedirs :: - $(NOECHO) $(UNINSTALL) $(SITEARCHEXP)/auto/$(FULLEXT)/.packlist - -uninstall_from_vendordirs :: - $(NOECHO) $(UNINSTALL) $(VENDORARCHEXP)/auto/$(FULLEXT)/.packlist - - -# --- MakeMaker force section: -# Phony target to force checking subdirectories. -FORCE : - $(NOECHO) $(NOOP) - - -# --- MakeMaker perldepend section: - -PERL_HDRS = \ - $(PERL_INC)/EXTERN.h \ - $(PERL_INC)/INTERN.h \ - $(PERL_INC)/XSUB.h \ - $(PERL_INC)/av.h \ - $(PERL_INC)/cc_runtime.h \ - $(PERL_INC)/config.h \ - $(PERL_INC)/cop.h \ - $(PERL_INC)/cv.h \ - $(PERL_INC)/dosish.h \ - $(PERL_INC)/embed.h \ - $(PERL_INC)/embedvar.h \ - $(PERL_INC)/fakethr.h \ - $(PERL_INC)/form.h \ - $(PERL_INC)/gv.h \ - $(PERL_INC)/handy.h \ - $(PERL_INC)/hv.h \ - $(PERL_INC)/intrpvar.h \ - $(PERL_INC)/iperlsys.h \ - $(PERL_INC)/keywords.h \ - $(PERL_INC)/mg.h \ - $(PERL_INC)/nostdio.h \ - $(PERL_INC)/op.h \ - $(PERL_INC)/opcode.h \ - $(PERL_INC)/patchlevel.h \ - $(PERL_INC)/perl.h \ - $(PERL_INC)/perlio.h \ - $(PERL_INC)/perlsdio.h \ - $(PERL_INC)/perlsfio.h \ - $(PERL_INC)/perlvars.h \ - $(PERL_INC)/perly.h \ - $(PERL_INC)/pp.h \ - $(PERL_INC)/pp_proto.h \ - $(PERL_INC)/proto.h \ - $(PERL_INC)/regcomp.h \ - $(PERL_INC)/regexp.h \ - $(PERL_INC)/regnodes.h \ - $(PERL_INC)/scope.h \ - $(PERL_INC)/sv.h \ - $(PERL_INC)/thread.h \ - $(PERL_INC)/unixish.h \ - $(PERL_INC)/util.h - -$(OBJECT) : $(PERL_HDRS) - -K20.c : $(XSUBPPDEPS) - - -# --- MakeMaker makefile section: - -$(OBJECT) : $(FIRST_MAKEFILE) - -# We take a very conservative approach here, but it's worth it. -# We move Makefile to Makefile.old here to avoid gnu make looping. -$(FIRST_MAKEFILE) : Makefile.PL $(CONFIGDEP) - $(NOECHO) $(ECHO) "Makefile out-of-date with respect to $?" - $(NOECHO) $(ECHO) "Cleaning current config before rebuilding Makefile..." - -$(NOECHO) $(RM_F) $(MAKEFILE_OLD) - -$(NOECHO) $(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD) - - $(MAKE) $(USEMAKEFILE) $(MAKEFILE_OLD) clean $(DEV_NULL) - $(PERLRUN) Makefile.PL - $(NOECHO) $(ECHO) "==> Your Makefile has been rebuilt. <==" - $(NOECHO) $(ECHO) "==> Please rerun the $(MAKE) command. <==" - false - - - -# --- MakeMaker staticmake section: - -# --- MakeMaker makeaperl section --- -MAP_TARGET = perl -FULLPERL = /usr/bin/perl - -$(MAP_TARGET) :: static $(MAKE_APERL_FILE) - $(MAKE) $(USEMAKEFILE) $(MAKE_APERL_FILE) $@ - -$(MAKE_APERL_FILE) : $(FIRST_MAKEFILE) pm_to_blib - $(NOECHO) $(ECHO) Writing \"$(MAKE_APERL_FILE)\" for this $(MAP_TARGET) - $(NOECHO) $(PERLRUNINST) \ - Makefile.PL DIR= \ - MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \ - MAKEAPERL=1 NORECURS=1 CCCDLFLAGS= - - -# --- MakeMaker test section: - -TEST_VERBOSE=0 -TEST_TYPE=test_$(LINKTYPE) -TEST_FILE = test.pl -TEST_FILES = t/*.t -TESTDB_SW = -d - -testdb :: testdb_$(LINKTYPE) - -test :: $(TEST_TYPE) subdirs-test - -subdirs-test :: - $(NOECHO) $(NOOP) - - -test_dynamic :: pure_all - PERL_DL_NONLAZY=1 $(FULLPERLRUN) "-MExtUtils::Command::MM" "-e" "test_harness($(TEST_VERBOSE), '$(INST_LIB)', '$(INST_ARCHLIB)')" $(TEST_FILES) - -testdb_dynamic :: pure_all - PERL_DL_NONLAZY=1 $(FULLPERLRUN) $(TESTDB_SW) "-I$(INST_LIB)" "-I$(INST_ARCHLIB)" $(TEST_FILE) - -test_ : test_dynamic - -test_static :: pure_all $(MAP_TARGET) - PERL_DL_NONLAZY=1 ./$(MAP_TARGET) "-MExtUtils::Command::MM" "-e" "test_harness($(TEST_VERBOSE), '$(INST_LIB)', '$(INST_ARCHLIB)')" $(TEST_FILES) - -testdb_static :: pure_all $(MAP_TARGET) - PERL_DL_NONLAZY=1 ./$(MAP_TARGET) $(TESTDB_SW) "-I$(INST_LIB)" "-I$(INST_ARCHLIB)" $(TEST_FILE) - - - -# --- MakeMaker ppd section: -# Creates a PPD (Perl Package Description) for a binary distribution. -ppd : - $(NOECHO) $(ECHO) '' > $(DISTNAME).ppd - $(NOECHO) $(ECHO) ' $(DISTNAME)' >> $(DISTNAME).ppd - $(NOECHO) $(ECHO) ' Perl extension for blah blah blah' >> $(DISTNAME).ppd - $(NOECHO) $(ECHO) ' A. U. Thor <buu@>' >> $(DISTNAME).ppd - $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd - $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd - $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd - $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd - $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd - $(NOECHO) $(ECHO) '' >> $(DISTNAME).ppd - - -# --- MakeMaker pm_to_blib section: - -pm_to_blib : $(TO_INST_PM) - $(NOECHO) $(ABSPERLRUN) -MExtUtils::Install -e 'pm_to_blib({@ARGV}, '\''$(INST_LIB)/auto'\'', '\''$(PM_FILTER)'\'')' -- \ - lib/Language/K20.pm blib/lib/Language/K20.pm - $(NOECHO) $(TOUCH) pm_to_blib - - -# --- MakeMaker selfdocument section: - - -# --- MakeMaker postamble section: - - -# End. diff --git a/deps/Language-K20/README b/deps/Language-K20/README deleted file mode 100644 index 8902f8b..0000000 --- a/deps/Language-K20/README +++ /dev/null @@ -1,40 +0,0 @@ -Language-K20 version 0.01 -========================= - -The README is used to introduce the module and provide instructions on -how to install the module, any machine dependencies it may have (for -example C compilers and installed libraries) and any other information -that should be provided before the module is installed. - -A README file is required for CPAN modules since CPAN extracts the -README file from a module distribution so that people browsing the -archive can use it get an idea of the modules uses. It is usually a -good idea to provide version information here so that people can -decide whether fixes for the module are worth downloading. - -INSTALLATION - -To install this module type the following: - - perl Makefile.PL - make - make test - make install - -DEPENDENCIES - -This module requires these other modules and libraries: - - blah blah blah - -COPYRIGHT AND LICENCE - -Put the correct copyright and licence information here. - -Copyright (C) 2009 by A. U. Thor - -This library is free software; you can redistribute it and/or modify -it under the same terms as Perl itself, either Perl version 5.10.0 or, -at your option, any later version of Perl 5 you may have available. - - diff --git a/deps/Language-K20/const-c.inc b/deps/Language-K20/const-c.inc deleted file mode 100644 index 380f16e..0000000 --- a/deps/Language-K20/const-c.inc +++ /dev/null @@ -1,55 +0,0 @@ -#define PERL_constant_NOTFOUND 1 -#define PERL_constant_NOTDEF 2 -#define PERL_constant_ISIV 3 -#define PERL_constant_ISNO 4 -#define PERL_constant_ISNV 5 -#define PERL_constant_ISPV 6 -#define PERL_constant_ISPVN 7 -#define PERL_constant_ISSV 8 -#define PERL_constant_ISUNDEF 9 -#define PERL_constant_ISUV 10 -#define PERL_constant_ISYES 11 - -#ifndef NVTYPE -typedef double NV; /* 5.6 and later define NVTYPE, and typedef NV to it. */ -#endif -#ifndef aTHX_ -#define aTHX_ /* 5.6 or later define this for threading support. */ -#endif -#ifndef pTHX_ -#define pTHX_ /* 5.6 or later define this for threading support. */ -#endif - -static int -constant (pTHX_ const char *name, STRLEN len) { - /* Initially switch on the length of the name. */ - /* When generated this function returned values for the list of names given - in this section of perl code. Rather than manually editing these functions - to add or remove constants, which would result in this comment and section - of code becoming inaccurate, we recommend that you edit this section of - code, and use it to regenerate a new set of constant functions which you - then use to replace the originals. - - Regenerate these constant functions by feeding this entire source file to - perl -x - -#!/usr/bin/perl -w -use ExtUtils::Constant qw (constant_types C_constant XS_constant); - -my $types = {map {($_, 1)} qw()}; -my @names = (qw()); - -print constant_types(), "\n"; # macro defs -foreach (C_constant ("Language::K20", 'constant', 'IV', $types, undef, 3, @names) ) { - print $_, "\n"; # C constant subs -} -print "\n#### XS Section:\n"; -print XS_constant ("Language::K20", $types); -__END__ - */ - - switch (len) { - } - return PERL_constant_NOTFOUND; -} - diff --git a/deps/Language-K20/const-xs.inc b/deps/Language-K20/const-xs.inc deleted file mode 100644 index 4a2151f..0000000 --- a/deps/Language-K20/const-xs.inc +++ /dev/null @@ -1,89 +0,0 @@ -void -constant(sv) - PREINIT: -#ifdef dXSTARG - dXSTARG; /* Faster if we have it. */ -#else - dTARGET; -#endif - STRLEN len; - int type; - /* IV iv; Uncomment this if you need to return IVs */ - /* NV nv; Uncomment this if you need to return NVs */ - /* const char *pv; Uncomment this if you need to return PVs */ - INPUT: - SV * sv; - const char * s = SvPV(sv, len); - PPCODE: - type = constant(aTHX_ s, len); - /* Return 1 or 2 items. First is error message, or undef if no error. - Second, if present, is found value */ - switch (type) { - case PERL_constant_NOTFOUND: - sv = - sv_2mortal(newSVpvf("%s is not a valid Language::K20 macro", s)); - PUSHs(sv); - break; - case PERL_constant_NOTDEF: - sv = sv_2mortal(newSVpvf( - "Your vendor has not defined Language::K20 macro %s, used", - s)); - PUSHs(sv); - break; - /* Uncomment this if you need to return IVs - case PERL_constant_ISIV: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHi(iv); - break; */ - /* Uncomment this if you need to return NOs - case PERL_constant_ISNO: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHs(&PL_sv_no); - break; */ - /* Uncomment this if you need to return NVs - case PERL_constant_ISNV: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHn(nv); - break; */ - /* Uncomment this if you need to return PVs - case PERL_constant_ISPV: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHp(pv, strlen(pv)); - break; */ - /* Uncomment this if you need to return PVNs - case PERL_constant_ISPVN: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHp(pv, iv); - break; */ - /* Uncomment this if you need to return SVs - case PERL_constant_ISSV: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHs(sv); - break; */ - /* Uncomment this if you need to return UNDEFs - case PERL_constant_ISUNDEF: - break; */ - /* Uncomment this if you need to return UVs - case PERL_constant_ISUV: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHu((UV)iv); - break; */ - /* Uncomment this if you need to return YESs - case PERL_constant_ISYES: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHs(&PL_sv_yes); - break; */ - default: - sv = sv_2mortal(newSVpvf( - "Unexpected return type %d while processing Language::K20 macro %s, used", - type, s)); - PUSHs(sv); - } diff --git a/deps/Language-K20/fallback/.svn/entries b/deps/Language-K20/fallback/.svn/entries deleted file mode 100644 index c9d5660..0000000 --- a/deps/Language-K20/fallback/.svn/entries +++ /dev/null @@ -1,96 +0,0 @@ -10 - -dir -475 -svn://erxz.com/bb3/branches/perlbuut/deps/Language-K20/fallback -svn://erxz.com/bb3 - - - -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - -dcb1cea6-7f7e-4c78-8a22-148ace8ce36e - -const-xs.inc -file - - - - -2009-10-03T22:54:20.000000Z -13caaef5933aaecf0dafdb6d7d44739f -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -2652 - -const-c.inc -file - - - - -2009-10-03T22:54:20.000000Z -24b4de74e5952209b3583056bb92ef17 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -1711 - diff --git a/deps/Language-K20/fallback/.svn/text-base/const-c.inc.svn-base b/deps/Language-K20/fallback/.svn/text-base/const-c.inc.svn-base deleted file mode 100644 index 380f16e..0000000 --- a/deps/Language-K20/fallback/.svn/text-base/const-c.inc.svn-base +++ /dev/null @@ -1,55 +0,0 @@ -#define PERL_constant_NOTFOUND 1 -#define PERL_constant_NOTDEF 2 -#define PERL_constant_ISIV 3 -#define PERL_constant_ISNO 4 -#define PERL_constant_ISNV 5 -#define PERL_constant_ISPV 6 -#define PERL_constant_ISPVN 7 -#define PERL_constant_ISSV 8 -#define PERL_constant_ISUNDEF 9 -#define PERL_constant_ISUV 10 -#define PERL_constant_ISYES 11 - -#ifndef NVTYPE -typedef double NV; /* 5.6 and later define NVTYPE, and typedef NV to it. */ -#endif -#ifndef aTHX_ -#define aTHX_ /* 5.6 or later define this for threading support. */ -#endif -#ifndef pTHX_ -#define pTHX_ /* 5.6 or later define this for threading support. */ -#endif - -static int -constant (pTHX_ const char *name, STRLEN len) { - /* Initially switch on the length of the name. */ - /* When generated this function returned values for the list of names given - in this section of perl code. Rather than manually editing these functions - to add or remove constants, which would result in this comment and section - of code becoming inaccurate, we recommend that you edit this section of - code, and use it to regenerate a new set of constant functions which you - then use to replace the originals. - - Regenerate these constant functions by feeding this entire source file to - perl -x - -#!/usr/bin/perl -w -use ExtUtils::Constant qw (constant_types C_constant XS_constant); - -my $types = {map {($_, 1)} qw()}; -my @names = (qw()); - -print constant_types(), "\n"; # macro defs -foreach (C_constant ("Language::K20", 'constant', 'IV', $types, undef, 3, @names) ) { - print $_, "\n"; # C constant subs -} -print "\n#### XS Section:\n"; -print XS_constant ("Language::K20", $types); -__END__ - */ - - switch (len) { - } - return PERL_constant_NOTFOUND; -} - diff --git a/deps/Language-K20/fallback/.svn/text-base/const-xs.inc.svn-base b/deps/Language-K20/fallback/.svn/text-base/const-xs.inc.svn-base deleted file mode 100644 index 4a2151f..0000000 --- a/deps/Language-K20/fallback/.svn/text-base/const-xs.inc.svn-base +++ /dev/null @@ -1,89 +0,0 @@ -void -constant(sv) - PREINIT: -#ifdef dXSTARG - dXSTARG; /* Faster if we have it. */ -#else - dTARGET; -#endif - STRLEN len; - int type; - /* IV iv; Uncomment this if you need to return IVs */ - /* NV nv; Uncomment this if you need to return NVs */ - /* const char *pv; Uncomment this if you need to return PVs */ - INPUT: - SV * sv; - const char * s = SvPV(sv, len); - PPCODE: - type = constant(aTHX_ s, len); - /* Return 1 or 2 items. First is error message, or undef if no error. - Second, if present, is found value */ - switch (type) { - case PERL_constant_NOTFOUND: - sv = - sv_2mortal(newSVpvf("%s is not a valid Language::K20 macro", s)); - PUSHs(sv); - break; - case PERL_constant_NOTDEF: - sv = sv_2mortal(newSVpvf( - "Your vendor has not defined Language::K20 macro %s, used", - s)); - PUSHs(sv); - break; - /* Uncomment this if you need to return IVs - case PERL_constant_ISIV: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHi(iv); - break; */ - /* Uncomment this if you need to return NOs - case PERL_constant_ISNO: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHs(&PL_sv_no); - break; */ - /* Uncomment this if you need to return NVs - case PERL_constant_ISNV: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHn(nv); - break; */ - /* Uncomment this if you need to return PVs - case PERL_constant_ISPV: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHp(pv, strlen(pv)); - break; */ - /* Uncomment this if you need to return PVNs - case PERL_constant_ISPVN: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHp(pv, iv); - break; */ - /* Uncomment this if you need to return SVs - case PERL_constant_ISSV: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHs(sv); - break; */ - /* Uncomment this if you need to return UNDEFs - case PERL_constant_ISUNDEF: - break; */ - /* Uncomment this if you need to return UVs - case PERL_constant_ISUV: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHu((UV)iv); - break; */ - /* Uncomment this if you need to return YESs - case PERL_constant_ISYES: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHs(&PL_sv_yes); - break; */ - default: - sv = sv_2mortal(newSVpvf( - "Unexpected return type %d while processing Language::K20 macro %s, used", - type, s)); - PUSHs(sv); - } diff --git a/deps/Language-K20/fallback/const-c.inc b/deps/Language-K20/fallback/const-c.inc deleted file mode 100644 index 380f16e..0000000 --- a/deps/Language-K20/fallback/const-c.inc +++ /dev/null @@ -1,55 +0,0 @@ -#define PERL_constant_NOTFOUND 1 -#define PERL_constant_NOTDEF 2 -#define PERL_constant_ISIV 3 -#define PERL_constant_ISNO 4 -#define PERL_constant_ISNV 5 -#define PERL_constant_ISPV 6 -#define PERL_constant_ISPVN 7 -#define PERL_constant_ISSV 8 -#define PERL_constant_ISUNDEF 9 -#define PERL_constant_ISUV 10 -#define PERL_constant_ISYES 11 - -#ifndef NVTYPE -typedef double NV; /* 5.6 and later define NVTYPE, and typedef NV to it. */ -#endif -#ifndef aTHX_ -#define aTHX_ /* 5.6 or later define this for threading support. */ -#endif -#ifndef pTHX_ -#define pTHX_ /* 5.6 or later define this for threading support. */ -#endif - -static int -constant (pTHX_ const char *name, STRLEN len) { - /* Initially switch on the length of the name. */ - /* When generated this function returned values for the list of names given - in this section of perl code. Rather than manually editing these functions - to add or remove constants, which would result in this comment and section - of code becoming inaccurate, we recommend that you edit this section of - code, and use it to regenerate a new set of constant functions which you - then use to replace the originals. - - Regenerate these constant functions by feeding this entire source file to - perl -x - -#!/usr/bin/perl -w -use ExtUtils::Constant qw (constant_types C_constant XS_constant); - -my $types = {map {($_, 1)} qw()}; -my @names = (qw()); - -print constant_types(), "\n"; # macro defs -foreach (C_constant ("Language::K20", 'constant', 'IV', $types, undef, 3, @names) ) { - print $_, "\n"; # C constant subs -} -print "\n#### XS Section:\n"; -print XS_constant ("Language::K20", $types); -__END__ - */ - - switch (len) { - } - return PERL_constant_NOTFOUND; -} - diff --git a/deps/Language-K20/fallback/const-xs.inc b/deps/Language-K20/fallback/const-xs.inc deleted file mode 100644 index 4a2151f..0000000 --- a/deps/Language-K20/fallback/const-xs.inc +++ /dev/null @@ -1,89 +0,0 @@ -void -constant(sv) - PREINIT: -#ifdef dXSTARG - dXSTARG; /* Faster if we have it. */ -#else - dTARGET; -#endif - STRLEN len; - int type; - /* IV iv; Uncomment this if you need to return IVs */ - /* NV nv; Uncomment this if you need to return NVs */ - /* const char *pv; Uncomment this if you need to return PVs */ - INPUT: - SV * sv; - const char * s = SvPV(sv, len); - PPCODE: - type = constant(aTHX_ s, len); - /* Return 1 or 2 items. First is error message, or undef if no error. - Second, if present, is found value */ - switch (type) { - case PERL_constant_NOTFOUND: - sv = - sv_2mortal(newSVpvf("%s is not a valid Language::K20 macro", s)); - PUSHs(sv); - break; - case PERL_constant_NOTDEF: - sv = sv_2mortal(newSVpvf( - "Your vendor has not defined Language::K20 macro %s, used", - s)); - PUSHs(sv); - break; - /* Uncomment this if you need to return IVs - case PERL_constant_ISIV: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHi(iv); - break; */ - /* Uncomment this if you need to return NOs - case PERL_constant_ISNO: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHs(&PL_sv_no); - break; */ - /* Uncomment this if you need to return NVs - case PERL_constant_ISNV: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHn(nv); - break; */ - /* Uncomment this if you need to return PVs - case PERL_constant_ISPV: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHp(pv, strlen(pv)); - break; */ - /* Uncomment this if you need to return PVNs - case PERL_constant_ISPVN: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHp(pv, iv); - break; */ - /* Uncomment this if you need to return SVs - case PERL_constant_ISSV: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHs(sv); - break; */ - /* Uncomment this if you need to return UNDEFs - case PERL_constant_ISUNDEF: - break; */ - /* Uncomment this if you need to return UVs - case PERL_constant_ISUV: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHu((UV)iv); - break; */ - /* Uncomment this if you need to return YESs - case PERL_constant_ISYES: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHs(&PL_sv_yes); - break; */ - default: - sv = sv_2mortal(newSVpvf( - "Unexpected return type %d while processing Language::K20 macro %s, used", - type, s)); - PUSHs(sv); - } diff --git a/deps/Language-K20/k20.h b/deps/Language-K20/k20.h deleted file mode 100644 index acf7cd7..0000000 --- a/deps/Language-K20/k20.h +++ /dev/null @@ -1,69 +0,0 @@ -/* K(f:obj 2:("f";2)) call C(K f(K x,K y){}) MAX 7 args*/ -#define R return -#define O printf -#define Z static -#define DO(n,x) {I i=0,_i=(n);for(;i<_i;++i){x;}} -typedef int I;typedef double F;typedef char C;typedef C*S;typedef unsigned char UC; -typedef struct k0{I c,t,n;struct k0*k[1];}*K; - -/* atom accessors, e.g. Ki(x)=2 */ -#define Ki(x) ((x)->n) -#define Kf(x) (*KF(x)) -#define Kc(x) (*(UC*)&(x)->n) -#define Ks(x) (*(S*)&(x)->n) - -/* list accessors, e.g. KF(x)[i]=2.0 */ -#define KI(x) ((I*)((x)->k)) -#define KF(x) ((F*)((x)->k)) -#define KC(x) ((UC*)((x)->k)) -#define KS(x) ((S*)((x)->k)) -#define KK(x) ((K*)((x)->k)) - -#ifdef __cplusplus -extern "C" { -#endif - -extern S sp(S); /* symbol from phrase */ - -/* atom generators, e.g. gi(2),gf(2.0),gc('2'),gs(sp("2")) */ -extern K gi(I),gf(F),gc(C),gs(S),gn(void); - -/* list generator (t as in 4::), e.g. gtn(-1,9) integer vector */ -extern K gtn(I t,I n); - -/* phrase (-3=4::) generators, e.g. gp("asdf");C*s;gpn(s,4); */ -extern K gp(S),gpn(S,I); - -/* error, e.g. if(x->t!=-1)return kerr("need integer vector");*/ -extern K kerr(S),gsk(S,K),gnk(I,...),ci(K),ksk(S,K),kap(K*,void*); -extern I cd(K),jd(I),dj(I),scd(I),sdf(I,I(*)(void)),sfn(S,K(*)(void),I); - -#ifdef __cplusplus -} -#endif - -/* e.g. -load function(s) from a.c - -#include "k20.h" -K f(K x,K y){return gi(Ki(x)+Ki(y));} // add 2 integers -K g(K x){return gf(Kf(x)+1);} // add 1 to float -... - -LINUX(dlopen): cc -shared a.c -o a.so - -in k, - f:"[path]/a"2:("f";2) - g:"[path]/a"2:("g";1) - - f[2;3] -5 - g[2.3] -3.3 - -FILES: .l(k binary) 16 byte header: -3 1 type count -types -1(int) -2(float) -3(byte) can be mapped as is. -syms are null terminated. - -*/ - diff --git a/deps/Language-K20/lib/.svn/entries b/deps/Language-K20/lib/.svn/entries deleted file mode 100644 index 382707b..0000000 --- a/deps/Language-K20/lib/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -475 -svn://erxz.com/bb3/branches/perlbuut/deps/Language-K20/lib -svn://erxz.com/bb3 - - - -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - -dcb1cea6-7f7e-4c78-8a22-148ace8ce36e - -Language -dir - diff --git a/deps/Language-K20/lib/Language/.svn/entries b/deps/Language-K20/lib/Language/.svn/entries deleted file mode 100644 index 91f0c6e..0000000 --- a/deps/Language-K20/lib/Language/.svn/entries +++ /dev/null @@ -1,62 +0,0 @@ -10 - -dir -475 -svn://erxz.com/bb3/branches/perlbuut/deps/Language-K20/lib/Language -svn://erxz.com/bb3 - - - -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - -dcb1cea6-7f7e-4c78-8a22-148ace8ce36e - -K20.pm -file - - - - -2009-10-03T22:54:20.000000Z -546c7f32b4b9748235c153e40962d4d9 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -2475 - diff --git a/deps/Language-K20/lib/Language/.svn/text-base/K20.pm.svn-base b/deps/Language-K20/lib/Language/.svn/text-base/K20.pm.svn-base deleted file mode 100644 index b38d468..0000000 --- a/deps/Language-K20/lib/Language/.svn/text-base/K20.pm.svn-base +++ /dev/null @@ -1,113 +0,0 @@ -package Language::K20; - -use 5.006000; -use strict; -use warnings; -use Carp; - -require Exporter; -use AutoLoader; - -our @ISA = qw(Exporter); - -# Items to export into callers namespace by default. Note: do not export -# names by default without a very good reason. Use EXPORT_OK instead. -# Do not simply export all your public functions/methods/constants. - -# This allows declaration use Language::K20 ':all'; -# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK -# will save memory. -our %EXPORT_TAGS = ( 'all' => [ qw( - -) ] ); - -our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); - -our @EXPORT = qw( - -); - -our $VERSION = '0.01'; - -sub AUTOLOAD { - # This AUTOLOAD is used to 'autoload' constants from the constant() - # XS function. - - my $constname; - our $AUTOLOAD; - ($constname = $AUTOLOAD) =~ s/.*:://; - croak "&Language::K20::constant not defined" if $constname eq 'constant'; - my ($error, $val) = constant($constname); - if ($error) { croak $error; } - { - no strict 'refs'; - # Fixed between 5.005_53 and 5.005_61 -#XXX if ($] >= 5.00561) { -#XXX *$AUTOLOAD = sub () { $val }; -#XXX } -#XXX else { - *$AUTOLOAD = sub { $val }; -#XXX } - } - goto &$AUTOLOAD; -} - -require XSLoader; -XSLoader::load('Language::K20', $VERSION); - -# Preloaded methods go here. - -# Autoload methods go after =cut, and are processed by the autosplit program. - -1; -__END__ -# Below is stub documentation for your module. You'd better edit it! - -=head1 NAME - -Language::K20 - Perl extension for blah blah blah - -=head1 SYNOPSIS - - use Language::K20; - blah blah blah - -=head1 DESCRIPTION - -Stub documentation for Language::K20, created by h2xs. It looks like the -author of the extension was negligent enough to leave the stub -unedited. - -Blah blah blah. - -=head2 EXPORT - -None by default. - - - -=head1 SEE ALSO - -Mention other useful documentation such as the documentation of -related modules or operating system documentation (such as man pages -in UNIX), or any relevant external documentation such as RFCs or -standards. - -If you have a mailing list set up for your module, mention it here. - -If you have a web site set up for your module, mention it here. - -=head1 AUTHOR - -A. U. Thor, Ebuu@E - -=head1 COPYRIGHT AND LICENSE - -Copyright (C) 2009 by A. U. Thor - -This library is free software; you can redistribute it and/or modify -it under the same terms as Perl itself, either Perl version 5.10.0 or, -at your option, any later version of Perl 5 you may have available. - - -=cut diff --git a/deps/Language-K20/lib/Language/K20.pm b/deps/Language-K20/lib/Language/K20.pm deleted file mode 100644 index b38d468..0000000 --- a/deps/Language-K20/lib/Language/K20.pm +++ /dev/null @@ -1,113 +0,0 @@ -package Language::K20; - -use 5.006000; -use strict; -use warnings; -use Carp; - -require Exporter; -use AutoLoader; - -our @ISA = qw(Exporter); - -# Items to export into callers namespace by default. Note: do not export -# names by default without a very good reason. Use EXPORT_OK instead. -# Do not simply export all your public functions/methods/constants. - -# This allows declaration use Language::K20 ':all'; -# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK -# will save memory. -our %EXPORT_TAGS = ( 'all' => [ qw( - -) ] ); - -our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); - -our @EXPORT = qw( - -); - -our $VERSION = '0.01'; - -sub AUTOLOAD { - # This AUTOLOAD is used to 'autoload' constants from the constant() - # XS function. - - my $constname; - our $AUTOLOAD; - ($constname = $AUTOLOAD) =~ s/.*:://; - croak "&Language::K20::constant not defined" if $constname eq 'constant'; - my ($error, $val) = constant($constname); - if ($error) { croak $error; } - { - no strict 'refs'; - # Fixed between 5.005_53 and 5.005_61 -#XXX if ($] >= 5.00561) { -#XXX *$AUTOLOAD = sub () { $val }; -#XXX } -#XXX else { - *$AUTOLOAD = sub { $val }; -#XXX } - } - goto &$AUTOLOAD; -} - -require XSLoader; -XSLoader::load('Language::K20', $VERSION); - -# Preloaded methods go here. - -# Autoload methods go after =cut, and are processed by the autosplit program. - -1; -__END__ -# Below is stub documentation for your module. You'd better edit it! - -=head1 NAME - -Language::K20 - Perl extension for blah blah blah - -=head1 SYNOPSIS - - use Language::K20; - blah blah blah - -=head1 DESCRIPTION - -Stub documentation for Language::K20, created by h2xs. It looks like the -author of the extension was negligent enough to leave the stub -unedited. - -Blah blah blah. - -=head2 EXPORT - -None by default. - - - -=head1 SEE ALSO - -Mention other useful documentation such as the documentation of -related modules or operating system documentation (such as man pages -in UNIX), or any relevant external documentation such as RFCs or -standards. - -If you have a mailing list set up for your module, mention it here. - -If you have a web site set up for your module, mention it here. - -=head1 AUTHOR - -A. U. Thor, Ebuu@E - -=head1 COPYRIGHT AND LICENSE - -Copyright (C) 2009 by A. U. Thor - -This library is free software; you can redistribute it and/or modify -it under the same terms as Perl itself, either Perl version 5.10.0 or, -at your option, any later version of Perl 5 you may have available. - - -=cut diff --git a/deps/Language-K20/ppport.h b/deps/Language-K20/ppport.h deleted file mode 100644 index 3e3d52f..0000000 --- a/deps/Language-K20/ppport.h +++ /dev/null @@ -1,6984 +0,0 @@ -#if 0 -<<'SKIP'; -#endif -/* ----------------------------------------------------------------------- - - ppport.h -- Perl/Pollution/Portability Version 3.17 - - Automatically created by Devel::PPPort running under perl 5.010000. - - Do NOT edit this file directly! -- Edit PPPort_pm.PL and the - includes in parts/inc/ instead. - - Use 'perldoc ppport.h' to view the documentation below. - ----------------------------------------------------------------------- - -SKIP - -=pod - -=head1 NAME - -ppport.h - Perl/Pollution/Portability version 3.17 - -=head1 SYNOPSIS - - perl ppport.h [options] [source files] - - Searches current directory for files if no [source files] are given - - --help show short help - - --version show version - - --patch=file write one patch file with changes - --copy=suffix write changed copies with suffix - --diff=program use diff program and options - - --compat-version=version provide compatibility with Perl version - --cplusplus accept C++ comments - - --quiet don't output anything except fatal errors - --nodiag don't show diagnostics - --nohints don't show hints - --nochanges don't suggest changes - --nofilter don't filter input files - - --strip strip all script and doc functionality from - ppport.h - - --list-provided list provided API - --list-unsupported list unsupported API - --api-info=name show Perl API portability information - -=head1 COMPATIBILITY - -This version of F is designed to support operation with Perl -installations back to 5.003, and has been tested up to 5.10.0. - -=head1 OPTIONS - -=head2 --help - -Display a brief usage summary. - -=head2 --version - -Display the version of F. - -=head2 --patch=I - -If this option is given, a single patch file will be created if -any changes are suggested. This requires a working diff program -to be installed on your system. - -=head2 --copy=I - -If this option is given, a copy of each file will be saved with -the given suffix that contains the suggested changes. This does -not require any external programs. Note that this does not -automagially add a dot between the original filename and the -suffix. If you want the dot, you have to include it in the option -argument. - -If neither C<--patch> or C<--copy> are given, the default is to -simply print the diffs for each file. This requires either -C or a C program to be installed. - -=head2 --diff=I - -Manually set the diff program and options to use. The default -is to use C, when installed, and output unified -context diffs. - -=head2 --compat-version=I - -Tell F to check for compatibility with the given -Perl version. The default is to check for compatibility with Perl -version 5.003. You can use this option to reduce the output -of F if you intend to be backward compatible only -down to a certain Perl version. - -=head2 --cplusplus - -Usually, F will detect C++ style comments and -replace them with C style comments for portability reasons. -Using this option instructs F to leave C++ -comments untouched. - -=head2 --quiet - -Be quiet. Don't print anything except fatal errors. - -=head2 --nodiag - -Don't output any diagnostic messages. Only portability -alerts will be printed. - -=head2 --nohints - -Don't output any hints. Hints often contain useful portability -notes. Warnings will still be displayed. - -=head2 --nochanges - -Don't suggest any changes. Only give diagnostic output and hints -unless these are also deactivated. - -=head2 --nofilter - -Don't filter the list of input files. By default, files not looking -like source code (i.e. not *.xs, *.c, *.cc, *.cpp or *.h) are skipped. - -=head2 --strip - -Strip all script and documentation functionality from F. -This reduces the size of F dramatically and may be useful -if you want to include F in smaller modules without -increasing their distribution size too much. - -The stripped F will have a C<--unstrip> option that allows -you to undo the stripping, but only if an appropriate C -module is installed. - -=head2 --list-provided - -Lists the API elements for which compatibility is provided by -F. Also lists if it must be explicitly requested, -if it has dependencies, and if there are hints or warnings for it. - -=head2 --list-unsupported - -Lists the API elements that are known not to be supported by -F and below which version of Perl they probably -won't be available or work. - -=head2 --api-info=I - -Show portability information for API elements matching I. -If I is surrounded by slashes, it is interpreted as a regular -expression. - -=head1 DESCRIPTION - -In order for a Perl extension (XS) module to be as portable as possible -across differing versions of Perl itself, certain steps need to be taken. - -=over 4 - -=item * - -Including this header is the first major one. This alone will give you -access to a large part of the Perl API that hasn't been available in -earlier Perl releases. Use - - perl ppport.h --list-provided - -to see which API elements are provided by ppport.h. - -=item * - -You should avoid using deprecated parts of the API. For example, using -global Perl variables without the C prefix is deprecated. Also, -some API functions used to have a C prefix. Using this form is -also deprecated. You can safely use the supported API, as F -will provide wrappers for older Perl versions. - -=item * - -If you use one of a few functions or variables that were not present in -earlier versions of Perl, and that can't be provided using a macro, you -have to explicitly request support for these functions by adding one or -more C<#define>s in your source code before the inclusion of F. - -These functions or variables will be marked C in the list shown -by C<--list-provided>. - -Depending on whether you module has a single or multiple files that -use such functions or variables, you want either C or global -variants. - -For a C function or variable (used only in a single source -file), use: - - #define NEED_function - #define NEED_variable - -For a global function or variable (used in multiple source files), -use: - - #define NEED_function_GLOBAL - #define NEED_variable_GLOBAL - -Note that you mustn't have more than one global request for the -same function or variable in your project. - - Function / Variable Static Request Global Request - ----------------------------------------------------------------------------------------- - PL_parser NEED_PL_parser NEED_PL_parser_GLOBAL - PL_signals NEED_PL_signals NEED_PL_signals_GLOBAL - eval_pv() NEED_eval_pv NEED_eval_pv_GLOBAL - grok_bin() NEED_grok_bin NEED_grok_bin_GLOBAL - grok_hex() NEED_grok_hex NEED_grok_hex_GLOBAL - grok_number() NEED_grok_number NEED_grok_number_GLOBAL - grok_numeric_radix() NEED_grok_numeric_radix NEED_grok_numeric_radix_GLOBAL - grok_oct() NEED_grok_oct NEED_grok_oct_GLOBAL - load_module() NEED_load_module NEED_load_module_GLOBAL - my_snprintf() NEED_my_snprintf NEED_my_snprintf_GLOBAL - my_sprintf() NEED_my_sprintf NEED_my_sprintf_GLOBAL - my_strlcat() NEED_my_strlcat NEED_my_strlcat_GLOBAL - my_strlcpy() NEED_my_strlcpy NEED_my_strlcpy_GLOBAL - newCONSTSUB() NEED_newCONSTSUB NEED_newCONSTSUB_GLOBAL - newRV_noinc() NEED_newRV_noinc NEED_newRV_noinc_GLOBAL - newSVpvn_flags() NEED_newSVpvn_flags NEED_newSVpvn_flags_GLOBAL - newSVpvn_share() NEED_newSVpvn_share NEED_newSVpvn_share_GLOBAL - pv_display() NEED_pv_display NEED_pv_display_GLOBAL - pv_escape() NEED_pv_escape NEED_pv_escape_GLOBAL - pv_pretty() NEED_pv_pretty NEED_pv_pretty_GLOBAL - sv_2pv_flags() NEED_sv_2pv_flags NEED_sv_2pv_flags_GLOBAL - sv_2pvbyte() NEED_sv_2pvbyte NEED_sv_2pvbyte_GLOBAL - sv_catpvf_mg() NEED_sv_catpvf_mg NEED_sv_catpvf_mg_GLOBAL - sv_catpvf_mg_nocontext() NEED_sv_catpvf_mg_nocontext NEED_sv_catpvf_mg_nocontext_GLOBAL - sv_pvn_force_flags() NEED_sv_pvn_force_flags NEED_sv_pvn_force_flags_GLOBAL - sv_setpvf_mg() NEED_sv_setpvf_mg NEED_sv_setpvf_mg_GLOBAL - sv_setpvf_mg_nocontext() NEED_sv_setpvf_mg_nocontext NEED_sv_setpvf_mg_nocontext_GLOBAL - vload_module() NEED_vload_module NEED_vload_module_GLOBAL - vnewSVpvf() NEED_vnewSVpvf NEED_vnewSVpvf_GLOBAL - warner() NEED_warner NEED_warner_GLOBAL - -To avoid namespace conflicts, you can change the namespace of the -explicitly exported functions / variables using the C -macro. Just C<#define> the macro before including C: - - #define DPPP_NAMESPACE MyOwnNamespace_ - #include "ppport.h" - -The default namespace is C. - -=back - -The good thing is that most of the above can be checked by running -F on your source code. See the next section for -details. - -=head1 EXAMPLES - -To verify whether F is needed for your module, whether you -should make any changes to your code, and whether any special defines -should be used, F can be run as a Perl script to check your -source code. Simply say: - - perl ppport.h - -The result will usually be a list of patches suggesting changes -that should at least be acceptable, if not necessarily the most -efficient solution, or a fix for all possible problems. - -If you know that your XS module uses features only available in -newer Perl releases, if you're aware that it uses C++ comments, -and if you want all suggestions as a single patch file, you could -use something like this: - - perl ppport.h --compat-version=5.6.0 --cplusplus --patch=test.diff - -If you only want your code to be scanned without any suggestions -for changes, use: - - perl ppport.h --nochanges - -You can specify a different C program or options, using -the C<--diff> option: - - perl ppport.h --diff='diff -C 10' - -This would output context diffs with 10 lines of context. - -If you want to create patched copies of your files instead, use: - - perl ppport.h --copy=.new - -To display portability information for the C function, -use: - - perl ppport.h --api-info=newSVpvn - -Since the argument to C<--api-info> can be a regular expression, -you can use - - perl ppport.h --api-info=/_nomg$/ - -to display portability information for all C<_nomg> functions or - - perl ppport.h --api-info=/./ - -to display information for all known API elements. - -=head1 BUGS - -If this version of F is causing failure during -the compilation of this module, please check if newer versions -of either this module or C are available on CPAN -before sending a bug report. - -If F was generated using the latest version of -C and is causing failure of this module, please -file a bug report using the CPAN Request Tracker at L. - -Please include the following information: - -=over 4 - -=item 1. - -The complete output from running "perl -V" - -=item 2. - -This file. - -=item 3. - -The name and version of the module you were trying to build. - -=item 4. - -A full log of the build that failed. - -=item 5. - -Any other information that you think could be relevant. - -=back - -For the latest version of this code, please get the C -module from CPAN. - -=head1 COPYRIGHT - -Version 3.x, Copyright (c) 2004-2009, Marcus Holland-Moritz. - -Version 2.x, Copyright (C) 2001, Paul Marquess. - -Version 1.x, Copyright (C) 1999, Kenneth Albanowski. - -This program is free software; you can redistribute it and/or -modify it under the same terms as Perl itself. - -=head1 SEE ALSO - -See L. - -=cut - -use strict; - -# Disable broken TRIE-optimization -BEGIN { eval '${^RE_TRIE_MAXBUF} = -1' if $] >= 5.009004 && $] <= 5.009005 } - -my $VERSION = 3.17; - -my %opt = ( - quiet => 0, - diag => 1, - hints => 1, - changes => 1, - cplusplus => 0, - filter => 1, - strip => 0, - version => 0, -); - -my($ppport) = $0 =~ /([\w.]+)$/; -my $LF = '(?:\r\n|[\r\n])'; # line feed -my $HS = "[ \t]"; # horizontal whitespace - -# Never use C comments in this file! -my $ccs = '/'.'*'; -my $cce = '*'.'/'; -my $rccs = quotemeta $ccs; -my $rcce = quotemeta $cce; - -eval { - require Getopt::Long; - Getopt::Long::GetOptions(\%opt, qw( - help quiet diag! filter! hints! changes! cplusplus strip version - patch=s copy=s diff=s compat-version=s - list-provided list-unsupported api-info=s - )) or usage(); -}; - -if ($@ and grep /^-/, @ARGV) { - usage() if "@ARGV" =~ /^--?h(?:elp)?$/; - die "Getopt::Long not found. Please don't use any options.\n"; -} - -if ($opt{version}) { - print "This is $0 $VERSION.\n"; - exit 0; -} - -usage() if $opt{help}; -strip() if $opt{strip}; - -if (exists $opt{'compat-version'}) { - my($r,$v,$s) = eval { parse_version($opt{'compat-version'}) }; - if ($@) { - die "Invalid version number format: '$opt{'compat-version'}'\n"; - } - die "Only Perl 5 is supported\n" if $r != 5; - die "Invalid version number: $opt{'compat-version'}\n" if $v >= 1000 || $s >= 1000; - $opt{'compat-version'} = sprintf "%d.%03d%03d", $r, $v, $s; -} -else { - $opt{'compat-version'} = 5; -} - -my %API = map { /^(\w+)\|([^|]*)\|([^|]*)\|(\w*)$/ - ? ( $1 => { - ($2 ? ( base => $2 ) : ()), - ($3 ? ( todo => $3 ) : ()), - (index($4, 'v') >= 0 ? ( varargs => 1 ) : ()), - (index($4, 'p') >= 0 ? ( provided => 1 ) : ()), - (index($4, 'n') >= 0 ? ( nothxarg => 1 ) : ()), - } ) - : die "invalid spec: $_" } qw( -AvFILLp|5.004050||p -AvFILL||| -CLASS|||n -CPERLscope|5.005000||p -CX_CURPAD_SAVE||| -CX_CURPAD_SV||| -CopFILEAV|5.006000||p -CopFILEGV_set|5.006000||p -CopFILEGV|5.006000||p -CopFILESV|5.006000||p -CopFILE_set|5.006000||p -CopFILE|5.006000||p -CopSTASHPV_set|5.006000||p -CopSTASHPV|5.006000||p -CopSTASH_eq|5.006000||p -CopSTASH_set|5.006000||p -CopSTASH|5.006000||p -CopyD|5.009002||p -Copy||| -CvPADLIST||| -CvSTASH||| -CvWEAKOUTSIDE||| -DEFSV_set|5.011000||p -DEFSV|5.004050||p -END_EXTERN_C|5.005000||p -ENTER||| -ERRSV|5.004050||p -EXTEND||| -EXTERN_C|5.005000||p -F0convert|||n -FREETMPS||| -GIMME_V||5.004000|n -GIMME|||n -GROK_NUMERIC_RADIX|5.007002||p -G_ARRAY||| -G_DISCARD||| -G_EVAL||| -G_METHOD|5.006001||p -G_NOARGS||| -G_SCALAR||| -G_VOID||5.004000| -GetVars||| -GvSV||| -Gv_AMupdate||| -HEf_SVKEY||5.004000| -HeHASH||5.004000| -HeKEY||5.004000| -HeKLEN||5.004000| -HePV||5.004000| -HeSVKEY_force||5.004000| -HeSVKEY_set||5.004000| -HeSVKEY||5.004000| -HeUTF8||5.011000| -HeVAL||5.004000| -HvNAME||| -INT2PTR|5.006000||p -IN_LOCALE_COMPILETIME|5.007002||p -IN_LOCALE_RUNTIME|5.007002||p -IN_LOCALE|5.007002||p -IN_PERL_COMPILETIME|5.008001||p -IS_NUMBER_GREATER_THAN_UV_MAX|5.007002||p -IS_NUMBER_INFINITY|5.007002||p -IS_NUMBER_IN_UV|5.007002||p -IS_NUMBER_NAN|5.007003||p -IS_NUMBER_NEG|5.007002||p -IS_NUMBER_NOT_INT|5.007002||p -IVSIZE|5.006000||p -IVTYPE|5.006000||p -IVdf|5.006000||p -LEAVE||| -LVRET||| -MARK||| -MULTICALL||5.011000| -MY_CXT_CLONE|5.009002||p -MY_CXT_INIT|5.007003||p -MY_CXT|5.007003||p -MoveD|5.009002||p -Move||| -NOOP|5.005000||p -NUM2PTR|5.006000||p -NVTYPE|5.006000||p -NVef|5.006001||p -NVff|5.006001||p -NVgf|5.006001||p -Newxc|5.009003||p -Newxz|5.009003||p -Newx|5.009003||p -Nullav||| -Nullch||| -Nullcv||| -Nullhv||| -Nullsv||| -ORIGMARK||| -PAD_BASE_SV||| -PAD_CLONE_VARS||| -PAD_COMPNAME_FLAGS||| -PAD_COMPNAME_GEN_set||| -PAD_COMPNAME_GEN||| -PAD_COMPNAME_OURSTASH||| -PAD_COMPNAME_PV||| -PAD_COMPNAME_TYPE||| -PAD_DUP||| -PAD_RESTORE_LOCAL||| -PAD_SAVE_LOCAL||| -PAD_SAVE_SETNULLPAD||| -PAD_SETSV||| -PAD_SET_CUR_NOSAVE||| -PAD_SET_CUR||| -PAD_SVl||| -PAD_SV||| -PERLIO_FUNCS_CAST|5.009003||p -PERLIO_FUNCS_DECL|5.009003||p -PERL_ABS|5.008001||p -PERL_BCDVERSION|5.011000||p -PERL_GCC_BRACE_GROUPS_FORBIDDEN|5.008001||p -PERL_HASH|5.004000||p -PERL_INT_MAX|5.004000||p -PERL_INT_MIN|5.004000||p -PERL_LONG_MAX|5.004000||p -PERL_LONG_MIN|5.004000||p -PERL_MAGIC_arylen|5.007002||p -PERL_MAGIC_backref|5.007002||p -PERL_MAGIC_bm|5.007002||p -PERL_MAGIC_collxfrm|5.007002||p -PERL_MAGIC_dbfile|5.007002||p -PERL_MAGIC_dbline|5.007002||p -PERL_MAGIC_defelem|5.007002||p -PERL_MAGIC_envelem|5.007002||p -PERL_MAGIC_env|5.007002||p -PERL_MAGIC_ext|5.007002||p -PERL_MAGIC_fm|5.007002||p -PERL_MAGIC_glob|5.011000||p -PERL_MAGIC_isaelem|5.007002||p -PERL_MAGIC_isa|5.007002||p -PERL_MAGIC_mutex|5.011000||p -PERL_MAGIC_nkeys|5.007002||p -PERL_MAGIC_overload_elem|5.007002||p -PERL_MAGIC_overload_table|5.007002||p -PERL_MAGIC_overload|5.007002||p -PERL_MAGIC_pos|5.007002||p -PERL_MAGIC_qr|5.007002||p -PERL_MAGIC_regdata|5.007002||p -PERL_MAGIC_regdatum|5.007002||p -PERL_MAGIC_regex_global|5.007002||p -PERL_MAGIC_shared_scalar|5.007003||p -PERL_MAGIC_shared|5.007003||p -PERL_MAGIC_sigelem|5.007002||p -PERL_MAGIC_sig|5.007002||p -PERL_MAGIC_substr|5.007002||p -PERL_MAGIC_sv|5.007002||p -PERL_MAGIC_taint|5.007002||p -PERL_MAGIC_tiedelem|5.007002||p -PERL_MAGIC_tiedscalar|5.007002||p -PERL_MAGIC_tied|5.007002||p -PERL_MAGIC_utf8|5.008001||p -PERL_MAGIC_uvar_elem|5.007003||p -PERL_MAGIC_uvar|5.007002||p -PERL_MAGIC_vec|5.007002||p -PERL_MAGIC_vstring|5.008001||p -PERL_PV_ESCAPE_ALL|5.009004||p -PERL_PV_ESCAPE_FIRSTCHAR|5.009004||p -PERL_PV_ESCAPE_NOBACKSLASH|5.009004||p -PERL_PV_ESCAPE_NOCLEAR|5.009004||p -PERL_PV_ESCAPE_QUOTE|5.009004||p -PERL_PV_ESCAPE_RE|5.009005||p -PERL_PV_ESCAPE_UNI_DETECT|5.009004||p -PERL_PV_ESCAPE_UNI|5.009004||p -PERL_PV_PRETTY_DUMP|5.009004||p -PERL_PV_PRETTY_ELLIPSES|5.010000||p -PERL_PV_PRETTY_LTGT|5.009004||p -PERL_PV_PRETTY_NOCLEAR|5.010000||p -PERL_PV_PRETTY_QUOTE|5.009004||p -PERL_PV_PRETTY_REGPROP|5.009004||p -PERL_QUAD_MAX|5.004000||p -PERL_QUAD_MIN|5.004000||p -PERL_REVISION|5.006000||p -PERL_SCAN_ALLOW_UNDERSCORES|5.007003||p -PERL_SCAN_DISALLOW_PREFIX|5.007003||p -PERL_SCAN_GREATER_THAN_UV_MAX|5.007003||p -PERL_SCAN_SILENT_ILLDIGIT|5.008001||p -PERL_SHORT_MAX|5.004000||p -PERL_SHORT_MIN|5.004000||p -PERL_SIGNALS_UNSAFE_FLAG|5.008001||p -PERL_SUBVERSION|5.006000||p -PERL_UCHAR_MAX|5.004000||p -PERL_UCHAR_MIN|5.004000||p -PERL_UINT_MAX|5.004000||p -PERL_UINT_MIN|5.004000||p -PERL_ULONG_MAX|5.004000||p -PERL_ULONG_MIN|5.004000||p -PERL_UNUSED_ARG|5.009003||p -PERL_UNUSED_CONTEXT|5.009004||p -PERL_UNUSED_DECL|5.007002||p -PERL_UNUSED_VAR|5.007002||p -PERL_UQUAD_MAX|5.004000||p -PERL_UQUAD_MIN|5.004000||p -PERL_USE_GCC_BRACE_GROUPS|5.009004||p -PERL_USHORT_MAX|5.004000||p -PERL_USHORT_MIN|5.004000||p -PERL_VERSION|5.006000||p -PL_DBsignal|5.005000||p -PL_DBsingle|||pn -PL_DBsub|||pn -PL_DBtrace|||pn -PL_Sv|5.005000||p -PL_bufend|5.011000||p -PL_bufptr|5.011000||p -PL_compiling|5.004050||p -PL_copline|5.011000||p -PL_curcop|5.004050||p -PL_curstash|5.004050||p -PL_debstash|5.004050||p -PL_defgv|5.004050||p -PL_diehook|5.004050||p -PL_dirty|5.004050||p -PL_dowarn|||pn -PL_errgv|5.004050||p -PL_expect|5.011000||p -PL_hexdigit|5.005000||p -PL_hints|5.005000||p -PL_last_in_gv|||n -PL_laststatval|5.005000||p -PL_lex_state|5.011000||p -PL_lex_stuff|5.011000||p -PL_linestr|5.011000||p -PL_modglobal||5.005000|n -PL_na|5.004050||pn -PL_no_modify|5.006000||p -PL_ofsgv|||n -PL_parser|5.009005||p -PL_perl_destruct_level|5.004050||p -PL_perldb|5.004050||p -PL_ppaddr|5.006000||p -PL_rsfp_filters|5.004050||p -PL_rsfp|5.004050||p -PL_rs|||n -PL_signals|5.008001||p -PL_stack_base|5.004050||p -PL_stack_sp|5.004050||p -PL_statcache|5.005000||p -PL_stdingv|5.004050||p -PL_sv_arenaroot|5.004050||p -PL_sv_no|5.004050||pn -PL_sv_undef|5.004050||pn -PL_sv_yes|5.004050||pn -PL_tainted|5.004050||p -PL_tainting|5.004050||p -PL_tokenbuf|5.011000||p -POP_MULTICALL||5.011000| -POPi|||n -POPl|||n -POPn|||n -POPpbytex||5.007001|n -POPpx||5.005030|n -POPp|||n -POPs|||n -PTR2IV|5.006000||p -PTR2NV|5.006000||p -PTR2UV|5.006000||p -PTR2nat|5.009003||p -PTR2ul|5.007001||p -PTRV|5.006000||p -PUSHMARK||| -PUSH_MULTICALL||5.011000| -PUSHi||| -PUSHmortal|5.009002||p -PUSHn||| -PUSHp||| -PUSHs||| -PUSHu|5.004000||p -PUTBACK||| -PerlIO_clearerr||5.007003| -PerlIO_close||5.007003| -PerlIO_context_layers||5.009004| -PerlIO_eof||5.007003| -PerlIO_error||5.007003| -PerlIO_fileno||5.007003| -PerlIO_fill||5.007003| -PerlIO_flush||5.007003| -PerlIO_get_base||5.007003| -PerlIO_get_bufsiz||5.007003| -PerlIO_get_cnt||5.007003| -PerlIO_get_ptr||5.007003| -PerlIO_read||5.007003| -PerlIO_seek||5.007003| -PerlIO_set_cnt||5.007003| -PerlIO_set_ptrcnt||5.007003| -PerlIO_setlinebuf||5.007003| -PerlIO_stderr||5.007003| -PerlIO_stdin||5.007003| -PerlIO_stdout||5.007003| -PerlIO_tell||5.007003| -PerlIO_unread||5.007003| -PerlIO_write||5.007003| -Perl_signbit||5.009005|n -PoisonFree|5.009004||p -PoisonNew|5.009004||p -PoisonWith|5.009004||p -Poison|5.008000||p -RETVAL|||n -Renewc||| -Renew||| -SAVECLEARSV||| -SAVECOMPPAD||| -SAVEPADSV||| -SAVETMPS||| -SAVE_DEFSV|5.004050||p -SPAGAIN||| -SP||| -START_EXTERN_C|5.005000||p -START_MY_CXT|5.007003||p -STMT_END|||p -STMT_START|||p -STR_WITH_LEN|5.009003||p -ST||| -SV_CONST_RETURN|5.009003||p -SV_COW_DROP_PV|5.008001||p -SV_COW_SHARED_HASH_KEYS|5.009005||p -SV_GMAGIC|5.007002||p -SV_HAS_TRAILING_NUL|5.009004||p -SV_IMMEDIATE_UNREF|5.007001||p -SV_MUTABLE_RETURN|5.009003||p -SV_NOSTEAL|5.009002||p -SV_SMAGIC|5.009003||p -SV_UTF8_NO_ENCODING|5.008001||p -SVf_UTF8|5.006000||p -SVf|5.006000||p -SVt_IV||| -SVt_NV||| -SVt_PVAV||| -SVt_PVCV||| -SVt_PVHV||| -SVt_PVMG||| -SVt_PV||| -Safefree||| -Slab_Alloc||| -Slab_Free||| -Slab_to_rw||| -StructCopy||| -SvCUR_set||| -SvCUR||| -SvEND||| -SvGAMAGIC||5.006001| -SvGETMAGIC|5.004050||p -SvGROW||| -SvIOK_UV||5.006000| -SvIOK_notUV||5.006000| -SvIOK_off||| -SvIOK_only_UV||5.006000| -SvIOK_only||| -SvIOK_on||| -SvIOKp||| -SvIOK||| -SvIVX||| -SvIV_nomg|5.009001||p -SvIV_set||| -SvIVx||| -SvIV||| -SvIsCOW_shared_hash||5.008003| -SvIsCOW||5.008003| -SvLEN_set||| -SvLEN||| -SvLOCK||5.007003| -SvMAGIC_set|5.009003||p -SvNIOK_off||| -SvNIOKp||| -SvNIOK||| -SvNOK_off||| -SvNOK_only||| -SvNOK_on||| -SvNOKp||| -SvNOK||| -SvNVX||| -SvNV_set||| -SvNVx||| -SvNV||| -SvOK||| -SvOOK_offset||5.011000| -SvOOK||| -SvPOK_off||| -SvPOK_only_UTF8||5.006000| -SvPOK_only||| -SvPOK_on||| -SvPOKp||| -SvPOK||| -SvPVX_const|5.009003||p -SvPVX_mutable|5.009003||p -SvPVX||| -SvPV_const|5.009003||p -SvPV_flags_const_nolen|5.009003||p -SvPV_flags_const|5.009003||p -SvPV_flags_mutable|5.009003||p -SvPV_flags|5.007002||p -SvPV_force_flags_mutable|5.009003||p -SvPV_force_flags_nolen|5.009003||p -SvPV_force_flags|5.007002||p -SvPV_force_mutable|5.009003||p -SvPV_force_nolen|5.009003||p -SvPV_force_nomg_nolen|5.009003||p -SvPV_force_nomg|5.007002||p -SvPV_force|||p -SvPV_mutable|5.009003||p -SvPV_nolen_const|5.009003||p -SvPV_nolen|5.006000||p -SvPV_nomg_const_nolen|5.009003||p -SvPV_nomg_const|5.009003||p -SvPV_nomg|5.007002||p -SvPV_renew|5.009003||p -SvPV_set||| -SvPVbyte_force||5.009002| -SvPVbyte_nolen||5.006000| -SvPVbytex_force||5.006000| -SvPVbytex||5.006000| -SvPVbyte|5.006000||p -SvPVutf8_force||5.006000| -SvPVutf8_nolen||5.006000| -SvPVutf8x_force||5.006000| -SvPVutf8x||5.006000| -SvPVutf8||5.006000| -SvPVx||| -SvPV||| -SvREFCNT_dec||| -SvREFCNT_inc_NN|5.009004||p -SvREFCNT_inc_simple_NN|5.009004||p -SvREFCNT_inc_simple_void_NN|5.009004||p -SvREFCNT_inc_simple_void|5.009004||p -SvREFCNT_inc_simple|5.009004||p -SvREFCNT_inc_void_NN|5.009004||p -SvREFCNT_inc_void|5.009004||p -SvREFCNT_inc|||p -SvREFCNT||| -SvROK_off||| -SvROK_on||| -SvROK||| -SvRV_set|5.009003||p -SvRV||| -SvRXOK||5.009005| -SvRX||5.009005| -SvSETMAGIC||| -SvSHARED_HASH|5.009003||p -SvSHARE||5.007003| -SvSTASH_set|5.009003||p -SvSTASH||| -SvSetMagicSV_nosteal||5.004000| -SvSetMagicSV||5.004000| -SvSetSV_nosteal||5.004000| -SvSetSV||| -SvTAINTED_off||5.004000| -SvTAINTED_on||5.004000| -SvTAINTED||5.004000| -SvTAINT||| -SvTRUE||| -SvTYPE||| -SvUNLOCK||5.007003| -SvUOK|5.007001|5.006000|p -SvUPGRADE||| -SvUTF8_off||5.006000| -SvUTF8_on||5.006000| -SvUTF8||5.006000| -SvUVXx|5.004000||p -SvUVX|5.004000||p -SvUV_nomg|5.009001||p -SvUV_set|5.009003||p -SvUVx|5.004000||p -SvUV|5.004000||p -SvVOK||5.008001| -SvVSTRING_mg|5.009004||p -THIS|||n -UNDERBAR|5.009002||p -UTF8_MAXBYTES|5.009002||p -UVSIZE|5.006000||p -UVTYPE|5.006000||p -UVXf|5.007001||p -UVof|5.006000||p -UVuf|5.006000||p -UVxf|5.006000||p -WARN_ALL|5.006000||p -WARN_AMBIGUOUS|5.006000||p -WARN_ASSERTIONS|5.011000||p -WARN_BAREWORD|5.006000||p -WARN_CLOSED|5.006000||p -WARN_CLOSURE|5.006000||p -WARN_DEBUGGING|5.006000||p -WARN_DEPRECATED|5.006000||p -WARN_DIGIT|5.006000||p -WARN_EXEC|5.006000||p -WARN_EXITING|5.006000||p -WARN_GLOB|5.006000||p -WARN_INPLACE|5.006000||p -WARN_INTERNAL|5.006000||p -WARN_IO|5.006000||p -WARN_LAYER|5.008000||p -WARN_MALLOC|5.006000||p -WARN_MISC|5.006000||p -WARN_NEWLINE|5.006000||p -WARN_NUMERIC|5.006000||p -WARN_ONCE|5.006000||p -WARN_OVERFLOW|5.006000||p -WARN_PACK|5.006000||p -WARN_PARENTHESIS|5.006000||p -WARN_PIPE|5.006000||p -WARN_PORTABLE|5.006000||p -WARN_PRECEDENCE|5.006000||p -WARN_PRINTF|5.006000||p -WARN_PROTOTYPE|5.006000||p -WARN_QW|5.006000||p -WARN_RECURSION|5.006000||p -WARN_REDEFINE|5.006000||p -WARN_REGEXP|5.006000||p -WARN_RESERVED|5.006000||p -WARN_SEMICOLON|5.006000||p -WARN_SEVERE|5.006000||p -WARN_SIGNAL|5.006000||p -WARN_SUBSTR|5.006000||p -WARN_SYNTAX|5.006000||p -WARN_TAINT|5.006000||p -WARN_THREADS|5.008000||p -WARN_UNINITIALIZED|5.006000||p -WARN_UNOPENED|5.006000||p -WARN_UNPACK|5.006000||p -WARN_UNTIE|5.006000||p -WARN_UTF8|5.006000||p -WARN_VOID|5.006000||p -XCPT_CATCH|5.009002||p -XCPT_RETHROW|5.009002||p -XCPT_TRY_END|5.009002||p -XCPT_TRY_START|5.009002||p -XPUSHi||| -XPUSHmortal|5.009002||p -XPUSHn||| -XPUSHp||| -XPUSHs||| -XPUSHu|5.004000||p -XSRETURN_EMPTY||| -XSRETURN_IV||| -XSRETURN_NO||| -XSRETURN_NV||| -XSRETURN_PV||| -XSRETURN_UNDEF||| -XSRETURN_UV|5.008001||p -XSRETURN_YES||| -XSRETURN|||p -XST_mIV||| -XST_mNO||| -XST_mNV||| -XST_mPV||| -XST_mUNDEF||| -XST_mUV|5.008001||p -XST_mYES||| -XS_VERSION_BOOTCHECK||| -XS_VERSION||| -XSprePUSH|5.006000||p -XS||| -ZeroD|5.009002||p -Zero||| -_aMY_CXT|5.007003||p -_pMY_CXT|5.007003||p -aMY_CXT_|5.007003||p -aMY_CXT|5.007003||p -aTHXR_|5.011000||p -aTHXR|5.011000||p -aTHX_|5.006000||p -aTHX|5.006000||p -add_data|||n -addmad||| -allocmy||| -amagic_call||| -amagic_cmp_locale||| -amagic_cmp||| -amagic_i_ncmp||| -amagic_ncmp||| -any_dup||| -ao||| -append_elem||| -append_list||| -append_madprops||| -apply_attrs_my||| -apply_attrs_string||5.006001| -apply_attrs||| -apply||| -atfork_lock||5.007003|n -atfork_unlock||5.007003|n -av_arylen_p||5.009003| -av_clear||| -av_create_and_push||5.009005| -av_create_and_unshift_one||5.009005| -av_delete||5.006000| -av_exists||5.006000| -av_extend||| -av_fetch||| -av_fill||| -av_iter_p||5.011000| -av_len||| -av_make||| -av_pop||| -av_push||| -av_reify||| -av_shift||| -av_store||| -av_undef||| -av_unshift||| -ax|||n -bad_type||| -bind_match||| -block_end||| -block_gimme||5.004000| -block_start||| -boolSV|5.004000||p -boot_core_PerlIO||| -boot_core_UNIVERSAL||| -boot_core_mro||| -boot_core_xsutils||| -bytes_from_utf8||5.007001| -bytes_to_uni|||n -bytes_to_utf8||5.006001| -call_argv|5.006000||p -call_atexit||5.006000| -call_list||5.004000| -call_method|5.006000||p -call_pv|5.006000||p -call_sv|5.006000||p -calloc||5.007002|n -cando||| -cast_i32||5.006000| -cast_iv||5.006000| -cast_ulong||5.006000| -cast_uv||5.006000| -check_type_and_open||| -check_uni||| -checkcomma||| -checkposixcc||| -ckWARN|5.006000||p -ck_anoncode||| -ck_bitop||| -ck_concat||| -ck_defined||| -ck_delete||| -ck_die||| -ck_each||| -ck_eof||| -ck_eval||| -ck_exec||| -ck_exists||| -ck_exit||| -ck_ftst||| -ck_fun||| -ck_glob||| -ck_grep||| -ck_index||| -ck_join||| -ck_lfun||| -ck_listiob||| -ck_match||| -ck_method||| -ck_null||| -ck_open||| -ck_readline||| -ck_repeat||| -ck_require||| -ck_return||| -ck_rfun||| -ck_rvconst||| -ck_sassign||| -ck_select||| -ck_shift||| -ck_sort||| -ck_spair||| -ck_split||| -ck_subr||| -ck_substr||| -ck_svconst||| -ck_trunc||| -ck_unpack||| -ckwarn_d||5.009003| -ckwarn||5.009003| -cl_and|||n -cl_anything|||n -cl_init_zero|||n -cl_init|||n -cl_is_anything|||n -cl_or|||n -clear_placeholders||| -closest_cop||| -convert||| -cop_free||| -cr_textfilter||| -create_eval_scope||| -croak_nocontext|||vn -croak_xs_usage||5.011000| -croak|||v -csighandler||5.009003|n -curmad||| -custom_op_desc||5.007003| -custom_op_name||5.007003| -cv_ckproto_len||| -cv_clone||| -cv_const_sv||5.004000| -cv_dump||| -cv_undef||| -cx_dump||5.005000| -cx_dup||| -cxinc||| -dAXMARK|5.009003||p -dAX|5.007002||p -dITEMS|5.007002||p -dMARK||| -dMULTICALL||5.009003| -dMY_CXT_SV|5.007003||p -dMY_CXT|5.007003||p -dNOOP|5.006000||p -dORIGMARK||| -dSP||| -dTHR|5.004050||p -dTHXR|5.011000||p -dTHXa|5.006000||p -dTHXoa|5.006000||p -dTHX|5.006000||p -dUNDERBAR|5.009002||p -dVAR|5.009003||p -dXCPT|5.009002||p -dXSARGS||| -dXSI32||| -dXSTARG|5.006000||p -deb_curcv||| -deb_nocontext|||vn -deb_stack_all||| -deb_stack_n||| -debop||5.005000| -debprofdump||5.005000| -debprof||| -debstackptrs||5.007003| -debstack||5.007003| -debug_start_match||| -deb||5.007003|v -del_sv||| -delete_eval_scope||| -delimcpy||5.004000| -deprecate_old||| -deprecate||| -despatch_signals||5.007001| -destroy_matcher||| -die_nocontext|||vn -die_where||| -die|||v -dirp_dup||| -div128||| -djSP||| -do_aexec5||| -do_aexec||| -do_aspawn||| -do_binmode||5.004050| -do_chomp||| -do_chop||| -do_close||| -do_dump_pad||| -do_eof||| -do_exec3||| -do_execfree||| -do_exec||| -do_gv_dump||5.006000| -do_gvgv_dump||5.006000| -do_hv_dump||5.006000| -do_ipcctl||| -do_ipcget||| -do_join||| -do_kv||| -do_magic_dump||5.006000| -do_msgrcv||| -do_msgsnd||| -do_oddball||| -do_op_dump||5.006000| -do_op_xmldump||| -do_open9||5.006000| -do_openn||5.007001| -do_open||5.004000| -do_pmop_dump||5.006000| -do_pmop_xmldump||| -do_print||| -do_readline||| -do_seek||| -do_semop||| -do_shmio||| -do_smartmatch||| -do_spawn_nowait||| -do_spawn||| -do_sprintf||| -do_sv_dump||5.006000| -do_sysseek||| -do_tell||| -do_trans_complex_utf8||| -do_trans_complex||| -do_trans_count_utf8||| -do_trans_count||| -do_trans_simple_utf8||| -do_trans_simple||| -do_trans||| -do_vecget||| -do_vecset||| -do_vop||| -docatch||| -doeval||| -dofile||| -dofindlabel||| -doform||| -doing_taint||5.008001|n -dooneliner||| -doopen_pm||| -doparseform||| -dopoptoeval||| -dopoptogiven||| -dopoptolabel||| -dopoptoloop||| -dopoptosub_at||| -dopoptowhen||| -doref||5.009003| -dounwind||| -dowantarray||| -dump_all||5.006000| -dump_eval||5.006000| -dump_exec_pos||| -dump_fds||| -dump_form||5.006000| -dump_indent||5.006000|v -dump_mstats||| -dump_packsubs||5.006000| -dump_sub||5.006000| -dump_sv_child||| -dump_trie_interim_list||| -dump_trie_interim_table||| -dump_trie||| -dump_vindent||5.006000| -dumpuntil||| -dup_attrlist||| -emulate_cop_io||| -eval_pv|5.006000||p -eval_sv|5.006000||p -exec_failed||| -expect_number||| -fbm_compile||5.005000| -fbm_instr||5.005000| -feature_is_enabled||| -fetch_cop_label||5.011000| -filter_add||| -filter_del||| -filter_gets||| -filter_read||| -find_and_forget_pmops||| -find_array_subscript||| -find_beginning||| -find_byclass||| -find_hash_subscript||| -find_in_my_stash||| -find_runcv||5.008001| -find_rundefsvoffset||5.009002| -find_script||| -find_uninit_var||| -first_symbol|||n -fold_constants||| -forbid_setid||| -force_ident||| -force_list||| -force_next||| -force_version||| -force_word||| -forget_pmop||| -form_nocontext|||vn -form||5.004000|v -fp_dup||| -fprintf_nocontext|||vn -free_global_struct||| -free_tied_hv_pool||| -free_tmps||| -gen_constant_list||| -get_arena||| -get_aux_mg||| -get_av|5.006000||p -get_context||5.006000|n -get_cvn_flags||5.009005| -get_cv|5.006000||p -get_db_sub||| -get_debug_opts||| -get_hash_seed||| -get_hv|5.006000||p -get_isa_hash||| -get_mstats||| -get_no_modify||| -get_num||| -get_op_descs||5.005000| -get_op_names||5.005000| -get_opargs||| -get_ppaddr||5.006000| -get_re_arg||| -get_sv|5.006000||p -get_vtbl||5.005030| -getcwd_sv||5.007002| -getenv_len||| -glob_2number||| -glob_2pv||| -glob_assign_glob||| -glob_assign_ref||| -gp_dup||| -gp_free||| -gp_ref||| -grok_bin|5.007003||p -grok_hex|5.007003||p -grok_number|5.007002||p -grok_numeric_radix|5.007002||p -grok_oct|5.007003||p -group_end||| -gv_AVadd||| -gv_HVadd||| -gv_IOadd||| -gv_SVadd||| -gv_autoload4||5.004000| -gv_check||| -gv_const_sv||5.009003| -gv_dump||5.006000| -gv_efullname3||5.004000| -gv_efullname4||5.006001| -gv_efullname||| -gv_ename||| -gv_fetchfile_flags||5.009005| -gv_fetchfile||| -gv_fetchmeth_autoload||5.007003| -gv_fetchmethod_autoload||5.004000| -gv_fetchmethod_flags||5.011000| -gv_fetchmethod||| -gv_fetchmeth||| -gv_fetchpvn_flags||5.009002| -gv_fetchpv||| -gv_fetchsv||5.009002| -gv_fullname3||5.004000| -gv_fullname4||5.006001| -gv_fullname||| -gv_get_super_pkg||| -gv_handler||5.007001| -gv_init_sv||| -gv_init||| -gv_name_set||5.009004| -gv_stashpvn|5.004000||p -gv_stashpvs||5.009003| -gv_stashpv||| -gv_stashsv||| -he_dup||| -hek_dup||| -hfreeentries||| -hsplit||| -hv_assert||5.011000| -hv_auxinit|||n -hv_backreferences_p||| -hv_clear_placeholders||5.009001| -hv_clear||| -hv_common_key_len||5.010000| -hv_common||5.010000| -hv_copy_hints_hv||| -hv_delayfree_ent||5.004000| -hv_delete_common||| -hv_delete_ent||5.004000| -hv_delete||| -hv_eiter_p||5.009003| -hv_eiter_set||5.009003| -hv_exists_ent||5.004000| -hv_exists||| -hv_fetch_ent||5.004000| -hv_fetchs|5.009003||p -hv_fetch||| -hv_free_ent||5.004000| -hv_iterinit||| -hv_iterkeysv||5.004000| -hv_iterkey||| -hv_iternext_flags||5.008000| -hv_iternextsv||| -hv_iternext||| -hv_iterval||| -hv_kill_backrefs||| -hv_ksplit||5.004000| -hv_magic_check|||n -hv_magic||| -hv_name_set||5.009003| -hv_notallowed||| -hv_placeholders_get||5.009003| -hv_placeholders_p||5.009003| -hv_placeholders_set||5.009003| -hv_riter_p||5.009003| -hv_riter_set||5.009003| -hv_scalar||5.009001| -hv_store_ent||5.004000| -hv_store_flags||5.008000| -hv_stores|5.009004||p -hv_store||| -hv_undef||| -ibcmp_locale||5.004000| -ibcmp_utf8||5.007003| -ibcmp||| -incline||| -incpush_if_exists||| -incpush_use_sep||| -incpush||| -ingroup||| -init_argv_symbols||| -init_debugger||| -init_global_struct||| -init_i18nl10n||5.006000| -init_i18nl14n||5.006000| -init_ids||| -init_interp||| -init_main_stash||| -init_perllib||| -init_postdump_symbols||| -init_predump_symbols||| -init_stacks||5.005000| -init_tm||5.007002| -instr||| -intro_my||| -intuit_method||| -intuit_more||| -invert||| -io_close||| -isALNUMC|5.006000||p -isALNUM||| -isALPHA||| -isASCII|5.006000||p -isBLANK|5.006001||p -isCNTRL|5.006000||p -isDIGIT||| -isGRAPH|5.006000||p -isLOWER||| -isPRINT|5.004000||p -isPSXSPC|5.006001||p -isPUNCT|5.006000||p -isSPACE||| -isUPPER||| -isXDIGIT|5.006000||p -is_an_int||| -is_gv_magical_sv||| -is_handle_constructor|||n -is_list_assignment||| -is_lvalue_sub||5.007001| -is_uni_alnum_lc||5.006000| -is_uni_alnumc_lc||5.006000| -is_uni_alnumc||5.006000| -is_uni_alnum||5.006000| -is_uni_alpha_lc||5.006000| -is_uni_alpha||5.006000| -is_uni_ascii_lc||5.006000| -is_uni_ascii||5.006000| -is_uni_cntrl_lc||5.006000| -is_uni_cntrl||5.006000| -is_uni_digit_lc||5.006000| -is_uni_digit||5.006000| -is_uni_graph_lc||5.006000| -is_uni_graph||5.006000| -is_uni_idfirst_lc||5.006000| -is_uni_idfirst||5.006000| -is_uni_lower_lc||5.006000| -is_uni_lower||5.006000| -is_uni_print_lc||5.006000| -is_uni_print||5.006000| -is_uni_punct_lc||5.006000| -is_uni_punct||5.006000| -is_uni_space_lc||5.006000| -is_uni_space||5.006000| -is_uni_upper_lc||5.006000| -is_uni_upper||5.006000| -is_uni_xdigit_lc||5.006000| -is_uni_xdigit||5.006000| -is_utf8_alnumc||5.006000| -is_utf8_alnum||5.006000| -is_utf8_alpha||5.006000| -is_utf8_ascii||5.006000| -is_utf8_char_slow|||n -is_utf8_char||5.006000| -is_utf8_cntrl||5.006000| -is_utf8_common||| -is_utf8_digit||5.006000| -is_utf8_graph||5.006000| -is_utf8_idcont||5.008000| -is_utf8_idfirst||5.006000| -is_utf8_lower||5.006000| -is_utf8_mark||5.006000| -is_utf8_print||5.006000| -is_utf8_punct||5.006000| -is_utf8_space||5.006000| -is_utf8_string_loclen||5.009003| -is_utf8_string_loc||5.008001| -is_utf8_string||5.006001| -is_utf8_upper||5.006000| -is_utf8_xdigit||5.006000| -isa_lookup||| -items|||n -ix|||n -jmaybe||| -join_exact||| -keyword||| -leave_scope||| -lex_end||| -lex_start||| -linklist||| -listkids||| -list||| -load_module_nocontext|||vn -load_module|5.006000||pv -localize||| -looks_like_bool||| -looks_like_number||| -lop||| -mPUSHi|5.009002||p -mPUSHn|5.009002||p -mPUSHp|5.009002||p -mPUSHs|5.011000||p -mPUSHu|5.009002||p -mXPUSHi|5.009002||p -mXPUSHn|5.009002||p -mXPUSHp|5.009002||p -mXPUSHs|5.011000||p -mXPUSHu|5.009002||p -mad_free||| -madlex||| -madparse||| -magic_clear_all_env||| -magic_clearenv||| -magic_clearhint||| -magic_clearisa||| -magic_clearpack||| -magic_clearsig||| -magic_dump||5.006000| -magic_existspack||| -magic_freearylen_p||| -magic_freeovrld||| -magic_getarylen||| -magic_getdefelem||| -magic_getnkeys||| -magic_getpack||| -magic_getpos||| -magic_getsig||| -magic_getsubstr||| -magic_gettaint||| -magic_getuvar||| -magic_getvec||| -magic_get||| -magic_killbackrefs||| -magic_len||| -magic_methcall||| -magic_methpack||| -magic_nextpack||| -magic_regdata_cnt||| -magic_regdatum_get||| -magic_regdatum_set||| -magic_scalarpack||| -magic_set_all_env||| -magic_setamagic||| -magic_setarylen||| -magic_setcollxfrm||| -magic_setdbline||| -magic_setdefelem||| -magic_setenv||| -magic_sethint||| -magic_setisa||| -magic_setmglob||| -magic_setnkeys||| -magic_setpack||| -magic_setpos||| -magic_setregexp||| -magic_setsig||| -magic_setsubstr||| -magic_settaint||| -magic_setutf8||| -magic_setuvar||| -magic_setvec||| -magic_set||| -magic_sizepack||| -magic_wipepack||| -make_matcher||| -make_trie_failtable||| -make_trie||| -malloc_good_size|||n -malloced_size|||n -malloc||5.007002|n -markstack_grow||| -matcher_matches_sv||| -measure_struct||| -memEQ|5.004000||p -memNE|5.004000||p -mem_collxfrm||| -mem_log_common|||n -mess_alloc||| -mess_nocontext|||vn -mess||5.006000|v -method_common||| -mfree||5.007002|n -mg_clear||| -mg_copy||| -mg_dup||| -mg_find||| -mg_free||| -mg_get||| -mg_length||5.005000| -mg_localize||| -mg_magical||| -mg_set||| -mg_size||5.005000| -mini_mktime||5.007002| -missingterm||| -mode_from_discipline||| -modkids||| -mod||| -more_bodies||| -more_sv||| -moreswitches||| -mro_get_from_name||5.011000| -mro_get_linear_isa_dfs||| -mro_get_linear_isa||5.009005| -mro_get_private_data||5.011000| -mro_isa_changed_in||| -mro_meta_dup||| -mro_meta_init||| -mro_method_changed_in||5.009005| -mro_register||5.011000| -mro_set_mro||5.011000| -mro_set_private_data||5.011000| -mul128||| -mulexp10|||n -my_atof2||5.007002| -my_atof||5.006000| -my_attrs||| -my_bcopy|||n -my_betoh16|||n -my_betoh32|||n -my_betoh64|||n -my_betohi|||n -my_betohl|||n -my_betohs|||n -my_bzero|||n -my_chsize||| -my_clearenv||| -my_cxt_index||| -my_cxt_init||| -my_dirfd||5.009005| -my_exit_jump||| -my_exit||| -my_failure_exit||5.004000| -my_fflush_all||5.006000| -my_fork||5.007003|n -my_htobe16|||n -my_htobe32|||n -my_htobe64|||n -my_htobei|||n -my_htobel|||n -my_htobes|||n -my_htole16|||n -my_htole32|||n -my_htole64|||n -my_htolei|||n -my_htolel|||n -my_htoles|||n -my_htonl||| -my_kid||| -my_letoh16|||n -my_letoh32|||n -my_letoh64|||n -my_letohi|||n -my_letohl|||n -my_letohs|||n -my_lstat||| -my_memcmp||5.004000|n -my_memset|||n -my_ntohl||| -my_pclose||5.004000| -my_popen_list||5.007001| -my_popen||5.004000| -my_setenv||| -my_snprintf|5.009004||pvn -my_socketpair||5.007003|n -my_sprintf|5.009003||pvn -my_stat||| -my_strftime||5.007002| -my_strlcat|5.009004||pn -my_strlcpy|5.009004||pn -my_swabn|||n -my_swap||| -my_unexec||| -my_vsnprintf||5.009004|n -need_utf8|||n -newANONATTRSUB||5.006000| -newANONHASH||| -newANONLIST||| -newANONSUB||| -newASSIGNOP||| -newATTRSUB||5.006000| -newAVREF||| -newAV||| -newBINOP||| -newCONDOP||| -newCONSTSUB|5.004050||p -newCVREF||| -newDEFSVOP||| -newFORM||| -newFOROP||| -newGIVENOP||5.009003| -newGIVWHENOP||| -newGP||| -newGVOP||| -newGVREF||| -newGVgen||| -newHVREF||| -newHVhv||5.005000| -newHV||| -newIO||| -newLISTOP||| -newLOGOP||| -newLOOPEX||| -newLOOPOP||| -newMADPROP||| -newMADsv||| -newMYSUB||| -newNULLLIST||| -newOP||| -newPADOP||| -newPMOP||| -newPROG||| -newPVOP||| -newRANGE||| -newRV_inc|5.004000||p -newRV_noinc|5.004000||p -newRV||| -newSLICEOP||| -newSTATEOP||| -newSUB||| -newSVOP||| -newSVREF||| -newSV_type||5.009005| -newSVhek||5.009003| -newSViv||| -newSVnv||| -newSVpvf_nocontext|||vn -newSVpvf||5.004000|v -newSVpvn_flags|5.011000||p -newSVpvn_share|5.007001||p -newSVpvn_utf8|5.011000||p -newSVpvn|5.004050||p -newSVpvs_flags|5.011000||p -newSVpvs_share||5.009003| -newSVpvs|5.009003||p -newSVpv||| -newSVrv||| -newSVsv||| -newSVuv|5.006000||p -newSV||| -newTOKEN||| -newUNOP||| -newWHENOP||5.009003| -newWHILEOP||5.009003| -newXS_flags||5.009004| -newXSproto||5.006000| -newXS||5.006000| -new_collate||5.006000| -new_constant||| -new_ctype||5.006000| -new_he||| -new_logop||| -new_numeric||5.006000| -new_stackinfo||5.005000| -new_version||5.009000| -new_warnings_bitfield||| -next_symbol||| -nextargv||| -nextchar||| -ninstr||| -no_bareword_allowed||| -no_fh_allowed||| -no_op||| -not_a_number||| -nothreadhook||5.008000| -nuke_stacks||| -num_overflow|||n -offer_nice_chunk||| -oopsAV||| -oopsHV||| -op_clear||| -op_const_sv||| -op_dump||5.006000| -op_free||| -op_getmad_weak||| -op_getmad||| -op_null||5.007002| -op_refcnt_dec||| -op_refcnt_inc||| -op_refcnt_lock||5.009002| -op_refcnt_unlock||5.009002| -op_xmldump||| -open_script||| -pMY_CXT_|5.007003||p -pMY_CXT|5.007003||p -pTHX_|5.006000||p -pTHX|5.006000||p -packWARN|5.007003||p -pack_cat||5.007003| -pack_rec||| -package||| -packlist||5.008001| -pad_add_anon||| -pad_add_name||| -pad_alloc||| -pad_block_start||| -pad_check_dup||| -pad_compname_type||| -pad_findlex||| -pad_findmy||| -pad_fixup_inner_anons||| -pad_free||| -pad_leavemy||| -pad_new||| -pad_peg|||n -pad_push||| -pad_reset||| -pad_setsv||| -pad_sv||5.011000| -pad_swipe||| -pad_tidy||| -pad_undef||| -parse_body||| -parse_unicode_opts||| -parser_dup||| -parser_free||| -path_is_absolute|||n -peep||| -pending_Slabs_to_ro||| -perl_alloc_using|||n -perl_alloc|||n -perl_clone_using|||n -perl_clone|||n -perl_construct|||n -perl_destruct||5.007003|n -perl_free|||n -perl_parse||5.006000|n -perl_run|||n -pidgone||| -pm_description||| -pmflag||| -pmop_dump||5.006000| -pmop_xmldump||| -pmruntime||| -pmtrans||| -pop_scope||| -pregcomp||5.009005| -pregexec||| -pregfree2||5.011000| -pregfree||| -prepend_elem||| -prepend_madprops||| -printbuf||| -printf_nocontext|||vn -process_special_blocks||| -ptr_table_clear||5.009005| -ptr_table_fetch||5.009005| -ptr_table_find|||n -ptr_table_free||5.009005| -ptr_table_new||5.009005| -ptr_table_split||5.009005| -ptr_table_store||5.009005| -push_scope||| -put_byte||| -pv_display|5.006000||p -pv_escape|5.009004||p -pv_pretty|5.009004||p -pv_uni_display||5.007003| -qerror||| -qsortsvu||| -re_compile||5.009005| -re_croak2||| -re_dup_guts||| -re_intuit_start||5.009005| -re_intuit_string||5.006000| -readpipe_override||| -realloc||5.007002|n -reentrant_free||| -reentrant_init||| -reentrant_retry|||vn -reentrant_size||| -ref_array_or_hash||| -refcounted_he_chain_2hv||| -refcounted_he_fetch||| -refcounted_he_free||| -refcounted_he_new_common||| -refcounted_he_new||| -refcounted_he_value||| -refkids||| -refto||| -ref||5.011000| -reg_check_named_buff_matched||| -reg_named_buff_all||5.009005| -reg_named_buff_exists||5.009005| -reg_named_buff_fetch||5.009005| -reg_named_buff_firstkey||5.009005| -reg_named_buff_iter||| -reg_named_buff_nextkey||5.009005| -reg_named_buff_scalar||5.009005| -reg_named_buff||| -reg_namedseq||| -reg_node||| -reg_numbered_buff_fetch||| -reg_numbered_buff_length||| -reg_numbered_buff_store||| -reg_qr_package||| -reg_recode||| -reg_scan_name||| -reg_skipcomment||| -reg_temp_copy||| -reganode||| -regatom||| -regbranch||| -regclass_swash||5.009004| -regclass||| -regcppop||| -regcppush||| -regcurly|||n -regdump_extflags||| -regdump||5.005000| -regdupe_internal||| -regexec_flags||5.005000| -regfree_internal||5.009005| -reghop3|||n -reghop4|||n -reghopmaybe3|||n -reginclass||| -reginitcolors||5.006000| -reginsert||| -regmatch||| -regnext||5.005000| -regpiece||| -regpposixcc||| -regprop||| -regrepeat||| -regtail_study||| -regtail||| -regtry||| -reguni||| -regwhite|||n -reg||| -repeatcpy||| -report_evil_fh||| -report_uninit||| -require_pv||5.006000| -require_tie_mod||| -restore_magic||| -rninstr||| -rsignal_restore||| -rsignal_save||| -rsignal_state||5.004000| -rsignal||5.004000| -run_body||| -run_user_filter||| -runops_debug||5.005000| -runops_standard||5.005000| -rvpv_dup||| -rxres_free||| -rxres_restore||| -rxres_save||| -safesyscalloc||5.006000|n -safesysfree||5.006000|n -safesysmalloc||5.006000|n -safesysrealloc||5.006000|n -same_dirent||| -save_I16||5.004000| -save_I32||| -save_I8||5.006000| -save_adelete||5.011000| -save_aelem||5.004050| -save_alloc||5.006000| -save_aptr||| -save_ary||| -save_bool||5.008001| -save_clearsv||| -save_delete||| -save_destructor_x||5.006000| -save_destructor||5.006000| -save_freeop||| -save_freepv||| -save_freesv||| -save_generic_pvref||5.006001| -save_generic_svref||5.005030| -save_gp||5.004000| -save_hash||| -save_hek_flags|||n -save_helem_flags||5.011000| -save_helem||5.004050| -save_hints||| -save_hptr||| -save_int||| -save_item||| -save_iv||5.005000| -save_lines||| -save_list||| -save_long||| -save_magic||| -save_mortalizesv||5.007001| -save_nogv||| -save_op||| -save_padsv_and_mortalize||5.011000| -save_pptr||| -save_pushi32ptr||| -save_pushptri32ptr||| -save_pushptrptr||| -save_pushptr||5.011000| -save_re_context||5.006000| -save_scalar_at||| -save_scalar||| -save_set_svflags||5.009000| -save_shared_pvref||5.007003| -save_sptr||| -save_svref||| -save_vptr||5.006000| -savepvn||| -savepvs||5.009003| -savepv||| -savesharedpvn||5.009005| -savesharedpv||5.007003| -savestack_grow_cnt||5.008001| -savestack_grow||| -savesvpv||5.009002| -sawparens||| -scalar_mod_type|||n -scalarboolean||| -scalarkids||| -scalarseq||| -scalarvoid||| -scalar||| -scan_bin||5.006000| -scan_commit||| -scan_const||| -scan_formline||| -scan_heredoc||| -scan_hex||| -scan_ident||| -scan_inputsymbol||| -scan_num||5.007001| -scan_oct||| -scan_pat||| -scan_str||| -scan_subst||| -scan_trans||| -scan_version||5.009001| -scan_vstring||5.009005| -scan_word||| -scope||| -screaminstr||5.005000| -search_const||| -seed||5.008001| -sequence_num||| -sequence_tail||| -sequence||| -set_context||5.006000|n -set_numeric_local||5.006000| -set_numeric_radix||5.006000| -set_numeric_standard||5.006000| -setdefout||| -share_hek_flags||| -share_hek||5.004000| -si_dup||| -sighandler|||n -simplify_sort||| -skipspace0||| -skipspace1||| -skipspace2||| -skipspace||| -softref2xv||| -sortcv_stacked||| -sortcv_xsub||| -sortcv||| -sortsv_flags||5.009003| -sortsv||5.007003| -space_join_names_mortal||| -ss_dup||| -stack_grow||| -start_force||| -start_glob||| -start_subparse||5.004000| -stashpv_hvname_match||5.011000| -stdize_locale||| -store_cop_label||| -strEQ||| -strGE||| -strGT||| -strLE||| -strLT||| -strNE||| -str_to_version||5.006000| -strip_return||| -strnEQ||| -strnNE||| -study_chunk||| -sub_crush_depth||| -sublex_done||| -sublex_push||| -sublex_start||| -sv_2bool||| -sv_2cv||| -sv_2io||| -sv_2iuv_common||| -sv_2iuv_non_preserve||| -sv_2iv_flags||5.009001| -sv_2iv||| -sv_2mortal||| -sv_2num||| -sv_2nv||| -sv_2pv_flags|5.007002||p -sv_2pv_nolen|5.006000||p -sv_2pvbyte_nolen|5.006000||p -sv_2pvbyte|5.006000||p -sv_2pvutf8_nolen||5.006000| -sv_2pvutf8||5.006000| -sv_2pv||| -sv_2uv_flags||5.009001| -sv_2uv|5.004000||p -sv_add_arena||| -sv_add_backref||| -sv_backoff||| -sv_bless||| -sv_cat_decode||5.008001| -sv_catpv_mg|5.004050||p -sv_catpvf_mg_nocontext|||pvn -sv_catpvf_mg|5.006000|5.004000|pv -sv_catpvf_nocontext|||vn -sv_catpvf||5.004000|v -sv_catpvn_flags||5.007002| -sv_catpvn_mg|5.004050||p -sv_catpvn_nomg|5.007002||p -sv_catpvn||| -sv_catpvs|5.009003||p -sv_catpv||| -sv_catsv_flags||5.007002| -sv_catsv_mg|5.004050||p -sv_catsv_nomg|5.007002||p -sv_catsv||| -sv_catxmlpvn||| -sv_catxmlsv||| -sv_chop||| -sv_clean_all||| -sv_clean_objs||| -sv_clear||| -sv_cmp_locale||5.004000| -sv_cmp||| -sv_collxfrm||| -sv_compile_2op||5.008001| -sv_copypv||5.007003| -sv_dec||| -sv_del_backref||| -sv_derived_from||5.004000| -sv_destroyable||5.010000| -sv_does||5.009004| -sv_dump||| -sv_dup||| -sv_eq||| -sv_exp_grow||| -sv_force_normal_flags||5.007001| -sv_force_normal||5.006000| -sv_free2||| -sv_free_arenas||| -sv_free||| -sv_gets||5.004000| -sv_grow||| -sv_i_ncmp||| -sv_inc||| -sv_insert_flags||5.011000| -sv_insert||| -sv_isa||| -sv_isobject||| -sv_iv||5.005000| -sv_kill_backrefs||| -sv_len_utf8||5.006000| -sv_len||| -sv_magic_portable|5.011000|5.004000|p -sv_magicext||5.007003| -sv_magic||| -sv_mortalcopy||| -sv_ncmp||| -sv_newmortal||| -sv_newref||| -sv_nolocking||5.007003| -sv_nosharing||5.007003| -sv_nounlocking||| -sv_nv||5.005000| -sv_peek||5.005000| -sv_pos_b2u_midway||| -sv_pos_b2u||5.006000| -sv_pos_u2b_cached||| -sv_pos_u2b_forwards|||n -sv_pos_u2b_midway|||n -sv_pos_u2b||5.006000| -sv_pvbyten_force||5.006000| -sv_pvbyten||5.006000| -sv_pvbyte||5.006000| -sv_pvn_force_flags|5.007002||p -sv_pvn_force||| -sv_pvn_nomg|5.007003|5.005000|p -sv_pvn||5.005000| -sv_pvutf8n_force||5.006000| -sv_pvutf8n||5.006000| -sv_pvutf8||5.006000| -sv_pv||5.006000| -sv_recode_to_utf8||5.007003| -sv_reftype||| -sv_release_COW||| -sv_replace||| -sv_report_used||| -sv_reset||| -sv_rvweaken||5.006000| -sv_setiv_mg|5.004050||p -sv_setiv||| -sv_setnv_mg|5.006000||p -sv_setnv||| -sv_setpv_mg|5.004050||p -sv_setpvf_mg_nocontext|||pvn -sv_setpvf_mg|5.006000|5.004000|pv -sv_setpvf_nocontext|||vn -sv_setpvf||5.004000|v -sv_setpviv_mg||5.008001| -sv_setpviv||5.008001| -sv_setpvn_mg|5.004050||p -sv_setpvn||| -sv_setpvs|5.009004||p -sv_setpv||| -sv_setref_iv||| -sv_setref_nv||| -sv_setref_pvn||| -sv_setref_pv||| -sv_setref_uv||5.007001| -sv_setsv_cow||| -sv_setsv_flags||5.007002| -sv_setsv_mg|5.004050||p -sv_setsv_nomg|5.007002||p -sv_setsv||| -sv_setuv_mg|5.004050||p -sv_setuv|5.004000||p -sv_tainted||5.004000| -sv_taint||5.004000| -sv_true||5.005000| -sv_unglob||| -sv_uni_display||5.007003| -sv_unmagic||| -sv_unref_flags||5.007001| -sv_unref||| -sv_untaint||5.004000| -sv_upgrade||| -sv_usepvn_flags||5.009004| -sv_usepvn_mg|5.004050||p -sv_usepvn||| -sv_utf8_decode||5.006000| -sv_utf8_downgrade||5.006000| -sv_utf8_encode||5.006000| -sv_utf8_upgrade_flags_grow||5.011000| -sv_utf8_upgrade_flags||5.007002| -sv_utf8_upgrade_nomg||5.007002| -sv_utf8_upgrade||5.007001| -sv_uv|5.005000||p -sv_vcatpvf_mg|5.006000|5.004000|p -sv_vcatpvfn||5.004000| -sv_vcatpvf|5.006000|5.004000|p -sv_vsetpvf_mg|5.006000|5.004000|p -sv_vsetpvfn||5.004000| -sv_vsetpvf|5.006000|5.004000|p -sv_xmlpeek||| -svtype||| -swallow_bom||| -swap_match_buff||| -swash_fetch||5.007002| -swash_get||| -swash_init||5.006000| -sys_init3||5.010000|n -sys_init||5.010000|n -sys_intern_clear||| -sys_intern_dup||| -sys_intern_init||| -sys_term||5.010000|n -taint_env||| -taint_proper||| -tmps_grow||5.006000| -toLOWER||| -toUPPER||| -to_byte_substr||| -to_uni_fold||5.007003| -to_uni_lower_lc||5.006000| -to_uni_lower||5.007003| -to_uni_title_lc||5.006000| -to_uni_title||5.007003| -to_uni_upper_lc||5.006000| -to_uni_upper||5.007003| -to_utf8_case||5.007003| -to_utf8_fold||5.007003| -to_utf8_lower||5.007003| -to_utf8_substr||| -to_utf8_title||5.007003| -to_utf8_upper||5.007003| -token_free||| -token_getmad||| -tokenize_use||| -tokeq||| -tokereport||| -too_few_arguments||| -too_many_arguments||| -uiv_2buf|||n -unlnk||| -unpack_rec||| -unpack_str||5.007003| -unpackstring||5.008001| -unshare_hek_or_pvn||| -unshare_hek||| -unsharepvn||5.004000| -unwind_handler_stack||| -update_debugger_info||| -upg_version||5.009005| -usage||| -utf16_to_utf8_reversed||5.006001| -utf16_to_utf8||5.006001| -utf8_distance||5.006000| -utf8_hop||5.006000| -utf8_length||5.007001| -utf8_mg_pos_cache_update||| -utf8_to_bytes||5.006001| -utf8_to_uvchr||5.007001| -utf8_to_uvuni||5.007001| -utf8n_to_uvchr||| -utf8n_to_uvuni||5.007001| -utilize||| -uvchr_to_utf8_flags||5.007003| -uvchr_to_utf8||| -uvuni_to_utf8_flags||5.007003| -uvuni_to_utf8||5.007001| -validate_suid||| -varname||| -vcmp||5.009000| -vcroak||5.006000| -vdeb||5.007003| -vdie_common||| -vdie_croak_common||| -vdie||| -vform||5.006000| -visit||| -vivify_defelem||| -vivify_ref||| -vload_module|5.006000||p -vmess||5.006000| -vnewSVpvf|5.006000|5.004000|p -vnormal||5.009002| -vnumify||5.009000| -vstringify||5.009000| -vverify||5.009003| -vwarner||5.006000| -vwarn||5.006000| -wait4pid||| -warn_nocontext|||vn -warner_nocontext|||vn -warner|5.006000|5.004000|pv -warn|||v -watch||| -whichsig||| -write_no_mem||| -write_to_stderr||| -xmldump_all||| -xmldump_attr||| -xmldump_eval||| -xmldump_form||| -xmldump_indent|||v -xmldump_packsubs||| -xmldump_sub||| -xmldump_vindent||| -yyerror||| -yylex||| -yyparse||| -yywarn||| -); - -if (exists $opt{'list-unsupported'}) { - my $f; - for $f (sort { lc $a cmp lc $b } keys %API) { - next unless $API{$f}{todo}; - print "$f ", '.'x(40-length($f)), " ", format_version($API{$f}{todo}), "\n"; - } - exit 0; -} - -# Scan for possible replacement candidates - -my(%replace, %need, %hints, %warnings, %depends); -my $replace = 0; -my($hint, $define, $function); - -sub find_api -{ - my $code = shift; - $code =~ s{ - / (?: \*[^*]*\*+(?:[^$ccs][^*]*\*+)* / | /[^\r\n]*) - | "[^"\\]*(?:\\.[^"\\]*)*" - | '[^'\\]*(?:\\.[^'\\]*)*' }{}egsx; - grep { exists $API{$_} } $code =~ /(\w+)/mg; -} - -while () { - if ($hint) { - my $h = $hint->[0] eq 'Hint' ? \%hints : \%warnings; - if (m{^\s*\*\s(.*?)\s*$}) { - for (@{$hint->[1]}) { - $h->{$_} ||= ''; # suppress warning with older perls - $h->{$_} .= "$1\n"; - } - } - else { undef $hint } - } - - $hint = [$1, [split /,?\s+/, $2]] - if m{^\s*$rccs\s+(Hint|Warning):\s+(\w+(?:,?\s+\w+)*)\s*$}; - - if ($define) { - if ($define->[1] =~ /\\$/) { - $define->[1] .= $_; - } - else { - if (exists $API{$define->[0]} && $define->[1] !~ /^DPPP_\(/) { - my @n = find_api($define->[1]); - push @{$depends{$define->[0]}}, @n if @n - } - undef $define; - } - } - - $define = [$1, $2] if m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(.*)}; - - if ($function) { - if (/^}/) { - if (exists $API{$function->[0]}) { - my @n = find_api($function->[1]); - push @{$depends{$function->[0]}}, @n if @n - } - undef $function; - } - else { - $function->[1] .= $_; - } - } - - $function = [$1, ''] if m{^DPPP_\(my_(\w+)\)}; - - $replace = $1 if m{^\s*$rccs\s+Replace:\s+(\d+)\s+$rcce\s*$}; - $replace{$2} = $1 if $replace and m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(\w+)}; - $replace{$2} = $1 if m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(\w+).*$rccs\s+Replace\s+$rcce}; - $replace{$1} = $2 if m{^\s*$rccs\s+Replace (\w+) with (\w+)\s+$rcce\s*$}; - - if (m{^\s*$rccs\s+(\w+(\s*,\s*\w+)*)\s+depends\s+on\s+(\w+(\s*,\s*\w+)*)\s+$rcce\s*$}) { - my @deps = map { s/\s+//g; $_ } split /,/, $3; - my $d; - for $d (map { s/\s+//g; $_ } split /,/, $1) { - push @{$depends{$d}}, @deps; - } - } - - $need{$1} = 1 if m{^#if\s+defined\(NEED_(\w+)(?:_GLOBAL)?\)}; -} - -for (values %depends) { - my %s; - $_ = [sort grep !$s{$_}++, @$_]; -} - -if (exists $opt{'api-info'}) { - my $f; - my $count = 0; - my $match = $opt{'api-info'} =~ m!^/(.*)/$! ? $1 : "^\Q$opt{'api-info'}\E\$"; - for $f (sort { lc $a cmp lc $b } keys %API) { - next unless $f =~ /$match/; - print "\n=== $f ===\n\n"; - my $info = 0; - if ($API{$f}{base} || $API{$f}{todo}) { - my $base = format_version($API{$f}{base} || $API{$f}{todo}); - print "Supported at least starting from perl-$base.\n"; - $info++; - } - if ($API{$f}{provided}) { - my $todo = $API{$f}{todo} ? format_version($API{$f}{todo}) : "5.003"; - print "Support by $ppport provided back to perl-$todo.\n"; - print "Support needs to be explicitly requested by NEED_$f.\n" if exists $need{$f}; - print "Depends on: ", join(', ', @{$depends{$f}}), ".\n" if exists $depends{$f}; - print "\n$hints{$f}" if exists $hints{$f}; - print "\nWARNING:\n$warnings{$f}" if exists $warnings{$f}; - $info++; - } - print "No portability information available.\n" unless $info; - $count++; - } - $count or print "Found no API matching '$opt{'api-info'}'."; - print "\n"; - exit 0; -} - -if (exists $opt{'list-provided'}) { - my $f; - for $f (sort { lc $a cmp lc $b } keys %API) { - next unless $API{$f}{provided}; - my @flags; - push @flags, 'explicit' if exists $need{$f}; - push @flags, 'depend' if exists $depends{$f}; - push @flags, 'hint' if exists $hints{$f}; - push @flags, 'warning' if exists $warnings{$f}; - my $flags = @flags ? ' ['.join(', ', @flags).']' : ''; - print "$f$flags\n"; - } - exit 0; -} - -my @files; -my @srcext = qw( .xs .c .h .cc .cpp -c.inc -xs.inc ); -my $srcext = join '|', map { quotemeta $_ } @srcext; - -if (@ARGV) { - my %seen; - for (@ARGV) { - if (-e) { - if (-f) { - push @files, $_ unless $seen{$_}++; - } - else { warn "'$_' is not a file.\n" } - } - else { - my @new = grep { -f } glob $_ - or warn "'$_' does not exist.\n"; - push @files, grep { !$seen{$_}++ } @new; - } - } -} -else { - eval { - require File::Find; - File::Find::find(sub { - $File::Find::name =~ /($srcext)$/i - and push @files, $File::Find::name; - }, '.'); - }; - if ($@) { - @files = map { glob "*$_" } @srcext; - } -} - -if (!@ARGV || $opt{filter}) { - my(@in, @out); - my %xsc = map { /(.*)\.xs$/ ? ("$1.c" => 1, "$1.cc" => 1) : () } @files; - for (@files) { - my $out = exists $xsc{$_} || /\b\Q$ppport\E$/i || !/($srcext)$/i; - push @{ $out ? \@out : \@in }, $_; - } - if (@ARGV && @out) { - warning("Skipping the following files (use --nofilter to avoid this):\n| ", join "\n| ", @out); - } - @files = @in; -} - -die "No input files given!\n" unless @files; - -my(%files, %global, %revreplace); -%revreplace = reverse %replace; -my $filename; -my $patch_opened = 0; - -for $filename (@files) { - unless (open IN, "<$filename") { - warn "Unable to read from $filename: $!\n"; - next; - } - - info("Scanning $filename ..."); - - my $c = do { local $/; }; - close IN; - - my %file = (orig => $c, changes => 0); - - # Temporarily remove C/XS comments and strings from the code - my @ccom; - - $c =~ s{ - ( ^$HS*\#$HS*include\b[^\r\n]+\b(?:\Q$ppport\E|XSUB\.h)\b[^\r\n]* - | ^$HS*\#$HS*(?:define|elif|if(?:def)?)\b[^\r\n]* ) - | ( ^$HS*\#[^\r\n]* - | "[^"\\]*(?:\\.[^"\\]*)*" - | '[^'\\]*(?:\\.[^'\\]*)*' - | / (?: \*[^*]*\*+(?:[^$ccs][^*]*\*+)* / | /[^\r\n]* ) ) - }{ defined $2 and push @ccom, $2; - defined $1 ? $1 : "$ccs$#ccom$cce" }mgsex; - - $file{ccom} = \@ccom; - $file{code} = $c; - $file{has_inc_ppport} = $c =~ /^$HS*#$HS*include[^\r\n]+\b\Q$ppport\E\b/m; - - my $func; - - for $func (keys %API) { - my $match = $func; - $match .= "|$revreplace{$func}" if exists $revreplace{$func}; - if ($c =~ /\b(?:Perl_)?($match)\b/) { - $file{uses_replace}{$1}++ if exists $revreplace{$func} && $1 eq $revreplace{$func}; - $file{uses_Perl}{$func}++ if $c =~ /\bPerl_$func\b/; - if (exists $API{$func}{provided}) { - $file{uses_provided}{$func}++; - if (!exists $API{$func}{base} || $API{$func}{base} > $opt{'compat-version'}) { - $file{uses}{$func}++; - my @deps = rec_depend($func); - if (@deps) { - $file{uses_deps}{$func} = \@deps; - for (@deps) { - $file{uses}{$_} = 0 unless exists $file{uses}{$_}; - } - } - for ($func, @deps) { - $file{needs}{$_} = 'static' if exists $need{$_}; - } - } - } - if (exists $API{$func}{todo} && $API{$func}{todo} > $opt{'compat-version'}) { - if ($c =~ /\b$func\b/) { - $file{uses_todo}{$func}++; - } - } - } - } - - while ($c =~ /^$HS*#$HS*define$HS+(NEED_(\w+?)(_GLOBAL)?)\b/mg) { - if (exists $need{$2}) { - $file{defined $3 ? 'needed_global' : 'needed_static'}{$2}++; - } - else { warning("Possibly wrong #define $1 in $filename") } - } - - for (qw(uses needs uses_todo needed_global needed_static)) { - for $func (keys %{$file{$_}}) { - push @{$global{$_}{$func}}, $filename; - } - } - - $files{$filename} = \%file; -} - -# Globally resolve NEED_'s -my $need; -for $need (keys %{$global{needs}}) { - if (@{$global{needs}{$need}} > 1) { - my @targets = @{$global{needs}{$need}}; - my @t = grep $files{$_}{needed_global}{$need}, @targets; - @targets = @t if @t; - @t = grep /\.xs$/i, @targets; - @targets = @t if @t; - my $target = shift @targets; - $files{$target}{needs}{$need} = 'global'; - for (@{$global{needs}{$need}}) { - $files{$_}{needs}{$need} = 'extern' if $_ ne $target; - } - } -} - -for $filename (@files) { - exists $files{$filename} or next; - - info("=== Analyzing $filename ==="); - - my %file = %{$files{$filename}}; - my $func; - my $c = $file{code}; - my $warnings = 0; - - for $func (sort keys %{$file{uses_Perl}}) { - if ($API{$func}{varargs}) { - unless ($API{$func}{nothxarg}) { - my $changes = ($c =~ s{\b(Perl_$func\s*\(\s*)(?!aTHX_?)(\)|[^\s)]*\))} - { $1 . ($2 eq ')' ? 'aTHX' : 'aTHX_ ') . $2 }ge); - if ($changes) { - warning("Doesn't pass interpreter argument aTHX to Perl_$func"); - $file{changes} += $changes; - } - } - } - else { - warning("Uses Perl_$func instead of $func"); - $file{changes} += ($c =~ s{\bPerl_$func(\s*)\((\s*aTHX_?)?\s*} - {$func$1(}g); - } - } - - for $func (sort keys %{$file{uses_replace}}) { - warning("Uses $func instead of $replace{$func}"); - $file{changes} += ($c =~ s/\b$func\b/$replace{$func}/g); - } - - for $func (sort keys %{$file{uses_provided}}) { - if ($file{uses}{$func}) { - if (exists $file{uses_deps}{$func}) { - diag("Uses $func, which depends on ", join(', ', @{$file{uses_deps}{$func}})); - } - else { - diag("Uses $func"); - } - } - $warnings += hint($func); - } - - unless ($opt{quiet}) { - for $func (sort keys %{$file{uses_todo}}) { - print "*** WARNING: Uses $func, which may not be portable below perl ", - format_version($API{$func}{todo}), ", even with '$ppport'\n"; - $warnings++; - } - } - - for $func (sort keys %{$file{needed_static}}) { - my $message = ''; - if (not exists $file{uses}{$func}) { - $message = "No need to define NEED_$func if $func is never used"; - } - elsif (exists $file{needs}{$func} && $file{needs}{$func} ne 'static') { - $message = "No need to define NEED_$func when already needed globally"; - } - if ($message) { - diag($message); - $file{changes} += ($c =~ s/^$HS*#$HS*define$HS+NEED_$func\b.*$LF//mg); - } - } - - for $func (sort keys %{$file{needed_global}}) { - my $message = ''; - if (not exists $global{uses}{$func}) { - $message = "No need to define NEED_${func}_GLOBAL if $func is never used"; - } - elsif (exists $file{needs}{$func}) { - if ($file{needs}{$func} eq 'extern') { - $message = "No need to define NEED_${func}_GLOBAL when already needed globally"; - } - elsif ($file{needs}{$func} eq 'static') { - $message = "No need to define NEED_${func}_GLOBAL when only used in this file"; - } - } - if ($message) { - diag($message); - $file{changes} += ($c =~ s/^$HS*#$HS*define$HS+NEED_${func}_GLOBAL\b.*$LF//mg); - } - } - - $file{needs_inc_ppport} = keys %{$file{uses}}; - - if ($file{needs_inc_ppport}) { - my $pp = ''; - - for $func (sort keys %{$file{needs}}) { - my $type = $file{needs}{$func}; - next if $type eq 'extern'; - my $suffix = $type eq 'global' ? '_GLOBAL' : ''; - unless (exists $file{"needed_$type"}{$func}) { - if ($type eq 'global') { - diag("Files [@{$global{needs}{$func}}] need $func, adding global request"); - } - else { - diag("File needs $func, adding static request"); - } - $pp .= "#define NEED_$func$suffix\n"; - } - } - - if ($pp && ($c =~ s/^(?=$HS*#$HS*define$HS+NEED_\w+)/$pp/m)) { - $pp = ''; - $file{changes}++; - } - - unless ($file{has_inc_ppport}) { - diag("Needs to include '$ppport'"); - $pp .= qq(#include "$ppport"\n) - } - - if ($pp) { - $file{changes} += ($c =~ s/^($HS*#$HS*define$HS+NEED_\w+.*?)^/$1$pp/ms) - || ($c =~ s/^(?=$HS*#$HS*include.*\Q$ppport\E)/$pp/m) - || ($c =~ s/^($HS*#$HS*include.*XSUB.*\s*?)^/$1$pp/m) - || ($c =~ s/^/$pp/); - } - } - else { - if ($file{has_inc_ppport}) { - diag("No need to include '$ppport'"); - $file{changes} += ($c =~ s/^$HS*?#$HS*include.*\Q$ppport\E.*?$LF//m); - } - } - - # put back in our C comments - my $ix; - my $cppc = 0; - my @ccom = @{$file{ccom}}; - for $ix (0 .. $#ccom) { - if (!$opt{cplusplus} && $ccom[$ix] =~ s!^//!!) { - $cppc++; - $file{changes} += $c =~ s/$rccs$ix$rcce/$ccs$ccom[$ix] $cce/; - } - else { - $c =~ s/$rccs$ix$rcce/$ccom[$ix]/; - } - } - - if ($cppc) { - my $s = $cppc != 1 ? 's' : ''; - warning("Uses $cppc C++ style comment$s, which is not portable"); - } - - my $s = $warnings != 1 ? 's' : ''; - my $warn = $warnings ? " ($warnings warning$s)" : ''; - info("Analysis completed$warn"); - - if ($file{changes}) { - if (exists $opt{copy}) { - my $newfile = "$filename$opt{copy}"; - if (-e $newfile) { - error("'$newfile' already exists, refusing to write copy of '$filename'"); - } - else { - local *F; - if (open F, ">$newfile") { - info("Writing copy of '$filename' with changes to '$newfile'"); - print F $c; - close F; - } - else { - error("Cannot open '$newfile' for writing: $!"); - } - } - } - elsif (exists $opt{patch} || $opt{changes}) { - if (exists $opt{patch}) { - unless ($patch_opened) { - if (open PATCH, ">$opt{patch}") { - $patch_opened = 1; - } - else { - error("Cannot open '$opt{patch}' for writing: $!"); - delete $opt{patch}; - $opt{changes} = 1; - goto fallback; - } - } - mydiff(\*PATCH, $filename, $c); - } - else { -fallback: - info("Suggested changes:"); - mydiff(\*STDOUT, $filename, $c); - } - } - else { - my $s = $file{changes} == 1 ? '' : 's'; - info("$file{changes} potentially required change$s detected"); - } - } - else { - info("Looks good"); - } -} - -close PATCH if $patch_opened; - -exit 0; - - -sub try_use { eval "use @_;"; return $@ eq '' } - -sub mydiff -{ - local *F = shift; - my($file, $str) = @_; - my $diff; - - if (exists $opt{diff}) { - $diff = run_diff($opt{diff}, $file, $str); - } - - if (!defined $diff and try_use('Text::Diff')) { - $diff = Text::Diff::diff($file, \$str, { STYLE => 'Unified' }); - $diff = <
$tmp") { - print F $str; - close F; - - if (open F, "$prog $file $tmp |") { - while () { - s/\Q$tmp\E/$file.patched/; - $diff .= $_; - } - close F; - unlink $tmp; - return $diff; - } - - unlink $tmp; - } - else { - error("Cannot open '$tmp' for writing: $!"); - } - - return undef; -} - -sub rec_depend -{ - my($func, $seen) = @_; - return () unless exists $depends{$func}; - $seen = {%{$seen||{}}}; - return () if $seen->{$func}++; - my %s; - grep !$s{$_}++, map { ($_, rec_depend($_, $seen)) } @{$depends{$func}}; -} - -sub parse_version -{ - my $ver = shift; - - if ($ver =~ /^(\d+)\.(\d+)\.(\d+)$/) { - return ($1, $2, $3); - } - elsif ($ver !~ /^\d+\.[\d_]+$/) { - die "cannot parse version '$ver'\n"; - } - - $ver =~ s/_//g; - $ver =~ s/$/000000/; - - my($r,$v,$s) = $ver =~ /(\d+)\.(\d{3})(\d{3})/; - - $v = int $v; - $s = int $s; - - if ($r < 5 || ($r == 5 && $v < 6)) { - if ($s % 10) { - die "cannot parse version '$ver'\n"; - } - } - - return ($r, $v, $s); -} - -sub format_version -{ - my $ver = shift; - - $ver =~ s/$/000000/; - my($r,$v,$s) = $ver =~ /(\d+)\.(\d{3})(\d{3})/; - - $v = int $v; - $s = int $s; - - if ($r < 5 || ($r == 5 && $v < 6)) { - if ($s % 10) { - die "invalid version '$ver'\n"; - } - $s /= 10; - - $ver = sprintf "%d.%03d", $r, $v; - $s > 0 and $ver .= sprintf "_%02d", $s; - - return $ver; - } - - return sprintf "%d.%d.%d", $r, $v, $s; -} - -sub info -{ - $opt{quiet} and return; - print @_, "\n"; -} - -sub diag -{ - $opt{quiet} and return; - $opt{diag} and print @_, "\n"; -} - -sub warning -{ - $opt{quiet} and return; - print "*** ", @_, "\n"; -} - -sub error -{ - print "*** ERROR: ", @_, "\n"; -} - -my %given_hints; -my %given_warnings; -sub hint -{ - $opt{quiet} and return; - my $func = shift; - my $rv = 0; - if (exists $warnings{$func} && !$given_warnings{$func}++) { - my $warn = $warnings{$func}; - $warn =~ s!^!*** !mg; - print "*** WARNING: $func\n", $warn; - $rv++; - } - if ($opt{hints} && exists $hints{$func} && !$given_hints{$func}++) { - my $hint = $hints{$func}; - $hint =~ s/^/ /mg; - print " --- hint for $func ---\n", $hint; - } - $rv; -} - -sub usage -{ - my($usage) = do { local(@ARGV,$/)=($0); <> } =~ /^=head\d$HS+SYNOPSIS\s*^(.*?)\s*^=/ms; - my %M = ( 'I' => '*' ); - $usage =~ s/^\s*perl\s+\S+/$^X $0/; - $usage =~ s/([A-Z])<([^>]+)>/$M{$1}$2$M{$1}/g; - - print < }; - my($copy) = $self =~ /^=head\d\s+COPYRIGHT\s*^(.*?)^=\w+/ms; - $copy =~ s/^(?=\S+)/ /gms; - $self =~ s/^$HS+Do NOT edit.*?(?=^-)/$copy/ms; - $self =~ s/^SKIP.*(?=^__DATA__)/SKIP -if (\@ARGV && \$ARGV[0] eq '--unstrip') { - eval { require Devel::PPPort }; - \$@ and die "Cannot require Devel::PPPort, please install.\\n"; - if (eval \$Devel::PPPort::VERSION < $VERSION) { - die "$0 was originally generated with Devel::PPPort $VERSION.\\n" - . "Your Devel::PPPort is only version \$Devel::PPPort::VERSION.\\n" - . "Please install a newer version, or --unstrip will not work.\\n"; - } - Devel::PPPort::WriteFile(\$0); - exit 0; -} -print <$0" or die "cannot strip $0: $!\n"; - print OUT "$pl$c\n"; - - exit 0; -} - -__DATA__ -*/ - -#ifndef _P_P_PORTABILITY_H_ -#define _P_P_PORTABILITY_H_ - -#ifndef DPPP_NAMESPACE -# define DPPP_NAMESPACE DPPP_ -#endif - -#define DPPP_CAT2(x,y) CAT2(x,y) -#define DPPP_(name) DPPP_CAT2(DPPP_NAMESPACE, name) - -#ifndef PERL_REVISION -# if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION)) -# define PERL_PATCHLEVEL_H_IMPLICIT -# include -# endif -# if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL))) -# include -# endif -# ifndef PERL_REVISION -# define PERL_REVISION (5) - /* Replace: 1 */ -# define PERL_VERSION PATCHLEVEL -# define PERL_SUBVERSION SUBVERSION - /* Replace PERL_PATCHLEVEL with PERL_VERSION */ - /* Replace: 0 */ -# endif -#endif - -#define _dpppDEC2BCD(dec) ((((dec)/100)<<8)|((((dec)%100)/10)<<4)|((dec)%10)) -#define PERL_BCDVERSION ((_dpppDEC2BCD(PERL_REVISION)<<24)|(_dpppDEC2BCD(PERL_VERSION)<<12)|_dpppDEC2BCD(PERL_SUBVERSION)) - -/* It is very unlikely that anyone will try to use this with Perl 6 - (or greater), but who knows. - */ -#if PERL_REVISION != 5 -# error ppport.h only works with Perl version 5 -#endif /* PERL_REVISION != 5 */ -#ifndef dTHR -# define dTHR dNOOP -#endif -#ifndef dTHX -# define dTHX dNOOP -#endif - -#ifndef dTHXa -# define dTHXa(x) dNOOP -#endif -#ifndef pTHX -# define pTHX void -#endif - -#ifndef pTHX_ -# define pTHX_ -#endif - -#ifndef aTHX -# define aTHX -#endif - -#ifndef aTHX_ -# define aTHX_ -#endif - -#if (PERL_BCDVERSION < 0x5006000) -# ifdef USE_THREADS -# define aTHXR thr -# define aTHXR_ thr, -# else -# define aTHXR -# define aTHXR_ -# endif -# define dTHXR dTHR -#else -# define aTHXR aTHX -# define aTHXR_ aTHX_ -# define dTHXR dTHX -#endif -#ifndef dTHXoa -# define dTHXoa(x) dTHXa(x) -#endif - -#ifdef I_LIMITS -# include -#endif - -#ifndef PERL_UCHAR_MIN -# define PERL_UCHAR_MIN ((unsigned char)0) -#endif - -#ifndef PERL_UCHAR_MAX -# ifdef UCHAR_MAX -# define PERL_UCHAR_MAX ((unsigned char)UCHAR_MAX) -# else -# ifdef MAXUCHAR -# define PERL_UCHAR_MAX ((unsigned char)MAXUCHAR) -# else -# define PERL_UCHAR_MAX ((unsigned char)~(unsigned)0) -# endif -# endif -#endif - -#ifndef PERL_USHORT_MIN -# define PERL_USHORT_MIN ((unsigned short)0) -#endif - -#ifndef PERL_USHORT_MAX -# ifdef USHORT_MAX -# define PERL_USHORT_MAX ((unsigned short)USHORT_MAX) -# else -# ifdef MAXUSHORT -# define PERL_USHORT_MAX ((unsigned short)MAXUSHORT) -# else -# ifdef USHRT_MAX -# define PERL_USHORT_MAX ((unsigned short)USHRT_MAX) -# else -# define PERL_USHORT_MAX ((unsigned short)~(unsigned)0) -# endif -# endif -# endif -#endif - -#ifndef PERL_SHORT_MAX -# ifdef SHORT_MAX -# define PERL_SHORT_MAX ((short)SHORT_MAX) -# else -# ifdef MAXSHORT /* Often used in */ -# define PERL_SHORT_MAX ((short)MAXSHORT) -# else -# ifdef SHRT_MAX -# define PERL_SHORT_MAX ((short)SHRT_MAX) -# else -# define PERL_SHORT_MAX ((short) (PERL_USHORT_MAX >> 1)) -# endif -# endif -# endif -#endif - -#ifndef PERL_SHORT_MIN -# ifdef SHORT_MIN -# define PERL_SHORT_MIN ((short)SHORT_MIN) -# else -# ifdef MINSHORT -# define PERL_SHORT_MIN ((short)MINSHORT) -# else -# ifdef SHRT_MIN -# define PERL_SHORT_MIN ((short)SHRT_MIN) -# else -# define PERL_SHORT_MIN (-PERL_SHORT_MAX - ((3 & -1) == 3)) -# endif -# endif -# endif -#endif - -#ifndef PERL_UINT_MAX -# ifdef UINT_MAX -# define PERL_UINT_MAX ((unsigned int)UINT_MAX) -# else -# ifdef MAXUINT -# define PERL_UINT_MAX ((unsigned int)MAXUINT) -# else -# define PERL_UINT_MAX (~(unsigned int)0) -# endif -# endif -#endif - -#ifndef PERL_UINT_MIN -# define PERL_UINT_MIN ((unsigned int)0) -#endif - -#ifndef PERL_INT_MAX -# ifdef INT_MAX -# define PERL_INT_MAX ((int)INT_MAX) -# else -# ifdef MAXINT /* Often used in */ -# define PERL_INT_MAX ((int)MAXINT) -# else -# define PERL_INT_MAX ((int)(PERL_UINT_MAX >> 1)) -# endif -# endif -#endif - -#ifndef PERL_INT_MIN -# ifdef INT_MIN -# define PERL_INT_MIN ((int)INT_MIN) -# else -# ifdef MININT -# define PERL_INT_MIN ((int)MININT) -# else -# define PERL_INT_MIN (-PERL_INT_MAX - ((3 & -1) == 3)) -# endif -# endif -#endif - -#ifndef PERL_ULONG_MAX -# ifdef ULONG_MAX -# define PERL_ULONG_MAX ((unsigned long)ULONG_MAX) -# else -# ifdef MAXULONG -# define PERL_ULONG_MAX ((unsigned long)MAXULONG) -# else -# define PERL_ULONG_MAX (~(unsigned long)0) -# endif -# endif -#endif - -#ifndef PERL_ULONG_MIN -# define PERL_ULONG_MIN ((unsigned long)0L) -#endif - -#ifndef PERL_LONG_MAX -# ifdef LONG_MAX -# define PERL_LONG_MAX ((long)LONG_MAX) -# else -# ifdef MAXLONG -# define PERL_LONG_MAX ((long)MAXLONG) -# else -# define PERL_LONG_MAX ((long) (PERL_ULONG_MAX >> 1)) -# endif -# endif -#endif - -#ifndef PERL_LONG_MIN -# ifdef LONG_MIN -# define PERL_LONG_MIN ((long)LONG_MIN) -# else -# ifdef MINLONG -# define PERL_LONG_MIN ((long)MINLONG) -# else -# define PERL_LONG_MIN (-PERL_LONG_MAX - ((3 & -1) == 3)) -# endif -# endif -#endif - -#if defined(HAS_QUAD) && (defined(convex) || defined(uts)) -# ifndef PERL_UQUAD_MAX -# ifdef ULONGLONG_MAX -# define PERL_UQUAD_MAX ((unsigned long long)ULONGLONG_MAX) -# else -# ifdef MAXULONGLONG -# define PERL_UQUAD_MAX ((unsigned long long)MAXULONGLONG) -# else -# define PERL_UQUAD_MAX (~(unsigned long long)0) -# endif -# endif -# endif - -# ifndef PERL_UQUAD_MIN -# define PERL_UQUAD_MIN ((unsigned long long)0L) -# endif - -# ifndef PERL_QUAD_MAX -# ifdef LONGLONG_MAX -# define PERL_QUAD_MAX ((long long)LONGLONG_MAX) -# else -# ifdef MAXLONGLONG -# define PERL_QUAD_MAX ((long long)MAXLONGLONG) -# else -# define PERL_QUAD_MAX ((long long) (PERL_UQUAD_MAX >> 1)) -# endif -# endif -# endif - -# ifndef PERL_QUAD_MIN -# ifdef LONGLONG_MIN -# define PERL_QUAD_MIN ((long long)LONGLONG_MIN) -# else -# ifdef MINLONGLONG -# define PERL_QUAD_MIN ((long long)MINLONGLONG) -# else -# define PERL_QUAD_MIN (-PERL_QUAD_MAX - ((3 & -1) == 3)) -# endif -# endif -# endif -#endif - -/* This is based on code from 5.003 perl.h */ -#ifdef HAS_QUAD -# ifdef cray -#ifndef IVTYPE -# define IVTYPE int -#endif - -#ifndef IV_MIN -# define IV_MIN PERL_INT_MIN -#endif - -#ifndef IV_MAX -# define IV_MAX PERL_INT_MAX -#endif - -#ifndef UV_MIN -# define UV_MIN PERL_UINT_MIN -#endif - -#ifndef UV_MAX -# define UV_MAX PERL_UINT_MAX -#endif - -# ifdef INTSIZE -#ifndef IVSIZE -# define IVSIZE INTSIZE -#endif - -# endif -# else -# if defined(convex) || defined(uts) -#ifndef IVTYPE -# define IVTYPE long long -#endif - -#ifndef IV_MIN -# define IV_MIN PERL_QUAD_MIN -#endif - -#ifndef IV_MAX -# define IV_MAX PERL_QUAD_MAX -#endif - -#ifndef UV_MIN -# define UV_MIN PERL_UQUAD_MIN -#endif - -#ifndef UV_MAX -# define UV_MAX PERL_UQUAD_MAX -#endif - -# ifdef LONGLONGSIZE -#ifndef IVSIZE -# define IVSIZE LONGLONGSIZE -#endif - -# endif -# else -#ifndef IVTYPE -# define IVTYPE long -#endif - -#ifndef IV_MIN -# define IV_MIN PERL_LONG_MIN -#endif - -#ifndef IV_MAX -# define IV_MAX PERL_LONG_MAX -#endif - -#ifndef UV_MIN -# define UV_MIN PERL_ULONG_MIN -#endif - -#ifndef UV_MAX -# define UV_MAX PERL_ULONG_MAX -#endif - -# ifdef LONGSIZE -#ifndef IVSIZE -# define IVSIZE LONGSIZE -#endif - -# endif -# endif -# endif -#ifndef IVSIZE -# define IVSIZE 8 -#endif - -#ifndef PERL_QUAD_MIN -# define PERL_QUAD_MIN IV_MIN -#endif - -#ifndef PERL_QUAD_MAX -# define PERL_QUAD_MAX IV_MAX -#endif - -#ifndef PERL_UQUAD_MIN -# define PERL_UQUAD_MIN UV_MIN -#endif - -#ifndef PERL_UQUAD_MAX -# define PERL_UQUAD_MAX UV_MAX -#endif - -#else -#ifndef IVTYPE -# define IVTYPE long -#endif - -#ifndef IV_MIN -# define IV_MIN PERL_LONG_MIN -#endif - -#ifndef IV_MAX -# define IV_MAX PERL_LONG_MAX -#endif - -#ifndef UV_MIN -# define UV_MIN PERL_ULONG_MIN -#endif - -#ifndef UV_MAX -# define UV_MAX PERL_ULONG_MAX -#endif - -#endif - -#ifndef IVSIZE -# ifdef LONGSIZE -# define IVSIZE LONGSIZE -# else -# define IVSIZE 4 /* A bold guess, but the best we can make. */ -# endif -#endif -#ifndef UVTYPE -# define UVTYPE unsigned IVTYPE -#endif - -#ifndef UVSIZE -# define UVSIZE IVSIZE -#endif -#ifndef sv_setuv -# define sv_setuv(sv, uv) \ - STMT_START { \ - UV TeMpUv = uv; \ - if (TeMpUv <= IV_MAX) \ - sv_setiv(sv, TeMpUv); \ - else \ - sv_setnv(sv, (double)TeMpUv); \ - } STMT_END -#endif -#ifndef newSVuv -# define newSVuv(uv) ((uv) <= IV_MAX ? newSViv((IV)uv) : newSVnv((NV)uv)) -#endif -#ifndef sv_2uv -# define sv_2uv(sv) ((PL_Sv = (sv)), (UV) (SvNOK(PL_Sv) ? SvNV(PL_Sv) : sv_2nv(PL_Sv))) -#endif - -#ifndef SvUVX -# define SvUVX(sv) ((UV)SvIVX(sv)) -#endif - -#ifndef SvUVXx -# define SvUVXx(sv) SvUVX(sv) -#endif - -#ifndef SvUV -# define SvUV(sv) (SvIOK(sv) ? SvUVX(sv) : sv_2uv(sv)) -#endif - -#ifndef SvUVx -# define SvUVx(sv) ((PL_Sv = (sv)), SvUV(PL_Sv)) -#endif - -/* Hint: sv_uv - * Always use the SvUVx() macro instead of sv_uv(). - */ -#ifndef sv_uv -# define sv_uv(sv) SvUVx(sv) -#endif - -#if !defined(SvUOK) && defined(SvIOK_UV) -# define SvUOK(sv) SvIOK_UV(sv) -#endif -#ifndef XST_mUV -# define XST_mUV(i,v) (ST(i) = sv_2mortal(newSVuv(v)) ) -#endif - -#ifndef XSRETURN_UV -# define XSRETURN_UV(v) STMT_START { XST_mUV(0,v); XSRETURN(1); } STMT_END -#endif -#ifndef PUSHu -# define PUSHu(u) STMT_START { sv_setuv(TARG, (UV)(u)); PUSHTARG; } STMT_END -#endif - -#ifndef XPUSHu -# define XPUSHu(u) STMT_START { sv_setuv(TARG, (UV)(u)); XPUSHTARG; } STMT_END -#endif - -#ifdef HAS_MEMCMP -#ifndef memNE -# define memNE(s1,s2,l) (memcmp(s1,s2,l)) -#endif - -#ifndef memEQ -# define memEQ(s1,s2,l) (!memcmp(s1,s2,l)) -#endif - -#else -#ifndef memNE -# define memNE(s1,s2,l) (bcmp(s1,s2,l)) -#endif - -#ifndef memEQ -# define memEQ(s1,s2,l) (!bcmp(s1,s2,l)) -#endif - -#endif -#ifndef MoveD -# define MoveD(s,d,n,t) memmove((char*)(d),(char*)(s), (n) * sizeof(t)) -#endif - -#ifndef CopyD -# define CopyD(s,d,n,t) memcpy((char*)(d),(char*)(s), (n) * sizeof(t)) -#endif - -#ifdef HAS_MEMSET -#ifndef ZeroD -# define ZeroD(d,n,t) memzero((char*)(d), (n) * sizeof(t)) -#endif - -#else -#ifndef ZeroD -# define ZeroD(d,n,t) ((void)memzero((char*)(d), (n) * sizeof(t)), d) -#endif - -#endif -#ifndef PoisonWith -# define PoisonWith(d,n,t,b) (void)memset((char*)(d), (U8)(b), (n) * sizeof(t)) -#endif - -#ifndef PoisonNew -# define PoisonNew(d,n,t) PoisonWith(d,n,t,0xAB) -#endif - -#ifndef PoisonFree -# define PoisonFree(d,n,t) PoisonWith(d,n,t,0xEF) -#endif - -#ifndef Poison -# define Poison(d,n,t) PoisonFree(d,n,t) -#endif -#ifndef Newx -# define Newx(v,n,t) New(0,v,n,t) -#endif - -#ifndef Newxc -# define Newxc(v,n,t,c) Newc(0,v,n,t,c) -#endif - -#ifndef Newxz -# define Newxz(v,n,t) Newz(0,v,n,t) -#endif - -#ifndef PERL_UNUSED_DECL -# ifdef HASATTRIBUTE -# if (defined(__GNUC__) && defined(__cplusplus)) || defined(__INTEL_COMPILER) -# define PERL_UNUSED_DECL -# else -# define PERL_UNUSED_DECL __attribute__((unused)) -# endif -# else -# define PERL_UNUSED_DECL -# endif -#endif - -#ifndef PERL_UNUSED_ARG -# if defined(lint) && defined(S_SPLINT_S) /* www.splint.org */ -# include -# define PERL_UNUSED_ARG(x) NOTE(ARGUNUSED(x)) -# else -# define PERL_UNUSED_ARG(x) ((void)x) -# endif -#endif - -#ifndef PERL_UNUSED_VAR -# define PERL_UNUSED_VAR(x) ((void)x) -#endif - -#ifndef PERL_UNUSED_CONTEXT -# ifdef USE_ITHREADS -# define PERL_UNUSED_CONTEXT PERL_UNUSED_ARG(my_perl) -# else -# define PERL_UNUSED_CONTEXT -# endif -#endif -#ifndef NOOP -# define NOOP /*EMPTY*/(void)0 -#endif - -#ifndef dNOOP -# define dNOOP extern int /*@unused@*/ Perl___notused PERL_UNUSED_DECL -#endif - -#ifndef NVTYPE -# if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) -# define NVTYPE long double -# else -# define NVTYPE double -# endif -typedef NVTYPE NV; -#endif - -#ifndef INT2PTR -# if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE) -# define PTRV UV -# define INT2PTR(any,d) (any)(d) -# else -# if PTRSIZE == LONGSIZE -# define PTRV unsigned long -# else -# define PTRV unsigned -# endif -# define INT2PTR(any,d) (any)(PTRV)(d) -# endif -#endif - -#ifndef PTR2ul -# if PTRSIZE == LONGSIZE -# define PTR2ul(p) (unsigned long)(p) -# else -# define PTR2ul(p) INT2PTR(unsigned long,p) -# endif -#endif -#ifndef PTR2nat -# define PTR2nat(p) (PTRV)(p) -#endif - -#ifndef NUM2PTR -# define NUM2PTR(any,d) (any)PTR2nat(d) -#endif - -#ifndef PTR2IV -# define PTR2IV(p) INT2PTR(IV,p) -#endif - -#ifndef PTR2UV -# define PTR2UV(p) INT2PTR(UV,p) -#endif - -#ifndef PTR2NV -# define PTR2NV(p) NUM2PTR(NV,p) -#endif - -#undef START_EXTERN_C -#undef END_EXTERN_C -#undef EXTERN_C -#ifdef __cplusplus -# define START_EXTERN_C extern "C" { -# define END_EXTERN_C } -# define EXTERN_C extern "C" -#else -# define START_EXTERN_C -# define END_EXTERN_C -# define EXTERN_C extern -#endif - -#if defined(PERL_GCC_PEDANTIC) -# ifndef PERL_GCC_BRACE_GROUPS_FORBIDDEN -# define PERL_GCC_BRACE_GROUPS_FORBIDDEN -# endif -#endif - -#if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) && !defined(__cplusplus) -# ifndef PERL_USE_GCC_BRACE_GROUPS -# define PERL_USE_GCC_BRACE_GROUPS -# endif -#endif - -#undef STMT_START -#undef STMT_END -#ifdef PERL_USE_GCC_BRACE_GROUPS -# define STMT_START (void)( /* gcc supports ``({ STATEMENTS; })'' */ -# define STMT_END ) -#else -# if defined(VOIDFLAGS) && (VOIDFLAGS) && (defined(sun) || defined(__sun__)) && !defined(__GNUC__) -# define STMT_START if (1) -# define STMT_END else (void)0 -# else -# define STMT_START do -# define STMT_END while (0) -# endif -#endif -#ifndef boolSV -# define boolSV(b) ((b) ? &PL_sv_yes : &PL_sv_no) -#endif - -/* DEFSV appears first in 5.004_56 */ -#ifndef DEFSV -# define DEFSV GvSV(PL_defgv) -#endif - -#ifndef SAVE_DEFSV -# define SAVE_DEFSV SAVESPTR(GvSV(PL_defgv)) -#endif - -#ifndef DEFSV_set -# define DEFSV_set(sv) (DEFSV = (sv)) -#endif - -/* Older perls (<=5.003) lack AvFILLp */ -#ifndef AvFILLp -# define AvFILLp AvFILL -#endif -#ifndef ERRSV -# define ERRSV get_sv("@",FALSE) -#endif - -/* Hint: gv_stashpvn - * This function's backport doesn't support the length parameter, but - * rather ignores it. Portability can only be ensured if the length - * parameter is used for speed reasons, but the length can always be - * correctly computed from the string argument. - */ -#ifndef gv_stashpvn -# define gv_stashpvn(str,len,create) gv_stashpv(str,create) -#endif - -/* Replace: 1 */ -#ifndef get_cv -# define get_cv perl_get_cv -#endif - -#ifndef get_sv -# define get_sv perl_get_sv -#endif - -#ifndef get_av -# define get_av perl_get_av -#endif - -#ifndef get_hv -# define get_hv perl_get_hv -#endif - -/* Replace: 0 */ -#ifndef dUNDERBAR -# define dUNDERBAR dNOOP -#endif - -#ifndef UNDERBAR -# define UNDERBAR DEFSV -#endif -#ifndef dAX -# define dAX I32 ax = MARK - PL_stack_base + 1 -#endif - -#ifndef dITEMS -# define dITEMS I32 items = SP - MARK -#endif -#ifndef dXSTARG -# define dXSTARG SV * targ = sv_newmortal() -#endif -#ifndef dAXMARK -# define dAXMARK I32 ax = POPMARK; \ - register SV ** const mark = PL_stack_base + ax++ -#endif -#ifndef XSprePUSH -# define XSprePUSH (sp = PL_stack_base + ax - 1) -#endif - -#if (PERL_BCDVERSION < 0x5005000) -# undef XSRETURN -# define XSRETURN(off) \ - STMT_START { \ - PL_stack_sp = PL_stack_base + ax + ((off) - 1); \ - return; \ - } STMT_END -#endif -#ifndef PERL_ABS -# define PERL_ABS(x) ((x) < 0 ? -(x) : (x)) -#endif -#ifndef dVAR -# define dVAR dNOOP -#endif -#ifndef SVf -# define SVf "_" -#endif -#ifndef UTF8_MAXBYTES -# define UTF8_MAXBYTES UTF8_MAXLEN -#endif -#ifndef CPERLscope -# define CPERLscope(x) x -#endif -#ifndef PERL_HASH -# define PERL_HASH(hash,str,len) \ - STMT_START { \ - const char *s_PeRlHaSh = str; \ - I32 i_PeRlHaSh = len; \ - U32 hash_PeRlHaSh = 0; \ - while (i_PeRlHaSh--) \ - hash_PeRlHaSh = hash_PeRlHaSh * 33 + *s_PeRlHaSh++; \ - (hash) = hash_PeRlHaSh; \ - } STMT_END -#endif - -#ifndef PERLIO_FUNCS_DECL -# ifdef PERLIO_FUNCS_CONST -# define PERLIO_FUNCS_DECL(funcs) const PerlIO_funcs funcs -# define PERLIO_FUNCS_CAST(funcs) (PerlIO_funcs*)(funcs) -# else -# define PERLIO_FUNCS_DECL(funcs) PerlIO_funcs funcs -# define PERLIO_FUNCS_CAST(funcs) (funcs) -# endif -#endif - -/* provide these typedefs for older perls */ -#if (PERL_BCDVERSION < 0x5009003) - -# ifdef ARGSproto -typedef OP* (CPERLscope(*Perl_ppaddr_t))(ARGSproto); -# else -typedef OP* (CPERLscope(*Perl_ppaddr_t))(pTHX); -# endif - -typedef OP* (CPERLscope(*Perl_check_t)) (pTHX_ OP*); - -#endif -#ifndef isPSXSPC -# define isPSXSPC(c) (isSPACE(c) || (c) == '\v') -#endif - -#ifndef isBLANK -# define isBLANK(c) ((c) == ' ' || (c) == '\t') -#endif - -#ifdef EBCDIC -#ifndef isALNUMC -# define isALNUMC(c) isalnum(c) -#endif - -#ifndef isASCII -# define isASCII(c) isascii(c) -#endif - -#ifndef isCNTRL -# define isCNTRL(c) iscntrl(c) -#endif - -#ifndef isGRAPH -# define isGRAPH(c) isgraph(c) -#endif - -#ifndef isPRINT -# define isPRINT(c) isprint(c) -#endif - -#ifndef isPUNCT -# define isPUNCT(c) ispunct(c) -#endif - -#ifndef isXDIGIT -# define isXDIGIT(c) isxdigit(c) -#endif - -#else -# if (PERL_BCDVERSION < 0x5010000) -/* Hint: isPRINT - * The implementation in older perl versions includes all of the - * isSPACE() characters, which is wrong. The version provided by - * Devel::PPPort always overrides a present buggy version. - */ -# undef isPRINT -# endif -#ifndef isALNUMC -# define isALNUMC(c) (isALPHA(c) || isDIGIT(c)) -#endif - -#ifndef isASCII -# define isASCII(c) ((c) <= 127) -#endif - -#ifndef isCNTRL -# define isCNTRL(c) ((c) < ' ' || (c) == 127) -#endif - -#ifndef isGRAPH -# define isGRAPH(c) (isALNUM(c) || isPUNCT(c)) -#endif - -#ifndef isPRINT -# define isPRINT(c) (((c) >= 32 && (c) < 127)) -#endif - -#ifndef isPUNCT -# define isPUNCT(c) (((c) >= 33 && (c) <= 47) || ((c) >= 58 && (c) <= 64) || ((c) >= 91 && (c) <= 96) || ((c) >= 123 && (c) <= 126)) -#endif - -#ifndef isXDIGIT -# define isXDIGIT(c) (isDIGIT(c) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F')) -#endif - -#endif - -#ifndef PERL_SIGNALS_UNSAFE_FLAG - -#define PERL_SIGNALS_UNSAFE_FLAG 0x0001 - -#if (PERL_BCDVERSION < 0x5008000) -# define D_PPP_PERL_SIGNALS_INIT PERL_SIGNALS_UNSAFE_FLAG -#else -# define D_PPP_PERL_SIGNALS_INIT 0 -#endif - -#if defined(NEED_PL_signals) -static U32 DPPP_(my_PL_signals) = D_PPP_PERL_SIGNALS_INIT; -#elif defined(NEED_PL_signals_GLOBAL) -U32 DPPP_(my_PL_signals) = D_PPP_PERL_SIGNALS_INIT; -#else -extern U32 DPPP_(my_PL_signals); -#endif -#define PL_signals DPPP_(my_PL_signals) - -#endif - -/* Hint: PL_ppaddr - * Calling an op via PL_ppaddr requires passing a context argument - * for threaded builds. Since the context argument is different for - * 5.005 perls, you can use aTHXR (supplied by ppport.h), which will - * automatically be defined as the correct argument. - */ - -#if (PERL_BCDVERSION <= 0x5005005) -/* Replace: 1 */ -# define PL_ppaddr ppaddr -# define PL_no_modify no_modify -/* Replace: 0 */ -#endif - -#if (PERL_BCDVERSION <= 0x5004005) -/* Replace: 1 */ -# define PL_DBsignal DBsignal -# define PL_DBsingle DBsingle -# define PL_DBsub DBsub -# define PL_DBtrace DBtrace -# define PL_Sv Sv -# define PL_bufend bufend -# define PL_bufptr bufptr -# define PL_compiling compiling -# define PL_copline copline -# define PL_curcop curcop -# define PL_curstash curstash -# define PL_debstash debstash -# define PL_defgv defgv -# define PL_diehook diehook -# define PL_dirty dirty -# define PL_dowarn dowarn -# define PL_errgv errgv -# define PL_expect expect -# define PL_hexdigit hexdigit -# define PL_hints hints -# define PL_laststatval laststatval -# define PL_lex_state lex_state -# define PL_lex_stuff lex_stuff -# define PL_linestr linestr -# define PL_na na -# define PL_perl_destruct_level perl_destruct_level -# define PL_perldb perldb -# define PL_rsfp_filters rsfp_filters -# define PL_rsfp rsfp -# define PL_stack_base stack_base -# define PL_stack_sp stack_sp -# define PL_statcache statcache -# define PL_stdingv stdingv -# define PL_sv_arenaroot sv_arenaroot -# define PL_sv_no sv_no -# define PL_sv_undef sv_undef -# define PL_sv_yes sv_yes -# define PL_tainted tainted -# define PL_tainting tainting -# define PL_tokenbuf tokenbuf -/* Replace: 0 */ -#endif - -/* Warning: PL_parser - * For perl versions earlier than 5.9.5, this is an always - * non-NULL dummy. Also, it cannot be dereferenced. Don't - * use it if you can avoid is and unless you absolutely know - * what you're doing. - * If you always check that PL_parser is non-NULL, you can - * define DPPP_PL_parser_NO_DUMMY to avoid the creation of - * a dummy parser structure. - */ - -#if (PERL_BCDVERSION >= 0x5009005) -# ifdef DPPP_PL_parser_NO_DUMMY -# define D_PPP_my_PL_parser_var(var) ((PL_parser ? PL_parser : \ - (croak("panic: PL_parser == NULL in %s:%d", \ - __FILE__, __LINE__), (yy_parser *) NULL))->var) -# else -# ifdef DPPP_PL_parser_NO_DUMMY_WARNING -# define D_PPP_parser_dummy_warning(var) -# else -# define D_PPP_parser_dummy_warning(var) \ - warn("warning: dummy PL_" #var " used in %s:%d", __FILE__, __LINE__), -# endif -# define D_PPP_my_PL_parser_var(var) ((PL_parser ? PL_parser : \ - (D_PPP_parser_dummy_warning(var) &DPPP_(dummy_PL_parser)))->var) -#if defined(NEED_PL_parser) -static yy_parser DPPP_(dummy_PL_parser); -#elif defined(NEED_PL_parser_GLOBAL) -yy_parser DPPP_(dummy_PL_parser); -#else -extern yy_parser DPPP_(dummy_PL_parser); -#endif - -# endif - -/* PL_expect, PL_copline, PL_rsfp, PL_rsfp_filters, PL_linestr, PL_bufptr, PL_bufend, PL_lex_state, PL_lex_stuff, PL_tokenbuf depends on PL_parser */ -/* Warning: PL_expect, PL_copline, PL_rsfp, PL_rsfp_filters, PL_linestr, PL_bufptr, PL_bufend, PL_lex_state, PL_lex_stuff, PL_tokenbuf - * Do not use this variable unless you know exactly what you're - * doint. It is internal to the perl parser and may change or even - * be removed in the future. As of perl 5.9.5, you have to check - * for (PL_parser != NULL) for this variable to have any effect. - * An always non-NULL PL_parser dummy is provided for earlier - * perl versions. - * If PL_parser is NULL when you try to access this variable, a - * dummy is being accessed instead and a warning is issued unless - * you define DPPP_PL_parser_NO_DUMMY_WARNING. - * If DPPP_PL_parser_NO_DUMMY is defined, the code trying to access - * this variable will croak with a panic message. - */ - -# define PL_expect D_PPP_my_PL_parser_var(expect) -# define PL_copline D_PPP_my_PL_parser_var(copline) -# define PL_rsfp D_PPP_my_PL_parser_var(rsfp) -# define PL_rsfp_filters D_PPP_my_PL_parser_var(rsfp_filters) -# define PL_linestr D_PPP_my_PL_parser_var(linestr) -# define PL_bufptr D_PPP_my_PL_parser_var(bufptr) -# define PL_bufend D_PPP_my_PL_parser_var(bufend) -# define PL_lex_state D_PPP_my_PL_parser_var(lex_state) -# define PL_lex_stuff D_PPP_my_PL_parser_var(lex_stuff) -# define PL_tokenbuf D_PPP_my_PL_parser_var(tokenbuf) - -#else - -/* ensure that PL_parser != NULL and cannot be dereferenced */ -# define PL_parser ((void *) 1) - -#endif -#ifndef mPUSHs -# define mPUSHs(s) PUSHs(sv_2mortal(s)) -#endif - -#ifndef PUSHmortal -# define PUSHmortal PUSHs(sv_newmortal()) -#endif - -#ifndef mPUSHp -# define mPUSHp(p,l) sv_setpvn(PUSHmortal, (p), (l)) -#endif - -#ifndef mPUSHn -# define mPUSHn(n) sv_setnv(PUSHmortal, (NV)(n)) -#endif - -#ifndef mPUSHi -# define mPUSHi(i) sv_setiv(PUSHmortal, (IV)(i)) -#endif - -#ifndef mPUSHu -# define mPUSHu(u) sv_setuv(PUSHmortal, (UV)(u)) -#endif -#ifndef mXPUSHs -# define mXPUSHs(s) XPUSHs(sv_2mortal(s)) -#endif - -#ifndef XPUSHmortal -# define XPUSHmortal XPUSHs(sv_newmortal()) -#endif - -#ifndef mXPUSHp -# define mXPUSHp(p,l) STMT_START { EXTEND(sp,1); sv_setpvn(PUSHmortal, (p), (l)); } STMT_END -#endif - -#ifndef mXPUSHn -# define mXPUSHn(n) STMT_START { EXTEND(sp,1); sv_setnv(PUSHmortal, (NV)(n)); } STMT_END -#endif - -#ifndef mXPUSHi -# define mXPUSHi(i) STMT_START { EXTEND(sp,1); sv_setiv(PUSHmortal, (IV)(i)); } STMT_END -#endif - -#ifndef mXPUSHu -# define mXPUSHu(u) STMT_START { EXTEND(sp,1); sv_setuv(PUSHmortal, (UV)(u)); } STMT_END -#endif - -/* Replace: 1 */ -#ifndef call_sv -# define call_sv perl_call_sv -#endif - -#ifndef call_pv -# define call_pv perl_call_pv -#endif - -#ifndef call_argv -# define call_argv perl_call_argv -#endif - -#ifndef call_method -# define call_method perl_call_method -#endif -#ifndef eval_sv -# define eval_sv perl_eval_sv -#endif - -/* Replace: 0 */ -#ifndef PERL_LOADMOD_DENY -# define PERL_LOADMOD_DENY 0x1 -#endif - -#ifndef PERL_LOADMOD_NOIMPORT -# define PERL_LOADMOD_NOIMPORT 0x2 -#endif - -#ifndef PERL_LOADMOD_IMPORT_OPS -# define PERL_LOADMOD_IMPORT_OPS 0x4 -#endif - -#ifndef G_METHOD -# define G_METHOD 64 -# ifdef call_sv -# undef call_sv -# endif -# if (PERL_BCDVERSION < 0x5006000) -# define call_sv(sv, flags) ((flags) & G_METHOD ? perl_call_method((char *) SvPV_nolen_const(sv), \ - (flags) & ~G_METHOD) : perl_call_sv(sv, flags)) -# else -# define call_sv(sv, flags) ((flags) & G_METHOD ? Perl_call_method(aTHX_ (char *) SvPV_nolen_const(sv), \ - (flags) & ~G_METHOD) : Perl_call_sv(aTHX_ sv, flags)) -# endif -#endif - -/* Replace perl_eval_pv with eval_pv */ - -#ifndef eval_pv -#if defined(NEED_eval_pv) -static SV* DPPP_(my_eval_pv)(char *p, I32 croak_on_error); -static -#else -extern SV* DPPP_(my_eval_pv)(char *p, I32 croak_on_error); -#endif - -#ifdef eval_pv -# undef eval_pv -#endif -#define eval_pv(a,b) DPPP_(my_eval_pv)(aTHX_ a,b) -#define Perl_eval_pv DPPP_(my_eval_pv) - -#if defined(NEED_eval_pv) || defined(NEED_eval_pv_GLOBAL) - -SV* -DPPP_(my_eval_pv)(char *p, I32 croak_on_error) -{ - dSP; - SV* sv = newSVpv(p, 0); - - PUSHMARK(sp); - eval_sv(sv, G_SCALAR); - SvREFCNT_dec(sv); - - SPAGAIN; - sv = POPs; - PUTBACK; - - if (croak_on_error && SvTRUE(GvSV(errgv))) - croak(SvPVx(GvSV(errgv), na)); - - return sv; -} - -#endif -#endif - -#ifndef vload_module -#if defined(NEED_vload_module) -static void DPPP_(my_vload_module)(U32 flags, SV *name, SV *ver, va_list *args); -static -#else -extern void DPPP_(my_vload_module)(U32 flags, SV *name, SV *ver, va_list *args); -#endif - -#ifdef vload_module -# undef vload_module -#endif -#define vload_module(a,b,c,d) DPPP_(my_vload_module)(aTHX_ a,b,c,d) -#define Perl_vload_module DPPP_(my_vload_module) - -#if defined(NEED_vload_module) || defined(NEED_vload_module_GLOBAL) - -void -DPPP_(my_vload_module)(U32 flags, SV *name, SV *ver, va_list *args) -{ - dTHR; - dVAR; - OP *veop, *imop; - - OP * const modname = newSVOP(OP_CONST, 0, name); - /* 5.005 has a somewhat hacky force_normal that doesn't croak on - SvREADONLY() if PL_compling is true. Current perls take care in - ck_require() to correctly turn off SvREADONLY before calling - force_normal_flags(). This seems a better fix than fudging PL_compling - */ - SvREADONLY_off(((SVOP*)modname)->op_sv); - modname->op_private |= OPpCONST_BARE; - if (ver) { - veop = newSVOP(OP_CONST, 0, ver); - } - else - veop = NULL; - if (flags & PERL_LOADMOD_NOIMPORT) { - imop = sawparens(newNULLLIST()); - } - else if (flags & PERL_LOADMOD_IMPORT_OPS) { - imop = va_arg(*args, OP*); - } - else { - SV *sv; - imop = NULL; - sv = va_arg(*args, SV*); - while (sv) { - imop = append_elem(OP_LIST, imop, newSVOP(OP_CONST, 0, sv)); - sv = va_arg(*args, SV*); - } - } - { - const line_t ocopline = PL_copline; - COP * const ocurcop = PL_curcop; - const int oexpect = PL_expect; - -#if (PERL_BCDVERSION >= 0x5004000) - utilize(!(flags & PERL_LOADMOD_DENY), start_subparse(FALSE, 0), - veop, modname, imop); -#else - utilize(!(flags & PERL_LOADMOD_DENY), start_subparse(), - modname, imop); -#endif - PL_expect = oexpect; - PL_copline = ocopline; - PL_curcop = ocurcop; - } -} - -#endif -#endif - -#ifndef load_module -#if defined(NEED_load_module) -static void DPPP_(my_load_module)(U32 flags, SV *name, SV *ver, ...); -static -#else -extern void DPPP_(my_load_module)(U32 flags, SV *name, SV *ver, ...); -#endif - -#ifdef load_module -# undef load_module -#endif -#define load_module DPPP_(my_load_module) -#define Perl_load_module DPPP_(my_load_module) - -#if defined(NEED_load_module) || defined(NEED_load_module_GLOBAL) - -void -DPPP_(my_load_module)(U32 flags, SV *name, SV *ver, ...) -{ - va_list args; - va_start(args, ver); - vload_module(flags, name, ver, &args); - va_end(args); -} - -#endif -#endif -#ifndef newRV_inc -# define newRV_inc(sv) newRV(sv) /* Replace */ -#endif - -#ifndef newRV_noinc -#if defined(NEED_newRV_noinc) -static SV * DPPP_(my_newRV_noinc)(SV *sv); -static -#else -extern SV * DPPP_(my_newRV_noinc)(SV *sv); -#endif - -#ifdef newRV_noinc -# undef newRV_noinc -#endif -#define newRV_noinc(a) DPPP_(my_newRV_noinc)(aTHX_ a) -#define Perl_newRV_noinc DPPP_(my_newRV_noinc) - -#if defined(NEED_newRV_noinc) || defined(NEED_newRV_noinc_GLOBAL) -SV * -DPPP_(my_newRV_noinc)(SV *sv) -{ - SV *rv = (SV *)newRV(sv); - SvREFCNT_dec(sv); - return rv; -} -#endif -#endif - -/* Hint: newCONSTSUB - * Returns a CV* as of perl-5.7.1. This return value is not supported - * by Devel::PPPort. - */ - -/* newCONSTSUB from IO.xs is in the core starting with 5.004_63 */ -#if (PERL_BCDVERSION < 0x5004063) && (PERL_BCDVERSION != 0x5004005) -#if defined(NEED_newCONSTSUB) -static void DPPP_(my_newCONSTSUB)(HV *stash, const char *name, SV *sv); -static -#else -extern void DPPP_(my_newCONSTSUB)(HV *stash, const char *name, SV *sv); -#endif - -#ifdef newCONSTSUB -# undef newCONSTSUB -#endif -#define newCONSTSUB(a,b,c) DPPP_(my_newCONSTSUB)(aTHX_ a,b,c) -#define Perl_newCONSTSUB DPPP_(my_newCONSTSUB) - -#if defined(NEED_newCONSTSUB) || defined(NEED_newCONSTSUB_GLOBAL) - -/* This is just a trick to avoid a dependency of newCONSTSUB on PL_parser */ -/* (There's no PL_parser in perl < 5.005, so this is completely safe) */ -#define D_PPP_PL_copline PL_copline - -void -DPPP_(my_newCONSTSUB)(HV *stash, const char *name, SV *sv) -{ - U32 oldhints = PL_hints; - HV *old_cop_stash = PL_curcop->cop_stash; - HV *old_curstash = PL_curstash; - line_t oldline = PL_curcop->cop_line; - PL_curcop->cop_line = D_PPP_PL_copline; - - PL_hints &= ~HINT_BLOCK_SCOPE; - if (stash) - PL_curstash = PL_curcop->cop_stash = stash; - - newSUB( - -#if (PERL_BCDVERSION < 0x5003022) - start_subparse(), -#elif (PERL_BCDVERSION == 0x5003022) - start_subparse(0), -#else /* 5.003_23 onwards */ - start_subparse(FALSE, 0), -#endif - - newSVOP(OP_CONST, 0, newSVpv((char *) name, 0)), - newSVOP(OP_CONST, 0, &PL_sv_no), /* SvPV(&PL_sv_no) == "" -- GMB */ - newSTATEOP(0, Nullch, newSVOP(OP_CONST, 0, sv)) - ); - - PL_hints = oldhints; - PL_curcop->cop_stash = old_cop_stash; - PL_curstash = old_curstash; - PL_curcop->cop_line = oldline; -} -#endif -#endif - -/* - * Boilerplate macros for initializing and accessing interpreter-local - * data from C. All statics in extensions should be reworked to use - * this, if you want to make the extension thread-safe. See ext/re/re.xs - * for an example of the use of these macros. - * - * Code that uses these macros is responsible for the following: - * 1. #define MY_CXT_KEY to a unique string, e.g. "DynaLoader_guts" - * 2. Declare a typedef named my_cxt_t that is a structure that contains - * all the data that needs to be interpreter-local. - * 3. Use the START_MY_CXT macro after the declaration of my_cxt_t. - * 4. Use the MY_CXT_INIT macro such that it is called exactly once - * (typically put in the BOOT: section). - * 5. Use the members of the my_cxt_t structure everywhere as - * MY_CXT.member. - * 6. Use the dMY_CXT macro (a declaration) in all the functions that - * access MY_CXT. - */ - -#if defined(MULTIPLICITY) || defined(PERL_OBJECT) || \ - defined(PERL_CAPI) || defined(PERL_IMPLICIT_CONTEXT) - -#ifndef START_MY_CXT - -/* This must appear in all extensions that define a my_cxt_t structure, - * right after the definition (i.e. at file scope). The non-threads - * case below uses it to declare the data as static. */ -#define START_MY_CXT - -#if (PERL_BCDVERSION < 0x5004068) -/* Fetches the SV that keeps the per-interpreter data. */ -#define dMY_CXT_SV \ - SV *my_cxt_sv = get_sv(MY_CXT_KEY, FALSE) -#else /* >= perl5.004_68 */ -#define dMY_CXT_SV \ - SV *my_cxt_sv = *hv_fetch(PL_modglobal, MY_CXT_KEY, \ - sizeof(MY_CXT_KEY)-1, TRUE) -#endif /* < perl5.004_68 */ - -/* This declaration should be used within all functions that use the - * interpreter-local data. */ -#define dMY_CXT \ - dMY_CXT_SV; \ - my_cxt_t *my_cxtp = INT2PTR(my_cxt_t*,SvUV(my_cxt_sv)) - -/* Creates and zeroes the per-interpreter data. - * (We allocate my_cxtp in a Perl SV so that it will be released when - * the interpreter goes away.) */ -#define MY_CXT_INIT \ - dMY_CXT_SV; \ - /* newSV() allocates one more than needed */ \ - my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\ - Zero(my_cxtp, 1, my_cxt_t); \ - sv_setuv(my_cxt_sv, PTR2UV(my_cxtp)) - -/* This macro must be used to access members of the my_cxt_t structure. - * e.g. MYCXT.some_data */ -#define MY_CXT (*my_cxtp) - -/* Judicious use of these macros can reduce the number of times dMY_CXT - * is used. Use is similar to pTHX, aTHX etc. */ -#define pMY_CXT my_cxt_t *my_cxtp -#define pMY_CXT_ pMY_CXT, -#define _pMY_CXT ,pMY_CXT -#define aMY_CXT my_cxtp -#define aMY_CXT_ aMY_CXT, -#define _aMY_CXT ,aMY_CXT - -#endif /* START_MY_CXT */ - -#ifndef MY_CXT_CLONE -/* Clones the per-interpreter data. */ -#define MY_CXT_CLONE \ - dMY_CXT_SV; \ - my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\ - Copy(INT2PTR(my_cxt_t*, SvUV(my_cxt_sv)), my_cxtp, 1, my_cxt_t);\ - sv_setuv(my_cxt_sv, PTR2UV(my_cxtp)) -#endif - -#else /* single interpreter */ - -#ifndef START_MY_CXT - -#define START_MY_CXT static my_cxt_t my_cxt; -#define dMY_CXT_SV dNOOP -#define dMY_CXT dNOOP -#define MY_CXT_INIT NOOP -#define MY_CXT my_cxt - -#define pMY_CXT void -#define pMY_CXT_ -#define _pMY_CXT -#define aMY_CXT -#define aMY_CXT_ -#define _aMY_CXT - -#endif /* START_MY_CXT */ - -#ifndef MY_CXT_CLONE -#define MY_CXT_CLONE NOOP -#endif - -#endif - -#ifndef IVdf -# if IVSIZE == LONGSIZE -# define IVdf "ld" -# define UVuf "lu" -# define UVof "lo" -# define UVxf "lx" -# define UVXf "lX" -# else -# if IVSIZE == INTSIZE -# define IVdf "d" -# define UVuf "u" -# define UVof "o" -# define UVxf "x" -# define UVXf "X" -# endif -# endif -#endif - -#ifndef NVef -# if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && \ - defined(PERL_PRIfldbl) && (PERL_BCDVERSION != 0x5006000) - /* Not very likely, but let's try anyway. */ -# define NVef PERL_PRIeldbl -# define NVff PERL_PRIfldbl -# define NVgf PERL_PRIgldbl -# else -# define NVef "e" -# define NVff "f" -# define NVgf "g" -# endif -#endif - -#ifndef SvREFCNT_inc -# ifdef PERL_USE_GCC_BRACE_GROUPS -# define SvREFCNT_inc(sv) \ - ({ \ - SV * const _sv = (SV*)(sv); \ - if (_sv) \ - (SvREFCNT(_sv))++; \ - _sv; \ - }) -# else -# define SvREFCNT_inc(sv) \ - ((PL_Sv=(SV*)(sv)) ? (++(SvREFCNT(PL_Sv)),PL_Sv) : NULL) -# endif -#endif - -#ifndef SvREFCNT_inc_simple -# ifdef PERL_USE_GCC_BRACE_GROUPS -# define SvREFCNT_inc_simple(sv) \ - ({ \ - if (sv) \ - (SvREFCNT(sv))++; \ - (SV *)(sv); \ - }) -# else -# define SvREFCNT_inc_simple(sv) \ - ((sv) ? (SvREFCNT(sv)++,(SV*)(sv)) : NULL) -# endif -#endif - -#ifndef SvREFCNT_inc_NN -# ifdef PERL_USE_GCC_BRACE_GROUPS -# define SvREFCNT_inc_NN(sv) \ - ({ \ - SV * const _sv = (SV*)(sv); \ - SvREFCNT(_sv)++; \ - _sv; \ - }) -# else -# define SvREFCNT_inc_NN(sv) \ - (PL_Sv=(SV*)(sv),++(SvREFCNT(PL_Sv)),PL_Sv) -# endif -#endif - -#ifndef SvREFCNT_inc_void -# ifdef PERL_USE_GCC_BRACE_GROUPS -# define SvREFCNT_inc_void(sv) \ - ({ \ - SV * const _sv = (SV*)(sv); \ - if (_sv) \ - (void)(SvREFCNT(_sv)++); \ - }) -# else -# define SvREFCNT_inc_void(sv) \ - (void)((PL_Sv=(SV*)(sv)) ? ++(SvREFCNT(PL_Sv)) : 0) -# endif -#endif -#ifndef SvREFCNT_inc_simple_void -# define SvREFCNT_inc_simple_void(sv) STMT_START { if (sv) SvREFCNT(sv)++; } STMT_END -#endif - -#ifndef SvREFCNT_inc_simple_NN -# define SvREFCNT_inc_simple_NN(sv) (++SvREFCNT(sv), (SV*)(sv)) -#endif - -#ifndef SvREFCNT_inc_void_NN -# define SvREFCNT_inc_void_NN(sv) (void)(++SvREFCNT((SV*)(sv))) -#endif - -#ifndef SvREFCNT_inc_simple_void_NN -# define SvREFCNT_inc_simple_void_NN(sv) (void)(++SvREFCNT((SV*)(sv))) -#endif - -#if (PERL_BCDVERSION < 0x5006000) -# define D_PPP_CONSTPV_ARG(x) ((char *) (x)) -#else -# define D_PPP_CONSTPV_ARG(x) (x) -#endif -#ifndef newSVpvn -# define newSVpvn(data,len) ((data) \ - ? ((len) ? newSVpv((data), (len)) : newSVpv("", 0)) \ - : newSV(0)) -#endif -#ifndef newSVpvn_utf8 -# define newSVpvn_utf8(s, len, u) newSVpvn_flags((s), (len), (u) ? SVf_UTF8 : 0) -#endif -#ifndef SVf_UTF8 -# define SVf_UTF8 0 -#endif - -#ifndef newSVpvn_flags - -#if defined(NEED_newSVpvn_flags) -static SV * DPPP_(my_newSVpvn_flags)(pTHX_ const char *s, STRLEN len, U32 flags); -static -#else -extern SV * DPPP_(my_newSVpvn_flags)(pTHX_ const char *s, STRLEN len, U32 flags); -#endif - -#ifdef newSVpvn_flags -# undef newSVpvn_flags -#endif -#define newSVpvn_flags(a,b,c) DPPP_(my_newSVpvn_flags)(aTHX_ a,b,c) -#define Perl_newSVpvn_flags DPPP_(my_newSVpvn_flags) - -#if defined(NEED_newSVpvn_flags) || defined(NEED_newSVpvn_flags_GLOBAL) - -SV * -DPPP_(my_newSVpvn_flags)(pTHX_ const char *s, STRLEN len, U32 flags) -{ - SV *sv = newSVpvn(D_PPP_CONSTPV_ARG(s), len); - SvFLAGS(sv) |= (flags & SVf_UTF8); - return (flags & SVs_TEMP) ? sv_2mortal(sv) : sv; -} - -#endif - -#endif - -/* Backwards compatibility stuff... :-( */ -#if !defined(NEED_sv_2pv_flags) && defined(NEED_sv_2pv_nolen) -# define NEED_sv_2pv_flags -#endif -#if !defined(NEED_sv_2pv_flags_GLOBAL) && defined(NEED_sv_2pv_nolen_GLOBAL) -# define NEED_sv_2pv_flags_GLOBAL -#endif - -/* Hint: sv_2pv_nolen - * Use the SvPV_nolen() or SvPV_nolen_const() macros instead of sv_2pv_nolen(). - */ -#ifndef sv_2pv_nolen -# define sv_2pv_nolen(sv) SvPV_nolen(sv) -#endif - -#ifdef SvPVbyte - -/* Hint: SvPVbyte - * Does not work in perl-5.6.1, ppport.h implements a version - * borrowed from perl-5.7.3. - */ - -#if (PERL_BCDVERSION < 0x5007000) - -#if defined(NEED_sv_2pvbyte) -static char * DPPP_(my_sv_2pvbyte)(pTHX_ SV *sv, STRLEN *lp); -static -#else -extern char * DPPP_(my_sv_2pvbyte)(pTHX_ SV *sv, STRLEN *lp); -#endif - -#ifdef sv_2pvbyte -# undef sv_2pvbyte -#endif -#define sv_2pvbyte(a,b) DPPP_(my_sv_2pvbyte)(aTHX_ a,b) -#define Perl_sv_2pvbyte DPPP_(my_sv_2pvbyte) - -#if defined(NEED_sv_2pvbyte) || defined(NEED_sv_2pvbyte_GLOBAL) - -char * -DPPP_(my_sv_2pvbyte)(pTHX_ SV *sv, STRLEN *lp) -{ - sv_utf8_downgrade(sv,0); - return SvPV(sv,*lp); -} - -#endif - -/* Hint: sv_2pvbyte - * Use the SvPVbyte() macro instead of sv_2pvbyte(). - */ - -#undef SvPVbyte - -#define SvPVbyte(sv, lp) \ - ((SvFLAGS(sv) & (SVf_POK|SVf_UTF8)) == (SVf_POK) \ - ? ((lp = SvCUR(sv)), SvPVX(sv)) : sv_2pvbyte(sv, &lp)) - -#endif - -#else - -# define SvPVbyte SvPV -# define sv_2pvbyte sv_2pv - -#endif -#ifndef sv_2pvbyte_nolen -# define sv_2pvbyte_nolen(sv) sv_2pv_nolen(sv) -#endif - -/* Hint: sv_pvn - * Always use the SvPV() macro instead of sv_pvn(). - */ - -/* Hint: sv_pvn_force - * Always use the SvPV_force() macro instead of sv_pvn_force(). - */ - -/* If these are undefined, they're not handled by the core anyway */ -#ifndef SV_IMMEDIATE_UNREF -# define SV_IMMEDIATE_UNREF 0 -#endif - -#ifndef SV_GMAGIC -# define SV_GMAGIC 0 -#endif - -#ifndef SV_COW_DROP_PV -# define SV_COW_DROP_PV 0 -#endif - -#ifndef SV_UTF8_NO_ENCODING -# define SV_UTF8_NO_ENCODING 0 -#endif - -#ifndef SV_NOSTEAL -# define SV_NOSTEAL 0 -#endif - -#ifndef SV_CONST_RETURN -# define SV_CONST_RETURN 0 -#endif - -#ifndef SV_MUTABLE_RETURN -# define SV_MUTABLE_RETURN 0 -#endif - -#ifndef SV_SMAGIC -# define SV_SMAGIC 0 -#endif - -#ifndef SV_HAS_TRAILING_NUL -# define SV_HAS_TRAILING_NUL 0 -#endif - -#ifndef SV_COW_SHARED_HASH_KEYS -# define SV_COW_SHARED_HASH_KEYS 0 -#endif - -#if (PERL_BCDVERSION < 0x5007002) - -#if defined(NEED_sv_2pv_flags) -static char * DPPP_(my_sv_2pv_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags); -static -#else -extern char * DPPP_(my_sv_2pv_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags); -#endif - -#ifdef sv_2pv_flags -# undef sv_2pv_flags -#endif -#define sv_2pv_flags(a,b,c) DPPP_(my_sv_2pv_flags)(aTHX_ a,b,c) -#define Perl_sv_2pv_flags DPPP_(my_sv_2pv_flags) - -#if defined(NEED_sv_2pv_flags) || defined(NEED_sv_2pv_flags_GLOBAL) - -char * -DPPP_(my_sv_2pv_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags) -{ - STRLEN n_a = (STRLEN) flags; - return sv_2pv(sv, lp ? lp : &n_a); -} - -#endif - -#if defined(NEED_sv_pvn_force_flags) -static char * DPPP_(my_sv_pvn_force_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags); -static -#else -extern char * DPPP_(my_sv_pvn_force_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags); -#endif - -#ifdef sv_pvn_force_flags -# undef sv_pvn_force_flags -#endif -#define sv_pvn_force_flags(a,b,c) DPPP_(my_sv_pvn_force_flags)(aTHX_ a,b,c) -#define Perl_sv_pvn_force_flags DPPP_(my_sv_pvn_force_flags) - -#if defined(NEED_sv_pvn_force_flags) || defined(NEED_sv_pvn_force_flags_GLOBAL) - -char * -DPPP_(my_sv_pvn_force_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags) -{ - STRLEN n_a = (STRLEN) flags; - return sv_pvn_force(sv, lp ? lp : &n_a); -} - -#endif - -#endif - -#if (PERL_BCDVERSION < 0x5008008) || ( (PERL_BCDVERSION >= 0x5009000) && (PERL_BCDVERSION < 0x5009003) ) -# define DPPP_SVPV_NOLEN_LP_ARG &PL_na -#else -# define DPPP_SVPV_NOLEN_LP_ARG 0 -#endif -#ifndef SvPV_const -# define SvPV_const(sv, lp) SvPV_flags_const(sv, lp, SV_GMAGIC) -#endif - -#ifndef SvPV_mutable -# define SvPV_mutable(sv, lp) SvPV_flags_mutable(sv, lp, SV_GMAGIC) -#endif -#ifndef SvPV_flags -# define SvPV_flags(sv, lp, flags) \ - ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ - ? ((lp = SvCUR(sv)), SvPVX(sv)) : sv_2pv_flags(sv, &lp, flags)) -#endif -#ifndef SvPV_flags_const -# define SvPV_flags_const(sv, lp, flags) \ - ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ - ? ((lp = SvCUR(sv)), SvPVX_const(sv)) : \ - (const char*) sv_2pv_flags(sv, &lp, flags|SV_CONST_RETURN)) -#endif -#ifndef SvPV_flags_const_nolen -# define SvPV_flags_const_nolen(sv, flags) \ - ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ - ? SvPVX_const(sv) : \ - (const char*) sv_2pv_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, flags|SV_CONST_RETURN)) -#endif -#ifndef SvPV_flags_mutable -# define SvPV_flags_mutable(sv, lp, flags) \ - ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ - ? ((lp = SvCUR(sv)), SvPVX_mutable(sv)) : \ - sv_2pv_flags(sv, &lp, flags|SV_MUTABLE_RETURN)) -#endif -#ifndef SvPV_force -# define SvPV_force(sv, lp) SvPV_force_flags(sv, lp, SV_GMAGIC) -#endif - -#ifndef SvPV_force_nolen -# define SvPV_force_nolen(sv) SvPV_force_flags_nolen(sv, SV_GMAGIC) -#endif - -#ifndef SvPV_force_mutable -# define SvPV_force_mutable(sv, lp) SvPV_force_flags_mutable(sv, lp, SV_GMAGIC) -#endif - -#ifndef SvPV_force_nomg -# define SvPV_force_nomg(sv, lp) SvPV_force_flags(sv, lp, 0) -#endif - -#ifndef SvPV_force_nomg_nolen -# define SvPV_force_nomg_nolen(sv) SvPV_force_flags_nolen(sv, 0) -#endif -#ifndef SvPV_force_flags -# define SvPV_force_flags(sv, lp, flags) \ - ((SvFLAGS(sv) & (SVf_POK|SVf_THINKFIRST)) == SVf_POK \ - ? ((lp = SvCUR(sv)), SvPVX(sv)) : sv_pvn_force_flags(sv, &lp, flags)) -#endif -#ifndef SvPV_force_flags_nolen -# define SvPV_force_flags_nolen(sv, flags) \ - ((SvFLAGS(sv) & (SVf_POK|SVf_THINKFIRST)) == SVf_POK \ - ? SvPVX(sv) : sv_pvn_force_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, flags)) -#endif -#ifndef SvPV_force_flags_mutable -# define SvPV_force_flags_mutable(sv, lp, flags) \ - ((SvFLAGS(sv) & (SVf_POK|SVf_THINKFIRST)) == SVf_POK \ - ? ((lp = SvCUR(sv)), SvPVX_mutable(sv)) \ - : sv_pvn_force_flags(sv, &lp, flags|SV_MUTABLE_RETURN)) -#endif -#ifndef SvPV_nolen -# define SvPV_nolen(sv) \ - ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ - ? SvPVX(sv) : sv_2pv_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, SV_GMAGIC)) -#endif -#ifndef SvPV_nolen_const -# define SvPV_nolen_const(sv) \ - ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ - ? SvPVX_const(sv) : sv_2pv_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, SV_GMAGIC|SV_CONST_RETURN)) -#endif -#ifndef SvPV_nomg -# define SvPV_nomg(sv, lp) SvPV_flags(sv, lp, 0) -#endif - -#ifndef SvPV_nomg_const -# define SvPV_nomg_const(sv, lp) SvPV_flags_const(sv, lp, 0) -#endif - -#ifndef SvPV_nomg_const_nolen -# define SvPV_nomg_const_nolen(sv) SvPV_flags_const_nolen(sv, 0) -#endif -#ifndef SvPV_renew -# define SvPV_renew(sv,n) STMT_START { SvLEN_set(sv, n); \ - SvPV_set((sv), (char *) saferealloc( \ - (Malloc_t)SvPVX(sv), (MEM_SIZE)((n)))); \ - } STMT_END -#endif -#ifndef SvMAGIC_set -# define SvMAGIC_set(sv, val) \ - STMT_START { assert(SvTYPE(sv) >= SVt_PVMG); \ - (((XPVMG*) SvANY(sv))->xmg_magic = (val)); } STMT_END -#endif - -#if (PERL_BCDVERSION < 0x5009003) -#ifndef SvPVX_const -# define SvPVX_const(sv) ((const char*) (0 + SvPVX(sv))) -#endif - -#ifndef SvPVX_mutable -# define SvPVX_mutable(sv) (0 + SvPVX(sv)) -#endif -#ifndef SvRV_set -# define SvRV_set(sv, val) \ - STMT_START { assert(SvTYPE(sv) >= SVt_RV); \ - (((XRV*) SvANY(sv))->xrv_rv = (val)); } STMT_END -#endif - -#else -#ifndef SvPVX_const -# define SvPVX_const(sv) ((const char*)((sv)->sv_u.svu_pv)) -#endif - -#ifndef SvPVX_mutable -# define SvPVX_mutable(sv) ((sv)->sv_u.svu_pv) -#endif -#ifndef SvRV_set -# define SvRV_set(sv, val) \ - STMT_START { assert(SvTYPE(sv) >= SVt_RV); \ - ((sv)->sv_u.svu_rv = (val)); } STMT_END -#endif - -#endif -#ifndef SvSTASH_set -# define SvSTASH_set(sv, val) \ - STMT_START { assert(SvTYPE(sv) >= SVt_PVMG); \ - (((XPVMG*) SvANY(sv))->xmg_stash = (val)); } STMT_END -#endif - -#if (PERL_BCDVERSION < 0x5004000) -#ifndef SvUV_set -# define SvUV_set(sv, val) \ - STMT_START { assert(SvTYPE(sv) == SVt_IV || SvTYPE(sv) >= SVt_PVIV); \ - (((XPVIV*) SvANY(sv))->xiv_iv = (IV) (val)); } STMT_END -#endif - -#else -#ifndef SvUV_set -# define SvUV_set(sv, val) \ - STMT_START { assert(SvTYPE(sv) == SVt_IV || SvTYPE(sv) >= SVt_PVIV); \ - (((XPVUV*) SvANY(sv))->xuv_uv = (val)); } STMT_END -#endif - -#endif - -#if (PERL_BCDVERSION >= 0x5004000) && !defined(vnewSVpvf) -#if defined(NEED_vnewSVpvf) -static SV * DPPP_(my_vnewSVpvf)(pTHX_ const char *pat, va_list *args); -static -#else -extern SV * DPPP_(my_vnewSVpvf)(pTHX_ const char *pat, va_list *args); -#endif - -#ifdef vnewSVpvf -# undef vnewSVpvf -#endif -#define vnewSVpvf(a,b) DPPP_(my_vnewSVpvf)(aTHX_ a,b) -#define Perl_vnewSVpvf DPPP_(my_vnewSVpvf) - -#if defined(NEED_vnewSVpvf) || defined(NEED_vnewSVpvf_GLOBAL) - -SV * -DPPP_(my_vnewSVpvf)(pTHX_ const char *pat, va_list *args) -{ - register SV *sv = newSV(0); - sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)); - return sv; -} - -#endif -#endif - -#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_vcatpvf) -# define sv_vcatpvf(sv, pat, args) sv_vcatpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)) -#endif - -#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_vsetpvf) -# define sv_vsetpvf(sv, pat, args) sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)) -#endif - -#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_catpvf_mg) -#if defined(NEED_sv_catpvf_mg) -static void DPPP_(my_sv_catpvf_mg)(pTHX_ SV *sv, const char *pat, ...); -static -#else -extern void DPPP_(my_sv_catpvf_mg)(pTHX_ SV *sv, const char *pat, ...); -#endif - -#define Perl_sv_catpvf_mg DPPP_(my_sv_catpvf_mg) - -#if defined(NEED_sv_catpvf_mg) || defined(NEED_sv_catpvf_mg_GLOBAL) - -void -DPPP_(my_sv_catpvf_mg)(pTHX_ SV *sv, const char *pat, ...) -{ - va_list args; - va_start(args, pat); - sv_vcatpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); - SvSETMAGIC(sv); - va_end(args); -} - -#endif -#endif - -#ifdef PERL_IMPLICIT_CONTEXT -#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_catpvf_mg_nocontext) -#if defined(NEED_sv_catpvf_mg_nocontext) -static void DPPP_(my_sv_catpvf_mg_nocontext)(SV *sv, const char *pat, ...); -static -#else -extern void DPPP_(my_sv_catpvf_mg_nocontext)(SV *sv, const char *pat, ...); -#endif - -#define sv_catpvf_mg_nocontext DPPP_(my_sv_catpvf_mg_nocontext) -#define Perl_sv_catpvf_mg_nocontext DPPP_(my_sv_catpvf_mg_nocontext) - -#if defined(NEED_sv_catpvf_mg_nocontext) || defined(NEED_sv_catpvf_mg_nocontext_GLOBAL) - -void -DPPP_(my_sv_catpvf_mg_nocontext)(SV *sv, const char *pat, ...) -{ - dTHX; - va_list args; - va_start(args, pat); - sv_vcatpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); - SvSETMAGIC(sv); - va_end(args); -} - -#endif -#endif -#endif - -/* sv_catpvf_mg depends on sv_catpvf_mg_nocontext */ -#ifndef sv_catpvf_mg -# ifdef PERL_IMPLICIT_CONTEXT -# define sv_catpvf_mg Perl_sv_catpvf_mg_nocontext -# else -# define sv_catpvf_mg Perl_sv_catpvf_mg -# endif -#endif - -#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_vcatpvf_mg) -# define sv_vcatpvf_mg(sv, pat, args) \ - STMT_START { \ - sv_vcatpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)); \ - SvSETMAGIC(sv); \ - } STMT_END -#endif - -#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_setpvf_mg) -#if defined(NEED_sv_setpvf_mg) -static void DPPP_(my_sv_setpvf_mg)(pTHX_ SV *sv, const char *pat, ...); -static -#else -extern void DPPP_(my_sv_setpvf_mg)(pTHX_ SV *sv, const char *pat, ...); -#endif - -#define Perl_sv_setpvf_mg DPPP_(my_sv_setpvf_mg) - -#if defined(NEED_sv_setpvf_mg) || defined(NEED_sv_setpvf_mg_GLOBAL) - -void -DPPP_(my_sv_setpvf_mg)(pTHX_ SV *sv, const char *pat, ...) -{ - va_list args; - va_start(args, pat); - sv_vsetpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); - SvSETMAGIC(sv); - va_end(args); -} - -#endif -#endif - -#ifdef PERL_IMPLICIT_CONTEXT -#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_setpvf_mg_nocontext) -#if defined(NEED_sv_setpvf_mg_nocontext) -static void DPPP_(my_sv_setpvf_mg_nocontext)(SV *sv, const char *pat, ...); -static -#else -extern void DPPP_(my_sv_setpvf_mg_nocontext)(SV *sv, const char *pat, ...); -#endif - -#define sv_setpvf_mg_nocontext DPPP_(my_sv_setpvf_mg_nocontext) -#define Perl_sv_setpvf_mg_nocontext DPPP_(my_sv_setpvf_mg_nocontext) - -#if defined(NEED_sv_setpvf_mg_nocontext) || defined(NEED_sv_setpvf_mg_nocontext_GLOBAL) - -void -DPPP_(my_sv_setpvf_mg_nocontext)(SV *sv, const char *pat, ...) -{ - dTHX; - va_list args; - va_start(args, pat); - sv_vsetpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); - SvSETMAGIC(sv); - va_end(args); -} - -#endif -#endif -#endif - -/* sv_setpvf_mg depends on sv_setpvf_mg_nocontext */ -#ifndef sv_setpvf_mg -# ifdef PERL_IMPLICIT_CONTEXT -# define sv_setpvf_mg Perl_sv_setpvf_mg_nocontext -# else -# define sv_setpvf_mg Perl_sv_setpvf_mg -# endif -#endif - -#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_vsetpvf_mg) -# define sv_vsetpvf_mg(sv, pat, args) \ - STMT_START { \ - sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)); \ - SvSETMAGIC(sv); \ - } STMT_END -#endif - -#ifndef newSVpvn_share - -#if defined(NEED_newSVpvn_share) -static SV * DPPP_(my_newSVpvn_share)(pTHX_ const char *src, I32 len, U32 hash); -static -#else -extern SV * DPPP_(my_newSVpvn_share)(pTHX_ const char *src, I32 len, U32 hash); -#endif - -#ifdef newSVpvn_share -# undef newSVpvn_share -#endif -#define newSVpvn_share(a,b,c) DPPP_(my_newSVpvn_share)(aTHX_ a,b,c) -#define Perl_newSVpvn_share DPPP_(my_newSVpvn_share) - -#if defined(NEED_newSVpvn_share) || defined(NEED_newSVpvn_share_GLOBAL) - -SV * -DPPP_(my_newSVpvn_share)(pTHX_ const char *src, I32 len, U32 hash) -{ - SV *sv; - if (len < 0) - len = -len; - if (!hash) - PERL_HASH(hash, (char*) src, len); - sv = newSVpvn((char *) src, len); - sv_upgrade(sv, SVt_PVIV); - SvIVX(sv) = hash; - SvREADONLY_on(sv); - SvPOK_on(sv); - return sv; -} - -#endif - -#endif -#ifndef SvSHARED_HASH -# define SvSHARED_HASH(sv) (0 + SvUVX(sv)) -#endif -#ifndef WARN_ALL -# define WARN_ALL 0 -#endif - -#ifndef WARN_CLOSURE -# define WARN_CLOSURE 1 -#endif - -#ifndef WARN_DEPRECATED -# define WARN_DEPRECATED 2 -#endif - -#ifndef WARN_EXITING -# define WARN_EXITING 3 -#endif - -#ifndef WARN_GLOB -# define WARN_GLOB 4 -#endif - -#ifndef WARN_IO -# define WARN_IO 5 -#endif - -#ifndef WARN_CLOSED -# define WARN_CLOSED 6 -#endif - -#ifndef WARN_EXEC -# define WARN_EXEC 7 -#endif - -#ifndef WARN_LAYER -# define WARN_LAYER 8 -#endif - -#ifndef WARN_NEWLINE -# define WARN_NEWLINE 9 -#endif - -#ifndef WARN_PIPE -# define WARN_PIPE 10 -#endif - -#ifndef WARN_UNOPENED -# define WARN_UNOPENED 11 -#endif - -#ifndef WARN_MISC -# define WARN_MISC 12 -#endif - -#ifndef WARN_NUMERIC -# define WARN_NUMERIC 13 -#endif - -#ifndef WARN_ONCE -# define WARN_ONCE 14 -#endif - -#ifndef WARN_OVERFLOW -# define WARN_OVERFLOW 15 -#endif - -#ifndef WARN_PACK -# define WARN_PACK 16 -#endif - -#ifndef WARN_PORTABLE -# define WARN_PORTABLE 17 -#endif - -#ifndef WARN_RECURSION -# define WARN_RECURSION 18 -#endif - -#ifndef WARN_REDEFINE -# define WARN_REDEFINE 19 -#endif - -#ifndef WARN_REGEXP -# define WARN_REGEXP 20 -#endif - -#ifndef WARN_SEVERE -# define WARN_SEVERE 21 -#endif - -#ifndef WARN_DEBUGGING -# define WARN_DEBUGGING 22 -#endif - -#ifndef WARN_INPLACE -# define WARN_INPLACE 23 -#endif - -#ifndef WARN_INTERNAL -# define WARN_INTERNAL 24 -#endif - -#ifndef WARN_MALLOC -# define WARN_MALLOC 25 -#endif - -#ifndef WARN_SIGNAL -# define WARN_SIGNAL 26 -#endif - -#ifndef WARN_SUBSTR -# define WARN_SUBSTR 27 -#endif - -#ifndef WARN_SYNTAX -# define WARN_SYNTAX 28 -#endif - -#ifndef WARN_AMBIGUOUS -# define WARN_AMBIGUOUS 29 -#endif - -#ifndef WARN_BAREWORD -# define WARN_BAREWORD 30 -#endif - -#ifndef WARN_DIGIT -# define WARN_DIGIT 31 -#endif - -#ifndef WARN_PARENTHESIS -# define WARN_PARENTHESIS 32 -#endif - -#ifndef WARN_PRECEDENCE -# define WARN_PRECEDENCE 33 -#endif - -#ifndef WARN_PRINTF -# define WARN_PRINTF 34 -#endif - -#ifndef WARN_PROTOTYPE -# define WARN_PROTOTYPE 35 -#endif - -#ifndef WARN_QW -# define WARN_QW 36 -#endif - -#ifndef WARN_RESERVED -# define WARN_RESERVED 37 -#endif - -#ifndef WARN_SEMICOLON -# define WARN_SEMICOLON 38 -#endif - -#ifndef WARN_TAINT -# define WARN_TAINT 39 -#endif - -#ifndef WARN_THREADS -# define WARN_THREADS 40 -#endif - -#ifndef WARN_UNINITIALIZED -# define WARN_UNINITIALIZED 41 -#endif - -#ifndef WARN_UNPACK -# define WARN_UNPACK 42 -#endif - -#ifndef WARN_UNTIE -# define WARN_UNTIE 43 -#endif - -#ifndef WARN_UTF8 -# define WARN_UTF8 44 -#endif - -#ifndef WARN_VOID -# define WARN_VOID 45 -#endif - -#ifndef WARN_ASSERTIONS -# define WARN_ASSERTIONS 46 -#endif -#ifndef packWARN -# define packWARN(a) (a) -#endif - -#ifndef ckWARN -# ifdef G_WARN_ON -# define ckWARN(a) (PL_dowarn & G_WARN_ON) -# else -# define ckWARN(a) PL_dowarn -# endif -#endif - -#if (PERL_BCDVERSION >= 0x5004000) && !defined(warner) -#if defined(NEED_warner) -static void DPPP_(my_warner)(U32 err, const char *pat, ...); -static -#else -extern void DPPP_(my_warner)(U32 err, const char *pat, ...); -#endif - -#define Perl_warner DPPP_(my_warner) - -#if defined(NEED_warner) || defined(NEED_warner_GLOBAL) - -void -DPPP_(my_warner)(U32 err, const char *pat, ...) -{ - SV *sv; - va_list args; - - PERL_UNUSED_ARG(err); - - va_start(args, pat); - sv = vnewSVpvf(pat, &args); - va_end(args); - sv_2mortal(sv); - warn("%s", SvPV_nolen(sv)); -} - -#define warner Perl_warner - -#define Perl_warner_nocontext Perl_warner - -#endif -#endif - -/* concatenating with "" ensures that only literal strings are accepted as argument - * note that STR_WITH_LEN() can't be used as argument to macros or functions that - * under some configurations might be macros - */ -#ifndef STR_WITH_LEN -# define STR_WITH_LEN(s) (s ""), (sizeof(s)-1) -#endif -#ifndef newSVpvs -# define newSVpvs(str) newSVpvn(str "", sizeof(str) - 1) -#endif - -#ifndef newSVpvs_flags -# define newSVpvs_flags(str, flags) newSVpvn_flags(str "", sizeof(str) - 1, flags) -#endif - -#ifndef sv_catpvs -# define sv_catpvs(sv, str) sv_catpvn(sv, str "", sizeof(str) - 1) -#endif - -#ifndef sv_setpvs -# define sv_setpvs(sv, str) sv_setpvn(sv, str "", sizeof(str) - 1) -#endif - -#ifndef hv_fetchs -# define hv_fetchs(hv, key, lval) hv_fetch(hv, key "", sizeof(key) - 1, lval) -#endif - -#ifndef hv_stores -# define hv_stores(hv, key, val) hv_store(hv, key "", sizeof(key) - 1, val, 0) -#endif -#ifndef SvGETMAGIC -# define SvGETMAGIC(x) STMT_START { if (SvGMAGICAL(x)) mg_get(x); } STMT_END -#endif -#ifndef PERL_MAGIC_sv -# define PERL_MAGIC_sv '\0' -#endif - -#ifndef PERL_MAGIC_overload -# define PERL_MAGIC_overload 'A' -#endif - -#ifndef PERL_MAGIC_overload_elem -# define PERL_MAGIC_overload_elem 'a' -#endif - -#ifndef PERL_MAGIC_overload_table -# define PERL_MAGIC_overload_table 'c' -#endif - -#ifndef PERL_MAGIC_bm -# define PERL_MAGIC_bm 'B' -#endif - -#ifndef PERL_MAGIC_regdata -# define PERL_MAGIC_regdata 'D' -#endif - -#ifndef PERL_MAGIC_regdatum -# define PERL_MAGIC_regdatum 'd' -#endif - -#ifndef PERL_MAGIC_env -# define PERL_MAGIC_env 'E' -#endif - -#ifndef PERL_MAGIC_envelem -# define PERL_MAGIC_envelem 'e' -#endif - -#ifndef PERL_MAGIC_fm -# define PERL_MAGIC_fm 'f' -#endif - -#ifndef PERL_MAGIC_regex_global -# define PERL_MAGIC_regex_global 'g' -#endif - -#ifndef PERL_MAGIC_isa -# define PERL_MAGIC_isa 'I' -#endif - -#ifndef PERL_MAGIC_isaelem -# define PERL_MAGIC_isaelem 'i' -#endif - -#ifndef PERL_MAGIC_nkeys -# define PERL_MAGIC_nkeys 'k' -#endif - -#ifndef PERL_MAGIC_dbfile -# define PERL_MAGIC_dbfile 'L' -#endif - -#ifndef PERL_MAGIC_dbline -# define PERL_MAGIC_dbline 'l' -#endif - -#ifndef PERL_MAGIC_mutex -# define PERL_MAGIC_mutex 'm' -#endif - -#ifndef PERL_MAGIC_shared -# define PERL_MAGIC_shared 'N' -#endif - -#ifndef PERL_MAGIC_shared_scalar -# define PERL_MAGIC_shared_scalar 'n' -#endif - -#ifndef PERL_MAGIC_collxfrm -# define PERL_MAGIC_collxfrm 'o' -#endif - -#ifndef PERL_MAGIC_tied -# define PERL_MAGIC_tied 'P' -#endif - -#ifndef PERL_MAGIC_tiedelem -# define PERL_MAGIC_tiedelem 'p' -#endif - -#ifndef PERL_MAGIC_tiedscalar -# define PERL_MAGIC_tiedscalar 'q' -#endif - -#ifndef PERL_MAGIC_qr -# define PERL_MAGIC_qr 'r' -#endif - -#ifndef PERL_MAGIC_sig -# define PERL_MAGIC_sig 'S' -#endif - -#ifndef PERL_MAGIC_sigelem -# define PERL_MAGIC_sigelem 's' -#endif - -#ifndef PERL_MAGIC_taint -# define PERL_MAGIC_taint 't' -#endif - -#ifndef PERL_MAGIC_uvar -# define PERL_MAGIC_uvar 'U' -#endif - -#ifndef PERL_MAGIC_uvar_elem -# define PERL_MAGIC_uvar_elem 'u' -#endif - -#ifndef PERL_MAGIC_vstring -# define PERL_MAGIC_vstring 'V' -#endif - -#ifndef PERL_MAGIC_vec -# define PERL_MAGIC_vec 'v' -#endif - -#ifndef PERL_MAGIC_utf8 -# define PERL_MAGIC_utf8 'w' -#endif - -#ifndef PERL_MAGIC_substr -# define PERL_MAGIC_substr 'x' -#endif - -#ifndef PERL_MAGIC_defelem -# define PERL_MAGIC_defelem 'y' -#endif - -#ifndef PERL_MAGIC_glob -# define PERL_MAGIC_glob '*' -#endif - -#ifndef PERL_MAGIC_arylen -# define PERL_MAGIC_arylen '#' -#endif - -#ifndef PERL_MAGIC_pos -# define PERL_MAGIC_pos '.' -#endif - -#ifndef PERL_MAGIC_backref -# define PERL_MAGIC_backref '<' -#endif - -#ifndef PERL_MAGIC_ext -# define PERL_MAGIC_ext '~' -#endif - -/* That's the best we can do... */ -#ifndef sv_catpvn_nomg -# define sv_catpvn_nomg sv_catpvn -#endif - -#ifndef sv_catsv_nomg -# define sv_catsv_nomg sv_catsv -#endif - -#ifndef sv_setsv_nomg -# define sv_setsv_nomg sv_setsv -#endif - -#ifndef sv_pvn_nomg -# define sv_pvn_nomg sv_pvn -#endif - -#ifndef SvIV_nomg -# define SvIV_nomg SvIV -#endif - -#ifndef SvUV_nomg -# define SvUV_nomg SvUV -#endif - -#ifndef sv_catpv_mg -# define sv_catpv_mg(sv, ptr) \ - STMT_START { \ - SV *TeMpSv = sv; \ - sv_catpv(TeMpSv,ptr); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifndef sv_catpvn_mg -# define sv_catpvn_mg(sv, ptr, len) \ - STMT_START { \ - SV *TeMpSv = sv; \ - sv_catpvn(TeMpSv,ptr,len); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifndef sv_catsv_mg -# define sv_catsv_mg(dsv, ssv) \ - STMT_START { \ - SV *TeMpSv = dsv; \ - sv_catsv(TeMpSv,ssv); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifndef sv_setiv_mg -# define sv_setiv_mg(sv, i) \ - STMT_START { \ - SV *TeMpSv = sv; \ - sv_setiv(TeMpSv,i); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifndef sv_setnv_mg -# define sv_setnv_mg(sv, num) \ - STMT_START { \ - SV *TeMpSv = sv; \ - sv_setnv(TeMpSv,num); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifndef sv_setpv_mg -# define sv_setpv_mg(sv, ptr) \ - STMT_START { \ - SV *TeMpSv = sv; \ - sv_setpv(TeMpSv,ptr); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifndef sv_setpvn_mg -# define sv_setpvn_mg(sv, ptr, len) \ - STMT_START { \ - SV *TeMpSv = sv; \ - sv_setpvn(TeMpSv,ptr,len); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifndef sv_setsv_mg -# define sv_setsv_mg(dsv, ssv) \ - STMT_START { \ - SV *TeMpSv = dsv; \ - sv_setsv(TeMpSv,ssv); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifndef sv_setuv_mg -# define sv_setuv_mg(sv, i) \ - STMT_START { \ - SV *TeMpSv = sv; \ - sv_setuv(TeMpSv,i); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif - -#ifndef sv_usepvn_mg -# define sv_usepvn_mg(sv, ptr, len) \ - STMT_START { \ - SV *TeMpSv = sv; \ - sv_usepvn(TeMpSv,ptr,len); \ - SvSETMAGIC(TeMpSv); \ - } STMT_END -#endif -#ifndef SvVSTRING_mg -# define SvVSTRING_mg(sv) (SvMAGICAL(sv) ? mg_find(sv, PERL_MAGIC_vstring) : NULL) -#endif - -/* Hint: sv_magic_portable - * This is a compatibility function that is only available with - * Devel::PPPort. It is NOT in the perl core. - * Its purpose is to mimic the 5.8.0 behaviour of sv_magic() when - * it is being passed a name pointer with namlen == 0. In that - * case, perl 5.8.0 and later store the pointer, not a copy of it. - * The compatibility can be provided back to perl 5.004. With - * earlier versions, the code will not compile. - */ - -#if (PERL_BCDVERSION < 0x5004000) - - /* code that uses sv_magic_portable will not compile */ - -#elif (PERL_BCDVERSION < 0x5008000) - -# define sv_magic_portable(sv, obj, how, name, namlen) \ - STMT_START { \ - SV *SvMp_sv = (sv); \ - char *SvMp_name = (char *) (name); \ - I32 SvMp_namlen = (namlen); \ - if (SvMp_name && SvMp_namlen == 0) \ - { \ - MAGIC *mg; \ - sv_magic(SvMp_sv, obj, how, 0, 0); \ - mg = SvMAGIC(SvMp_sv); \ - mg->mg_len = -42; /* XXX: this is the tricky part */ \ - mg->mg_ptr = SvMp_name; \ - } \ - else \ - { \ - sv_magic(SvMp_sv, obj, how, SvMp_name, SvMp_namlen); \ - } \ - } STMT_END - -#else - -# define sv_magic_portable(a, b, c, d, e) sv_magic(a, b, c, d, e) - -#endif - -#ifdef USE_ITHREADS -#ifndef CopFILE -# define CopFILE(c) ((c)->cop_file) -#endif - -#ifndef CopFILEGV -# define CopFILEGV(c) (CopFILE(c) ? gv_fetchfile(CopFILE(c)) : Nullgv) -#endif - -#ifndef CopFILE_set -# define CopFILE_set(c,pv) ((c)->cop_file = savepv(pv)) -#endif - -#ifndef CopFILESV -# define CopFILESV(c) (CopFILE(c) ? GvSV(gv_fetchfile(CopFILE(c))) : Nullsv) -#endif - -#ifndef CopFILEAV -# define CopFILEAV(c) (CopFILE(c) ? GvAV(gv_fetchfile(CopFILE(c))) : Nullav) -#endif - -#ifndef CopSTASHPV -# define CopSTASHPV(c) ((c)->cop_stashpv) -#endif - -#ifndef CopSTASHPV_set -# define CopSTASHPV_set(c,pv) ((c)->cop_stashpv = ((pv) ? savepv(pv) : Nullch)) -#endif - -#ifndef CopSTASH -# define CopSTASH(c) (CopSTASHPV(c) ? gv_stashpv(CopSTASHPV(c),GV_ADD) : Nullhv) -#endif - -#ifndef CopSTASH_set -# define CopSTASH_set(c,hv) CopSTASHPV_set(c, (hv) ? HvNAME(hv) : Nullch) -#endif - -#ifndef CopSTASH_eq -# define CopSTASH_eq(c,hv) ((hv) && (CopSTASHPV(c) == HvNAME(hv) \ - || (CopSTASHPV(c) && HvNAME(hv) \ - && strEQ(CopSTASHPV(c), HvNAME(hv))))) -#endif - -#else -#ifndef CopFILEGV -# define CopFILEGV(c) ((c)->cop_filegv) -#endif - -#ifndef CopFILEGV_set -# define CopFILEGV_set(c,gv) ((c)->cop_filegv = (GV*)SvREFCNT_inc(gv)) -#endif - -#ifndef CopFILE_set -# define CopFILE_set(c,pv) CopFILEGV_set((c), gv_fetchfile(pv)) -#endif - -#ifndef CopFILESV -# define CopFILESV(c) (CopFILEGV(c) ? GvSV(CopFILEGV(c)) : Nullsv) -#endif - -#ifndef CopFILEAV -# define CopFILEAV(c) (CopFILEGV(c) ? GvAV(CopFILEGV(c)) : Nullav) -#endif - -#ifndef CopFILE -# define CopFILE(c) (CopFILESV(c) ? SvPVX(CopFILESV(c)) : Nullch) -#endif - -#ifndef CopSTASH -# define CopSTASH(c) ((c)->cop_stash) -#endif - -#ifndef CopSTASH_set -# define CopSTASH_set(c,hv) ((c)->cop_stash = (hv)) -#endif - -#ifndef CopSTASHPV -# define CopSTASHPV(c) (CopSTASH(c) ? HvNAME(CopSTASH(c)) : Nullch) -#endif - -#ifndef CopSTASHPV_set -# define CopSTASHPV_set(c,pv) CopSTASH_set((c), gv_stashpv(pv,GV_ADD)) -#endif - -#ifndef CopSTASH_eq -# define CopSTASH_eq(c,hv) (CopSTASH(c) == (hv)) -#endif - -#endif /* USE_ITHREADS */ -#ifndef IN_PERL_COMPILETIME -# define IN_PERL_COMPILETIME (PL_curcop == &PL_compiling) -#endif - -#ifndef IN_LOCALE_RUNTIME -# define IN_LOCALE_RUNTIME (PL_curcop->op_private & HINT_LOCALE) -#endif - -#ifndef IN_LOCALE_COMPILETIME -# define IN_LOCALE_COMPILETIME (PL_hints & HINT_LOCALE) -#endif - -#ifndef IN_LOCALE -# define IN_LOCALE (IN_PERL_COMPILETIME ? IN_LOCALE_COMPILETIME : IN_LOCALE_RUNTIME) -#endif -#ifndef IS_NUMBER_IN_UV -# define IS_NUMBER_IN_UV 0x01 -#endif - -#ifndef IS_NUMBER_GREATER_THAN_UV_MAX -# define IS_NUMBER_GREATER_THAN_UV_MAX 0x02 -#endif - -#ifndef IS_NUMBER_NOT_INT -# define IS_NUMBER_NOT_INT 0x04 -#endif - -#ifndef IS_NUMBER_NEG -# define IS_NUMBER_NEG 0x08 -#endif - -#ifndef IS_NUMBER_INFINITY -# define IS_NUMBER_INFINITY 0x10 -#endif - -#ifndef IS_NUMBER_NAN -# define IS_NUMBER_NAN 0x20 -#endif -#ifndef GROK_NUMERIC_RADIX -# define GROK_NUMERIC_RADIX(sp, send) grok_numeric_radix(sp, send) -#endif -#ifndef PERL_SCAN_GREATER_THAN_UV_MAX -# define PERL_SCAN_GREATER_THAN_UV_MAX 0x02 -#endif - -#ifndef PERL_SCAN_SILENT_ILLDIGIT -# define PERL_SCAN_SILENT_ILLDIGIT 0x04 -#endif - -#ifndef PERL_SCAN_ALLOW_UNDERSCORES -# define PERL_SCAN_ALLOW_UNDERSCORES 0x01 -#endif - -#ifndef PERL_SCAN_DISALLOW_PREFIX -# define PERL_SCAN_DISALLOW_PREFIX 0x02 -#endif - -#ifndef grok_numeric_radix -#if defined(NEED_grok_numeric_radix) -static bool DPPP_(my_grok_numeric_radix)(pTHX_ const char ** sp, const char * send); -static -#else -extern bool DPPP_(my_grok_numeric_radix)(pTHX_ const char ** sp, const char * send); -#endif - -#ifdef grok_numeric_radix -# undef grok_numeric_radix -#endif -#define grok_numeric_radix(a,b) DPPP_(my_grok_numeric_radix)(aTHX_ a,b) -#define Perl_grok_numeric_radix DPPP_(my_grok_numeric_radix) - -#if defined(NEED_grok_numeric_radix) || defined(NEED_grok_numeric_radix_GLOBAL) -bool -DPPP_(my_grok_numeric_radix)(pTHX_ const char **sp, const char *send) -{ -#ifdef USE_LOCALE_NUMERIC -#ifdef PL_numeric_radix_sv - if (PL_numeric_radix_sv && IN_LOCALE) { - STRLEN len; - char* radix = SvPV(PL_numeric_radix_sv, len); - if (*sp + len <= send && memEQ(*sp, radix, len)) { - *sp += len; - return TRUE; - } - } -#else - /* older perls don't have PL_numeric_radix_sv so the radix - * must manually be requested from locale.h - */ -#include - dTHR; /* needed for older threaded perls */ - struct lconv *lc = localeconv(); - char *radix = lc->decimal_point; - if (radix && IN_LOCALE) { - STRLEN len = strlen(radix); - if (*sp + len <= send && memEQ(*sp, radix, len)) { - *sp += len; - return TRUE; - } - } -#endif -#endif /* USE_LOCALE_NUMERIC */ - /* always try "." if numeric radix didn't match because - * we may have data from different locales mixed */ - if (*sp < send && **sp == '.') { - ++*sp; - return TRUE; - } - return FALSE; -} -#endif -#endif - -#ifndef grok_number -#if defined(NEED_grok_number) -static int DPPP_(my_grok_number)(pTHX_ const char * pv, STRLEN len, UV * valuep); -static -#else -extern int DPPP_(my_grok_number)(pTHX_ const char * pv, STRLEN len, UV * valuep); -#endif - -#ifdef grok_number -# undef grok_number -#endif -#define grok_number(a,b,c) DPPP_(my_grok_number)(aTHX_ a,b,c) -#define Perl_grok_number DPPP_(my_grok_number) - -#if defined(NEED_grok_number) || defined(NEED_grok_number_GLOBAL) -int -DPPP_(my_grok_number)(pTHX_ const char *pv, STRLEN len, UV *valuep) -{ - const char *s = pv; - const char *send = pv + len; - const UV max_div_10 = UV_MAX / 10; - const char max_mod_10 = UV_MAX % 10; - int numtype = 0; - int sawinf = 0; - int sawnan = 0; - - while (s < send && isSPACE(*s)) - s++; - if (s == send) { - return 0; - } else if (*s == '-') { - s++; - numtype = IS_NUMBER_NEG; - } - else if (*s == '+') - s++; - - if (s == send) - return 0; - - /* next must be digit or the radix separator or beginning of infinity */ - if (isDIGIT(*s)) { - /* UVs are at least 32 bits, so the first 9 decimal digits cannot - overflow. */ - UV value = *s - '0'; - /* This construction seems to be more optimiser friendly. - (without it gcc does the isDIGIT test and the *s - '0' separately) - With it gcc on arm is managing 6 instructions (6 cycles) per digit. - In theory the optimiser could deduce how far to unroll the loop - before checking for overflow. */ - if (++s < send) { - int digit = *s - '0'; - if (digit >= 0 && digit <= 9) { - value = value * 10 + digit; - if (++s < send) { - digit = *s - '0'; - if (digit >= 0 && digit <= 9) { - value = value * 10 + digit; - if (++s < send) { - digit = *s - '0'; - if (digit >= 0 && digit <= 9) { - value = value * 10 + digit; - if (++s < send) { - digit = *s - '0'; - if (digit >= 0 && digit <= 9) { - value = value * 10 + digit; - if (++s < send) { - digit = *s - '0'; - if (digit >= 0 && digit <= 9) { - value = value * 10 + digit; - if (++s < send) { - digit = *s - '0'; - if (digit >= 0 && digit <= 9) { - value = value * 10 + digit; - if (++s < send) { - digit = *s - '0'; - if (digit >= 0 && digit <= 9) { - value = value * 10 + digit; - if (++s < send) { - digit = *s - '0'; - if (digit >= 0 && digit <= 9) { - value = value * 10 + digit; - if (++s < send) { - /* Now got 9 digits, so need to check - each time for overflow. */ - digit = *s - '0'; - while (digit >= 0 && digit <= 9 - && (value < max_div_10 - || (value == max_div_10 - && digit <= max_mod_10))) { - value = value * 10 + digit; - if (++s < send) - digit = *s - '0'; - else - break; - } - if (digit >= 0 && digit <= 9 - && (s < send)) { - /* value overflowed. - skip the remaining digits, don't - worry about setting *valuep. */ - do { - s++; - } while (s < send && isDIGIT(*s)); - numtype |= - IS_NUMBER_GREATER_THAN_UV_MAX; - goto skip_value; - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - numtype |= IS_NUMBER_IN_UV; - if (valuep) - *valuep = value; - - skip_value: - if (GROK_NUMERIC_RADIX(&s, send)) { - numtype |= IS_NUMBER_NOT_INT; - while (s < send && isDIGIT(*s)) /* optional digits after the radix */ - s++; - } - } - else if (GROK_NUMERIC_RADIX(&s, send)) { - numtype |= IS_NUMBER_NOT_INT | IS_NUMBER_IN_UV; /* valuep assigned below */ - /* no digits before the radix means we need digits after it */ - if (s < send && isDIGIT(*s)) { - do { - s++; - } while (s < send && isDIGIT(*s)); - if (valuep) { - /* integer approximation is valid - it's 0. */ - *valuep = 0; - } - } - else - return 0; - } else if (*s == 'I' || *s == 'i') { - s++; if (s == send || (*s != 'N' && *s != 'n')) return 0; - s++; if (s == send || (*s != 'F' && *s != 'f')) return 0; - s++; if (s < send && (*s == 'I' || *s == 'i')) { - s++; if (s == send || (*s != 'N' && *s != 'n')) return 0; - s++; if (s == send || (*s != 'I' && *s != 'i')) return 0; - s++; if (s == send || (*s != 'T' && *s != 't')) return 0; - s++; if (s == send || (*s != 'Y' && *s != 'y')) return 0; - s++; - } - sawinf = 1; - } else if (*s == 'N' || *s == 'n') { - /* XXX TODO: There are signaling NaNs and quiet NaNs. */ - s++; if (s == send || (*s != 'A' && *s != 'a')) return 0; - s++; if (s == send || (*s != 'N' && *s != 'n')) return 0; - s++; - sawnan = 1; - } else - return 0; - - if (sawinf) { - numtype &= IS_NUMBER_NEG; /* Keep track of sign */ - numtype |= IS_NUMBER_INFINITY | IS_NUMBER_NOT_INT; - } else if (sawnan) { - numtype &= IS_NUMBER_NEG; /* Keep track of sign */ - numtype |= IS_NUMBER_NAN | IS_NUMBER_NOT_INT; - } else if (s < send) { - /* we can have an optional exponent part */ - if (*s == 'e' || *s == 'E') { - /* The only flag we keep is sign. Blow away any "it's UV" */ - numtype &= IS_NUMBER_NEG; - numtype |= IS_NUMBER_NOT_INT; - s++; - if (s < send && (*s == '-' || *s == '+')) - s++; - if (s < send && isDIGIT(*s)) { - do { - s++; - } while (s < send && isDIGIT(*s)); - } - else - return 0; - } - } - while (s < send && isSPACE(*s)) - s++; - if (s >= send) - return numtype; - if (len == 10 && memEQ(pv, "0 but true", 10)) { - if (valuep) - *valuep = 0; - return IS_NUMBER_IN_UV; - } - return 0; -} -#endif -#endif - -/* - * The grok_* routines have been modified to use warn() instead of - * Perl_warner(). Also, 'hexdigit' was the former name of PL_hexdigit, - * which is why the stack variable has been renamed to 'xdigit'. - */ - -#ifndef grok_bin -#if defined(NEED_grok_bin) -static UV DPPP_(my_grok_bin)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result); -static -#else -extern UV DPPP_(my_grok_bin)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result); -#endif - -#ifdef grok_bin -# undef grok_bin -#endif -#define grok_bin(a,b,c,d) DPPP_(my_grok_bin)(aTHX_ a,b,c,d) -#define Perl_grok_bin DPPP_(my_grok_bin) - -#if defined(NEED_grok_bin) || defined(NEED_grok_bin_GLOBAL) -UV -DPPP_(my_grok_bin)(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) -{ - const char *s = start; - STRLEN len = *len_p; - UV value = 0; - NV value_nv = 0; - - const UV max_div_2 = UV_MAX / 2; - bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES; - bool overflowed = FALSE; - - if (!(*flags & PERL_SCAN_DISALLOW_PREFIX)) { - /* strip off leading b or 0b. - for compatibility silently suffer "b" and "0b" as valid binary - numbers. */ - if (len >= 1) { - if (s[0] == 'b') { - s++; - len--; - } - else if (len >= 2 && s[0] == '0' && s[1] == 'b') { - s+=2; - len-=2; - } - } - } - - for (; len-- && *s; s++) { - char bit = *s; - if (bit == '0' || bit == '1') { - /* Write it in this wonky order with a goto to attempt to get the - compiler to make the common case integer-only loop pretty tight. - With gcc seems to be much straighter code than old scan_bin. */ - redo: - if (!overflowed) { - if (value <= max_div_2) { - value = (value << 1) | (bit - '0'); - continue; - } - /* Bah. We're just overflowed. */ - warn("Integer overflow in binary number"); - overflowed = TRUE; - value_nv = (NV) value; - } - value_nv *= 2.0; - /* If an NV has not enough bits in its mantissa to - * represent a UV this summing of small low-order numbers - * is a waste of time (because the NV cannot preserve - * the low-order bits anyway): we could just remember when - * did we overflow and in the end just multiply value_nv by the - * right amount. */ - value_nv += (NV)(bit - '0'); - continue; - } - if (bit == '_' && len && allow_underscores && (bit = s[1]) - && (bit == '0' || bit == '1')) - { - --len; - ++s; - goto redo; - } - if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT)) - warn("Illegal binary digit '%c' ignored", *s); - break; - } - - if ( ( overflowed && value_nv > 4294967295.0) -#if UVSIZE > 4 - || (!overflowed && value > 0xffffffff ) -#endif - ) { - warn("Binary number > 0b11111111111111111111111111111111 non-portable"); - } - *len_p = s - start; - if (!overflowed) { - *flags = 0; - return value; - } - *flags = PERL_SCAN_GREATER_THAN_UV_MAX; - if (result) - *result = value_nv; - return UV_MAX; -} -#endif -#endif - -#ifndef grok_hex -#if defined(NEED_grok_hex) -static UV DPPP_(my_grok_hex)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result); -static -#else -extern UV DPPP_(my_grok_hex)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result); -#endif - -#ifdef grok_hex -# undef grok_hex -#endif -#define grok_hex(a,b,c,d) DPPP_(my_grok_hex)(aTHX_ a,b,c,d) -#define Perl_grok_hex DPPP_(my_grok_hex) - -#if defined(NEED_grok_hex) || defined(NEED_grok_hex_GLOBAL) -UV -DPPP_(my_grok_hex)(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) -{ - const char *s = start; - STRLEN len = *len_p; - UV value = 0; - NV value_nv = 0; - - const UV max_div_16 = UV_MAX / 16; - bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES; - bool overflowed = FALSE; - const char *xdigit; - - if (!(*flags & PERL_SCAN_DISALLOW_PREFIX)) { - /* strip off leading x or 0x. - for compatibility silently suffer "x" and "0x" as valid hex numbers. - */ - if (len >= 1) { - if (s[0] == 'x') { - s++; - len--; - } - else if (len >= 2 && s[0] == '0' && s[1] == 'x') { - s+=2; - len-=2; - } - } - } - - for (; len-- && *s; s++) { - xdigit = strchr((char *) PL_hexdigit, *s); - if (xdigit) { - /* Write it in this wonky order with a goto to attempt to get the - compiler to make the common case integer-only loop pretty tight. - With gcc seems to be much straighter code than old scan_hex. */ - redo: - if (!overflowed) { - if (value <= max_div_16) { - value = (value << 4) | ((xdigit - PL_hexdigit) & 15); - continue; - } - warn("Integer overflow in hexadecimal number"); - overflowed = TRUE; - value_nv = (NV) value; - } - value_nv *= 16.0; - /* If an NV has not enough bits in its mantissa to - * represent a UV this summing of small low-order numbers - * is a waste of time (because the NV cannot preserve - * the low-order bits anyway): we could just remember when - * did we overflow and in the end just multiply value_nv by the - * right amount of 16-tuples. */ - value_nv += (NV)((xdigit - PL_hexdigit) & 15); - continue; - } - if (*s == '_' && len && allow_underscores && s[1] - && (xdigit = strchr((char *) PL_hexdigit, s[1]))) - { - --len; - ++s; - goto redo; - } - if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT)) - warn("Illegal hexadecimal digit '%c' ignored", *s); - break; - } - - if ( ( overflowed && value_nv > 4294967295.0) -#if UVSIZE > 4 - || (!overflowed && value > 0xffffffff ) -#endif - ) { - warn("Hexadecimal number > 0xffffffff non-portable"); - } - *len_p = s - start; - if (!overflowed) { - *flags = 0; - return value; - } - *flags = PERL_SCAN_GREATER_THAN_UV_MAX; - if (result) - *result = value_nv; - return UV_MAX; -} -#endif -#endif - -#ifndef grok_oct -#if defined(NEED_grok_oct) -static UV DPPP_(my_grok_oct)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result); -static -#else -extern UV DPPP_(my_grok_oct)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result); -#endif - -#ifdef grok_oct -# undef grok_oct -#endif -#define grok_oct(a,b,c,d) DPPP_(my_grok_oct)(aTHX_ a,b,c,d) -#define Perl_grok_oct DPPP_(my_grok_oct) - -#if defined(NEED_grok_oct) || defined(NEED_grok_oct_GLOBAL) -UV -DPPP_(my_grok_oct)(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) -{ - const char *s = start; - STRLEN len = *len_p; - UV value = 0; - NV value_nv = 0; - - const UV max_div_8 = UV_MAX / 8; - bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES; - bool overflowed = FALSE; - - for (; len-- && *s; s++) { - /* gcc 2.95 optimiser not smart enough to figure that this subtraction - out front allows slicker code. */ - int digit = *s - '0'; - if (digit >= 0 && digit <= 7) { - /* Write it in this wonky order with a goto to attempt to get the - compiler to make the common case integer-only loop pretty tight. - */ - redo: - if (!overflowed) { - if (value <= max_div_8) { - value = (value << 3) | digit; - continue; - } - /* Bah. We're just overflowed. */ - warn("Integer overflow in octal number"); - overflowed = TRUE; - value_nv = (NV) value; - } - value_nv *= 8.0; - /* If an NV has not enough bits in its mantissa to - * represent a UV this summing of small low-order numbers - * is a waste of time (because the NV cannot preserve - * the low-order bits anyway): we could just remember when - * did we overflow and in the end just multiply value_nv by the - * right amount of 8-tuples. */ - value_nv += (NV)digit; - continue; - } - if (digit == ('_' - '0') && len && allow_underscores - && (digit = s[1] - '0') && (digit >= 0 && digit <= 7)) - { - --len; - ++s; - goto redo; - } - /* Allow \octal to work the DWIM way (that is, stop scanning - * as soon as non-octal characters are seen, complain only iff - * someone seems to want to use the digits eight and nine). */ - if (digit == 8 || digit == 9) { - if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT)) - warn("Illegal octal digit '%c' ignored", *s); - } - break; - } - - if ( ( overflowed && value_nv > 4294967295.0) -#if UVSIZE > 4 - || (!overflowed && value > 0xffffffff ) -#endif - ) { - warn("Octal number > 037777777777 non-portable"); - } - *len_p = s - start; - if (!overflowed) { - *flags = 0; - return value; - } - *flags = PERL_SCAN_GREATER_THAN_UV_MAX; - if (result) - *result = value_nv; - return UV_MAX; -} -#endif -#endif - -#if !defined(my_snprintf) -#if defined(NEED_my_snprintf) -static int DPPP_(my_my_snprintf)(char * buffer, const Size_t len, const char * format, ...); -static -#else -extern int DPPP_(my_my_snprintf)(char * buffer, const Size_t len, const char * format, ...); -#endif - -#define my_snprintf DPPP_(my_my_snprintf) -#define Perl_my_snprintf DPPP_(my_my_snprintf) - -#if defined(NEED_my_snprintf) || defined(NEED_my_snprintf_GLOBAL) - -int -DPPP_(my_my_snprintf)(char *buffer, const Size_t len, const char *format, ...) -{ - dTHX; - int retval; - va_list ap; - va_start(ap, format); -#ifdef HAS_VSNPRINTF - retval = vsnprintf(buffer, len, format, ap); -#else - retval = vsprintf(buffer, format, ap); -#endif - va_end(ap); - if (retval < 0 || (len > 0 && (Size_t)retval >= len)) - Perl_croak(aTHX_ "panic: my_snprintf buffer overflow"); - return retval; -} - -#endif -#endif - -#if !defined(my_sprintf) -#if defined(NEED_my_sprintf) -static int DPPP_(my_my_sprintf)(char * buffer, const char * pat, ...); -static -#else -extern int DPPP_(my_my_sprintf)(char * buffer, const char * pat, ...); -#endif - -#define my_sprintf DPPP_(my_my_sprintf) -#define Perl_my_sprintf DPPP_(my_my_sprintf) - -#if defined(NEED_my_sprintf) || defined(NEED_my_sprintf_GLOBAL) - -int -DPPP_(my_my_sprintf)(char *buffer, const char* pat, ...) -{ - va_list args; - va_start(args, pat); - vsprintf(buffer, pat, args); - va_end(args); - return strlen(buffer); -} - -#endif -#endif - -#ifdef NO_XSLOCKS -# ifdef dJMPENV -# define dXCPT dJMPENV; int rEtV = 0 -# define XCPT_TRY_START JMPENV_PUSH(rEtV); if (rEtV == 0) -# define XCPT_TRY_END JMPENV_POP; -# define XCPT_CATCH if (rEtV != 0) -# define XCPT_RETHROW JMPENV_JUMP(rEtV) -# else -# define dXCPT Sigjmp_buf oldTOP; int rEtV = 0 -# define XCPT_TRY_START Copy(top_env, oldTOP, 1, Sigjmp_buf); rEtV = Sigsetjmp(top_env, 1); if (rEtV == 0) -# define XCPT_TRY_END Copy(oldTOP, top_env, 1, Sigjmp_buf); -# define XCPT_CATCH if (rEtV != 0) -# define XCPT_RETHROW Siglongjmp(top_env, rEtV) -# endif -#endif - -#if !defined(my_strlcat) -#if defined(NEED_my_strlcat) -static Size_t DPPP_(my_my_strlcat)(char * dst, const char * src, Size_t size); -static -#else -extern Size_t DPPP_(my_my_strlcat)(char * dst, const char * src, Size_t size); -#endif - -#define my_strlcat DPPP_(my_my_strlcat) -#define Perl_my_strlcat DPPP_(my_my_strlcat) - -#if defined(NEED_my_strlcat) || defined(NEED_my_strlcat_GLOBAL) - -Size_t -DPPP_(my_my_strlcat)(char *dst, const char *src, Size_t size) -{ - Size_t used, length, copy; - - used = strlen(dst); - length = strlen(src); - if (size > 0 && used < size - 1) { - copy = (length >= size - used) ? size - used - 1 : length; - memcpy(dst + used, src, copy); - dst[used + copy] = '\0'; - } - return used + length; -} -#endif -#endif - -#if !defined(my_strlcpy) -#if defined(NEED_my_strlcpy) -static Size_t DPPP_(my_my_strlcpy)(char * dst, const char * src, Size_t size); -static -#else -extern Size_t DPPP_(my_my_strlcpy)(char * dst, const char * src, Size_t size); -#endif - -#define my_strlcpy DPPP_(my_my_strlcpy) -#define Perl_my_strlcpy DPPP_(my_my_strlcpy) - -#if defined(NEED_my_strlcpy) || defined(NEED_my_strlcpy_GLOBAL) - -Size_t -DPPP_(my_my_strlcpy)(char *dst, const char *src, Size_t size) -{ - Size_t length, copy; - - length = strlen(src); - if (size > 0) { - copy = (length >= size) ? size - 1 : length; - memcpy(dst, src, copy); - dst[copy] = '\0'; - } - return length; -} - -#endif -#endif -#ifndef PERL_PV_ESCAPE_QUOTE -# define PERL_PV_ESCAPE_QUOTE 0x0001 -#endif - -#ifndef PERL_PV_PRETTY_QUOTE -# define PERL_PV_PRETTY_QUOTE PERL_PV_ESCAPE_QUOTE -#endif - -#ifndef PERL_PV_PRETTY_ELLIPSES -# define PERL_PV_PRETTY_ELLIPSES 0x0002 -#endif - -#ifndef PERL_PV_PRETTY_LTGT -# define PERL_PV_PRETTY_LTGT 0x0004 -#endif - -#ifndef PERL_PV_ESCAPE_FIRSTCHAR -# define PERL_PV_ESCAPE_FIRSTCHAR 0x0008 -#endif - -#ifndef PERL_PV_ESCAPE_UNI -# define PERL_PV_ESCAPE_UNI 0x0100 -#endif - -#ifndef PERL_PV_ESCAPE_UNI_DETECT -# define PERL_PV_ESCAPE_UNI_DETECT 0x0200 -#endif - -#ifndef PERL_PV_ESCAPE_ALL -# define PERL_PV_ESCAPE_ALL 0x1000 -#endif - -#ifndef PERL_PV_ESCAPE_NOBACKSLASH -# define PERL_PV_ESCAPE_NOBACKSLASH 0x2000 -#endif - -#ifndef PERL_PV_ESCAPE_NOCLEAR -# define PERL_PV_ESCAPE_NOCLEAR 0x4000 -#endif - -#ifndef PERL_PV_ESCAPE_RE -# define PERL_PV_ESCAPE_RE 0x8000 -#endif - -#ifndef PERL_PV_PRETTY_NOCLEAR -# define PERL_PV_PRETTY_NOCLEAR PERL_PV_ESCAPE_NOCLEAR -#endif -#ifndef PERL_PV_PRETTY_DUMP -# define PERL_PV_PRETTY_DUMP PERL_PV_PRETTY_ELLIPSES|PERL_PV_PRETTY_QUOTE -#endif - -#ifndef PERL_PV_PRETTY_REGPROP -# define PERL_PV_PRETTY_REGPROP PERL_PV_PRETTY_ELLIPSES|PERL_PV_PRETTY_LTGT|PERL_PV_ESCAPE_RE -#endif - -/* Hint: pv_escape - * Note that unicode functionality is only backported to - * those perl versions that support it. For older perl - * versions, the implementation will fall back to bytes. - */ - -#ifndef pv_escape -#if defined(NEED_pv_escape) -static char * DPPP_(my_pv_escape)(pTHX_ SV * dsv, char const * const str, const STRLEN count, const STRLEN max, STRLEN * const escaped, const U32 flags); -static -#else -extern char * DPPP_(my_pv_escape)(pTHX_ SV * dsv, char const * const str, const STRLEN count, const STRLEN max, STRLEN * const escaped, const U32 flags); -#endif - -#ifdef pv_escape -# undef pv_escape -#endif -#define pv_escape(a,b,c,d,e,f) DPPP_(my_pv_escape)(aTHX_ a,b,c,d,e,f) -#define Perl_pv_escape DPPP_(my_pv_escape) - -#if defined(NEED_pv_escape) || defined(NEED_pv_escape_GLOBAL) - -char * -DPPP_(my_pv_escape)(pTHX_ SV *dsv, char const * const str, - const STRLEN count, const STRLEN max, - STRLEN * const escaped, const U32 flags) -{ - const char esc = flags & PERL_PV_ESCAPE_RE ? '%' : '\\'; - const char dq = flags & PERL_PV_ESCAPE_QUOTE ? '"' : esc; - char octbuf[32] = "%123456789ABCDF"; - STRLEN wrote = 0; - STRLEN chsize = 0; - STRLEN readsize = 1; -#if defined(is_utf8_string) && defined(utf8_to_uvchr) - bool isuni = flags & PERL_PV_ESCAPE_UNI ? 1 : 0; -#endif - const char *pv = str; - const char * const end = pv + count; - octbuf[0] = esc; - - if (!(flags & PERL_PV_ESCAPE_NOCLEAR)) - sv_setpvs(dsv, ""); - -#if defined(is_utf8_string) && defined(utf8_to_uvchr) - if ((flags & PERL_PV_ESCAPE_UNI_DETECT) && is_utf8_string((U8*)pv, count)) - isuni = 1; -#endif - - for (; pv < end && (!max || wrote < max) ; pv += readsize) { - const UV u = -#if defined(is_utf8_string) && defined(utf8_to_uvchr) - isuni ? utf8_to_uvchr((U8*)pv, &readsize) : -#endif - (U8)*pv; - const U8 c = (U8)u & 0xFF; - - if (u > 255 || (flags & PERL_PV_ESCAPE_ALL)) { - if (flags & PERL_PV_ESCAPE_FIRSTCHAR) - chsize = my_snprintf(octbuf, sizeof octbuf, - "%"UVxf, u); - else - chsize = my_snprintf(octbuf, sizeof octbuf, - "%cx{%"UVxf"}", esc, u); - } else if (flags & PERL_PV_ESCAPE_NOBACKSLASH) { - chsize = 1; - } else { - if (c == dq || c == esc || !isPRINT(c)) { - chsize = 2; - switch (c) { - case '\\' : /* fallthrough */ - case '%' : if (c == esc) - octbuf[1] = esc; - else - chsize = 1; - break; - case '\v' : octbuf[1] = 'v'; break; - case '\t' : octbuf[1] = 't'; break; - case '\r' : octbuf[1] = 'r'; break; - case '\n' : octbuf[1] = 'n'; break; - case '\f' : octbuf[1] = 'f'; break; - case '"' : if (dq == '"') - octbuf[1] = '"'; - else - chsize = 1; - break; - default: chsize = my_snprintf(octbuf, sizeof octbuf, - pv < end && isDIGIT((U8)*(pv+readsize)) - ? "%c%03o" : "%c%o", esc, c); - } - } else { - chsize = 1; - } - } - if (max && wrote + chsize > max) { - break; - } else if (chsize > 1) { - sv_catpvn(dsv, octbuf, chsize); - wrote += chsize; - } else { - char tmp[2]; - my_snprintf(tmp, sizeof tmp, "%c", c); - sv_catpvn(dsv, tmp, 1); - wrote++; - } - if (flags & PERL_PV_ESCAPE_FIRSTCHAR) - break; - } - if (escaped != NULL) - *escaped= pv - str; - return SvPVX(dsv); -} - -#endif -#endif - -#ifndef pv_pretty -#if defined(NEED_pv_pretty) -static char * DPPP_(my_pv_pretty)(pTHX_ SV * dsv, char const * const str, const STRLEN count, const STRLEN max, char const * const start_color, char const * const end_color, const U32 flags); -static -#else -extern char * DPPP_(my_pv_pretty)(pTHX_ SV * dsv, char const * const str, const STRLEN count, const STRLEN max, char const * const start_color, char const * const end_color, const U32 flags); -#endif - -#ifdef pv_pretty -# undef pv_pretty -#endif -#define pv_pretty(a,b,c,d,e,f,g) DPPP_(my_pv_pretty)(aTHX_ a,b,c,d,e,f,g) -#define Perl_pv_pretty DPPP_(my_pv_pretty) - -#if defined(NEED_pv_pretty) || defined(NEED_pv_pretty_GLOBAL) - -char * -DPPP_(my_pv_pretty)(pTHX_ SV *dsv, char const * const str, const STRLEN count, - const STRLEN max, char const * const start_color, char const * const end_color, - const U32 flags) -{ - const U8 dq = (flags & PERL_PV_PRETTY_QUOTE) ? '"' : '%'; - STRLEN escaped; - - if (!(flags & PERL_PV_PRETTY_NOCLEAR)) - sv_setpvs(dsv, ""); - - if (dq == '"') - sv_catpvs(dsv, "\""); - else if (flags & PERL_PV_PRETTY_LTGT) - sv_catpvs(dsv, "<"); - - if (start_color != NULL) - sv_catpv(dsv, D_PPP_CONSTPV_ARG(start_color)); - - pv_escape(dsv, str, count, max, &escaped, flags | PERL_PV_ESCAPE_NOCLEAR); - - if (end_color != NULL) - sv_catpv(dsv, D_PPP_CONSTPV_ARG(end_color)); - - if (dq == '"') - sv_catpvs(dsv, "\""); - else if (flags & PERL_PV_PRETTY_LTGT) - sv_catpvs(dsv, ">"); - - if ((flags & PERL_PV_PRETTY_ELLIPSES) && escaped < count) - sv_catpvs(dsv, "..."); - - return SvPVX(dsv); -} - -#endif -#endif - -#ifndef pv_display -#if defined(NEED_pv_display) -static char * DPPP_(my_pv_display)(pTHX_ SV * dsv, const char * pv, STRLEN cur, STRLEN len, STRLEN pvlim); -static -#else -extern char * DPPP_(my_pv_display)(pTHX_ SV * dsv, const char * pv, STRLEN cur, STRLEN len, STRLEN pvlim); -#endif - -#ifdef pv_display -# undef pv_display -#endif -#define pv_display(a,b,c,d,e) DPPP_(my_pv_display)(aTHX_ a,b,c,d,e) -#define Perl_pv_display DPPP_(my_pv_display) - -#if defined(NEED_pv_display) || defined(NEED_pv_display_GLOBAL) - -char * -DPPP_(my_pv_display)(pTHX_ SV *dsv, const char *pv, STRLEN cur, STRLEN len, STRLEN pvlim) -{ - pv_pretty(dsv, pv, cur, pvlim, NULL, NULL, PERL_PV_PRETTY_DUMP); - if (len > cur && pv[cur] == '\0') - sv_catpvs(dsv, "\\0"); - return SvPVX(dsv); -} - -#endif -#endif - -#endif /* _P_P_PORTABILITY_H_ */ - -/* End of File ppport.h */ diff --git a/deps/Language-K20/stubs_dl.c b/deps/Language-K20/stubs_dl.c deleted file mode 100644 index beb4295..0000000 --- a/deps/Language-K20/stubs_dl.c +++ /dev/null @@ -1,3 +0,0 @@ -void dlerror(){} -void dlopen(){} -void dlsym(){} diff --git a/deps/Language-K20/stubs_xs.c b/deps/Language-K20/stubs_xs.c deleted file mode 100644 index 0f0beb7..0000000 --- a/deps/Language-K20/stubs_xs.c +++ /dev/null @@ -1,47 +0,0 @@ -void XAllocColor(){} -void XAllocNamedColor(){} -void XBell(){} -void XChangeProperty(){} -void XCheckMaskEvent(){} -void XClearArea(){} -void XClearWindow(){} -void XCloseDisplay(){} -void XCopyArea(){} -void XCreateFontCursor(){} -void XCreateGC(){} -void XCreatePixmap(){} -void XCreateWindow(){} -void XDefineCursor(){} -void XDestroyWindow(){} -void XDrawArc(){} -void XDrawImageString(){} -void XDrawLine(){} -void XDrawLines(){} -void XDrawRectangle(){} -void XFillArc(){} -void XFillRectangle(){} -void XFlush(){} -void XFreeFontNames(){} -void XGrabPointer(){} -void XInternAtom(){} -void XListFonts(){} -void XLoadQueryFont(){} -void XLookupString(){} -void XMapRaised(){} -void XMoveResizeWindow(){} -void XNextEvent(){} -void XOpenDisplay(){} -void XPending(){} -void XQueryPointer(){} -void XResizeWindow(){} -void XSelectInput(){} -void XSetBackground(){} -void XSetFont(){} -void XSetForeground(){} -void XSetIconName(){} -void XSetNormalHints(){} -void XStoreName(){} -void XTextWidth(){} -void XUndefineCursor(){} -void XUngrabPointer(){} -void XUnmapWindow(){} diff --git a/deps/Language-K20/t/.svn/entries b/deps/Language-K20/t/.svn/entries deleted file mode 100644 index ecf9c06..0000000 --- a/deps/Language-K20/t/.svn/entries +++ /dev/null @@ -1,62 +0,0 @@ -10 - -dir -475 -svn://erxz.com/bb3/branches/perlbuut/deps/Language-K20/t -svn://erxz.com/bb3 - - - -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - -dcb1cea6-7f7e-4c78-8a22-148ace8ce36e - -Language-K20.t -file - - - - -2009-10-03T22:54:20.000000Z -bc7021cae6997dfc22151d4b96348882 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -512 - diff --git a/deps/Language-K20/t/.svn/text-base/Language-K20.t.svn-base b/deps/Language-K20/t/.svn/text-base/Language-K20.t.svn-base deleted file mode 100644 index 0cb06a8..0000000 --- a/deps/Language-K20/t/.svn/text-base/Language-K20.t.svn-base +++ /dev/null @@ -1,17 +0,0 @@ -# Before `make install' is performed this script should be runnable with -# `make test'. After `make install' it should work as `perl Language-K20.t' - -######################### - -# change 'tests => 1' to 'tests => last_test_to_print'; - -use Test; -BEGIN { plan tests => 1 }; -use Language::K20; -ok(1); # If we made it this far, we're ok. - -######################### - -# Insert your test code below, the Test::More module is use()ed here so read -# its man page ( perldoc Test::More ) for help writing this test script. - diff --git a/deps/Language-K20/t/Language-K20.t b/deps/Language-K20/t/Language-K20.t deleted file mode 100644 index 0cb06a8..0000000 --- a/deps/Language-K20/t/Language-K20.t +++ /dev/null @@ -1,17 +0,0 @@ -# Before `make install' is performed this script should be runnable with -# `make test'. After `make install' it should work as `perl Language-K20.t' - -######################### - -# change 'tests => 1' to 'tests => last_test_to_print'; - -use Test; -BEGIN { plan tests => 1 }; -use Language::K20; -ok(1); # If we made it this far, we're ok. - -######################### - -# Insert your test code below, the Test::More module is use()ed here so read -# its man page ( perldoc Test::More ) for help writing this test script. - diff --git a/deps/Math/.svn/entries b/deps/Math/.svn/entries deleted file mode 100644 index e268314..0000000 --- a/deps/Math/.svn/entries +++ /dev/null @@ -1,65 +0,0 @@ -10 - -dir -475 -svn://erxz.com/bb3/branches/perlbuut/deps/Math -svn://erxz.com/bb3 - - - -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - -dcb1cea6-7f7e-4c78-8a22-148ace8ce36e - -Farnsworth.pm -file - - - - -2009-10-03T22:54:20.000000Z -9ceafad68c9b4956ec38a54864c9505a -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -5990 - -Farnsworth -dir - diff --git a/deps/Math/.svn/text-base/Farnsworth.pm.svn-base b/deps/Math/.svn/text-base/Farnsworth.pm.svn-base deleted file mode 100644 index bac6e83..0000000 --- a/deps/Math/.svn/text-base/Farnsworth.pm.svn-base +++ /dev/null @@ -1,251 +0,0 @@ -#!/usr/bin/perl - -package Math::Farnsworth; - -our $VERSION = "0.6.0"; - -use strict; -use warnings; - -use Math::Farnsworth::Evaluate; -use Math::Farnsworth::Value; -use Math::Farnsworth::Dimension; -use Math::Farnsworth::Units; -use Math::Farnsworth::FunctionDispatch; -use Math::Farnsworth::Variables; -use Math::Farnsworth::Output; -use Math::Pari; - -use Carp qw(croak); - -use Data::Dumper; - -sub new -{ - shift; #get the class off - - my $self = {}; - my @modules = @_; #i get passed a list of modules to use for standard stuff; - - Math::Pari::setprecision(100); - Math::Pari::allocatemem(40_000_000); - - if (@modules < 1) - { - #@modules = ("Units::Standard", "Functions::Standard", "Functions::StdMath", "Functions::GoogleTranslate", "Units::Currency"); #standard modules to include - } - - #print Dumper(\@modules); - - $self->{eval} = Math::Farnsworth::Evaluate->new(); - - for my $a (@modules) - { - eval 'use Math::Farnsworth::'.$a.'; Math::Farnsworth::'.$a.'::init($self->{eval});'; - die $@ if $@; - #print "-------FAILED? $a\n"; - #print $@; - #print "\n"; - } - - bless $self; - return $self; -} - -sub runString -{ - my $self = shift; - my @torun = @_; # we can run an array - my @results; - - push @results, new Math::Farnsworth::Output($self->{eval}{units},$self->{eval}->eval($_), $self->{eval}) for (@torun); - - return wantarray ? @results : $results[-1]; #return all of them in array context, only the last in scalar context -} - -sub runFile -{ - my $self = shift; - my $filename = shift; - - #my @results; #i should really probably only store them all IF they are needed - - open(my $fh, "<", $filename) or die "couldn't open: $!"; - my $lines; - my $first = 1; - while(<$fh>) - { - $first=0, next if ($first && $_ =~ /^#!/); #skip a shebang line, not part of the language but makes it possible to have executable .frns files! - $lines .= $_; - } - close($fh); - - #as much as i would like this to work WITHOUT this i need to filter blank lines out #not as sure i need to do this anymore! need tests to check - $lines =~ s/\s*\n\s*\n\s*/\n/; - - return new Math::Farnsworth::Output($self->{eval}{units},$self->{eval}->eval($lines), $self->{eval}); - -# while(<$fh>) -# { -# chomp; - #s|//.*$||; - #s|\s*$||; -# } - -# close($fh); - - #return wantarray ? @results : $results[-1]; #return all of them in array context, only the last in scalar context -} - -#this will wrap around a lot of the funky code for creating a nice looking output -#sub prettyOut -#{ -# my $self = shift; -# my $input = shift; - -# return $input->toperl($self->{eval}{units}); -#} - -1; -__END__ - -# Below is stub documentation for your module. You'd better edit it! - -=head1 NAME - -Math::Farnsworth - A Turing Complete Language for Mathematics - -=head1 SYNOPSIS - - use Math::Farnsworth; - - my $hubert = Math::Farnsworth->new(); - - my $result = $hubert->runString("10 km -> miles"); - - my $result = $hubert->runFile("file.frns"); - - print $result; - -=head1 DESCRIPTION - -THIS IS A BETA RELEASE! There are typos in the error messages and in the POD. There are also probably plenty of bugs. It is being released early because there have been a number of people who have shown interest in having it released. Not every feature is documented yet and a future release will have that cleaned up along with some of the hairier parts of the internal API. -Math::Farnsworth is a programming language originally inspired by Frink (see http://futureboy.homeip.net/frinkdocs/ ). -However due to certain difficulties during the creation of it, the syntax has changed slightly and the capabilities are also different. -Some things Math::Farnsworth can do a little better than Frink, other areas Math::Farnsworth lacks. - -=head2 PREREQUISITS - -Modules and Libraries you need before this will work - -=over 4 - -=item * - -The PARI library - -=item * - -L - -=item * - -L - -The following are optional - -For the Google Translation library - -=item * - -L - -=item * - -L - -=back - -=head2 METHODS - -ALL of the methods here call C whenever something doesn't go right. This means that unless you want bad input to them to cause your program to fail you should wrap any calls to them with C. When they call C they will give you back a message explaining what went wrong, this is useful for telling a user what they have done. - -=head3 runString - -This method takes a string (or multiple strings) and executes them as Math::Farnsworth expressions. -For more information on making Math::Farnsworth expressions, see L. - -=head3 runFile - -This takes a file name and executes the entire file as a single Math::Farnsworth expression. - -=head3 prettyOut - -This takes a Math::Farnsworth::Value and turns it into a string for perl to be able to display. This method WILL disappear in a future version. - -=head2 EXPORT - -None by default. - -=head2 KNOWN BUGS - -At the moment all known bugs are related to badly formatted output, this will be rectified in a future release. - -=head2 MISSING FEATURES - -The following features are currently missing and WILL be implemented in a future version of Math::Farnsworth - -=over 4 - -=item * - -Better control over the output - -=over 8 - -=item * - -Adjustable precision of numbers - -=item * - -Better defaults for certain types of output - -=back - -=item * - -Passing arguments by reference - -=item * - -Syntax tree introspection inside the language itself - -=item * - -Better Documentation - -=back - -=head1 SEE ALSO - -L L - - -There is also an RT tracker for the module (this may change) setup at -L, you can also reach the tracker by sending an email to Efarnsworth.rt@gmail.comE - -=head1 AUTHOR - -Ryan Voots Esimcop@cpan.orgE - -=head1 COPYRIGHT AND LICENSE - -Copyright (C) 2008 by Ryan Voots - -This library is free software; you can redistribute it and/or modify -it under the same terms as Perl itself, either Perl version 5.8.0 or, -at your option, any later version of Perl 5 you may have available. - - -=cut diff --git a/deps/Math/Farnsworth.pm b/deps/Math/Farnsworth.pm deleted file mode 100644 index bac6e83..0000000 --- a/deps/Math/Farnsworth.pm +++ /dev/null @@ -1,251 +0,0 @@ -#!/usr/bin/perl - -package Math::Farnsworth; - -our $VERSION = "0.6.0"; - -use strict; -use warnings; - -use Math::Farnsworth::Evaluate; -use Math::Farnsworth::Value; -use Math::Farnsworth::Dimension; -use Math::Farnsworth::Units; -use Math::Farnsworth::FunctionDispatch; -use Math::Farnsworth::Variables; -use Math::Farnsworth::Output; -use Math::Pari; - -use Carp qw(croak); - -use Data::Dumper; - -sub new -{ - shift; #get the class off - - my $self = {}; - my @modules = @_; #i get passed a list of modules to use for standard stuff; - - Math::Pari::setprecision(100); - Math::Pari::allocatemem(40_000_000); - - if (@modules < 1) - { - #@modules = ("Units::Standard", "Functions::Standard", "Functions::StdMath", "Functions::GoogleTranslate", "Units::Currency"); #standard modules to include - } - - #print Dumper(\@modules); - - $self->{eval} = Math::Farnsworth::Evaluate->new(); - - for my $a (@modules) - { - eval 'use Math::Farnsworth::'.$a.'; Math::Farnsworth::'.$a.'::init($self->{eval});'; - die $@ if $@; - #print "-------FAILED? $a\n"; - #print $@; - #print "\n"; - } - - bless $self; - return $self; -} - -sub runString -{ - my $self = shift; - my @torun = @_; # we can run an array - my @results; - - push @results, new Math::Farnsworth::Output($self->{eval}{units},$self->{eval}->eval($_), $self->{eval}) for (@torun); - - return wantarray ? @results : $results[-1]; #return all of them in array context, only the last in scalar context -} - -sub runFile -{ - my $self = shift; - my $filename = shift; - - #my @results; #i should really probably only store them all IF they are needed - - open(my $fh, "<", $filename) or die "couldn't open: $!"; - my $lines; - my $first = 1; - while(<$fh>) - { - $first=0, next if ($first && $_ =~ /^#!/); #skip a shebang line, not part of the language but makes it possible to have executable .frns files! - $lines .= $_; - } - close($fh); - - #as much as i would like this to work WITHOUT this i need to filter blank lines out #not as sure i need to do this anymore! need tests to check - $lines =~ s/\s*\n\s*\n\s*/\n/; - - return new Math::Farnsworth::Output($self->{eval}{units},$self->{eval}->eval($lines), $self->{eval}); - -# while(<$fh>) -# { -# chomp; - #s|//.*$||; - #s|\s*$||; -# } - -# close($fh); - - #return wantarray ? @results : $results[-1]; #return all of them in array context, only the last in scalar context -} - -#this will wrap around a lot of the funky code for creating a nice looking output -#sub prettyOut -#{ -# my $self = shift; -# my $input = shift; - -# return $input->toperl($self->{eval}{units}); -#} - -1; -__END__ - -# Below is stub documentation for your module. You'd better edit it! - -=head1 NAME - -Math::Farnsworth - A Turing Complete Language for Mathematics - -=head1 SYNOPSIS - - use Math::Farnsworth; - - my $hubert = Math::Farnsworth->new(); - - my $result = $hubert->runString("10 km -> miles"); - - my $result = $hubert->runFile("file.frns"); - - print $result; - -=head1 DESCRIPTION - -THIS IS A BETA RELEASE! There are typos in the error messages and in the POD. There are also probably plenty of bugs. It is being released early because there have been a number of people who have shown interest in having it released. Not every feature is documented yet and a future release will have that cleaned up along with some of the hairier parts of the internal API. -Math::Farnsworth is a programming language originally inspired by Frink (see http://futureboy.homeip.net/frinkdocs/ ). -However due to certain difficulties during the creation of it, the syntax has changed slightly and the capabilities are also different. -Some things Math::Farnsworth can do a little better than Frink, other areas Math::Farnsworth lacks. - -=head2 PREREQUISITS - -Modules and Libraries you need before this will work - -=over 4 - -=item * - -The PARI library - -=item * - -L - -=item * - -L - -The following are optional - -For the Google Translation library - -=item * - -L - -=item * - -L - -=back - -=head2 METHODS - -ALL of the methods here call C whenever something doesn't go right. This means that unless you want bad input to them to cause your program to fail you should wrap any calls to them with C. When they call C they will give you back a message explaining what went wrong, this is useful for telling a user what they have done. - -=head3 runString - -This method takes a string (or multiple strings) and executes them as Math::Farnsworth expressions. -For more information on making Math::Farnsworth expressions, see L. - -=head3 runFile - -This takes a file name and executes the entire file as a single Math::Farnsworth expression. - -=head3 prettyOut - -This takes a Math::Farnsworth::Value and turns it into a string for perl to be able to display. This method WILL disappear in a future version. - -=head2 EXPORT - -None by default. - -=head2 KNOWN BUGS - -At the moment all known bugs are related to badly formatted output, this will be rectified in a future release. - -=head2 MISSING FEATURES - -The following features are currently missing and WILL be implemented in a future version of Math::Farnsworth - -=over 4 - -=item * - -Better control over the output - -=over 8 - -=item * - -Adjustable precision of numbers - -=item * - -Better defaults for certain types of output - -=back - -=item * - -Passing arguments by reference - -=item * - -Syntax tree introspection inside the language itself - -=item * - -Better Documentation - -=back - -=head1 SEE ALSO - -L L - - -There is also an RT tracker for the module (this may change) setup at -L, you can also reach the tracker by sending an email to Efarnsworth.rt@gmail.comE - -=head1 AUTHOR - -Ryan Voots Esimcop@cpan.orgE - -=head1 COPYRIGHT AND LICENSE - -Copyright (C) 2008 by Ryan Voots - -This library is free software; you can redistribute it and/or modify -it under the same terms as Perl itself, either Perl version 5.8.0 or, -at your option, any later version of Perl 5 you may have available. - - -=cut diff --git a/deps/Math/Farnsworth/.svn/entries b/deps/Math/Farnsworth/.svn/entries deleted file mode 100644 index f342eb1..0000000 --- a/deps/Math/Farnsworth/.svn/entries +++ /dev/null @@ -1,380 +0,0 @@ -10 - -dir -475 -svn://erxz.com/bb3/branches/perlbuut/deps/Math/Farnsworth -svn://erxz.com/bb3 - - - -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - -dcb1cea6-7f7e-4c78-8a22-148ace8ce36e - -Dimension.pm -file - - - - -2009-10-03T22:54:20.000000Z -1e144517c71a99c39aec8028d63ad2d0 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -2433 - -FunctionDispatch.pm -file - - - - -2009-10-03T22:54:20.000000Z -4320a99f12bda9f6d6638ee9e1b3a706 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -7276 - -Evaluate.pm -file - - - - -2009-10-03T22:54:20.000000Z -67ef9f72ad5aef4d992c0fd7aa84c3a0 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -20889 - -Units -dir - -Variables.pm -file - - - - -2009-10-03T22:54:20.000000Z -1f39b4865076e291c11c192f3b06cdd8 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -2373 - -Error.pm -file - - - - -2009-10-03T22:54:20.000000Z -a7e022f88856b5fc754a9232700dc3fe -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -481 - -Value_old.pm -file - - - - -2009-10-03T22:54:20.000000Z -d22c1e15d70faaa31a0157036d6bf869 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -13928 - -Parser.pm -file - - - - -2009-10-03T22:54:20.000000Z -57fc9637753875f42c39c43b97e573d4 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -58526 - -Value.pm -file - - - - -2009-10-03T22:54:20.000000Z -cf958312df232de80b676d611185778e -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -3209 - -Docs -dir - -Functions -dir - -Output.pm -file - - - - -2009-10-03T22:54:20.000000Z -af77e165622cc23a803d6a06bdf60f01 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -15663 - -Value -dir - -Units.pm -file - - - - -2009-10-03T22:54:20.000000Z -8c64047656b5071d830d128d44abdd41 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -2930 - diff --git a/deps/Math/Farnsworth/.svn/text-base/Dimension.pm.svn-base b/deps/Math/Farnsworth/.svn/text-base/Dimension.pm.svn-base deleted file mode 100644 index a2ec518..0000000 --- a/deps/Math/Farnsworth/.svn/text-base/Dimension.pm.svn-base +++ /dev/null @@ -1,138 +0,0 @@ -package Math::Farnsworth::Dimension; - -use strict; -use warnings; - -use Data::Dumper; - -use List::MoreUtils qw(uniq); - -sub new -{ - my $class = shift; - my $dimers = shift; - my $scope = shift; - - my $dims; - { - if (defined($dimers)) - { - $dims = +{%{$dimers}}; #make a shallow copy, i don't feel like debugging this later if somehow i ended up with two objects blessing the same hashref - } - else - { - #none, use empty hash - $dims = {}; - } - } - - my $self = {dimen =>$dims, scope => $scope}; #so i don't have to rewrite a lot of code... NTS: this should probably go away later - - bless $self; -} - -sub compare -{ - my $self = shift; - my $target = shift; - -# print "DIMENWARN: ".join("::", caller())."\n"; -# print Dumper($self, $target); - - if ((!ref($target)) && keys %{$self->{dimen}} == 0) - { - return 1; - } - - if (keys %{$target->{dimen}} == keys %{$self->{dimen}}) #check lengths of keys - { - my $v = 1; - for my $k (keys %{$self->{dimen}}) - { - return 0 if (!exists($target->{dimen}{$k})); #optimization fixes bug! - $v = 0 if (($self->{dimen}{$k} != $target->{dimen}{$k}) && ($k ne "string")); - } - - if ($v) #also check if there are no dimensions - { - return 1; - } - } - - return 0; -} - -sub invert -{ - my $self = shift; - #i CAN'T modify myself in this! - my $atom = $self->new($self->{dimen}); - - for (keys %{$atom->{dimen}}) - { - #turn all positives to negatives and vice versa - $atom->{dimen}{$_} = -$atom->{dimen}{$_}; - } - - return $atom->prune(); -} - -sub merge -{ - my $self = shift; - #i CAN'T modify myself in this! - my $atom = Math::Farnsworth::Dimension->new($self->{dimen}); - - my $partner = shift; - my $pd = {}; - - if (ref($partner) eq "Math::Farnsworth::Dimension") - { - $pd = $partner->{dimen}; - } - - for (uniq (keys %{$atom->{dimen}}, keys %{$pd})) - { - no warnings 'uninitialized'; - $atom->{dimen}{$_} += $partner->{dimen}{$_}; - } - - return $atom->prune(); -} - -sub mult -{ - my $self = shift; - #i CAN'T modify myself in this! - my $atom = Math::Farnsworth::Dimension->new($self->{dimen}); - - my $value = shift; - - for (keys %{$atom->{dimen}}) - { - no warnings 'uninitialized'; - $atom->{dimen}{$_} *= $value; #this might turn them into Math::PARI objects? does it matter? - } - - return $atom->prune(); -} - - -sub prune -{ - my $self = shift; - - for (keys %{$self->{dimen}}) - { - if (!$self->{dimen}{$_}) - { - delete $self->{dimen}{$_}; - } - } - - return $self; -} - -1; - -# vim: filetype=perl diff --git a/deps/Math/Farnsworth/.svn/text-base/Error.pm.svn-base b/deps/Math/Farnsworth/.svn/text-base/Error.pm.svn-base deleted file mode 100644 index 6dcea5c..0000000 --- a/deps/Math/Farnsworth/.svn/text-base/Error.pm.svn-base +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/perl - -package Math::Farnsworth::Error; - -use strict; -use warnings; - -use Data::Dumper; -use Carp; - -require Exporter; -our @ISA = qw(Exporter); - -our @EXPORT = qw(error); - -use overload '""' => \&tostring, - 'eq' => \&eq; - -sub error -{ - my $err = shift; - my $eobj = {}; - $eobj->{msg} = $err; - bless $eobj; - - die $eobj; -} - -sub tostring -{ - my $self = shift; - return $self->{msg}; -} - -sub eq -{ - my ($one, $two, $rev) = @_; - - my $str = $one->tostring(); - return $str eq $two; -} diff --git a/deps/Math/Farnsworth/.svn/text-base/Evaluate.pm.svn-base b/deps/Math/Farnsworth/.svn/text-base/Evaluate.pm.svn-base deleted file mode 100644 index 5435087..0000000 --- a/deps/Math/Farnsworth/.svn/text-base/Evaluate.pm.svn-base +++ /dev/null @@ -1,759 +0,0 @@ -#!/usr/bin/perl - -package Math::Farnsworth::Evaluate; - -use strict; -use warnings; - -use Data::Dumper; -use Carp; - -use Math::Farnsworth::FunctionDispatch; -use Math::Farnsworth::Variables; -use Math::Farnsworth::Units; -use Math::Farnsworth::Parser; -use Math::Farnsworth::Value; -use Math::Farnsworth::Value::Pari; -use Math::Farnsworth::Value::Date; -use Math::Farnsworth::Value::String; -use Math::Farnsworth::Value::Undef; -use Math::Farnsworth::Value::Lambda; -use Math::Farnsworth::Value::Array; -use Math::Farnsworth::Value::Boolean; -use Math::Farnsworth::Output; -use Math::Farnsworth::Error; - -use Math::Pari ':hex'; #why not? - -sub new -{ - my $class = shift; - my $self = {}; - bless $self; - - my %opts = (@_); - - if (ref($opts{funcs}) eq "Math::Farnsworth::FunctionDispatch") - { - $self->{funcs} = $opts{funcs}; - } - else - { - $self->{funcs} = new Math::Farnsworth::FunctionDispatch(); - } - - if (ref($opts{vars}) eq "Math::Farnsworth::Variables") - { - $self->{vars} = $opts{vars}; - } - else - { - $self->{vars} = new Math::Farnsworth::Variables(); - } - - if (ref($opts{units}) eq "Math::Farnsworth::Units") - { - $self->{units} = $opts{units}; - } - else - { - $self->{units} = new Math::Farnsworth::Units(); - } - - if (ref($opts{parser}) eq "Math::Farnsworth::Parser") - { - $self->{parser} = $opts{parser}; - } - else - { - $self->{parser} = new Math::Farnsworth::Parser(); - } - - $self->{dumpbranches} = 0; - - return $self; -} - -sub eval -{ - my $self = shift; - my $code = shift; #i should probably take an array, so i can use arrays of things, but that'll be later - - $code =~ s/^\s*//; - $code =~ s/\s*$//; - - my $tree = $self->{parser}->parse($code); #should i catch the exceptions here? dunno - - #print Dumper($tree); - - $self->evalbranch($tree); -} - -#evaluate a single branch -sub evalbranch -{ - my $self = shift; - - my $branch = shift; - my $type = ref($branch); #this'll grab what kind from the bless on the tree - - my $return; #to make things simpler later on - - #print Data::Dumper->Dump([$branch],["BRANCH"]); - - if ($type eq "Add") - { - my $a = $self->makevalue($branch->[0]); - my $b = $self->makevalue($branch->[1]); - $return = $a + $b; - } - elsif ($type eq "Sub") - { - my $a = $self->makevalue($branch->[0]); - my $b = $self->makevalue($branch->[1]); - $return = $a - $b; - } - elsif ($type eq "Mul") - { - if ((ref($branch->[0]) eq "Fetch") && (ref($branch->[1]) eq "Array") && ($branch->[2] eq "imp")) - { - #we've got a new style function call! - my $a = $branch->[0][0]; #grab the function name - my $b = $self->makevalue($branch->[1]); - - #print "----------------FUNCCALL! $a\n"; - #print Dumper($a, $b); - - if ($self->{funcs}->isfunc($a)) #check if there is a func $a - { #$return = $self->{funcs}->callfunc($self, $name, $args, $branch); - $return = $self->{funcs}->callfunc($self, $a, $b, $branch); - } - else #otherwise we try to - { - $a = $self->makevalue($branch->[0]); #evaluate it, since it wasn't a function - - $return = $a * $b; #do the multiplication - } - } - else - { - my $a = $self->makevalue($branch->[0]); - my $b = $self->makevalue($branch->[1]); - - #print "-----------SUBMULT!\n"; - #print Dumper($a,$b); - - $return = $a * $b; - } - } - elsif ($type eq "Div") - { - my $a = $self->makevalue($branch->[0]); - my $b = $self->makevalue($branch->[1]); - #print Dumper($a, $b); - $return = $a / $b; - } - elsif ($type eq "Conforms") - { - my $a = $self->makevalue($branch->[0]); - my $b = $self->makevalue($branch->[1]); - $return = new Math::Farnsworth::Value::Boolean($a->conforms($b)); - } - elsif ($type eq "Mod") - { - my $a = $self->makevalue($branch->[0]); - my $b = $self->makevalue($branch->[1]); - $return = $a % $b; - } - elsif ($type eq "Pow") - { - my $a = $self->makevalue($branch->[0]); - my $b = $self->makevalue($branch->[1]); - $return = $a ** $b; - } - elsif ($type eq "And") - { - my $a = $self->makevalue($branch->[0]); - - if ($a->bool()) - { - my $b = $self->makevalue($branch->[1]); - $return = $a && $b ? 1 : 0; - $return = Math::Farnsworth::Value::Boolean->new($return); #make sure its the right type - } - else - { - $return = Math::Farnsworth::Value::Boolean->new(0); #make sure its the right type - } - } - elsif ($type eq "Or") - { - my $a = $self->makevalue($branch->[0]); - - if ($a->bool()) - { - $return = Math::Farnsworth::Value::Boolean->new(1); #make sure its the right type - } - else - { - my $b = $self->makevalue($branch->[1]); - $return = $a || $b ? 1 : 0; - $return = Math::Farnsworth::Value::Boolean->new($return); #make sure its the right type - } - } - elsif ($type eq "Xor") - { - my $a = $self->makevalue($branch->[0]); - my $b = $self->makevalue($branch->[1]); - $return = $a->bool() ^ $b->bool() ? 1 : 0; - $return = Math::Farnsworth::Value::Boolean->new($return); #make sure its the right type - } - elsif ($type eq "Not") - { - my $a = $self->makevalue($branch->[0]); - $return = $a->bool() ? 0 : 1; - $return = Math::Farnsworth::Value::Boolean->new($return); #make sure its the right type - } - elsif ($type eq "Gt") - { - my $a = $self->makevalue($branch->[0]); - my $b = $self->makevalue($branch->[1]); - $return = ($a > $b) ? 1 : 0; - $return = Math::Farnsworth::Value::Boolean->new($return); #make sure its the right type - } - elsif ($type eq "Lt") - { - my $a = $self->makevalue($branch->[0]); - my $b = $self->makevalue($branch->[1]); - $return = $a < $b ? 1 : 0; - $return = Math::Farnsworth::Value::Boolean->new($return); #make sure its the right type - } - elsif ($type eq "Ge") - { - my $a = $self->makevalue($branch->[0]); - my $b = $self->makevalue($branch->[1]); - $return = $a >= $b ? 1 : 0; - $return = Math::Farnsworth::Value::Boolean->new($return); #make sure its the right type - } - elsif ($type eq "Le") - { - my $a = $self->makevalue($branch->[0]); - my $b = $self->makevalue($branch->[1]); - $return = $a <= $b ? 1 : 0; - $return = Math::Farnsworth::Value::Boolean->new($return); #make sure its the right type - } - elsif ($type eq "Compare") - { - my $a = $self->makevalue($branch->[0]); - my $b = $self->makevalue($branch->[1]); - $return = $a <=> $b; - $return = Math::Farnsworth::Value::Pari->new($return); #make sure its the right type - } - elsif ($type eq "Eq") - { - my $a = $self->makevalue($branch->[0]); - my $b = $self->makevalue($branch->[1]); - $return = $a == $b ? 1 : 0; - $return = Math::Farnsworth::Value::Boolean->new($return); #make sure its the right type - } - elsif ($type eq "Ne") - { - my $a = $self->makevalue($branch->[0]); - my $b = $self->makevalue($branch->[1]); - $return = $a != $b ? 1 : 0; - $return = Math::Farnsworth::Value::Boolean->new($return); #make sure its the right type - } - elsif ($type eq "Ternary") - { - #turing completeness FTW - my $left = $self->makevalue($branch->[0]); - #$left = $left->bool() != new Math::Farnsworth::Value::Pari(0, $left->{dimen}); #shouldn't need it anymore, since i got ->bool working - $return = $left ? $self->makevalue($branch->[1]) : $self->makevalue($branch->[2]); - } - elsif ($type eq "If") - { - #turing completeness FTW - my $left = $self->makevalue($branch->[0]); - #$left = $left != new Math::Farnsworth::Value(0, $left->{dimen}); - - if ($left) - { - $return = $self->makevalue($branch->[1]); - } - else - { - $return = $self->makevalue($branch->[2]); - } - } - elsif ($type eq "Store") - { - my $lvalue = $self->makevalue($branch->[0]); - my $value = $self->makevalue($branch->[1]); - $return = $value; #make stores evaluate to the value on the right - #$self->{vars}->setvar($name, $value); - - my $cloned = $value->clone(); - warn "SETTING VALUES"; - warn Data::Dumper->Dump([$lvalue, $lvalue->getref(), $value, $cloned], [qw($lvalue \$ref $value $cloned)]); - ${$lvalue->getref()} = $cloned; - } - elsif ($type eq "DeclareVar") - { - my $name = $branch->[0]; - my $value; - #print "\n\n DECLARING $name\n"; - #print Dumper($branch); - - if (defined($branch->[1])) - { - $value = $self->makevalue($branch->[1]); - } - else - { - $value = $self->makevalue(bless [0], 'Num'); - } - - $return = $value; #make stores evaluate to the value on the right - $self->{vars}->declare($name, $value); - } - elsif ($type eq "FuncDef") - { - #print Dumper($branch); - my $name = $branch->[0]; - my $args = $branch->[1]; - my $value = $branch->[2]; #not really a value, but in fact the tree to run for the function - - my $nvars = new Math::Farnsworth::Variables($self->{vars}); #lamdbas get their own vars - my %nopts = (vars => $nvars, funcs => $self->{funcs}, units => $self->{units}, parser => $self->{parser}); - my $scope = $self->new(%nopts); - - my $vargs; - - for my $arg (@$args) - { - my $reference = $arg->[3]; - my $constraint = $arg->[2]; - my $default = $arg->[1]; - my $name = $arg->[0]; #name - - if (defined($default)) - { - $default = $self->makevalue($default); #should be right - } - - if (defined($constraint)) - { - #print Dumper($constraint); - $constraint = $self->makevalue($constraint); #should be right - #print Dumper($constraint); - } - - push @$vargs, [$name, $default, $constraint, $reference]; - } - - $self->{funcs}->addfunc($name, $vargs, $value, $scope); - $return = undef; #cause an error should someone manage to make it parse other than the way i think it should be - } - elsif ($type eq "FuncCall") - { - print "DEPRECIATED FUNCTION CALL!\n"; - my $name = $branch->[0]; - my $args = $self->makevalue($branch->[1]); #this is an array, need to evaluate it - - $return = $self->{funcs}->callfunc($self, $name, $args, $branch); - - #print "FUNCCALL RETURNED\n"; - #print Dumper($return); - - } - elsif ($type eq "Lambda") - { - my $args = $branch->[0]; - my $code = $branch->[1]; - - #print "==========LAMBDA==========\n"; - #print Data::Dumper->Dump([$args,$code], ["args", "code"]); - - my $nvars = new Math::Farnsworth::Variables($self->{vars}); #lamdbas get their own vars - my %nopts = (vars => $nvars, funcs => $self->{funcs}, units => $self->{units}, parser => $self->{parser}); - my $scope = $self->new(%nopts); - - #this should probably get a function in Math::Farnsworth::FunctionDispatch - my $vargs; - - for my $arg (@$args) - { - my $reference = $arg->[3]; - my $constraint = $arg->[2]; - my $default = $arg->[1]; - my $name = $arg->[0]; #name - - if ($reference) - { - #we've got a reference for lambdas! - carp "Passing arguments by reference for lambdas is unsupported at this time"; - } - - if (defined($default)) - { - $default = $self->makevalue($default); #should be right - } - - if (defined($constraint)) - { - #print Dumper($constraint); - $constraint = $self->makevalue($constraint); #should be right - #print Dumper($constraint); - } - - push @$vargs, [$name, $default, $constraint, $reference]; - } - - $return = new Math::Farnsworth::Value::Lambda($scope, $args, $code, $branch); - } - elsif ($type eq "LambdaCall") - { - my $left = $self->makevalue($branch->[0]); - my $right = $self->makevalue($branch->[1]); - - error "Right side of lamdbda call must evaluate to a Lambda\n" unless $right->istype("Lambda"); - - #need $args to be an array - my $args = $left->istype("Array") ? $left : new Math::Farnsworth::Value::Array([$left]); - - $return = $self->{funcs}->calllambda($right, $args); #needs to be updated - } - elsif (($type eq "Array") || ($type eq "SubArray")) - { - my $array = []; #fixes bug with empty arrays - for my $bs (@$branch) #iterate over all the elements - { - my $type = ref($bs); #find out what kind of thing we are - my $value = $self->makevalue($bs); - - #print "ARRAY FILL -- $type\n"; - -# if ($value->istype("Array")) -# { - #since we have an array, but its not in a SUBarray, we dereference it before the push - #push @$array, $value->getarray() unless ($type eq "SubArray"); - #push @$array, $value;# if ($type eq "SubArray"); - #} - #else - { - #print "ARRAY VALUE --- ".Dumper($value); - #its not an array or anything so we push it on - push @$array, $value; #we return an array ref! i need more error checking around for this later - } - } - $return = new Math::Farnsworth::Value::Array($array); - } - elsif ($type eq "ArgArray") - { - my $array = []; #autovivification wasn't working? - for my $bs (@$branch) #iterate over all the elements - { - my $type = ref($bs); #find out what kind of thing we are - my $value = $self->makevalue($bs); - - #even if it is an array we don't want to deref it here, because thats the wrong behavior, this will make things like push[a, 1,2,3] work properly - push @$array, $value; #we return an array ref! i need more error checking around for this later - } - $return = new Math::Farnsworth::Value::Array($array); - } - elsif ($type eq "ArrayFetch") - { - #print "\n\nAFETCH\n"; - my $var = $self->makevalue($branch->[0]); #need to check if this is an array, and die if not - my $listval = $self->makevalue($branch->[1]); - my @rval; - - #print Data::Dumper->Dump([$branch, $var, $listval], ["branch","var","listval"]); - - for ($listval->getarray()) - { - my $index = $_->getpari()*1.0; - #print STDERR "ARFET: ".$_->toperl()."\n"; - #ok this line FOR WHATEVER REASON, makes Math::Pari.xs die in isnull(), WHY i don't know, there's something wrong here somewhere - #my $float = $_ * (Math::Farnsworth::Value::Pari->new(1.0)); #makes rationals work right - - my $input = $var->getarrayref()->[$index]; - - #error "Array out of bounds\n" #old message, check is down below now; - $var->getarrayref()->[$index] = TYPE_UNDEF unless defined $input; - $input = $var->getarrayref()->[$index] unless defined $input; #reset the value if needed, this code should be redone but i don't feel like it right now XXX - - $input->setref(\$var->getarrayref()->[$index]); - push @rval, $input; - } - - #print Dumper(\@rval); - - if (@rval > 1) - { - my $pr = new Math::Farnsworth::Value::Array([@rval]); - $return = $pr; - $return->setref(\$return); #i think this should work fine - } - else - { - $return = $rval[0]; - } - } - elsif ($type eq "ArrayStore") - { - my $var = $self->makevalue(bless [$branch->[0]], 'Fetch'); #need to check if this is an array, and die if not - my $listval = $self->makevalue($branch->[1]); - my $rval = $self->makevalue($branch->[2]); - - #print Dumper($branch, $var, $listval); - - if ($listval->getarray() > 1) - { - error "Assigning to slices not implemented yet\n"; - } - - error "Only numerics may be given as array indexes!" unless ($listval->getarrayref()->[0]->istype("Pari")); - - my $num = $listval->getarrayref()->[0]->getpari() + 0; #the +0 makes sure its coerced into a number - - $var->getarrayref()->[$num] = $rval; - - for my $value ($var->getarray()) - { - $value = $self->makevalue(bless [0], 'Num') if !defined($value); - } - - $return = $rval; - } - elsif ($type eq "While") - { - my $cond = $branch->[0]; #what to check each time - my $stmts = $branch->[1]; #what to run each time - - my $condval = $self->makevalue($cond); - while ($condval) - { - my $v = $self->makevalue($stmts); - $condval = $self->makevalue($cond); - } - - $return = undef; #cause errors - } - elsif ($type eq "Stmt") - { - for my $bs (@$branch) #iterate over all the statements - { - if (defined($bs)) - { - my $r = $self->makevalue($bs); - $return = $r if defined $r; #this has interesting semantics! - } - } - } - elsif ($type eq "Paren") - { - $return = $self->makevalue($branch->[0]); - } - elsif ($type eq "SetDisplay") - { - print Dumper($branch); - my $combo = $branch->[0][0]; #is a string? - my $right = $branch->[1]; - - Math::Farnsworth::Output->setdisplay($combo, $right); - } - elsif ($type eq "UnitDef") - { - my $unitsize = $self->makevalue($branch->[1]); - my $name = $branch->[0]; - $self->{units}->addunit($name, $unitsize); - } - elsif ($type eq "DefineDimen") - { - my $unit = $branch->[1]; - my $dimen = $branch->[0]; - $self->{units}->adddimen($dimen, $unit); - } - elsif ($type eq "DefineCombo") - { - my $combo = $branch->[1]; #should get me a string! - my $value = $self->makevalue($branch->[0]); - Math::Farnsworth::Output::addcombo($combo, $value); - } - elsif (($type eq "SetPrefix") || ($type eq "SetPrefixAbrv")) - { - my $name = $branch->[0]; - my $value = $self->makevalue($branch->[1]); - #carp "SETTING PREFIX0: $name : $value : ".Dumper($branch->[1]) if ($name eq "m"); - $self->{units}->setprefix($name, $value); - } - elsif ($type eq "Trans") - { - my $left = $self->makevalue($branch->[0]); - my $rights = eval {$self->makevalue($branch->[1])}; - #print Dumper($@); - my $right = $rights; - - if (!$@ && defined($rights) && $rights->istype("String")) #if its a string we do some fun stuff - { - print "STRINGED\n"; - $right = $self->eval($rights->getstring()); #we need to set $right to the evaluation $rights - #print Dumper($rights, $right); - print "ERRORED: ".Dumper($@); - } - - if (!$@) - { - if ($left->conforms($right)) #only do this if they are the same - { - my $dispval = ($left / $right); - - #$return = $left; - %$return = %$left; #ok this makes NO SENSE as to WHY it would behave like it was... - bless $return, ref($left); - - if ($rights->istype("String")) - { - #right side was a string, use it - $return->{outmagic} = [$dispval, $rights]; - } - else - { - $return->{outmagic} = [$dispval]; - } - } - elsif ($self->{funcs}->isfunc($branch->[1][0])) - { - $left = $left->istype("Array") ? $left : new Math::Farnsworth::Value::Array([$left]); - $return = $self->{funcs}->callfunc($self, $branch->[1][0], $left); - - if ($rights->istype("String")) - { - #right side was a string, use it - my $nm = {%$return}; #do a shallow copy! - bless $nm, ref($return); #rebless it - $return->{outmagic} = [$nm, $rights]; - } - } - else - { - error "Conformance error, left side has different units than right side ".Dumper($branch->[1])."\n"; - } - } - else - { - #$right doesn't evaluate... so we check for a function? - $left = $left->istype("Array") ? $left : new Math::Farnsworth::Value::Array([$left]); - $return = $self->{funcs}->callfunc($self, $branch->[1][0], $left); - - if (defined($rights) && $rights->istype("String")) - { - #right side was a string, use it - my $nm = {%$return}; #do a shallow copy! - bless $nm, ref($return); #rebless it - $return->{outmagic} = [$nm, $rights]; - } - } - } - - if (!defined($return)) - { - #this creates a "true" undefined value for returning, this makes things funner! it also introduced a bug from naive coding above, which has been fixed - $return = new Math::Farnsworth::Value::Undef(); - } - - return $return; -} - -sub makevalue -{ - my $self = shift; - my $input = shift; - -# print "MAKEVALUE---------\n"; -# print Dumper($input); - - if (ref($input) eq "Num") - { - #need to make a value here with Math::Farnsworth::Value! - my $val = new Math::Farnsworth::Value::Pari($input->[0]); - return $val; - } - if (ref($input) eq "HexNum") - { - #need to make a value here with Math::Farnsworth::Value! - #print "HEX VALUE: ".$input->[0]."\n"; - my $value = eval $input->[0]; #this SHOULD work, shouldn't be a security risk since its validated through the lexer and parser. - my $val = new Math::Farnsworth::Value::Pari($value); - return $val; - } - elsif (ref($input) eq "Fetch") - { - #this needs to decide between variable and unit, but that'll come later - #esp since i also have to have this overridable for functions! - - my $name = $input->[0]; - if ($self->{vars}->isvar($name)) - { - return $self->{vars}->getvar($input->[0]); - } - elsif ($self->{units}->isunit($name)) - { - #print "FETCH: $name\n" if ($name eq "milli"); - return $self->{units}->getunit($name); - } - - die "Undefined symbol '$name'\n"; - } - elsif (ref($input) eq "String") #we've got a string that should be a value! - { - my $value = $input->[0]; - #here it comes in with quotes, so lets remove them - #$value =~ s/^"(.*)"$/$1/; #no longer needed - #$value =~ s/\\"/"/g; #i'm gonna move these into the constructor i think - #$value =~ s/\\\\/\\/g; - $value =~ s/\\(.)/qq("\\$1")/eeg; - my $ss = sub - { - my $var =shift; - $var =~ s/^[\$]//; - my $output = undef; - if ($var !~ /^{.*}$/) - { - $output = new Math::Farnsworth::Output($self->{units}, $self->{vars}->getvar($var), $self); - } - else - { - $var =~ s/[{}]//g; - $output = new Math::Farnsworth::Output($self->{units}, $self->eval($var), $self); - } - - "".$output; - }; - $value =~ s/(?($1)/eg; - my $val = new Math::Farnsworth::Value::String($value); - return $val; - } - elsif (ref($input) eq "Date") - { - #print "\n\n\nMaking DATE!\n\n\n"; - my $val = new Math::Farnsworth::Value::Date($input->[0]); -# print Dumper($val); - return $val; - } - elsif (ref($input) eq "VarArg") - { - #warn "Got a VarArg, code untested, want to mark when i get them\n"; #just so i can track down the inevitable crash - return "VarArg"; - } - elsif (ref($input) =~ /Math::Farnsworth::Value/) - { - warn "Got a Math::Farnsworth::Value::*, i PROBABLY shouldn't be getting these, i'm just going to let it fall through"; - return $input; - } - - return $self->evalbranch($input); -} - -1; diff --git a/deps/Math/Farnsworth/.svn/text-base/FunctionDispatch.pm.svn-base b/deps/Math/Farnsworth/.svn/text-base/FunctionDispatch.pm.svn-base deleted file mode 100644 index 052625b..0000000 --- a/deps/Math/Farnsworth/.svn/text-base/FunctionDispatch.pm.svn-base +++ /dev/null @@ -1,301 +0,0 @@ -package Math::Farnsworth::FunctionDispatch; - -use strict; -use warnings; - -use Data::Dumper; - -use Math::Farnsworth::Variables; -use Math::Farnsworth::Value::Array; -use Math::Farnsworth::Error; - -use Carp; - -sub new -{ - my $self = {}; - bless $self, (shift); -} - -sub addfunc -{ - my $self = shift; - my $name = shift; - my $args = shift; - my $value = shift; - my $scope = shift; - - #i should really have some error checking here - $self->{funcs}{$name} = {name=>$name, args=>$args, value=>$value, parentscope=>$scope}; -} - -sub getfunc -{ - my $self = shift; - my $name = shift; #which one to get, we return the hashref - return $self->{funcs}{$name}; -} - -sub isfunc -{ - my $self = shift; - my $name = shift; - - return exists($self->{funcs}{$name}); -} - -sub setupargs -{ - my $self = shift; - my $eval = shift; - my $args = shift; - my $argtypes = shift; - my $name = shift; #name to display - #my $branch = shift; - - my $vars = $eval->{vars}; #get the scope we need - -ARG:for my $argc (0..$#$argtypes) - { - my $n = $argtypes->[$argc][0]; #the rest are defaults and constraints - my $v = $args->getarrayref()->[$argc]; - - my $const = $argtypes->[$argc][2]; - - if (ref($const) eq "VarArg") - { - warn "Working around bug in lambdas!"; - $const = "VarArg"; - } - - if (!defined($v))# || ($v->{dimen}{dimen}{"undef"})) #uncomment for undef== default value - { - #i need a default value! - if (!defined($argtypes->[$argc][1]) && defined($argtypes->[$argc][0]) && (defined($const) && ref($const) !~ /Math::Farnsworth::Value/ && $const ne "VarArg")) - { - die "Required argument $argc to function $name\[\] missing\n"; - } - - $v = $argtypes->[$argc][1]; - } - - if (defined($const) && ref($const) =~ /Math::Farnsworth::Value/) - { - #we have a constraint - if (!$v->conforms($const)) - { - die "Constraint not met on argument $argc to $name\[\]\n"; - } - } - elsif (defined($const) && $const eq "VarArg") - { - #we've got a variable argument, it needs to slurp all the rest of the arguments into an array! - my $last = $#{$args->getarrayref()}; - my @vargs = @{$args->getarrayref()}[$argc..$last]; - my $v = new Math::Farnsworth::Value::Array(\@vargs); - $vars->declare($n, $v); #set the variable - last ARG; #don't parse ANY more arguments - } - - if (defined $n) #happens when no arguments! so we check if the name is defined - { - #print "SETVAR $n: "; - #print Dumper($argtypes->[$argc]); - #print Dumper($vars->{vars}); - if (!$argtypes->[$argc][3]) #make sure that it shouldn't be byref - { - $vars->declare($n, $v); - } - else - { - #it should be by ref - if ($v->getref()) - { - $vars->setref($n, $v->getref()); - } - else - { - error "Can't get reference from expression for argument $argc"; - } - } - - #print Dumper($vars->{vars}); - } - } -} - -#should i really have this here? or should i have it in evaluate.pm? -sub callfunc -{ - my $self = shift; - my $eval = shift; - my $name = shift; - my $args = shift; - my $branches = shift; - - my $argtypes = $self->{funcs}{$name}{args}; - - my $fval = $self->{funcs}{$name}{value}; - - #print "-------------ATTEMPTING TO CALL FUNCTION!-------------\n"; - #print "FUNCTION NAME : $name\n"; - #print "Dumper of func: ".Dumper($fval); - #print "--------------------THAT IS ALL\n"; - - die "Function $name is not defined\n" unless defined($fval); - die "Number of arguments not correct to $name\[\]\n" unless $self->checkparams($args, $argtypes); #this should check.... - -# print Dumper($args); - - my $neval; - - if (defined $self->{funcs}{$name}{parentscope}) - { - $neval = $self->{funcs}{$name}{parentscope}; - - my $nvars = new Math::Farnsworth::Variables($neval->{vars}); - - my %nopts = (vars => $nvars, funcs => $self, units => $neval->{units}, parser => $neval->{parser}); - $neval = $neval->new(%nopts); - } - else - { - #this should get scrapped once i fix the other modules! - carp "SETTING UP PARENT SCOPE OUT OF NO WHERE!"; - my $nvars = new Math::Farnsworth::Variables($eval->{vars}); - - my %nopts = (vars => $nvars, funcs => $self, units => $eval->{units}, parser => $eval->{parser}); - $neval = $eval->new(%nopts); -# $self->{funcs}{$name}{parentscope} = $neval; #store it for later! - } - - #print "NEWSCOPE! ".$neval->{vars}."\n"; - - #eval #just for fucks sake! - #{ - # my $facts = $neval->{vars}->getvar("facts"); - # print "FACTS!\n"; - # print Dumper($facts, "$facts"); - #}; - - #carp "$@" if $@; - - $self->setupargs($neval, $args, $argtypes, $name, $branches); #setup the arguments - - if (ref($fval) ne "CODE") - { - return $self->callbranch($neval, $fval, $name); - } - else - { - #we have a code ref, so we need to call it - return $fval->($args, $neval, $branches, $eval); - } -} - -sub calllambda -{ - my $self = shift; - my $lambda = shift; - my $args = shift; -# my $refscope = shift; -# my $branch = shift; #new for lambdas! - - my $argtypes = $lambda->getargs(); - my $fval = $lambda->getcode(); - my $eval = $lambda->getscope(); - - #print "LAMBDA---------------\n"; - #print Dumper($argtypes, $args, $fval); - - my $nvars = new Math::Farnsworth::Variables($eval->{vars}); - - my %nopts = (vars => $nvars, funcs => $self, units => $eval->{units}, parser => $eval->{parser}); - my $neval = $eval->new(%nopts); - - die "Number of arguments not correct to lambda\n" unless $self->checkparams($args, $argtypes); #this shoul - - $self->setupargs($neval, $args, $argtypes, "lambda"); - return $self->callbranch($neval, $fval); -} - -sub callbranch -{ - my $self = shift; - my $eval = shift; - my $branches = shift; - my $name = shift; - - -# print "CALLBRANCHES :: "; -# print $name if defined $name; -# print " :: $eval\n"; - - return $eval->evalbranch($branches); -} - -#this was supposed to be the checks for types and such, but now its something else entirely, mostly -sub checkparams -{ - my $self = shift; - my $args = shift; - my $argtypes = shift; - - my $vararg = 0; - - my $neededargs = 0; - my $badargs = 0; - - for my $argt (@$argtypes) - { - $neededargs++ unless (defined($argt->[1]) || !defined($argt->[0])); - $badargs++ if (!defined($argt->[0])); - } - - #might want to change the !~ to something else? - #warn "Strange bug here to investigate, lambdas produce blessed array refs for vararg... wtf"; - $vararg = 1 if (grep {defined($_->[2]) && ref($_->[2]) !~ /Math::Farnsworth::Value/ && (($_->[2] eq "VarArg") || (ref($_->[2]) eq "VarArg"))} @{$argtypes}); #find out if there is a vararg arg - - #print "NEEDED: $neededargs :: $vararg\n"; - #print Data::Dumper->Dump([$argtypes, $args->getarrayref()], [qw(argtypes args)]); - - return 1 if ($vararg || ($args->getarray() <= (@{$argtypes}-$badargs) && $args->getarray() >= $neededargs)); - - #return 0 unless (ref($args) eq "Math::Farnsworth::Value") && ($args->{dimen}->compare({dimen=>{array=>1}})); - - return 0; -} - -sub getref -{ - my $self = shift; - my $argc = shift; - my $branch = shift; - my $name = shift; - - #print "\n\nGETREF\n"; - #print Dumper($branch); - - if (ref $branch->[1] ne "Array") - { - #this should add support for some other stuff - error "Cannot get a reference if function/lambda is called without []"; - } - - my $argexpr = $branch->[1][$argc]; - - #print Dumper($argbranches->[$argc]); - - if (ref $argexpr ne "Fetch") - { - error "Argument $argc to $name\[\] is not referencable"; - } - - my $ref = $self->{funcs}{$name}->{scope}{vars}->getref($argexpr->[0]); - - print Dumper($argexpr, $ref); - - return $ref; -} - -1; diff --git a/deps/Math/Farnsworth/.svn/text-base/Output.pm.svn-base b/deps/Math/Farnsworth/.svn/text-base/Output.pm.svn-base deleted file mode 100644 index fe7aedb..0000000 --- a/deps/Math/Farnsworth/.svn/text-base/Output.pm.svn-base +++ /dev/null @@ -1,660 +0,0 @@ -package Math::Farnsworth::Output; - -use strict; -use warnings; - -use overload '""' => \&tostring; - -use Data::Dumper; -use Date::Manip; -use Carp qw(cluck carp confess); - -our %combos; -our %displays; - -#these primarily are used for display purposes -sub addcombo -{ - my $name = shift; - my $value = shift; #this is a valueless list of dimensions - - $combos{$name} = $value; -} - -#this returns the name of the combo that matches the current dimensions of a Math::Farnsworth::Value::Pari -sub findcombo -{ - my $self = shift; - my $value = shift; - - for my $combo (keys %combos) - { - my $cv = $combos{$combo}; #grab the value - return $combo if ($value->getdimen()->compare($cv->getdimen())); - } - - return undef; #none found -} - -#this sets a display for a combo first, then for a dimension -sub setdisplay -{ - my $self = shift; - my $name = shift; #this only works on things created by =!= or |||, i might try to extend that later but i don't think i need to, since you can just create a name with ||| when you need it - my $branch = shift; - - #I SHOULD CHECK FOR THE NAME!!!!! - #print Dumper($name, $branch); - - if (exists($combos{$name})) - { - $displays{$name} = $branch; - } - else - { - die "No such dimension/combination as $name\n"; - } -} - -sub getdisplay -{ - my $self = shift; - my $name = shift; - - if (defined($name) && exists($displays{$name})) - { - return $displays{$name}; #guess i'll just do the rest in there? - } - - return undef; -} - -sub new -{ - shift; #remove the class - my $self = {}; - $self->{units} = shift; - $self->{obj} = shift; - $self->{eval} = shift; - - #warn Dumper($self->{obj}); - die "Attempting to make output class of non Math::Farnsworth::Value" unless ref($self->{obj}) =~ /Math::Farnsworth::Value/; - confess "Forgot to add \$eval to params!" unless ref($self->{eval}) eq "Math::Farnsworth::Evaluate"; - - bless $self; -} - -sub tostring -{ - my $self = shift; - my $value = $self->{obj}; - - return $self->getoutstring($value); -} - -#this takes a set of dimensions and returns what to display -sub getoutstring -{ - my $self = shift; #i'll implement this later too -# my $dimen = shift; #i take a Math::Farnsworth::Dimension object! - my $value = shift; #the value so we can stringify it - - my @returns; - - if (defined($value->{outmagic})) - { - if (ref($value->{outmagic}[1]) eq "Math::Farnsworth::Value::String") - { - #ok we were given a string! - my $number = $value->{outmagic}[0]; - my $string = $value->{outmagic}[1]; - return $self->getoutstring($number) . " ".$string->getstring(); - } - elsif (exists($value->{outmagic}[0]) && (ref($value->{outmagic}[0]) ne "Math::Farnsworth::Value::Array")) - { - #ok we were given a value without the string - my $number = $value->{outmagic}[0]; - return $self->getoutstring($number); - } - else - { - print Dumper($value); - die "Unhandled output magic, this IS A BUG!"; - } - } - elsif (ref($value) eq "Math::Farnsworth::Value::Boolean") - { - return $value ? "True" : "False" - #these should do something! - } - elsif (ref($value) eq "Math::Farnsworth::Value::String") - { - #I NEED FUNCTIONS TO HANDLE ESCAPING AND UNESCAPING!!!! - my $val = $value->getstring(); - $val =~ s/\\/\\\\/g; - $val =~ s/"/\\"/g; - return '"'.$val.'"'; - } - elsif (ref($value) eq "Math::Farnsworth::Value::Array") - { - my @array; #this will be used to build the output - for my $v ($value->getarray()) - { - #print Dumper($v); - push @array, $self->getoutstring($v); - } - - return '['.(join ' , ', @array).']'; - } - elsif (ref($value) eq "Math::Farnsworth::Value::Date") - { - return $value->getdate()->strftime("# %F %H:%M:%S.%3N %Z #");#UnixDate($value->{pari}, "# %C #"); #output in ISO format for now - } - elsif (ref($value) eq "Math::Farnsworth::Value::Lambda") - { - - return $self->deparsetree($value->getbranches()); - } - elsif (ref($value) eq "Math::Farnsworth::Value::Undef") - { - return "undef"; - } - elsif (ref($value) eq "HASH") - { - warn "RED ALERT!!!! WE've got a BAD CASE HERE. We've got an UNBLESSED HASH"; - warn Dumper($value); - - return "undef"; - } - elsif (my $disp = $self->getdisplay($self->findcombo($value))) - { - #$disp should now contain the branches to be used on the RIGHT side of the -> - #wtf do i put on the left? i'm going to send over the Math::Farnsworth::Value, this generates a warning but i can remove that after i decide that its correct - - print "SUPERDISPLAY:\n"; - my $branch = bless [$value, $disp], 'Trans'; - print Dumper($branch); - my $newvalue = eval {$self->{eval}->evalbranch($branch);}; - return $self->getoutstring($newvalue); - } - else - { - my $dimen = $value->getdimen(); - #added a sort so its stable, i'll need this... - for my $d (sort {$a cmp $b} keys %{$dimen->{dimen}}) - { - my $exp = ""; - #print Dumper($dimen->{dimen}, $exp); - my $dv = "".($dimen->{dimen}{$d}); - my $realdv = "".(0.0+$dimen->{dimen}{$d}); #use this for comparing below, that way i can keep rational exponents when possible - - $dv =~ s/([.]\d+?)0+$/$1/; - $dv =~ s/E/e/; #make floating points clearer - - $exp = "^".($dv =~ /^[\d\.]+$/? $dv :"(".$dv.")") unless ($realdv eq "1"); - - push @returns, $self->{units}->getdimen($d).$exp; - } - - if (my $combo = $self->findcombo($value)) #this should be a method? - { - push @returns, "/* $combo */"; - } - - - my $prec = Math::Pari::setprecision(); - Math::Pari::setprecision(15); #set it to 15? - my $pv = "".(Math::Pari::pari_print($value->getpari())); - my $parenflag = $pv =~ /^[\d\.e]+$/i; - my $rational = $pv =~ m|/|; - - $pv =~ s/E/e/; #make floating points clearer - - if ($pv =~ m|/|) #check for rationality - { - my $nv = "".Math::Pari::pari_print($value->getpari() * 1.0); #attempt to force a floating value - $nv =~ s/([.]\d+?)0+$/$1/ ; - $pv .= " /* apx ($nv) */"; - } - - $pv = ($parenflag? $pv :"(".$pv.")"); #check if its a simple value, or complex, if it is complex, add parens - $pv =~ s/([.]\d+?)0+$/$1/ ; - - Math::Pari::setprecision($prec); #restore it before calcs - return $pv." ".join " ", @returns; - } -} - -sub deparsetree -{ - my $self = shift; - my $branch = shift; - - my $type = ref($branch); - my $return; - - if ($type eq "Add") - { - my $a = $self->deparsetree($branch->[0]); - my $b = $self->deparsetree($branch->[1]); - return $a . " + " . $b; - } - elsif ($type eq "Sub") - { - my $a = $self->deparsetree($branch->[0]); - my $b = $self->deparsetree($branch->[1]); - return $a . " - " . $b; - } - elsif ($type eq "Mul") - { - my $a = $self->deparsetree($branch->[0]); - my $b = $self->deparsetree($branch->[1]); - my $t = $branch->[2]; - - return $a . ($t eq 'imp' ? '' : ' * ') . $b; #NOTE: this should listen to the 'imp' or '*' in the tree! - } - elsif ($type eq "Div") - { - my $a = $self->deparsetree($branch->[0]); - my $b = $self->deparsetree($branch->[1]); - my $t = $branch->[2]; - - $return = $a . " $t " . $b; - } - elsif ($type eq "Conforms") - { - my $a = $self->deparsetree($branch->[0]); - my $b = $self->deparsetree($branch->[1]); - return "$a conforms $b"; - } - elsif ($type eq "Mod") - { - my $a = $self->deparsetree($branch->[0]); - my $b = $self->deparsetree($branch->[1]); - return "$a % $b"; - } - elsif ($type eq "Pow") - { - my $a = $self->deparsetree($branch->[0]); - my $b = $self->deparsetree($branch->[1]); - return "$a ^ $b"; - } - elsif ($type eq "And") - { - my $a = $self->deparsetree($branch->[0]); - my $b = $self->deparsetree($branch->[1]); - - return "$a && $b"; - } - elsif ($type eq "Or") - { - my $a = $self->deparsetree($branch->[0]); - my $b = $self->deparsetree($branch->[1]); - - return "$a || $b"; - } - elsif ($type eq "Xor") - { - my $a = $self->deparsetree($branch->[0]); - my $b = $self->deparsetree($branch->[1]); - return "$a ^^ $b"; - } - elsif ($type eq "Not") - { - my $a = $self->deparsetree($branch->[0]); - return "!$a"; - } - elsif ($type eq "Gt") - { - my $a = $self->deparsetree($branch->[0]); - my $b = $self->deparsetree($branch->[1]); - return "$a > $b"; - } - elsif ($type eq "Lt") - { - my $a = $self->deparsetree($branch->[0]); - my $b = $self->deparsetree($branch->[1]); - return "$a < $b"; - } - elsif ($type eq "Ge") - { - my $a = $self->deparsetree($branch->[0]); - my $b = $self->deparsetree($branch->[1]); - return "$a >= $b"; - } - elsif ($type eq "Le") - { - my $a = $self->deparsetree($branch->[0]); - my $b = $self->deparsetree($branch->[1]); - return "$a <= $b"; - } - elsif ($type eq "Compare") - { - my $a = $self->deparsetree($branch->[0]); - my $b = $self->deparsetree($branch->[1]); - return "$a <=> $b"; - } - elsif ($type eq "Eq") - { - my $a = $self->deparsetree($branch->[0]); - my $b = $self->deparsetree($branch->[1]); - return "$a == $b"; - } - elsif ($type eq "Ne") - { - my $a = $self->deparsetree($branch->[0]); - my $b = $self->deparsetree($branch->[1]); - return "$a != $b"; - } - elsif ($type eq "Ternary") - { - my $left = $self->deparsetree($branch->[0]); - my $one = $self->deparsetree($branch->[1]); - my $two = $self->deparsetree($branch->[2]); - - return "$left ? $one : $two"; - } - elsif ($type eq "If") - { - my $return = ""; - my $left = $self->deparsetree($branch->[0]); - my $std = $self->deparsetree($branch->[1]); - - $return = "if ($left) { $std }"; - - if ($branch->[2]) - { - my $else = $self->deparsetree($branch->[2]); - $return .= " else { $else }"; - } - - #$return .= ";"; #NOTE: DO I NEED THIS? probably not! - - return $return; - } - elsif ($type eq "Store") - { - my $name = $branch->[0]; - my $value = $self->deparsetree($branch->[1]); - - return "$name = $value"; - } - elsif ($type eq "DeclareVar") - { - my $name = $branch->[0]; - - my $return = "var $name"; - - if (defined($branch->[1])) - { - my $val = $self->deparsetree($branch->[1]); - $return .= " = $val"; - } - - return $return; - } - elsif ($type eq "FuncDef") - { - #print Dumper($branch); - my $name = $branch->[0]; - my $args = $branch->[1]; - my $value = $self->deparsetree($branch->[2]); #not really a value, but in fact the tree to run for the function - - my $return = "${name}{"; - - my $vargs = ""; - - for my $arg (@$args) - { - my $foobs=""; - my $constraint = $arg->[2]; - my $default = $arg->[1]; - my $name = $arg->[0]; #name - - $foobs = $name; - if (defined($default)) - { - $foobs .= " = ".$self->deparsetree($default); #should be right - } - - if (defined($constraint)) - { - #print Dumper($constraint); - $foobs .= " isa ".$self->deparsetree($constraint); #should be right - #print Dumper($constraint); - } - - $vargs .= $foobs; - } - - $return .= "$vargs} := { $value }"; - } - elsif ($type eq "FuncCall") - { - my $name = $branch->[0]; - my $args = $self->deparsetree($branch->[1]); #this is an array, need to evaluate it - - return "$name\[$args\]"; - } - elsif ($type eq "Lambda") - { - my $args = $branch->[0]; - my $code = $self->deparsetree($branch->[1]); - - my $vargs = ""; - - for my $arg (@$args) - { - my $foobs=""; - my $reference = $arg->[3]; - my $constraint = $arg->[2]; - my $default = $arg->[1]; - my $name = $arg->[0]; #name - - $foobs = $name; - if ($reference) - { - $foobs .= " byref "; #should be right - } - - if (defined($default)) - { - $foobs .= " = ".$self->deparsetree($default); #should be right - } - - if (defined($constraint)) - { - #print Dumper($constraint); - $foobs .= " isa ".$self->deparsetree($constraint); #should be right - #print Dumper($constraint); - } - - $vargs .= $foobs; - } - - return "{`$vargs` $code}"; - } - elsif ($type eq "LambdaCall") - { - my $left = $self->deparsetree($branch->[0]); - my $right = $self->deparsetree($branch->[1]); - - return "$left => $right"; - } - elsif (($type eq "Array") || ($type eq "SubArray")) - { - my $array = []; #fixes bug with empty arrays - for my $bs (@$branch) #iterate over all the elements - { - my $type = ref($bs); #find out what kind of thing we are - my $value = $self->deparsetree($bs); - - #since we have an array, but its not in a SUBarray, we dereference it before the push - push @$array, $value; - #push @$array, '['.$value.']' if ($type eq "SubArray"); - } - return '[ '.(join ', ',@$array).' ]'; - - } - elsif ($type eq "ArgArray") - { - my $array = []; - for my $bs (@$branch) #iterate over all the elements - { - my $value = $self->deparsetree($bs); - - push @$array, $value; #we return an array ref! i need more error checking around for this later - } - return join ', ', @$array; - } - elsif ($type eq "ArrayFetch") - { - my $var = $self->deparsetree($branch->[0]); #need to check if this is an array, and die if not - my $listval = $self->deparsetree($branch->[1]); - - $listval = substr $listval, 1,length($listval)-2; #strip the [] - - return "$var\@$listval\$"; - } - elsif ($type eq "ArrayStore") - { - my $var = $self->deparsetree(bless [$branch->[0]], 'Fetch'); #need to check if this is an array, and die if not - my $listval = $self->deparsetree($branch->[1]); - my $rval = $self->deparsetree($branch->[2]); - - $listval = substr $listval, 1,length($listval)-2; #strip the [] - - return "$var\@$listval\$ = $rval"; - } - elsif ($type eq "While") - { - my $cond = $self->deparsetree($branch->[0]); #what to check each time - my $stmts = $self->deparsetree($branch->[1]); #what to run each time - - return "while ($cond) { $stmts }" - } - elsif ($type eq "Stmt") - { - my $return = ""; - for my $bs (@$branch) #iterate over all the statements - { my $r = $self->deparsetree($bs); - $return .= "$r; " if defined $r; #this has interesting semantics! - } - return $return; - } - elsif ($type eq "Paren") - { - return '(' . $self->deparsetree($branch->[0]) . ')'; - } - elsif ($type eq "SetDisplay") - { - my $combo = $branch->[0][0]; #is a string? - my $right = $self->deparsetree($branch->[1]); - - return "$combo :-> $right"; - } - elsif ($type eq "UnitDef") - { - my $unitsize = $self->deparsetree($branch->[1]); - my $name = $branch->[0]; - - return "$name := $unitsize"; - } - elsif ($type eq "DefineDimen") - { - my $unit = $branch->[1]; - my $dimen = $branch->[0]; - - return "$dimen =!= $unit"; - } - elsif ($type eq "DefineCombo") - { - my $combo = $branch->[1]; #should get me a string! - my $value = $self->deparsetree($branch->[0]); - - return "$value ||| $combo"; - } - elsif (($type eq "SetPrefix") || ($type eq "SetPrefixAbrv")) - { - my $name = $branch->[0]; - my $value = $self->deparsetree($branch->[1]); - - return "$name ::- $value"; - } - elsif ($type eq "Trans") - { - my $left = $self->deparsetree($branch->[0]); - my $right = $self->deparsetree($branch->[1]); - - return "$left -> $right"; - } - elsif (($type eq "Num") || ($type eq "Fetch") || ($type eq "HexNum")) - { - return $branch->[0]; #its already a string! - } - elsif ($type eq "String") - { - return '"'.$branch->[0].'"'; - } - elsif ($type eq "Date") - { - return "#".$branch->[0]."#"; - } - elsif ($type eq "VarArg") - { - return "..."; - } - elsif (!defined($branch)) - { - return ""; #got an undefined value, just make it blank - } - else - { -# cluck "Unhandled input!"; - return '/*'.Dumper($branch).'*/'; - } -} - -sub makevalue -{ - confess "MAKEVALUE WAS CALLED!\n"; -} - -1; -__END__ - -# Below is stub documentation for your module. You'd better edit it! - -=head1 NAME - -Math::Farnsworth::Output - Wrapper class for making output simpler - -=head1 SYNOPSIS - - use Math::Farnsworth; - - my $hubert = Math::Farnsworth->new(); - - my $result = $hubert->runString("10 km -> miles"); - - my $result = $hubert->runFile("file.frns"); - - print $result; - -=head1 METHODS - -This has only one method that a user should be aware of, C; you can call this directly on the object, e.g. $result->tostring() - -=head1 AUTHOR - -Ryan Voots Esimcop@cpan.orgE - -=head1 COPYRIGHT AND LICENSE - -Copyright (C) 2008 by Ryan Voots - -This library is free software; you can redistribute it and/or modify -it under the same terms as Perl itself, either Perl version 5.8.0 or, -at your option, any later version of Perl 5 you may have available. - -=cut diff --git a/deps/Math/Farnsworth/.svn/text-base/Parser.pm.svn-base b/deps/Math/Farnsworth/.svn/text-base/Parser.pm.svn-base deleted file mode 100644 index 40b03e0..0000000 --- a/deps/Math/Farnsworth/.svn/text-base/Parser.pm.svn-base +++ /dev/null @@ -1,3693 +0,0 @@ -#################################################################### -# -# This file was generated using Parse::Yapp version 1.05. -# -# Don't edit this file, use source file instead. -# -# ANY CHANGE MADE HERE WILL BE LOST ! -# -#################################################################### -package Math::Farnsworth::Parser; -use vars qw ( @ISA ); -use strict; - -@ISA= qw ( Parse::Yapp::Driver ); -#Included Parse/Yapp/Driver.pm file---------------------------------------- -{ -# -# Module Parse::Yapp::Driver -# -# This module is part of the Parse::Yapp package available on your -# nearest CPAN -# -# Any use of this module in a standalone parser make the included -# text under the same copyright as the Parse::Yapp module itself. -# -# This notice should remain unchanged. -# -# (c) Copyright 1998-2001 Francois Desarmenien, all rights reserved. -# (see the pod text in Parse::Yapp module for use and distribution rights) -# - -package Parse::Yapp::Driver; - -require 5.004; - -use strict; - -use vars qw ( $VERSION $COMPATIBLE $FILENAME ); - -$VERSION = '1.05'; -$COMPATIBLE = '0.07'; -$FILENAME=__FILE__; - -use Carp; - -#Known parameters, all starting with YY (leading YY will be discarded) -my(%params)=(YYLEX => 'CODE', 'YYERROR' => 'CODE', YYVERSION => '', - YYRULES => 'ARRAY', YYSTATES => 'ARRAY', YYDEBUG => ''); -#Mandatory parameters -my(@params)=('LEX','RULES','STATES'); - -sub new { - my($class)=shift; - my($errst,$nberr,$token,$value,$check,$dotpos); - my($self)={ ERROR => \&_Error, - ERRST => \$errst, - NBERR => \$nberr, - TOKEN => \$token, - VALUE => \$value, - DOTPOS => \$dotpos, - STACK => [], - DEBUG => 0, - CHECK => \$check }; - - _CheckParams( [], \%params, \@_, $self ); - - exists($$self{VERSION}) - and $$self{VERSION} < $COMPATIBLE - and croak "Yapp driver version $VERSION ". - "incompatible with version $$self{VERSION}:\n". - "Please recompile parser module."; - - ref($class) - and $class=ref($class); - - bless($self,$class); -} - -sub YYParse { - my($self)=shift; - my($retval); - - _CheckParams( \@params, \%params, \@_, $self ); - - if($$self{DEBUG}) { - _DBLoad(); - $retval = eval '$self->_DBParse()';#Do not create stab entry on compile - $@ and die $@; - } - else { - $retval = $self->_Parse(); - } - $retval -} - -sub YYData { - my($self)=shift; - - exists($$self{USER}) - or $$self{USER}={}; - - $$self{USER}; - -} - -sub YYErrok { - my($self)=shift; - - ${$$self{ERRST}}=0; - undef; -} - -sub YYNberr { - my($self)=shift; - - ${$$self{NBERR}}; -} - -sub YYRecovering { - my($self)=shift; - - ${$$self{ERRST}} != 0; -} - -sub YYAbort { - my($self)=shift; - - ${$$self{CHECK}}='ABORT'; - undef; -} - -sub YYAccept { - my($self)=shift; - - ${$$self{CHECK}}='ACCEPT'; - undef; -} - -sub YYError { - my($self)=shift; - - ${$$self{CHECK}}='ERROR'; - undef; -} - -sub YYSemval { - my($self)=shift; - my($index)= $_[0] - ${$$self{DOTPOS}} - 1; - - $index < 0 - and -$index <= @{$$self{STACK}} - and return $$self{STACK}[$index][1]; - - undef; #Invalid index -} - -sub YYCurtok { - my($self)=shift; - - @_ - and ${$$self{TOKEN}}=$_[0]; - ${$$self{TOKEN}}; -} - -sub YYCurval { - my($self)=shift; - - @_ - and ${$$self{VALUE}}=$_[0]; - ${$$self{VALUE}}; -} - -sub YYExpect { - my($self)=shift; - - keys %{$self->{STATES}[$self->{STACK}[-1][0]]{ACTIONS}} -} - -sub YYLexer { - my($self)=shift; - - $$self{LEX}; -} - - -################# -# Private stuff # -################# - - -sub _CheckParams { - my($mandatory,$checklist,$inarray,$outhash)=@_; - my($prm,$value); - my($prmlst)={}; - - while(($prm,$value)=splice(@$inarray,0,2)) { - $prm=uc($prm); - exists($$checklist{$prm}) - or croak("Unknow parameter '$prm'"); - ref($value) eq $$checklist{$prm} - or croak("Invalid value for parameter '$prm'"); - $prm=unpack('@2A*',$prm); - $$outhash{$prm}=$value; - } - for (@$mandatory) { - exists($$outhash{$_}) - or croak("Missing mandatory parameter '".lc($_)."'"); - } -} - -sub _Error { - print "Parse error.\n"; -} - -sub _DBLoad { - { - no strict 'refs'; - - exists(${__PACKAGE__.'::'}{_DBParse})#Already loaded ? - and return; - } - my($fname)=__FILE__; - my(@drv); - open(DRV,"<$fname") or die "Report this as a BUG: Cannot open $fname"; - while() { - /^\s*sub\s+_Parse\s*{\s*$/ .. /^\s*}\s*#\s*_Parse\s*$/ - and do { - s/^#DBG>//; - push(@drv,$_); - } - } - close(DRV); - - $drv[0]=~s/_P/_DBP/; - eval join('',@drv); -} - -#Note that for loading debugging version of the driver, -#this file will be parsed from 'sub _Parse' up to '}#_Parse' inclusive. -#So, DO NOT remove comment at end of sub !!! -sub _Parse { - my($self)=shift; - - my($rules,$states,$lex,$error) - = @$self{ 'RULES', 'STATES', 'LEX', 'ERROR' }; - my($errstatus,$nberror,$token,$value,$stack,$check,$dotpos) - = @$self{ 'ERRST', 'NBERR', 'TOKEN', 'VALUE', 'STACK', 'CHECK', 'DOTPOS' }; - -#DBG> my($debug)=$$self{DEBUG}; -#DBG> my($dbgerror)=0; - -#DBG> my($ShowCurToken) = sub { -#DBG> my($tok)='>'; -#DBG> for (split('',$$token)) { -#DBG> $tok.= (ord($_) < 32 or ord($_) > 126) -#DBG> ? sprintf('<%02X>',ord($_)) -#DBG> : $_; -#DBG> } -#DBG> $tok.='<'; -#DBG> }; - - $$errstatus=0; - $$nberror=0; - ($$token,$$value)=(undef,undef); - @$stack=( [ 0, undef ] ); - $$check=''; - - while(1) { - my($actions,$act,$stateno); - - $stateno=$$stack[-1][0]; - $actions=$$states[$stateno]; - -#DBG> print STDERR ('-' x 40),"\n"; -#DBG> $debug & 0x2 -#DBG> and print STDERR "In state $stateno:\n"; -#DBG> $debug & 0x08 -#DBG> and print STDERR "Stack:[". -#DBG> join(',',map { $$_[0] } @$stack). -#DBG> "]\n"; - - - if (exists($$actions{ACTIONS})) { - - defined($$token) - or do { - ($$token,$$value)=&$lex($self); -#DBG> $debug & 0x01 -#DBG> and print STDERR "Need token. Got ".&$ShowCurToken."\n"; - }; - - $act= exists($$actions{ACTIONS}{$$token}) - ? $$actions{ACTIONS}{$$token} - : exists($$actions{DEFAULT}) - ? $$actions{DEFAULT} - : undef; - } - else { - $act=$$actions{DEFAULT}; -#DBG> $debug & 0x01 -#DBG> and print STDERR "Don't need token.\n"; - } - - defined($act) - and do { - - $act > 0 - and do { #shift - -#DBG> $debug & 0x04 -#DBG> and print STDERR "Shift and go to state $act.\n"; - - $$errstatus - and do { - --$$errstatus; - -#DBG> $debug & 0x10 -#DBG> and $dbgerror -#DBG> and $$errstatus == 0 -#DBG> and do { -#DBG> print STDERR "**End of Error recovery.\n"; -#DBG> $dbgerror=0; -#DBG> }; - }; - - - push(@$stack,[ $act, $$value ]); - - $$token ne '' #Don't eat the eof - and $$token=$$value=undef; - next; - }; - - #reduce - my($lhs,$len,$code,@sempar,$semval); - ($lhs,$len,$code)=@{$$rules[-$act]}; - -#DBG> $debug & 0x04 -#DBG> and $act -#DBG> and print STDERR "Reduce using rule ".-$act." ($lhs,$len): "; - - $act - or $self->YYAccept(); - - $$dotpos=$len; - - unpack('A1',$lhs) eq '@' #In line rule - and do { - $lhs =~ /^\@[0-9]+\-([0-9]+)$/ - or die "In line rule name '$lhs' ill formed: ". - "report it as a BUG.\n"; - $$dotpos = $1; - }; - - @sempar = $$dotpos - ? map { $$_[1] } @$stack[ -$$dotpos .. -1 ] - : (); - - $semval = $code ? &$code( $self, @sempar ) - : @sempar ? $sempar[0] : undef; - - splice(@$stack,-$len,$len); - - $$check eq 'ACCEPT' - and do { - -#DBG> $debug & 0x04 -#DBG> and print STDERR "Accept.\n"; - - return($semval); - }; - - $$check eq 'ABORT' - and do { - -#DBG> $debug & 0x04 -#DBG> and print STDERR "Abort.\n"; - - return(undef); - - }; - -#DBG> $debug & 0x04 -#DBG> and print STDERR "Back to state $$stack[-1][0], then "; - - $$check eq 'ERROR' - or do { -#DBG> $debug & 0x04 -#DBG> and print STDERR -#DBG> "go to state $$states[$$stack[-1][0]]{GOTOS}{$lhs}.\n"; - -#DBG> $debug & 0x10 -#DBG> and $dbgerror -#DBG> and $$errstatus == 0 -#DBG> and do { -#DBG> print STDERR "**End of Error recovery.\n"; -#DBG> $dbgerror=0; -#DBG> }; - - push(@$stack, - [ $$states[$$stack[-1][0]]{GOTOS}{$lhs}, $semval ]); - $$check=''; - next; - }; - -#DBG> $debug & 0x04 -#DBG> and print STDERR "Forced Error recovery.\n"; - - $$check=''; - - }; - - #Error - $$errstatus - or do { - - $$errstatus = 1; - &$error($self); - $$errstatus # if 0, then YYErrok has been called - or next; # so continue parsing - -#DBG> $debug & 0x10 -#DBG> and do { -#DBG> print STDERR "**Entering Error recovery.\n"; -#DBG> ++$dbgerror; -#DBG> }; - - ++$$nberror; - - }; - - $$errstatus == 3 #The next token is not valid: discard it - and do { - $$token eq '' # End of input: no hope - and do { -#DBG> $debug & 0x10 -#DBG> and print STDERR "**At eof: aborting.\n"; - return(undef); - }; - -#DBG> $debug & 0x10 -#DBG> and print STDERR "**Dicard invalid token ".&$ShowCurToken.".\n"; - - $$token=$$value=undef; - }; - - $$errstatus=3; - - while( @$stack - and ( not exists($$states[$$stack[-1][0]]{ACTIONS}) - or not exists($$states[$$stack[-1][0]]{ACTIONS}{error}) - or $$states[$$stack[-1][0]]{ACTIONS}{error} <= 0)) { - -#DBG> $debug & 0x10 -#DBG> and print STDERR "**Pop state $$stack[-1][0].\n"; - - pop(@$stack); - } - - @$stack - or do { - -#DBG> $debug & 0x10 -#DBG> and print STDERR "**No state left on stack: aborting.\n"; - - return(undef); - }; - - #shift the error token - -#DBG> $debug & 0x10 -#DBG> and print STDERR "**Shift \$error token and go to state ". -#DBG> $$states[$$stack[-1][0]]{ACTIONS}{error}. -#DBG> ".\n"; - - push(@$stack, [ $$states[$$stack[-1][0]]{ACTIONS}{error}, undef ]); - - } - - #never reached - croak("Error in driver logic. Please, report it as a BUG"); - -}#_Parse -#DO NOT remove comment - -1; - -} -#End of include-------------------------------------------------- - - -#line 20 "Farnsworth.yp" - -use Data::Dumper; #boobs -my $s; # warning - not re-entrant -my $fullstring; -my $charcount; - - -sub new { - my($class)=shift; - ref($class) - and $class=ref($class); - - my($self)=$class->SUPER::new( yyversion => '1.05', - yystates => -[ - {#State 0 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 17, - "var" => 20, - 'DATE' => 4, - "while" => 22, - 'STRING' => 7, - "if" => 10, - "(" => 26, - 'HEXNUMBER' => 25, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - DEFAULT => -1, - GOTOS => { - 'exprval2' => 2, - 'stma' => 18, - 'lambda' => 3, - 'exprval' => 19, - 'ifstartcond' => 21, - 'arrayfetchexpr' => 5, - 'if' => 8, - 'assignexpr' => 6, - 'stmt' => 23, - 'exprval1' => 9, - 'while' => 24, - 'expr' => 12, - 'multexpr' => 14 - } - }, - {#State 1 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 27, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 2 - DEFAULT => -47 - }, - {#State 3 - DEFAULT => -84 - }, - {#State 4 - DEFAULT => -87 - }, - {#State 5 - DEFAULT => -48 - }, - {#State 6 - DEFAULT => -89 - }, - {#State 7 - DEFAULT => -88 - }, - {#State 8 - DEFAULT => -12 - }, - {#State 9 - DEFAULT => -46 - }, - {#State 10 - ACTIONS => { - "(" => 29 - } - }, - {#State 11 - ACTIONS => { - 'HEXNUMBER' => 25, - "(" => 26, - 'NAME' => 30, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'exprval' => 31, - 'arrayfetchexpr' => 5 - } - }, - {#State 12 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "+" => 36, - "**" => 35, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "^" => 40, - "*" => 42, - "per" => 43, - ":->" => 44, - "!=" => 45, - "|||" => 46, - "?" => 49, - "&&" => 48, - "||" => 47, - "^^" => 50, - "/" => 52, - "->" => 51, - "=" => 53, - "=>" => 54, - "<=" => 56, - "<=>" => 55, - ">" => 57 - }, - DEFAULT => -5 - }, - {#State 13 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - "," => 58, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - DEFAULT => -29, - GOTOS => { - 'exprval2' => 2, - 'lambda' => 3, - 'exprval' => 19, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6, - 'exprval1' => 9, - 'array' => 59, - 'expr' => 60, - 'multexpr' => 14 - } - }, - {#State 14 - DEFAULT => -58 - }, - {#State 15 - DEFAULT => -42 - }, - {#State 16 - ACTIONS => { - 'NAME' => 62 - }, - DEFAULT => -39, - GOTOS => { - 'arglist' => 63, - 'argelement' => 61 - } - }, - {#State 17 - ACTIONS => { - "[" => 64, - "::-" => 68, - ":=" => 65, - "=!=" => 67, - "{" => 66, - ":-" => 69 - }, - DEFAULT => -44 - }, - {#State 18 - ACTIONS => { - '' => 70 - } - }, - {#State 19 - ACTIONS => { - "\@" => 71, - 'HEXNUMBER' => 25, - "(" => 26, - 'NUMBER' => 15, - 'NAME' => 30 - }, - DEFAULT => -56, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'exprval' => 72, - 'arrayfetchexpr' => 5 - } - }, - {#State 20 - ACTIONS => { - 'NAME' => 73 - } - }, - {#State 21 - ACTIONS => { - "\n" => 74, - "{" => 75 - }, - GOTOS => { - 'ifstmts' => 76 - } - }, - {#State 22 - ACTIONS => { - "(" => 77 - } - }, - {#State 23 - ACTIONS => { - "\n" => 79, - ";" => 78 - }, - DEFAULT => -2 - }, - {#State 24 - DEFAULT => -13 - }, - {#State 25 - DEFAULT => -43 - }, - {#State 26 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 80, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 27 - ACTIONS => { - "**" => 35, - "^" => 40 - }, - DEFAULT => -57 - }, - {#State 28 - ACTIONS => { - "[" => 64, - "::-" => 68, - "{" => 66, - ":-" => 69 - }, - DEFAULT => -44 - }, - {#State 29 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 81, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 30 - DEFAULT => -44 - }, - {#State 31 - ACTIONS => { - "\@" => 71 - }, - DEFAULT => -71 - }, - {#State 32 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 82, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 33 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 83, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 34 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 84, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 35 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 85, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 36 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 86, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 37 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 87, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 38 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 88, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 39 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 89, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 40 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 90, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 41 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 91, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 42 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 92, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 43 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 93, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 44 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 94, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 45 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 95, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 46 - ACTIONS => { - 'NAME' => 96 - } - }, - {#State 47 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 97, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 48 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 98, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 49 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 99, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 50 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 100, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 51 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 101, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 52 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 102, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 53 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 103, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 54 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 104, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 55 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 105, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 56 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 106, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 57 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 107, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 58 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - "," => 58, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - DEFAULT => -29, - GOTOS => { - 'exprval2' => 2, - 'lambda' => 3, - 'exprval' => 19, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6, - 'exprval1' => 9, - 'array' => 108, - 'expr' => 60, - 'multexpr' => 14 - } - }, - {#State 59 - ACTIONS => { - "]" => 109 - } - }, - {#State 60 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "+" => 36, - "**" => 35, - "," => 110, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "^" => 40, - "*" => 42, - "per" => 43, - "!=" => 45, - "?" => 49, - "&&" => 48, - "||" => 47, - "^^" => 50, - "/" => 52, - "->" => 51, - "=" => 53, - "=>" => 54, - "<=" => 56, - "<=>" => 55, - ">" => 57 - }, - DEFAULT => -28 - }, - {#State 61 - ACTIONS => { - "," => 111 - }, - DEFAULT => -41 - }, - {#State 62 - ACTIONS => { - "isa" => 114, - "byref" => 112, - "=" => 113 - }, - DEFAULT => -36 - }, - {#State 63 - ACTIONS => { - "`" => 115 - } - }, - {#State 64 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - "," => 58, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - DEFAULT => -29, - GOTOS => { - 'exprval2' => 2, - 'lambda' => 3, - 'exprval' => 19, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6, - 'exprval1' => 9, - 'array' => 116, - 'expr' => 60, - 'multexpr' => 14 - } - }, - {#State 65 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 117, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 66 - ACTIONS => { - 'NAME' => 62 - }, - DEFAULT => -39, - GOTOS => { - 'arglist' => 118, - 'argelement' => 61 - } - }, - {#State 67 - ACTIONS => { - 'NAME' => 119 - } - }, - {#State 68 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 120, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 69 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 121, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 70 - DEFAULT => 0 - }, - {#State 71 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - "," => 58, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - DEFAULT => -29, - GOTOS => { - 'exprval2' => 2, - 'lambda' => 3, - 'exprval' => 19, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6, - 'exprval1' => 9, - 'array' => 122, - 'expr' => 60, - 'multexpr' => 14 - } - }, - {#State 72 - ACTIONS => { - "\@" => 71 - }, - DEFAULT => -53 - }, - {#State 73 - ACTIONS => { - "=" => 123 - }, - DEFAULT => -6 - }, - {#State 74 - ACTIONS => { - "{" => 75 - }, - GOTOS => { - 'ifstmts' => 124 - } - }, - {#State 75 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 17, - "var" => 20, - 'DATE' => 4, - "while" => 22, - 'STRING' => 7, - "if" => 10, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - DEFAULT => -1, - GOTOS => { - 'exprval2' => 2, - 'stma' => 125, - 'lambda' => 3, - 'exprval' => 19, - 'ifstartcond' => 21, - 'arrayfetchexpr' => 5, - 'if' => 8, - 'assignexpr' => 6, - 'stmt' => 23, - 'exprval1' => 9, - 'while' => 24, - 'expr' => 12, - 'multexpr' => 14 - } - }, - {#State 76 - ACTIONS => { - "else" => 126 - }, - DEFAULT => -16 - }, - {#State 77 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 128, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 78 - ACTIONS => { - "-" => 1, - 'DATE' => 4, - 'STRING' => 7, - "if" => 10, - "!" => 11, - "[" => 13, - 'NUMBER' => 15, - "{`" => 16, - 'NAME' => 17, - "var" => 20, - "while" => 22, - "(" => 26, - 'HEXNUMBER' => 25 - }, - DEFAULT => -1, - GOTOS => { - 'exprval2' => 2, - 'stma' => 129, - 'lambda' => 3, - 'exprval' => 19, - 'ifstartcond' => 21, - 'arrayfetchexpr' => 5, - 'if' => 8, - 'assignexpr' => 6, - 'stmt' => 23, - 'exprval1' => 9, - 'while' => 24, - 'expr' => 12, - 'multexpr' => 14 - } - }, - {#State 79 - ACTIONS => { - "-" => 1, - 'DATE' => 4, - 'STRING' => 7, - "if" => 10, - "!" => 11, - "[" => 13, - 'NUMBER' => 15, - "{`" => 16, - 'NAME' => 17, - "var" => 20, - "while" => 22, - "(" => 26, - 'HEXNUMBER' => 25 - }, - DEFAULT => -1, - GOTOS => { - 'exprval2' => 2, - 'stma' => 130, - 'lambda' => 3, - 'exprval' => 19, - 'ifstartcond' => 21, - 'arrayfetchexpr' => 5, - 'if' => 8, - 'assignexpr' => 6, - 'stmt' => 23, - 'exprval1' => 9, - 'while' => 24, - 'expr' => 12, - 'multexpr' => 14 - } - }, - {#State 80 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "+" => 36, - "**" => 35, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "^" => 40, - "*" => 42, - "per" => 43, - ")" => 131, - "!=" => 45, - "?" => 49, - "||" => 47, - "&&" => 48, - "^^" => 50, - "/" => 52, - "->" => 51, - "=" => 53, - "=>" => 54, - "<=" => 56, - "<=>" => 55, - ">" => 57 - } - }, - {#State 81 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "+" => 36, - "**" => 35, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "^" => 40, - "*" => 42, - "per" => 43, - ")" => 132, - "!=" => 45, - "?" => 49, - "||" => 47, - "&&" => 48, - "^^" => 50, - "/" => 52, - "->" => 51, - "=" => 53, - "=>" => 54, - "<=" => 56, - "<=>" => 55, - ">" => 57 - } - }, - {#State 82 - ACTIONS => { - "%" => 37, - " " => 41, - "*" => 42, - "**" => 35, - "^" => 40, - "per" => 43, - "/" => 52 - }, - DEFAULT => -60 - }, - {#State 83 - ACTIONS => { - "-" => 32, - "<" => 34, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "*" => 42, - "<=" => 56, - ">" => 57, - "**" => 35, - "+" => 36, - "^" => 40, - "per" => 43, - "!=" => 45, - "/" => 52, - "<=>" => 55 - }, - DEFAULT => -66 - }, - {#State 84 - ACTIONS => { - "-" => 32, - "<" => undef, - "%" => 37, - "==" => undef, - ">=" => undef, - " " => 41, - "*" => 42, - "<=" => undef, - ">" => undef, - "**" => 35, - "+" => 36, - "^" => 40, - "per" => 43, - "!=" => undef, - "/" => 52, - "<=>" => undef - }, - DEFAULT => -72 - }, - {#State 85 - ACTIONS => { - "**" => 35, - "^" => 40 - }, - DEFAULT => -65 - }, - {#State 86 - ACTIONS => { - "%" => 37, - " " => 41, - "*" => 42, - "**" => 35, - "^" => 40, - "per" => 43, - "/" => 52 - }, - DEFAULT => -59 - }, - {#State 87 - ACTIONS => { - "**" => 35, - "^" => 40 - }, - DEFAULT => -63 - }, - {#State 88 - ACTIONS => { - "-" => 32, - "<" => undef, - "%" => 37, - "==" => undef, - ">=" => undef, - " " => 41, - "*" => 42, - "<=" => undef, - ">" => undef, - "**" => 35, - "+" => 36, - "^" => 40, - "per" => 43, - "!=" => undef, - "/" => 52, - "<=>" => undef - }, - DEFAULT => -76 - }, - {#State 89 - ACTIONS => { - "-" => 32, - "<" => undef, - "%" => 37, - "==" => undef, - ">=" => undef, - " " => 41, - "*" => 42, - "<=" => undef, - ">" => undef, - "**" => 35, - "+" => 36, - "^" => 40, - "per" => 43, - "!=" => undef, - "/" => 52, - "<=>" => undef - }, - DEFAULT => -75 - }, - {#State 90 - ACTIONS => { - "**" => 35, - "^" => 40 - }, - DEFAULT => -64 - }, - {#State 91 - ACTIONS => { - "**" => 35, - "^" => 40 - }, - DEFAULT => -55 - }, - {#State 92 - ACTIONS => { - "**" => 35, - "^" => 40 - }, - DEFAULT => -52 - }, - {#State 93 - ACTIONS => { - "%" => 37, - " " => 41, - "*" => 42, - "**" => 35, - "^" => 40, - "/" => 52 - }, - DEFAULT => -62 - }, - {#State 94 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "+" => 36, - "**" => 35, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "^" => 40, - "*" => 42, - "per" => 43, - "!=" => 45, - "?" => 49, - "||" => 47, - "&&" => 48, - "^^" => 50, - "/" => 52, - "->" => 51, - "=" => 53, - "=>" => 54, - "<=" => 56, - "<=>" => 55, - ">" => 57 - }, - DEFAULT => -9 - }, - {#State 95 - ACTIONS => { - "-" => 32, - "<" => undef, - "%" => 37, - "==" => undef, - ">=" => undef, - " " => 41, - "*" => 42, - "<=" => undef, - ">" => undef, - "**" => 35, - "+" => 36, - "^" => 40, - "per" => 43, - "!=" => undef, - "/" => 52, - "<=>" => undef - }, - DEFAULT => -78 - }, - {#State 96 - DEFAULT => -11 - }, - {#State 97 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "*" => 42, - "<=" => 56, - ">" => 57, - "**" => 35, - "+" => 36, - "^" => 40, - "per" => 43, - "!=" => 45, - "/" => 52, - "<=>" => 55 - }, - DEFAULT => -69 - }, - {#State 98 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "*" => 42, - "<=" => 56, - ">" => 57, - "**" => 35, - "+" => 36, - "^" => 40, - "per" => 43, - "!=" => 45, - "/" => 52, - "<=>" => 55 - }, - DEFAULT => -68 - }, - {#State 99 - ACTIONS => { - ":" => 133, - "-" => 32, - "conforms" => 33, - "<" => 34, - "+" => 36, - "**" => 35, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "^" => 40, - "*" => 42, - "per" => 43, - "!=" => 45, - "?" => 49, - "||" => 47, - "&&" => 48, - "^^" => 50, - "/" => 52, - "->" => 51, - "=" => 53, - "=>" => 54, - "<=" => 56, - "<=>" => 55, - ">" => 57 - } - }, - {#State 100 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "*" => 42, - "<=" => 56, - ">" => 57, - "**" => 35, - "+" => 36, - "^" => 40, - "per" => 43, - "!=" => 45, - "/" => 52, - "<=>" => 55 - }, - DEFAULT => -70 - }, - {#State 101 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "*" => 42, - "||" => 47, - "<=" => 56, - ">" => 57, - "**" => 35, - "+" => 36, - "^" => 40, - "per" => 43, - "!=" => 45, - "&&" => 48, - "?" => 49, - "^^" => 50, - "/" => 52, - "<=>" => 55 - }, - DEFAULT => -86 - }, - {#State 102 - ACTIONS => { - "**" => 35, - "^" => 40 - }, - DEFAULT => -61 - }, - {#State 103 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "*" => 42, - "||" => 47, - "->" => 51, - "=>" => 54, - "<=" => 56, - ">" => 57, - "**" => 35, - "+" => 36, - "^" => 40, - "per" => 43, - "!=" => 45, - "&&" => 48, - "?" => 49, - "^^" => 50, - "/" => 52, - "=" => 53, - "<=>" => 55 - }, - DEFAULT => -49 - }, - {#State 104 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "*" => 42, - "||" => 47, - "<=" => 56, - ">" => 57, - "**" => 35, - "+" => 36, - "^" => 40, - "per" => 43, - "!=" => 45, - "&&" => 48, - "?" => 49, - "^^" => 50, - "/" => 52, - "<=>" => 55 - }, - DEFAULT => -85 - }, - {#State 105 - ACTIONS => { - "-" => 32, - "<" => undef, - "%" => 37, - "==" => undef, - ">=" => undef, - " " => 41, - "*" => 42, - "<=" => undef, - ">" => undef, - "**" => 35, - "+" => 36, - "^" => 40, - "per" => 43, - "!=" => undef, - "/" => 52, - "<=>" => undef - }, - DEFAULT => -77 - }, - {#State 106 - ACTIONS => { - "-" => 32, - "<" => undef, - "%" => 37, - "==" => undef, - ">=" => undef, - " " => 41, - "*" => 42, - "<=" => undef, - ">" => undef, - "**" => 35, - "+" => 36, - "^" => 40, - "per" => 43, - "!=" => undef, - "/" => 52, - "<=>" => undef - }, - DEFAULT => -74 - }, - {#State 107 - ACTIONS => { - "-" => 32, - "<" => undef, - "%" => 37, - "==" => undef, - ">=" => undef, - " " => 41, - "*" => 42, - "<=" => undef, - ">" => undef, - "**" => 35, - "+" => 36, - "^" => 40, - "per" => 43, - "!=" => undef, - "/" => 52, - "<=>" => undef - }, - DEFAULT => -73 - }, - {#State 108 - DEFAULT => -30 - }, - {#State 109 - DEFAULT => -83 - }, - {#State 110 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - "," => 58, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - DEFAULT => -29, - GOTOS => { - 'exprval2' => 2, - 'lambda' => 3, - 'exprval' => 19, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6, - 'exprval1' => 9, - 'array' => 134, - 'expr' => 60, - 'multexpr' => 14 - } - }, - {#State 111 - ACTIONS => { - 'NAME' => 62 - }, - DEFAULT => -39, - GOTOS => { - 'arglist' => 135, - 'argelement' => 61 - } - }, - {#State 112 - ACTIONS => { - "isa" => 136 - }, - DEFAULT => -38 - }, - {#State 113 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 137, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 114 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - "..." => 140, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval2' => 2, - 'lambda' => 3, - 'exprval' => 19, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6, - 'exprval1' => 9, - 'expr' => 138, - 'multexpr' => 14, - 'constraint' => 139 - } - }, - {#State 115 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 17, - "var" => 20, - 'DATE' => 4, - "while" => 22, - 'STRING' => 7, - "if" => 10, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - DEFAULT => -1, - GOTOS => { - 'exprval2' => 2, - 'stma' => 141, - 'lambda' => 3, - 'exprval' => 19, - 'ifstartcond' => 21, - 'arrayfetchexpr' => 5, - 'if' => 8, - 'assignexpr' => 6, - 'stmt' => 23, - 'exprval1' => 9, - 'while' => 24, - 'expr' => 12, - 'multexpr' => 14 - } - }, - {#State 116 - ACTIONS => { - "]" => 142 - } - }, - {#State 117 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "+" => 36, - "**" => 35, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "^" => 40, - "*" => 42, - "per" => 43, - "!=" => 45, - "?" => 49, - "||" => 47, - "&&" => 48, - "^^" => 50, - "/" => 52, - "->" => 51, - "=" => 53, - "=>" => 54, - "<=" => 56, - "<=>" => 55, - ">" => 57 - }, - DEFAULT => -8 - }, - {#State 118 - ACTIONS => { - "}" => 143 - } - }, - {#State 119 - DEFAULT => -10 - }, - {#State 120 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "*" => 42, - "||" => 47, - "->" => 51, - "=>" => 54, - "<=" => 56, - ">" => 57, - "**" => 35, - "+" => 36, - "^" => 40, - "per" => 43, - "!=" => 45, - "&&" => 48, - "?" => 49, - "^^" => 50, - "/" => 52, - "=" => 53, - "<=>" => 55 - }, - DEFAULT => -79 - }, - {#State 121 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "*" => 42, - "||" => 47, - "->" => 51, - "=>" => 54, - "<=" => 56, - ">" => 57, - "**" => 35, - "+" => 36, - "^" => 40, - "per" => 43, - "!=" => 45, - "&&" => 48, - "?" => 49, - "^^" => 50, - "/" => 52, - "=" => 53, - "<=>" => 55 - }, - DEFAULT => -80 - }, - {#State 122 - ACTIONS => { - "\$" => 144 - } - }, - {#State 123 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 145, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 124 - ACTIONS => { - "else" => 146 - }, - DEFAULT => -18 - }, - {#State 125 - ACTIONS => { - "}" => 148 - } - }, - {#State 126 - ACTIONS => { - "\n" => 149, - "{" => 75 - }, - GOTOS => { - 'ifstmts' => 150 - } - }, - {#State 127 - ACTIONS => { - "else" => 151 - } - }, - {#State 128 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "+" => 36, - "**" => 35, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "^" => 40, - "*" => 42, - "per" => 43, - ")" => 152, - "!=" => 45, - "?" => 49, - "||" => 47, - "&&" => 48, - "^^" => 50, - "/" => 52, - "->" => 51, - "=" => 53, - "=>" => 54, - "<=" => 56, - "<=>" => 55, - ">" => 57 - } - }, - {#State 129 - DEFAULT => -3 - }, - {#State 130 - DEFAULT => -4 - }, - {#State 131 - DEFAULT => -45 - }, - {#State 132 - DEFAULT => -14 - }, - {#State 133 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 153, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 134 - DEFAULT => -27 - }, - {#State 135 - DEFAULT => -40 - }, - {#State 136 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - "..." => 140, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval2' => 2, - 'lambda' => 3, - 'exprval' => 19, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6, - 'exprval1' => 9, - 'expr' => 138, - 'multexpr' => 14, - 'constraint' => 154 - } - }, - {#State 137 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "+" => 36, - "**" => 35, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "^" => 40, - "*" => 42, - "per" => 43, - "!=" => 45, - "?" => 49, - "||" => 47, - "&&" => 48, - "^^" => 50, - "/" => 52, - "->" => 51, - "=" => 53, - "isa" => 155, - "=>" => 54, - "<=" => 56, - "<=>" => 55, - ">" => 57 - }, - DEFAULT => -35 - }, - {#State 138 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "+" => 36, - "**" => 35, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "^" => 40, - "*" => 42, - "per" => 43, - "!=" => 45, - "?" => 49, - "||" => 47, - "&&" => 48, - "^^" => 50, - "/" => 52, - "->" => 51, - "=" => 53, - "=>" => 54, - "<=" => 56, - "<=>" => 55, - ">" => 57 - }, - DEFAULT => -31 - }, - {#State 139 - DEFAULT => -34 - }, - {#State 140 - DEFAULT => -32 - }, - {#State 141 - ACTIONS => { - "}" => 156 - } - }, - {#State 142 - DEFAULT => -54 - }, - {#State 143 - ACTIONS => { - ":=" => 157 - } - }, - {#State 144 - DEFAULT => -50 - }, - {#State 145 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "+" => 36, - "**" => 35, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "^" => 40, - "*" => 42, - "per" => 43, - "!=" => 45, - "?" => 49, - "||" => 47, - "&&" => 48, - "^^" => 50, - "/" => 52, - "->" => 51, - "=" => 53, - "=>" => 54, - "<=" => 56, - "<=>" => 55, - ">" => 57 - }, - DEFAULT => -7 - }, - {#State 146 - ACTIONS => { - "\n" => 158, - "{" => 75 - }, - GOTOS => { - 'ifstmts' => 159 - } - }, - {#State 147 - ACTIONS => { - "else" => 160 - } - }, - {#State 148 - DEFAULT => -15 - }, - {#State 149 - ACTIONS => { - "{" => 75 - }, - GOTOS => { - 'ifstmts' => 161 - } - }, - {#State 150 - DEFAULT => -17 - }, - {#State 151 - ACTIONS => { - "\n" => 162, - "{" => 75 - }, - GOTOS => { - 'ifstmts' => 163 - } - }, - {#State 152 - ACTIONS => { - "{" => 164 - } - }, - {#State 153 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "*" => 42, - "||" => 47, - "<=" => 56, - ">" => 57, - "**" => 35, - "+" => 36, - "^" => 40, - "per" => 43, - "!=" => 45, - "&&" => 48, - "?" => 49, - "^^" => 50, - "/" => 52, - "<=>" => 55 - }, - DEFAULT => -67 - }, - {#State 154 - DEFAULT => -37 - }, - {#State 155 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - "..." => 140, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval2' => 2, - 'lambda' => 3, - 'exprval' => 19, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6, - 'exprval1' => 9, - 'expr' => 138, - 'multexpr' => 14, - 'constraint' => 165 - } - }, - {#State 156 - DEFAULT => -51 - }, - {#State 157 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - "{" => 167, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 166, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 158 - ACTIONS => { - "{" => 75 - }, - GOTOS => { - 'ifstmts' => 168 - } - }, - {#State 159 - DEFAULT => -19 - }, - {#State 160 - ACTIONS => { - "\n" => 169, - "{" => 75 - }, - GOTOS => { - 'ifstmts' => 170 - } - }, - {#State 161 - DEFAULT => -24 - }, - {#State 162 - ACTIONS => { - "{" => 75 - }, - GOTOS => { - 'ifstmts' => 171 - } - }, - {#State 163 - DEFAULT => -23 - }, - {#State 164 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 17, - "var" => 20, - 'DATE' => 4, - "while" => 22, - 'STRING' => 7, - "if" => 10, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - DEFAULT => -1, - GOTOS => { - 'exprval2' => 2, - 'stma' => 172, - 'lambda' => 3, - 'exprval' => 19, - 'ifstartcond' => 21, - 'arrayfetchexpr' => 5, - 'if' => 8, - 'assignexpr' => 6, - 'stmt' => 23, - 'exprval1' => 9, - 'while' => 24, - 'expr' => 12, - 'multexpr' => 14 - } - }, - {#State 165 - DEFAULT => -33 - }, - {#State 166 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "*" => 42, - "||" => 47, - "->" => 51, - "=>" => 54, - "<=" => 56, - ">" => 57, - "**" => 35, - "+" => 36, - "^" => 40, - "per" => 43, - "!=" => 45, - "&&" => 48, - "?" => 49, - "^^" => 50, - "/" => 52, - "=" => 53, - "<=>" => 55 - }, - DEFAULT => -81 - }, - {#State 167 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 17, - "var" => 20, - 'DATE' => 4, - "while" => 22, - 'STRING' => 7, - "if" => 10, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - DEFAULT => -1, - GOTOS => { - 'exprval2' => 2, - 'stma' => 173, - 'lambda' => 3, - 'exprval' => 19, - 'ifstartcond' => 21, - 'arrayfetchexpr' => 5, - 'if' => 8, - 'assignexpr' => 6, - 'stmt' => 23, - 'exprval1' => 9, - 'while' => 24, - 'expr' => 12, - 'multexpr' => 14 - } - }, - {#State 168 - DEFAULT => -21 - }, - {#State 169 - ACTIONS => { - "{" => 75 - }, - GOTOS => { - 'ifstmts' => 174 - } - }, - {#State 170 - DEFAULT => -20 - }, - {#State 171 - DEFAULT => -25 - }, - {#State 172 - ACTIONS => { - "}" => 175 - } - }, - {#State 173 - ACTIONS => { - "}" => 176 - } - }, - {#State 174 - DEFAULT => -22 - }, - {#State 175 - DEFAULT => -26 - }, - {#State 176 - DEFAULT => -82 - } -], - yyrules => -[ - [#Rule 0 - '$start', 2, undef - ], - [#Rule 1 - 'stma', 0, -sub -#line 30 "Farnsworth.yp" -{undef} - ], - [#Rule 2 - 'stma', 1, -sub -#line 31 "Farnsworth.yp" -{ bless [ $_[1] ], 'Stmt' } - ], - [#Rule 3 - 'stma', 3, -sub -#line 32 "Farnsworth.yp" -{ bless [ $_[1], ref($_[3]) eq "Stmt" ? @{$_[3]} : $_[3]], 'Stmt' } - ], - [#Rule 4 - 'stma', 3, -sub -#line 33 "Farnsworth.yp" -{ bless [ $_[1], ref($_[3]) eq "Stmt" ? @{$_[3]} : $_[3]], 'Stmt' } - ], - [#Rule 5 - 'stmt', 1, -sub -#line 37 "Farnsworth.yp" -{ $_[1] } - ], - [#Rule 6 - 'stmt', 2, -sub -#line 38 "Farnsworth.yp" -{ bless [ $_[2] ], 'DeclareVar' } - ], - [#Rule 7 - 'stmt', 4, -sub -#line 39 "Farnsworth.yp" -{ bless [ $_[2], $_[4] ], 'DeclareVar' } - ], - [#Rule 8 - 'stmt', 3, -sub -#line 40 "Farnsworth.yp" -{ bless [@_[1,3]], 'UnitDef' } - ], - [#Rule 9 - 'stmt', 3, -sub -#line 41 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'SetDisplay' } - ], - [#Rule 10 - 'stmt', 3, -sub -#line 42 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'DefineDimen' } - ], - [#Rule 11 - 'stmt', 3, -sub -#line 43 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'DefineCombo' } - ], - [#Rule 12 - 'stmt', 1, undef - ], - [#Rule 13 - 'stmt', 1, undef - ], - [#Rule 14 - 'ifstartcond', 4, -sub -#line 48 "Farnsworth.yp" -{$_[3]} - ], - [#Rule 15 - 'ifstmts', 3, -sub -#line 50 "Farnsworth.yp" -{$_[2]} - ], - [#Rule 16 - 'if', 2, -sub -#line 54 "Farnsworth.yp" -{bless [@_[1,2], undef], 'If'} - ], - [#Rule 17 - 'if', 4, -sub -#line 55 "Farnsworth.yp" -{bless [@_[1,2,4]], 'If'} - ], - [#Rule 18 - 'if', 3, -sub -#line 56 "Farnsworth.yp" -{bless [@_[1,3], undef], 'If'} - ], - [#Rule 19 - 'if', 5, -sub -#line 57 "Farnsworth.yp" -{bless [@_[1,3,5]], 'If'} - ], - [#Rule 20 - 'if', 6, -sub -#line 58 "Farnsworth.yp" -{bless [@_[1,3,6]], 'If'} - ], - [#Rule 21 - 'if', 6, -sub -#line 59 "Farnsworth.yp" -{bless [@_[1,3,6]], 'If'} - ], - [#Rule 22 - 'if', 7, -sub -#line 60 "Farnsworth.yp" -{bless [@_[1,3,7]], 'If'} - ], - [#Rule 23 - 'if', 5, -sub -#line 61 "Farnsworth.yp" -{bless [@_[1,2,5]], 'If'} - ], - [#Rule 24 - 'if', 5, -sub -#line 62 "Farnsworth.yp" -{bless [@_[1,2,5]], 'If'} - ], - [#Rule 25 - 'if', 6, -sub -#line 63 "Farnsworth.yp" -{bless [@_[1,2,6]], 'If'} - ], - [#Rule 26 - 'while', 7, -sub -#line 71 "Farnsworth.yp" -{ bless [ @_[3,6] ], 'While' } - ], - [#Rule 27 - 'array', 3, -sub -#line 78 "Farnsworth.yp" -{bless [ ( ref($_[1]) eq 'Array' ? ( bless [@{$_[1]}], 'SubArray' ) : $_[1] ), ref($_[3]) eq 'Array' ? @{$_[3]} : $_[3] ], 'Array' } - ], - [#Rule 28 - 'array', 1, -sub -#line 79 "Farnsworth.yp" -{bless [ ( ref($_[1]) eq 'Array' ? ( bless [@{$_[1]}], 'SubArray' ) : $_[1] ) ], 'Array'} - ], - [#Rule 29 - 'array', 0, -sub -#line 80 "Farnsworth.yp" -{bless [], 'Array'} - ], - [#Rule 30 - 'array', 2, -sub -#line 81 "Farnsworth.yp" -{bless [ undef, ref($_[2]) eq 'Array' ? @{$_[2]} : $_[2] ], 'Array' } - ], - [#Rule 31 - 'constraint', 1, undef - ], - [#Rule 32 - 'constraint', 1, -sub -#line 85 "Farnsworth.yp" -{bless [], 'VarArg'} - ], - [#Rule 33 - 'argelement', 5, -sub -#line 88 "Farnsworth.yp" -{bless [ $_[1], $_[3], $_[5], 0], 'Argele'} - ], - [#Rule 34 - 'argelement', 3, -sub -#line 89 "Farnsworth.yp" -{bless [ $_[1], undef, $_[3], 0], 'Argele'} - ], - [#Rule 35 - 'argelement', 3, -sub -#line 90 "Farnsworth.yp" -{bless [ $_[1], $_[3], undef, 0], 'Argele'} - ], - [#Rule 36 - 'argelement', 1, -sub -#line 91 "Farnsworth.yp" -{bless [ $_[1], undef, undef, 0], 'Argele'} - ], - [#Rule 37 - 'argelement', 4, -sub -#line 92 "Farnsworth.yp" -{bless [ $_[1], undef, $_[4], 1], 'Argele'} - ], - [#Rule 38 - 'argelement', 2, -sub -#line 93 "Farnsworth.yp" -{bless [ $_[1], undef, undef, 1], 'Argele'} - ], - [#Rule 39 - 'argelement', 0, undef - ], - [#Rule 40 - 'arglist', 3, -sub -#line 97 "Farnsworth.yp" -{ bless [ $_[1], ref($_[3]) eq 'Arglist' ? @{$_[3]} : $_[3] ], 'Arglist' } - ], - [#Rule 41 - 'arglist', 1, -sub -#line 98 "Farnsworth.yp" -{bless [ $_[1] ], 'Arglist'} - ], - [#Rule 42 - 'exprval1', 1, -sub -#line 101 "Farnsworth.yp" -{ bless [ $_[1] ], 'Num' } - ], - [#Rule 43 - 'exprval1', 1, -sub -#line 102 "Farnsworth.yp" -{ bless [ $_[1] ], 'HexNum' } - ], - [#Rule 44 - 'exprval2', 1, -sub -#line 106 "Farnsworth.yp" -{ bless [ $_[1] ], 'Fetch' } - ], - [#Rule 45 - 'exprval2', 3, -sub -#line 107 "Farnsworth.yp" -{ bless [$_[2]], 'Paren' } - ], - [#Rule 46 - 'exprval', 1, undef - ], - [#Rule 47 - 'exprval', 1, undef - ], - [#Rule 48 - 'exprval', 1, undef - ], - [#Rule 49 - 'assignexpr', 3, -sub -#line 115 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'Store' } - ], - [#Rule 50 - 'arrayfetchexpr', 4, -sub -#line 118 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'ArrayFetch' } - ], - [#Rule 51 - 'lambda', 5, -sub -#line 121 "Farnsworth.yp" -{bless [ @_[2,4] ], 'Lambda'} - ], - [#Rule 52 - 'multexpr', 3, -sub -#line 124 "Farnsworth.yp" -{ bless [ @_[1,3], '*'], 'Mul' } - ], - [#Rule 53 - 'multexpr', 2, -sub -#line 125 "Farnsworth.yp" -{ bless [ @_[1,2], 'imp'], 'Mul' } - ], - [#Rule 54 - 'multexpr', 4, -sub -#line 128 "Farnsworth.yp" -{ bless [ (bless [$_[1]], 'Fetch'), $_[3], 'imp' ], 'Mul' } - ], - [#Rule 55 - 'multexpr', 3, -sub -#line 129 "Farnsworth.yp" -{ bless [ @_[1,3], ''], 'Mul' } - ], - [#Rule 56 - 'expr', 1, -sub -#line 133 "Farnsworth.yp" -{ $_[1] } - ], - [#Rule 57 - 'expr', 2, -sub -#line 134 "Farnsworth.yp" -{ bless [ $_[2] , (bless ['-1'], 'Num'), '-name'], 'Mul' } - ], - [#Rule 58 - 'expr', 1, undef - ], - [#Rule 59 - 'expr', 3, -sub -#line 136 "Farnsworth.yp" -{ bless [ @_[1,3]], 'Add' } - ], - [#Rule 60 - 'expr', 3, -sub -#line 137 "Farnsworth.yp" -{ bless [ @_[1,3]], 'Sub' } - ], - [#Rule 61 - 'expr', 3, -sub -#line 138 "Farnsworth.yp" -{ bless [ @_[1,3], '/'], 'Div' } - ], - [#Rule 62 - 'expr', 3, -sub -#line 139 "Farnsworth.yp" -{ bless [ @_[1,3], 'per' ], 'Div' } - ], - [#Rule 63 - 'expr', 3, -sub -#line 140 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'Mod' } - ], - [#Rule 64 - 'expr', 3, -sub -#line 141 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'Pow' } - ], - [#Rule 65 - 'expr', 3, -sub -#line 142 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'Pow' } - ], - [#Rule 66 - 'expr', 3, -sub -#line 143 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'Conforms' } - ], - [#Rule 67 - 'expr', 5, -sub -#line 144 "Farnsworth.yp" -{ bless [@_[1,3,5]], 'Ternary' } - ], - [#Rule 68 - 'expr', 3, -sub -#line 145 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'And' } - ], - [#Rule 69 - 'expr', 3, -sub -#line 146 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'Or' } - ], - [#Rule 70 - 'expr', 3, -sub -#line 147 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'Xor' } - ], - [#Rule 71 - 'expr', 2, -sub -#line 148 "Farnsworth.yp" -{ bless [ $_[2] ], 'Not' } - ], - [#Rule 72 - 'expr', 3, -sub -#line 149 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'Lt' } - ], - [#Rule 73 - 'expr', 3, -sub -#line 150 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'Gt' } - ], - [#Rule 74 - 'expr', 3, -sub -#line 151 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'Le' } - ], - [#Rule 75 - 'expr', 3, -sub -#line 152 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'Ge' } - ], - [#Rule 76 - 'expr', 3, -sub -#line 153 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'Eq' } - ], - [#Rule 77 - 'expr', 3, -sub -#line 154 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'Compare' } - ], - [#Rule 78 - 'expr', 3, -sub -#line 155 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'Ne' } - ], - [#Rule 79 - 'expr', 3, -sub -#line 156 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'SetPrefix' } - ], - [#Rule 80 - 'expr', 3, -sub -#line 157 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'SetPrefixAbrv' } - ], - [#Rule 81 - 'expr', 6, -sub -#line 158 "Farnsworth.yp" -{ bless [@_[1,3], (bless [$_[6]], 'Stmt')], 'FuncDef' } - ], - [#Rule 82 - 'expr', 8, -sub -#line 159 "Farnsworth.yp" -{ bless [@_[1,3,7]], 'FuncDef' } - ], - [#Rule 83 - 'expr', 3, -sub -#line 160 "Farnsworth.yp" -{ $_[2] } - ], - [#Rule 84 - 'expr', 1, undef - ], - [#Rule 85 - 'expr', 3, -sub -#line 162 "Farnsworth.yp" -{bless [@_[1,3]], 'LambdaCall'} - ], - [#Rule 86 - 'expr', 3, -sub -#line 164 "Farnsworth.yp" -{ bless [ @_[1,3]], 'Trans' } - ], - [#Rule 87 - 'expr', 1, -sub -#line 165 "Farnsworth.yp" -{ bless [ $_[1] ], 'Date' } - ], - [#Rule 88 - 'expr', 1, -sub -#line 166 "Farnsworth.yp" -{ bless [ $_[1] ], 'String' } - ], - [#Rule 89 - 'expr', 1, undef - ] -], - @_); - bless($self,$class); -} - -#line 169 "Farnsworth.yp" - - -sub yylex - { - #i THINK this isn't what i want, since whitespace is significant in a few areas - #i'm going to instead shrink all whitespace down to no more than one space - #$s =~ s/\G\s{2,}/ /c; #don't need global? - $s =~ /\G\s*(?=\s)/gc; - - #1 while $s =~ /\G\s+/cg; #remove extra whitespace? - - $s =~ m|\G\s*/\*.*?\*/\s*|gcs and redo; #skip C comments - $s =~ m|\G\s*//.*\n?|gc and redo; -# $s =~ s|\G/\*.*?\*/||g; - - #i want a complete number regex - $s =~ /\G(0x[[:xdigit:]]+)/igc and return 'HEXNUMBER', $1; - $s =~ /\G(0b[01]+)/igc and return 'HEXNUMBER', $1; #binary - $s =~ /\G(0[0-7]+)/igc and return 'HEXNUMBER', $1; #octal - $s =~ /\G((\d+(\.\d*)?|\.\d+)([Ee][Ee]?[-+]?\d+))/gc - and return 'NUMBER', $1; - $s =~ /\G((\d+(\.\d*)?|\.\d+))/gc - and return 'NUMBER', $1; - $s =~ /\G(0[xX][0-9A-Fa-f])/gc and return $1; - - #token out the date - $s =~ /\G\s*#([^#]*)#\s*/gc and return 'DATE', $1; - - $s =~ /\G\s*"((\\.|[^"\\])*)"/gc #" bad syntax highlighters are annoying - and return "STRING", $1; - - #i'll probably ressurect this later too - #$s =~ /\G(do|for|elsif|else|if|print|while)\b/cg and return $1; - - $s =~ /\G\s*(while|conforms|else|if)\b\s*/cg and return $1; - - #seperated this to shorten the lines, and hopefully to make parts of it more readable - $s =~ /\G\s*(:=|==|!=|<=>|>=|<=|=>|->|:->|\*\*)\s*/icg and return lc $1; - $s =~ /\G\s*(var\b|per\b|isa\b|byref\b|\:?\:\-|\=\!\=|\|\|\|)\s*/icg and return lc $1; - $s =~ /\G\s*(\})/cg and return $1; - $s =~ /\G\s*(\+|\*|-|\/|\%|\^\^?|=|;|\n|\{\s*\`|\{|\}|\>|\<|\?|\:|\,|\&\&|\|\||\!|\||\.\.\.|\`)\s*/cg and return $1; - $s =~ /\G\s*(\)|\])/cg and return $1; #freaking quirky lexers! - $s =~ /\G(\(|\[)\s*/cg and return $1; - $s =~ /\G(\w[\w\d]*)/cg and return 'NAME', $1; #i need to handle -NAME later on when evaluating, or figure out a sane way to do it here - $s =~ /\G(.)/cgs and return $1; - return ''; - } - - -sub yylexwatch -{ - my @r = &yylex; - #print Dumper(\@r,[pos $s]); - #$charcount+=pos $s; - #$s = substr($s, pos $s); - return @r; -} - -sub yyerror - { - my $pos = pos $s; - substr($fullstring,$pos,0) = '<###YYLEX###>'; - $fullstring =~ s/^/### /mg; - die "### Syntax Error \@ $pos of\n$fullstring\n"; - } - -sub parse - { - $charcount=0; - my $self = shift; - $s = join ' ', @_; - $fullstring = $s; #preserve it for errors - my $code = eval - { $self->new(yylex => \&yylexwatch, yyerror => \&yyerror)->YYParse }; - die $@ if $@; - $code - } - -1; - -# vim: filetype=yacc - -1; diff --git a/deps/Math/Farnsworth/.svn/text-base/Units.pm.svn-base b/deps/Math/Farnsworth/.svn/text-base/Units.pm.svn-base deleted file mode 100644 index d253ef4..0000000 --- a/deps/Math/Farnsworth/.svn/text-base/Units.pm.svn-base +++ /dev/null @@ -1,134 +0,0 @@ -package Math::Farnsworth::Units; - -use strict; -use warnings; - -use Data::Dumper; -use Math::Farnsworth::Value::Pari; -use Math::Pari; -use Math::Farnsworth::Output; - -sub new -{ - #i should make a constructor that copies, but that'll come later - my $self = {units=>{1=>new Math::Farnsworth::Value::Pari(1)}, dimens=>{}}; #hack to make things work right - bless $self; -} - -sub addunit -{ - my $self = shift; - my $name = shift; - my $value = shift; - - $self->{units}{$name} = $value; - $self->{units}{$name."s"} = $value; #HACK! -} - -sub getunit -{ - my $self = shift; - my $name = shift; - - my $return; - - if ($self->_isunit($name)) - { - $return = $self->{units}{$name}; - } - elsif ($self->hasprefix($name)) - { - my ($preval, undef, $realname) = $self->getprefix($name); -# print "GETTING PREFIXES: $name :: $preval :: $realname ::".Dumper($preval, $realname) if (($name eq "mg") || ($name eq "l") || $name eq "milli"); - - $return = $preval * $self->{units}{$realname}; - } - -# print "GETTING UNIT: $name : $return : ".Dumper($return) if (($name eq "mg") || ($name eq "l") || $name eq "milli"); - return $return; -} - -sub hasprefix -{ - my $self = shift; - my $name = shift; - - #sort them by length, solves issues with longer ones not being found first - my @keys = keys %{$self->{prefix}}; - for my $pre (sort {length($b) <=> length($a)} @keys) - { - if ($name =~ /^\Q$pre\E(.*)$/) - { - return 1 if ($self->_isunit($1) || !length($1)); - } - } - return 0; #no prefix! -} - -sub getprefix -{ - my $self = shift; - my $name = shift; - - #sort them by length, solves issues with longer ones not being found first - for my $pre (sort {length($b) <=> length($a)} keys %{$self->{prefix}}) - { - #print "CHECKING PREFIX: $pre\n" if ($name eq "mg"); - if ($name =~ /^\Q$pre\E(.*)$/) - { - my $u = $1; - #print "FOUND: $name == $pre * $u\n"; - #print Dumper($self->{prefix}{$pre}) if ($name eq "mg"); - $u = 1 unless length($1); #to make certain things work right - return ($self->{prefix}{$pre},$pre,$u) if ($self->_isunit($1) || !length($1)); - } - } - return undef; #to cause errors when not there -} - -sub isunit -{ - my $self = shift; - my $name = shift; - - return $self->hasprefix($name) || $self->_isunit($name); -} - -sub _isunit -{ - my $self = shift; - my $name = shift; - return exists($self->{units}{$name}); -} - -sub adddimen -{ - my $self = shift; - my $name = shift; - my $default = shift; #primitive unit for the dimension, all other units are defined against this - my $val = new Math::Farnsworth::Value::Pari(1, {$name => 1}); #i think this is right - Math::Farnsworth::Output::addcombo($name,$val); - $self->{dimens}{$name} = $default; - $self->addunit($default, $val); -} - -#is this useful? yes, need it for display -sub getdimen -{ - my $self = shift; - my $name = shift; - - return $self->{dimens}{$name}; -} - -sub setprefix -{ - my $self = shift; - my $name = shift; - my $value = shift; - - #print "SETTING PREFIX: $name : $value\n" if ($name eq "m"); - $self->{prefix}{$name} = $value; -} - -1; diff --git a/deps/Math/Farnsworth/.svn/text-base/Value.pm.svn-base b/deps/Math/Farnsworth/.svn/text-base/Value.pm.svn-base deleted file mode 100644 index 0b2c723..0000000 --- a/deps/Math/Farnsworth/.svn/text-base/Value.pm.svn-base +++ /dev/null @@ -1,142 +0,0 @@ -#new value class! -package Math::Farnsworth::Value; - -use strict; -use warnings; - -use Carp; -use Data::Dumper; - -use base qw/Exporter/; - -use Math::Farnsworth::Value::Boolean; -use Math::Farnsworth::Value::Array; -use Math::Farnsworth::Value::String; -use Math::Farnsworth::Value::Date; -use Math::Farnsworth::Value::Pari; -use Math::Farnsworth::Value::Lambda; -use Math::Farnsworth::Value::Undef; - -our @EXPORT = qw(TYPE_BOOLEAN TYPE_STRING TYPE_DATE TYPE_PLAIN TYPE_TIME TYPE_LAMBDA TYPE_UNDEF TYPE_ARRAY); - -#### -#THESE FUNCTIONS WILL BE MOVED TO Math::Farnsworth::Value, or somewhere more appropriate - -sub setref -{ - my $self = shift; - my $ref = shift; - $self->{_ref} = $ref; -} - -sub getref -{ - my $self = shift; - return $self->{_ref}; -} - -sub istype -{ - my $self = shift; - my $allow = shift; #type to allow! - - return ref($self) =~ /\Q$allow/i; -} - -sub ismediumtype -{ - my $self = shift; - my $allow = shift; #type to allow! - $allow ||= ""; - - if ($self->isa("Math::Farnsworth::Value::Array") && $allow ne "Array") - { - return 1; - } - elsif ($self->isa("Math::Farnsworth::Value::Boolean") && $allow ne "Boolean") - { - return 1; - } - elsif ($self->isa("Math::Farnsworth::Value::String") && $allow ne "String") - { - return 1; - } - elsif ($self->isa("Math::Farnsworth::Value::Date") && $allow ne "Date") - { - return 1; - } -# promoting Lambda to a High type, so that it can capture the multiplication with other types -# elsif ($self->isa("Math::Farnsworth::Value::Lambda") && $allow ne "Lambda") -# { -# return 1; -# } - elsif ($self->isa("Math::Farnsworth::Value::Undef") && $allow ne "Undef") - { - return 1; - } - - return 0; -} - -#these values will also probably be put into a "memoized" setup so that they don't get recreated all the fucking time - -{ - my $boolean; - my $string; - my $date; - my $plain; - my $time; - my $lambda; - my $undef; - my $array; - - sub TYPE_BOOLEAN{return $boolean if $boolean; $boolean=new Math::Farnsworth::Value::Boolean(0)} - sub TYPE_STRING {return $string if $string; $string=new Math::Farnsworth::Value::String("")} - sub TYPE_DATE {return $date if $date; $date=new Math::Farnsworth::Value::Date("today")} - #this tells it that it is the same as a constraint of "1", e.g. no units - sub TYPE_PLAIN {return $plain if $plain; $plain=new Math::Farnsworth::Value::Pari(0)} - #this tells it that it is the same as a constraint of "1 s", e.g. seconds - sub TYPE_TIME {return $time if $time; $time=new Math::Farnsworth::Value::Pari(0, {time=>1})} - sub TYPE_LAMBDA {return $lambda if $lambda; $lambda=new Math::Farnsworth::Value::Lambda()} - sub TYPE_UNDEF {return $undef if $undef; $undef=new Math::Farnsworth::Value::Undef()} - sub TYPE_ARRAY {return $array if $array; $array=new Math::Farnsworth::Value::Array([])} -} - -sub conforms -{ - my $self = shift; - my $comparator = shift; - - if (ref($self) ne ref($comparator)) - { - return 0; - } - else - { - if (ref($self) eq "Math::Farnsworth::Value::Pari") - { - my $ret = $self->getdimen()->compare($comparator->getdimen()); - return $ret; - } - else - { - return 1; #for now? - } - } -} - -sub clone -{ - my $self = shift; - my $class = ref($self); - - my $newself = {}; - $newself->{$_} = $self->{$_} for (keys %$self); - - bless $newself, $class; - $newself->setref(undef); - - $newself; -} - -1; diff --git a/deps/Math/Farnsworth/.svn/text-base/Value_old.pm.svn-base b/deps/Math/Farnsworth/.svn/text-base/Value_old.pm.svn-base deleted file mode 100644 index 0f76f61..0000000 --- a/deps/Math/Farnsworth/.svn/text-base/Value_old.pm.svn-base +++ /dev/null @@ -1,430 +0,0 @@ -#!/usr/bin/perl - -package Math::Farnsworth::Value; - -use strict; -use warnings; - -use Data::Dumper; - -use Math::Pari; -use Math::Farnsworth::Dimension; -use Date::Manip; -use List::Util qw(sum); -use Storable qw(dclone); - -use utf8; - -our $VERSION = 0.5; - -use overload - '+' => \&add, - '-' => \&subtract, - '*' => \&mult, - '/' => \&div, - '%' => \&mod, - '**' => \&pow, - '<=>' => \&compare, - 'bool' => \&bool; - -sub new -{ - my $class = shift; - my $value = shift; - my $dimen = shift; #should only really be used internally? - my $outmagic = shift; #i'm still not sure on this one - - my $self = {}; - - bless $self, $class; - - $self->{outmagic} = $outmagic; - $self->{valueinput} = $value; - - if (ref($dimen) eq "Math::Farnsworth::Dimension") - { - $self->{dimen} = $dimen; - } - else - { - $dimen = {} if !defined($dimen); - $self->{dimen} = new Math::Farnsworth::Dimension($dimen); - } - - if (exists($self->{dimen}{dimen}{string}) || exists($self->{dimen}{dimen}{date}) || exists($self->{dimen}{dimen}{lambda})) - { - $self->{pari} = $value; - } - elsif (exists($self->{dimen}{dimen}{array})) - { - #we've got an array or date or lambda here - #use dclone() from Storable to make complete copies of everything! -# print "CALLER: ".join("::", caller())."\n"; -# print Dumper($value); - - if (!defined($value)) - { - #warn "OMG \$VALUE IS UNDEFINED!!!!"; - $value = []; - } - - $self->{pari} = [@{$value}]; #this should never not be an array reference - } - elsif (!defined($value)) - { - $self->{pari} = undef; - } - else - { - $value =~ s/ee/e/i; #fixes double ee's - $self->{pari} = PARI $value; - } - - - return $self; -} - -sub toperl -{ - my $self = shift; - - return "".($self->{pari}); #stringifiying it seems to work, though i need cases for arrays! -} - -sub add -{ - my ($one, $two, $rev) = @_; - - #check for $two being a simple value - my $tv = ref($two) && $two->isa("Math::Farnsworth::Value") ? $two->{pari} : $two; - - #i also need to check the units, but that will come later - #NOTE TO SELF this needs to be more helpful, i'll probably do something by adding stuff in ->new to be able to fetch more about the processing - #print Dumper($one->{dimen}, $two->{dimen}); - die "Unable to process different units in addition\n" unless ($one->{dimen}->compare($two->{dimen}) || $one->{dimen}{dimen}{date}); #always call this on one, since $two COULD be some other object - - #moving this down so that i don't do any math i don't have to - - my $new; - if ($one->{dimen}{dimen}{string}) - { - #print Dumper($one, $two); - $new = new Math::Farnsworth::Value($one->{pari} . $tv, $one->{dimen}); - } - elsif ($one->{dimen}{dimen}{array}) - { - die "Adding arrays is undefined behavoir!\n"; - } - elsif ($one->{dimen}{dimen}{bool}) - { - die "Adding Booleans is undefined behavoir!\n"; - } - elsif ($one->{dimen}{dimen}{lambda}) - { - die "Adding Lambdas is undefined behavoir.\n"; - } - elsif (($one->{dimen}{dimen}{date}) && ($two->{dimen}{dimen}{date})) - { - die "Adding of two dates is unsupported\n"; - } - elsif (($one->{dimen}{dimen}{date}) && ($two->{dimen}->compare({dimen=>{time => 1}}))) #check if we are adding time to a date - { - my $seconds = $two->toperl(); #calling WITHOUT the units SHOULD give me a string containing just the number - $seconds =~ s/\..*$//; #filter off fractional parts of a second as Date::Manip hates them - my $sign = $seconds > 0 ? "+" : "-"; #should work fine, even with loss of precision - my $delta = DateCalc($one->{pari}, "$sign $seconds seconds"); #order is switched, to make it work the way I think it should - - $new = new Math::Farnsworth::Value($delta, {date=>1}); - } - else - { - $new = new Math::Farnsworth::Value($one->{pari} + $tv, $one->{dimen}); - } - - return $new; -} - -sub subtract -{ - my ($one, $two, $rev) = @_; - - #check for $two being a simple value - my $tv = ref($two) && $two->isa("Math::Farnsworth::Value") ? $two->{pari} : $two; - - #i also need to check the units, but that will come later - #NOTE TO SELF this needs to be more helpful, i'll probably do something by adding stuff in ->new to be able to fetch more about the processing - die "Unable to process different units in subtraction\n" unless ($one->{dimen}->compare($two->{dimen}) || $one->{dimen}{dimen}{date}); #always call this on one, sinc - - #moving this down so that i don't do any math i don't have to - my $new; - if (!$rev) - { - if (($one->{dimen}{dimen}{date}) && ($two->{dimen}{dimen}{date})) - { - my $delta = DateCalc($two->{pari}, $one->{pari}); #order is switched, to make it work the way I think it should - die "something went screwy with calculating deltas, $delta\n" unless $delta =~ /^[+-](\d+:){6}(\d+)$/; - - my $seconds = new Math::Farnsworth::Value(Delta_Format($delta,1,"%st"), {time => 1}); - $new = $seconds; #create that - } - elsif (($one->{dimen}{dimen}{date}) && ($two->{dimen}->compare({dimen => {time => 1}}))) - { - my $seconds = $two->toperl(); #calling WITHOUT the units SHOULD give me a string containing just the number - $seconds =~ s/\..*$//; #filter off fractional parts of a second as Date::Manip hates them - my $sign = $seconds > 0 ? "-" : "+"; #should work fine, even with loss of precision - my $delta = DateCalc($one->{pari}, "$sign $seconds seconds"); #order is switched, to make it work the way I think it should - - $new = new Math::Farnsworth::Value($delta, {date=>1}); - } - elsif ($one->{dimen}{dimen}{date}) - { - #we reached here with some other subtraction with a Date, do not do it - die "Dates can only have dates and time subtracted, nothing else\n"; - } - elsif ($one->{dimen}{dimen}{array} || $two->{dimen}{dimen}{array}) - { - #we reached here with some other subtraction with a Date, do not do it - die "subtracting arrays is undefined behavior\n"; - } - elsif ($one->{dimen}{dimen}{string} || $two->{dimen}{dimen}{string}) - { - #we reached here with some other subtraction with a Date, do not do it - die "Subtracting strings is undefined behavior\n"; - } - elsif ($one->{dimen}{dimen}{bool} || $two->{dimen}{dimen}{bool}) - { - #we reached here with some other subtraction with a Date, do not do it - die "Subtracting Booleans is undefined behavior\n"; - } - elsif ($one->{dimen}{dimen}{lambda} || $two->{dimen}{dimen}{lambda}) - { - #we reached here with some other subtraction with a Date, do not do it - die "Subtracting lambdas is undefined behavior\n"; - } - else - { - $new = new Math::Farnsworth::Value($one->{pari} - $tv, $one->{dimen}); #if !$rev they are in order - } - } - else - { - die "some mistake happened here in subtraction\n"; #to test later on -# $new = new Math::Farnsworth::Value($tv - $one->{pari}, $one->{dimen}); #if !$rev they are in order - } - return $new; -} - -sub mod -{ - my ($one, $two, $rev) = @_; - - #check for $two being a simple value - my $tv = ref($two) && $two->isa("Math::Farnsworth::Value") ? $two->{pari} : $two; - - #i also need to check the units, but that will come later - #NOTE TO SELF this needs to be more helpful, i'll probably do something by adding stuff in ->new to be able to fetch more about the processing - die "Unable to process different units in modulous\n" unless $one->{dimen}->compare($two->{dimen}); #always call this on one, since $two COULD be some other object - - if ($one->{dimen}->compare({dimen => {string => 1}}) ||$one->{dimen}->compare({dimen => {array =>1}}) || - $two->{dimen}->compare({dimen => {string => 1}}) ||$two->{dimen}->compare({dimen => {array =>1}}) || - $two->{dimen}->compare({dimen => {bool => 1}}) ||$one->{dimen}->compare({dimen => {bool =>1}}) || - $two->{dimen}->compare({dimen => {lambda => 1}}) ||$one->{dimen}->compare({dimen => {lambda =>1}}) || - $two->{dimen}->compare({dimen => {date => 1}}) ||$one->{dimen}->compare({dimen => {date =>1}})) - { - die "Can't divide arrays or strings or booleans or dates or lambdas, it doesn't make sense\n"; - } - - #moving this down so that i don't do any math i don't have to - my $new; - if (!$rev) - { - $new = new Math::Farnsworth::Value($one->{pari} % $tv, $one->{dimen}); #if !$rev they are in order - } - else - { - $new = new Math::Farnsworth::Value($tv % $one->{pari}, $one->{dimen}); #if !$rev they are in order - } - return $new; -} - -sub mult -{ - my ($one, $two, $rev) = @_; - - #check for $two being a simple value - my $tv = ref($two) && $two->isa("Math::Farnsworth::Value") ? $two->{pari} : $two; - my $td = ref($two) && $two->isa("Math::Farnsworth::Value") ? $two->{dimen} : new Math::Farnsworth::Dimension(); - - if ($one->{dimen}->compare({dimen => {string => 1}}) ||$one->{dimen}->compare({dimen => {array =>1}}) || - $td->compare({dimen => {string => 1}}) ||$td->compare({dimen => {array =>1}}) || - $td->compare({dimen => {bool => 1}}) ||$one->{dimen}->compare({dimen => {bool =>1}}) || - $td->compare({dimen => {lambda => 1}}) ||$one->{dimen}->compare({dimen => {lambda =>1}}) || - $td->compare({dimen => {date => 1}}) ||$one->{dimen}->compare({dimen => {date =>1}})) { - die "Can't multiply arrays or strings, it doesn't make sense\n"; - } - - my $nd = $one->{dimen}->merge($td); #merge the dimensions! don't cross the streams though - - #moving this down so that i don't do any math i don't have to - my $new = new Math::Farnsworth::Value($one->{pari} * $tv, $nd); - return $new; -} - -sub div -{ - my ($one, $two, $rev) = @_; - - #check for $two being a simple value - my $tv = ref($two) && $two->isa("Math::Farnsworth::Value") ? $two->{pari} : $two; - my $td = ref($two) && $two->isa("Math::Farnsworth::Value") ? $two->{dimen} : new Math::Farnsworth::Dimension(); - - if ($one->{dimen}->compare({dimen => {string => 1}}) ||$one->{dimen}->compare({dimen => {array =>1}}) || - $td->compare({dimen => {string => 1}}) ||$td->compare({dimen => {array =>1}}) || - $td->compare({dimen => {bool => 1}}) ||$one->{dimen}->compare({dimen => {bool =>1}}) || - $td->compare({dimen => {lambda => 1}}) ||$one->{dimen}->compare({dimen => {lambda =>1}}) || - $td->compare({dimen => {date => 1}}) ||$one->{dimen}->compare({dimen => {date =>1}})) - { - die "Can't divide arrays or strings, it doesn't make sense\n"; - } - - #these are a little screwy SO i'll probably comment them more later - #probably after i find out that they're wrong - my $qd = $rev ? $td : $one->{dimen}; - my $dd = $rev ? $one->{dimen}->invert() : (ref($td) eq "HASH" ? $td : $td->invert()); - - my $nd; - - if (ref($qd) ne "HASH") - { - $nd = $qd->merge($dd); #merge the dimensions! don't cross the streams though - } - else - { - $nd = $dd->merge($qd); #merge them the other way, because $qd is a "HASH" and not an object - } - - #moving this down so that i don't do any math i don't have to - my $new; - if (!$rev) - { - $new = new Math::Farnsworth::Value($one->{pari} / $tv, $nd); #if !$rev they are in order - } - else - { - $new = new Math::Farnsworth::Value($tv / $one->{pari}, $nd); #if !$rev they are in order - } - - return $new; -} - -sub bool -{ - my $self = shift; - - #seems good enough of an idea to me - #i have a bug HERE - #print "BOOLCONV\n"; - #print Dumper($self); - #print "ENDBOOLCONV\n"; - return $self->{pari}?1:0; -} - -sub pow -{ - my ($one, $two, $rev) = @_; - - if ($one->{dimen}->compare({dimen => {string => 1}}) ||$one->{dimen}->compare({dimen => {array =>1}}) || - $two->{dimen}->compare({dimen => {string => 1}}) ||$two->{dimen}->compare({dimen => {array =>1}}) || - $two->{dimen}->compare({dimen => {bool => 1}}) ||$one->{dimen}->compare({dimen => {bool =>1}}) || - $two->{dimen}->compare({dimen => {lambda => 1}}) ||$one->{dimen}->compare({dimen => {lambda =>1}}) || - $two->{dimen}->compare({dimen => {date => 1}}) ||$one->{dimen}->compare({dimen => {date =>1}})) - { - die "Can't exponentiate arrays or strings or dates or bools, it doesn't make sense\n"; - } - - #check for $two being a simple value - my $tv = ref($two) && $two->isa("Math::Farnsworth::Value") ? $two->{pari} : $two; - my $td = ref($two) && $two->isa("Math::Farnsworth::Value") ? $two->{dimen} : undef; - - if (defined($td) && !$td->compare({dimen=>{}})) - { - die "A number with units as the exponent doesn't make sense"; - } - - #moving this down so that i don't do any math i don't have to - my $new; - if (!$rev) - { - $new = new Math::Farnsworth::Value($one->{pari} ** $tv, $one->{dimen}->mult($tv)); #if !$rev they are in order - } - else - { -# print Dumper(\@_); - #print "POW: $tv :: $two :: $one\n"; - $new = new Math::Farnsworth::Value($tv ** $one->{pari}, $one->{dimen}->mult($tv)); #if !$rev they are in order - } - - return $new; -} - -sub compare -{ - my ($one, $two, $rev) = @_; - - my $rv = $rev ? -1 : 1; - #check for $two being a simple value - my $tv = ref($two) && $two->isa("Math::Farnsworth::Value") ? $two->{pari} : $two; - - #i also need to check the units, but that will come later - #NOTE TO SELF this needs to be more helpful, i'll probably do something by adding stuff in ->new to be able to fetch more about the processing - die "Unable to process different units in compare\n" unless $one->{dimen}->compare($two->{dimen}); #always call this on one, since $two COULD be some other object - - #moving this down so that i don't do any math i don't have to - my $new; - - if ($one->{dimen}{dimen}{string}) - { - if ($one->{pari} eq $tv) - { - $new = 0; - } - elsif ($one->{pari} lt $tv) - { - $new = -1; - } - elsif ($one->{pari} gt $tv) - { - $new = 1; - } - } - elsif ($one->{dimen}{dimen}{array}) - { - die "Comparing arrays has not been implemented\n"; - } - elsif ($one->{dimen}{dimen}{lambdas}) - { - die "Comparing lambdas has not been implemented\n"; - } - elsif ($one->{dimen}{dimen}{date}) - { - return Date_Cmp($one->{pari}, $two->{pari}); #does it for me! - } - else - { - if ($one->{pari} == $tv) - { - $new = 0; - } - elsif ($one->{pari} < $tv) - { - $new = -1; - } - elsif ($one->{pari} > $tv) - { - $new =1; - } - } - - return $new; -} - diff --git a/deps/Math/Farnsworth/.svn/text-base/Variables.pm.svn-base b/deps/Math/Farnsworth/.svn/text-base/Variables.pm.svn-base deleted file mode 100644 index 35f9a1d..0000000 --- a/deps/Math/Farnsworth/.svn/text-base/Variables.pm.svn-base +++ /dev/null @@ -1,133 +0,0 @@ -package Math::Farnsworth::Variables; - -use strict; -use warnings; - -use Data::Dumper; -use Carp qw(cluck carp); - -#this is very simple right now but i'll need to make a way to inherit -#variables from an old Math::Farnsworth::Variables class so that i can do -#functions with "scoping" - -sub new -{ - my $class = shift; - my $state = shift; - my $self = {parent => undef, vars => {}}; - $self->{parent} = $state if (ref($state) eq "Math::Farnsworth::Variables"); - bless $self; -} - -sub setvar -{ - my $self = shift; - my $name = shift; - my $value = shift; - - if ((exists($self->{vars}{$name})) || !defined($self->{parent})) - { - if (exists($self->{vars}{$name}) && ref($self->{vars}{$name}) eq "REF") - { - #we've got a reference - ${$self->{vars}{$name}} = $value; - } - else - { - $self->{vars}{$name} = $value; - } - } - else - { - $self->{parent}->setvar($name, $value); #set it in the previous scope - } -} - -sub declare -{ - my $self = shift; - my $name = shift; - my $value = shift; - - if (!defined($name)) - { - cluck "NAME UNDEFINED!\n".Dumper([$self, $name, $value, @_]); - } - - #really all we need to do is just set it in this scope to see it - $self->{vars}{$name} = $value; -} - -sub setref -{ - my $self = shift; - my $name = shift; - - if (!defined($name)) - { - cluck "NAME UNDEFINED!\n".Dumper([$self, $name, @_]); - } - - #really all we need to do is just set it in this scope to see it - $self->{vars}{$name} = $_[0]; #can't set things myself with shift, HAVE to use @_ directly -} - -sub getref -{ - my $self = shift; - my $name = shift; - my $val; - - carp "DEPRECIATED CALL TO Variables->getref()"; - - if (exists($self->{vars}{$name})) - { - $val = \$self->{vars}{$name}; - } - elsif (defined($self->{parent})) - { - $val = $self->{parent}->getref($name); - } - - return $val; -} - -sub getvar -{ - my $self = shift; - my $name = shift; - my $val; - - if (exists($self->{vars}{$name})) - { - $val = $self->{vars}{$name}; - $val->setref(\$self->{vars}{$name}) unless (ref($val) eq "REF"); - } - elsif (defined($self->{parent})) - { - $val = $self->{parent}->getvar($name); - } - - if (ref $val eq "REF") - { #we've got one set by reference - $val = $$val; #deref it for getting its value - } - - return $val; -} - -sub isvar -{ - my $self = shift; - my $name = shift; - - my $r = exists($self->{vars}{$name}); - - if (!exists($self->{vars}{$name}) && defined($self->{parent})) - { - $r = $self->{parent}->isvar($name); - } - - return $r; -} -1; diff --git a/deps/Math/Farnsworth/Dimension.pm b/deps/Math/Farnsworth/Dimension.pm deleted file mode 100644 index a2ec518..0000000 --- a/deps/Math/Farnsworth/Dimension.pm +++ /dev/null @@ -1,138 +0,0 @@ -package Math::Farnsworth::Dimension; - -use strict; -use warnings; - -use Data::Dumper; - -use List::MoreUtils qw(uniq); - -sub new -{ - my $class = shift; - my $dimers = shift; - my $scope = shift; - - my $dims; - { - if (defined($dimers)) - { - $dims = +{%{$dimers}}; #make a shallow copy, i don't feel like debugging this later if somehow i ended up with two objects blessing the same hashref - } - else - { - #none, use empty hash - $dims = {}; - } - } - - my $self = {dimen =>$dims, scope => $scope}; #so i don't have to rewrite a lot of code... NTS: this should probably go away later - - bless $self; -} - -sub compare -{ - my $self = shift; - my $target = shift; - -# print "DIMENWARN: ".join("::", caller())."\n"; -# print Dumper($self, $target); - - if ((!ref($target)) && keys %{$self->{dimen}} == 0) - { - return 1; - } - - if (keys %{$target->{dimen}} == keys %{$self->{dimen}}) #check lengths of keys - { - my $v = 1; - for my $k (keys %{$self->{dimen}}) - { - return 0 if (!exists($target->{dimen}{$k})); #optimization fixes bug! - $v = 0 if (($self->{dimen}{$k} != $target->{dimen}{$k}) && ($k ne "string")); - } - - if ($v) #also check if there are no dimensions - { - return 1; - } - } - - return 0; -} - -sub invert -{ - my $self = shift; - #i CAN'T modify myself in this! - my $atom = $self->new($self->{dimen}); - - for (keys %{$atom->{dimen}}) - { - #turn all positives to negatives and vice versa - $atom->{dimen}{$_} = -$atom->{dimen}{$_}; - } - - return $atom->prune(); -} - -sub merge -{ - my $self = shift; - #i CAN'T modify myself in this! - my $atom = Math::Farnsworth::Dimension->new($self->{dimen}); - - my $partner = shift; - my $pd = {}; - - if (ref($partner) eq "Math::Farnsworth::Dimension") - { - $pd = $partner->{dimen}; - } - - for (uniq (keys %{$atom->{dimen}}, keys %{$pd})) - { - no warnings 'uninitialized'; - $atom->{dimen}{$_} += $partner->{dimen}{$_}; - } - - return $atom->prune(); -} - -sub mult -{ - my $self = shift; - #i CAN'T modify myself in this! - my $atom = Math::Farnsworth::Dimension->new($self->{dimen}); - - my $value = shift; - - for (keys %{$atom->{dimen}}) - { - no warnings 'uninitialized'; - $atom->{dimen}{$_} *= $value; #this might turn them into Math::PARI objects? does it matter? - } - - return $atom->prune(); -} - - -sub prune -{ - my $self = shift; - - for (keys %{$self->{dimen}}) - { - if (!$self->{dimen}{$_}) - { - delete $self->{dimen}{$_}; - } - } - - return $self; -} - -1; - -# vim: filetype=perl diff --git a/deps/Math/Farnsworth/Docs/.svn/entries b/deps/Math/Farnsworth/Docs/.svn/entries deleted file mode 100644 index 73774bc..0000000 --- a/deps/Math/Farnsworth/Docs/.svn/entries +++ /dev/null @@ -1,96 +0,0 @@ -10 - -dir -475 -svn://erxz.com/bb3/branches/perlbuut/deps/Math/Farnsworth/Docs -svn://erxz.com/bb3 - - - -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - -dcb1cea6-7f7e-4c78-8a22-148ace8ce36e - -Syntax.pm -file - - - - -2009-10-03T22:54:20.000000Z -526ef7b28c7025ee558b755359773721 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -18336 - -Functions.pm -file - - - - -2009-10-03T22:54:20.000000Z -746c239e7cdb2520d2ed1e58b2cd3a6c -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -7527 - diff --git a/deps/Math/Farnsworth/Docs/.svn/text-base/Functions.pm.svn-base b/deps/Math/Farnsworth/Docs/.svn/text-base/Functions.pm.svn-base deleted file mode 100644 index 1926b94..0000000 --- a/deps/Math/Farnsworth/Docs/.svn/text-base/Functions.pm.svn-base +++ /dev/null @@ -1,276 +0,0 @@ -1; -__END__ -=head1 NAME - -Math::Farnsworth::Docs::Functions - A big reference to all the functions in the Math::Farnsworth Standard Library - -=head1 DESCRIPTION - -This document is intended to document all of the functions that Math::Farnsworth includes in its standard library. - -=head1 Array Functions - -=head2 push[] - - push[array, elements, ...] - -Push will take an array and place all arguments following the array onto the end. Just like a C. - -=head2 pop[] - - result = pop[array] - -Pop is the antithesis (ED NOTE: need better word!) to push, instead of placing an element on the end of the array, pop[] removes it. - -=head2 unshift[] - - unshift[array, elements, ...] - -Unshift is very similar to pop[]. However instead of putting the elements on the end of the array; unshift puts them at the beginning. - -=head2 shift[] - - shift[array] - -Just as pop is the antithesis (ED NOTE: need better word, STILL!) to push, shift[] is the antithesis to unshift[] - -=head2 sort[] - - sortedarray = sort[elements, ... ] - sortedarray = sort[array] - sortedarray = sort[{`a,b` a <=> b}, elements, ... >] - sortedarray = sort[{`a,b` a <=> b}, array] - -sort[] will take a series of numbers or strings and sort them into either alphabetical or numerical order. -If you give a lambda as the first argument to sort[] it will use that to do all of the logic for comparing each element of the array. -This lambda must perform the comparison in a stable manner or the results will not be deterministic. The lambda must take two arguments and then return either a -1, 0, or 1 as the B=E> operator does. - -=head2 map[] - - mappedarray = map[maplambda, array] - mappedarray = map[maplambda, elements, ...] - mappedarray = map[{`x` x + 10}, array] - mappedarray = map[{`x` x + 10}, elements, ...] - -map[] will take an array or set of elements and pass each element as the first argument to B for B to transform. -B should return the new value for the element to be used in B. - -=head2 length[] - - howmany = length[array] - -When you give length[] and array, it will return how many elements the array has. - -=head2 reverse[] - - reversedarray = reverse[array] - -reverse[] will reverse the order of the elements in array and return the result. - -=head2 min[] and max[] - - minimum = min[array] - minimum = min[elements, ...] - maximum = max[array] - maximum = max[elements, ...] - -These two functions give you the minimum or maximum element from their arguments. - -=head1 String Functions - -=head2 reverse[] - - reversedstring = reverse[string] - -reverse[] will reverse the order of all the characters in the string. - -=head2 length[] - - howlong = length[string] - -When length[] take either a string as its argument it will return the length of the string in characters, this means that a string with unicode characters like B<"日本語"> will have a length of B<3>. - -=head2 ord[] - - codepoint = ord[string] - -ord[] will give you the unicode codepoint of the first character of the string you pass it. - -=head2 chr[] - - string = chr[codepoint] - -chr[] will take a unicode codepoint and give you back a string containing only that character. - -=head2 index[] - - position = index[string, substring] - position = index[string, substring, pos] - -index[] will search in B for the first occurance of B and return its B. If B is not found in B it will return -1. -The optional parameter B will tell index how far into the string to start looking, 0 being the start of the string. - -=head2 eval[] - - result = eval[string] - -eval[] will take a string and evaluate it as if it were the Math::Farnsworth language and return the result. - -=head2 substrLen[] - - substring = substrLen[string, start, length] - -substrLen[] will pull out a part of B that starts at B and is B characters. If B is longer than the end of B then it will B will only contain the text up until the end of the string. - -=head2 substr[] - - substring = substr[string, start, end] - -substr[] will pull out a part of B that starts at B and ends at B - -=head2 left[] - - substring = left[string, length] - -left[] returns the left 'B' characters from 'B'. - -=head2 right[] - - substring = right[string, length] - -right[] returns the right 'B' characters from 'B'. - -=head1 Math Functions - -=head2 Trigonometry Functions - - sin[x] csc[x] - cos[x] sec[x] - tan[x] cot[x] - atan[x] arctan[x] - acos[x] arccos[x] - asin[x] arcsin[x] - - sinh[x] - cosh[x] - tanh[x] - atanh[x] arctanh[x] - acosh[x] arccosh[x] - asinh[x] arcsinh[x] - - atan2[x, y] - -I will not go into a detailed explination of what these functions are. They are the basic trigonometric functions, they all take a single number in and return the result. -atan2[x,y] is best explained by wikipedia L. - -=head2 Miscellaneous Math Functions - - sqrt[x] - -Returns the square root of B - - exp[x] - -Returns B. - - ln[x] - -Returns the natural logarithm of B - - log[x] - -returns the logarithm base 10 of B - - abs[x] - -Returns the absolute value of B - - gcd[x, y] - -Returns the greatest common divisor of B and B - - lcm[x, y] - -Returns the lowest common multiple of B and B - - quad[a, b, c] - quadratic[a, b, c] - -Returns an array containing the two solutions to the quadratic equation described by the equation - - a x^2 + b x + c - -=head2 Rounding Functions - - floor[x] ceil[x] - int[x] trunc[x] - - rint[x] round[x, digits] - -floor[] and ceil[] do what they say they do. Both int[] and trunc[] will in fact just truncate a floating point number to an integer, dropping all digits past the decimal point. -rint[] will round the to the nearest integer. round[x, digits] will round to a specified number of digits, 0 being an integer 1 meaning having one digit past the decimal point. - -=head2 Functions for Rational Numbers - - numerator[x] - denominator[x] - -Because Math::Farnsworth uses L internally for doing all calculations numbers may be represented as a rational number when possible rather than a floating point number in order to preserve precision. -When used on floating point numbers numerator[] will return the number back to you, and denominator[] will return 1. - -=head2 Prime Numbers - - isprime[x] - -Returns true if B is a prime number. - - prime[x] - -Returns the Bth prime number. - - nextprime[x] - -Returns the next prime number after B - - precprimep[x] - -Returns the preceeding prime number before B - -=head2 Complex Number Math Functions - - conj[x] # conjugate - norm[x] # normal - real[x] # gives back the real part of a complex number - imag[x] # gives back the imaginary part of a complex number - -=head2 Random Number Functions - - randmax[x] - -randmax[x] returns a random number between 0 and B. - - getrseed[] - -returns the current seed for the random number generator. - - setrseed[x] - -sets the seed for the random number generator to B. - - random[] - -returns a random number between 0 and 1 with 30 digits of precision (e.g. 10**30 different random numbers). - -=head1 Miscellaneous Functions - -=head2 now[] - - now[] - -now[] returns the current date and time as a Math::Farnsworth Date value. - -=head2 unit[] - - unit[unit] - -unit[] takes the name of a unit B as a string (in future releases it will take it as a string or barename), and will always return the value of the unit[] named as such. This allows you to have access to a unit even when someone has carelessly defined a variable that stomps on that unit. diff --git a/deps/Math/Farnsworth/Docs/.svn/text-base/Syntax.pm.svn-base b/deps/Math/Farnsworth/Docs/.svn/text-base/Syntax.pm.svn-base deleted file mode 100644 index a492e47..0000000 --- a/deps/Math/Farnsworth/Docs/.svn/text-base/Syntax.pm.svn-base +++ /dev/null @@ -1,405 +0,0 @@ -1; -__END__ -# Below is stub documentation for your module. You'd better edit it! - -=head1 NAME - -Math::Farnsworth::Docs::Syntax - A bunch of examples of all the syntax in Math::Farnsworth - -=head1 SYNOPSIS - -This document is intended to help you understand how Math::Farnsworth syntax looks - -=head1 DESCRIPTION - -Math::Farnsworth is a programming language originally inspired by Frink (see http://futureboy.homeip.net/frinkdocs/ ). -However due to certain difficulties during the creation of it, the syntax has changed slightly and the capabilities are also different. -Some things Math::Farnsworth can do a little better than Frink, other areas Math::Farnsworth lacks (sometimes greatly). - -=head2 IMPLICIT MULTIPLICATION - -In Math::Farnsworth two tokens that are separated by a space or parenthesis are - -=head2 VARIABLES - -Variables in Math::Farnsworth are pretty simple to understand - - a = 1 - b = a + a - c = b * b - -You can also explicitly declare a variable so that it will only stay local to the scope that it is defined in, this allows you to define a variable that won't cause problems for anybody calling a function or lambda - - var i; - var x = 10; - -=cut -#find some way to work this in, it sounds good -# -#[00:53:24] simcop2387: what does " 10 * meters -#[00:53:33] " mean on the backend? -#[00:54:23] I thought "10 meteres" is a single unit.. -#[00:55:14] nope, 10 is a number, and meters is just a unit, they get multiplied together to make a value that carries the meters with it -#[00:55:38] what do you call the resulting value? -#[00:55:52] 10 meters -#[00:56:05] i'm not entirely sure what you're asking... -#[00:56:15] i've have an idea but its very vague -#[00:56:17] what do you call the structure which composes those values? -#[00:56:29] a "measurement" or what? -#[00:56:33] i guess -#[00:56:40] never really thought about it -#[00:57:00] might just be me. seems like it should have a name though -#[00:57:34] i think measurement would be correct, not sure where/how to fit it into the document yet -#[00:57:43] good thing to note around though -=pod - -=head3 Strings - -Like all good programming languages Math::Farnsworth has strings - - "Text goes here" - -=head4 String Escapes - -Math::Farnsworth currently only supports two escapes, this will be rectified in future versions of Math::Farnsworth but was not a priority for the first release which is intended to just be not much more than a proof of concept - - \" # to escape a quote inside a string - \\ # to escape a backslash inside a string - -=head4 Variable Interpolation - -Math::Farnsworth also supports interpolating variables inside of a string so that you can either stringify a number or just use them to produce nicer output. -The syntax looks something like this - - "There are $days until Halloween" - -Upon evaluating that string B<$days> will be replaced by the value of the variable B - -=head4 Expression Interpolation - -Math::Farnsworth also supports simple expressions to be interpolated inside of a string itself, the syntax is very similar to variable interpolation and can be used to interpolate a variable when you don't want to have some space around it. - - "One foot is the same as ${1.0 foot -> \"meters\"}." - -And the result will look like. - - "One foot is the same as 0.3048 meters." - -=head3 Dates - -Math::Farnsworth also supports dates as an inherent feature of the language meaning that you can use Math::Farnsworth to perform calculations involving dates -The syntax looks like this - - #March 3rd, 2008# - #2008-12-25# + 1 year - -Math::Farnsworth uses Date::Manip to do the parsing and calculations involving dates, so it can parse and work with any date format that Date::Manip supports - -=head3 Arrays - -Arrays in Math::Farnsworth are pretty simple to understand and create - - [element, element, element, ...] - -You can have any number of elements and they can contain anything that you can store in a variable (currently the only thing you cannot store in a variable is a function, but there is a solution to that, see below about Lambdas) - -=head4 Accessing elements of the Array - - NOTE: This section and its syntax is VERY likely to change in future releases - -You can access elements of arrays with syntax that looks like this - - a = [1,2,3] - b = a@0$ - -You can also do an array slice by putting multiple elements in between the @ and $. For example: - - a = [1,2,3] - b = a@0,2,1$ - -=head2 OPERATORS - -The Farnsworth Language is a simple language to learn, the basic operators +-/* are all there and do exactly what you think they should do (assuming you know any math or have programmed before) - -There are however two additional operators that you should be aware of to start with - -=head3 Logical Operators - -Farnsworth has logical operators for dealing with boolean values, it has the standard ones B<||> for OR, and B<&&> for AND, and B for NOT. It also has one more additional one B<^^> for XOR as I've found that to be useful in many situations - -=head3 per - -This is almost exactly the same as the division operator except that it has a different precedence. This allows you to do things like - - 10 meters per 3 hours - -This means the same as - - 10 meters / (3 hours) - -but it can be much easier to understand - -=head3 Implicit Multiplication - -White space or parenthesis between things (numbers, variables, function calls, etc.) means that you want to implicitly multiply the two tokens - - 10 meters - -is the same as - - 10 * meters - -note that space around operators such as +-*/ does not imply multiplication, this means that if you wanted to multiply something by a negative number you MUST use a *, otherwise it will think you want to subtract - -=head2 Functions - -Like most reasonable programming languages Math::Farnsworth has functions, the standard library contains many math related functions see L for a reference of them - -=head3 Defining - -To define a function you'll want to do something like this - - f{x} := x+x - -First we've got 'B' which is the name of the function, then we've got this weird little part following it 'B<{x}>' this defines the arguments that the functions takes, in this case its a single argument named 'B', next we've got 'B<:=>' this is the assignment operator for defining a function (it is also used for units, but we'll cover that later) then we've got the expression 'B' which is what the function actually does, in this case we're adding the argument to the function to itself - -Now lets have a look at a slightly more complicated function - - max{x,y} := { var z; if (x > y) {z = x} else {z = y}; z} - -here we've got a function 'B' that takes two arguments, 'B' and 'B', then we've got something new on the right side, 'B<{ var z; if (x E y) {z = x} else {z = y}; z}>', we've surrounded the expression on the right with ' B<{ }> ', this lets us use multiple statements to build up the function if you've programmed before you'll realize that we're separating each expression with a 'B<;>' - -the very last expression that gets evaluated, in this case, 'B' is what the function returns (NOTE: there are plans to add the ability to return at any point in the function but those have not been implemented yet) - -=head3 Calling Functions - -After defining a function you really should be able to call them shouldn't you? there are two basic ways to call functions in Farnsworth - -The simplest way is this - - max[1,2] - -this will call the function 'B' with the arguments 'B<1>'and 'B<2>' - -There is also another way to call functions indirectly, this way shouldn't be used in most cases as it can be confused with unit conversions which we will cover later - - [1,2] -> max - 10 -> f - -both of these methods call the functions to the right of 'B<-E>' using the expressions on the left as arguments. -This method should be used sparingly because it can be ambiguous and can actually cause problems when there is a unit the same name as a function that just happens to allow a proper conversion. -In the standard library there is a unit B (short for B) that will cause the following example to not work properly - - f{x} := {x * x} - 10 -> f - -This will not in fact call the function B, but will end up telling you how many Bs will fit into B<10>. -This is however a good way to do certain things that APPEAR to be a conversion between two things, but don't easily convert because there's some other factor involved. -Temperature conversions between Celsius and Kelvin are possible this way. - - C{x} := (x / K) - 273.15 - 10 K -> C - -and you'll get back the result B<-263.15>. That kind of conversion isn't possible to do with standard units as you'll begin to understand below. - -=head3 Default Parameters - -Arguments to functions in Math::Farnsworth can have default parameters so that they don't always have to be specified explicitly. -They are set when you create the function by setting the arguments equal to the default value - - f{x = 1} := {x * x} - -=head3 Type Constraints - -Arguments can also be told that they have to be of a certain type in order to be given to a function, otherwise an exception is raised and the execution of the code stops - -These also are create at the time you define the function - - f{x isa meter} := {x per 10 seconds} - -Currently type constraints have to be some expression that describes the type of input you are expecting, in this case we used "meter" however meter describes a length, and any expression that describes a length can be used as the argument to the function e.g. - - f[10 feet] - -is perfectly valid. There are plans to implement the ability to say something like 'B however they have not been implemented yet. -You can combine default arguments and constraints by specifying the default argument first, e.g. - - f{x = 10 cm isa meter} := {x per 10 seconds} - -=head3 Variable Number of Arguments - -Sometimes you want to be able to take any number of arguments in order to perform some action on many different things, this is possible in Math::Farnsworth. -You can do this by adding a constraint to the last argument to the function. - - dostuff{x, y isa ...} := {/*something*/}; - -From this example you can see that we use the type constraint 'B<...>'. What this does is tell Math::Farnsworth to take any additional arguments and place them into an array and pass that array as the variable B. -Here's an example of what use this can be to do something like recreate the C function from perl. - - map{sub isa {`x`}, x isa ...} := {var e; var out=[]; while(e = shift[x]) {push[out, (e => sub)]}; out}; - map[{`x` x+1}, 1,2,3]; - -What we've got here is the first argument B must be a Lambda (see below for more information on them). And the second argument swallows up ALL of the other arguments to the function allowing you to take any number of them. - -=head2 Units - -What are units? -Units are things like: inches, feet, meters, gallons, volts, liters, etc. - -Farnsworth tracks units throughout all calculations that you do with it this allows you to do things like add two lengths together, or multiply them to get an area. - -It also does unit conversions along the way allowing you to do things like 'B<1 foot + 12 inches> ' and Farnsworth will handle it for you correctly. - -Farnsworth handles this by converting everything into a single base unit when performing calculations, in the case of lengths it represents them all as meters - -=head3 Unit Conversions - -Since Farnsworth represents everything as a single unit it will always want to give you back your calculations in that base unit; This isn't always what you want. So you can tell it to convert between the units to get exactly what you are after. - - 1 foot + 12 inches - -When doing that calculation you would most likely want your answer back in 'B', however farnsworth gives you back something like - - 0.6096 m - -Now what the heck is that? You wanted feet didn't you? This is what the 'B<-E>' operator is for, it will make farnsworth tell you the result in any unit you wish, so lets try this again - - 1 foot + 12 inches -> feet - -and Farnsworth gives you back the single number 'B<2>'. That's the correct answer, but what if you wanted it to tell you 'B<2 feet>' instead? you can do this by putting the unit you want the result in in quotes that will tell Farnsworth that you want the answer to contain the unit also. So lets do this one more time - - 1 foot + 12 inches -> "feet" - -And Farnsworth will give you back - - 2 feet - -=head3 Unit Definitions - -Now that you know how to convert between units, lets talk about how to create your own, the basic syntax is - - UnitName := Expression - -This allows you to create any unit you would desire, say you want to be able to use smoots to measure things? - - smoot := 5 feet + 7 inches - -now you can talk about measurements like 'B<6.5 smoots>' in any other calculation, or convert any distance to smoots, e.g. 'B<1 au -E "smoots"> ' - -=head3 Unit Prefixes - -Farnsworth also supports the SI standard prefixes such as kilo, centi, nano, etc. - -It however supports them on ALL units, so you can in fact say 'B<1 kilosmoot>' to mean 1000 smoots. - -you can also define your own prefixes by doing this - - kibi :- 1024 - mibi :- 1024 * 1024 - -This allows you to add any prefixes you need to make a calculation simple and easy to do - -NOTE: bits and bytes use the SI units of 1000 for kilobit, megabit, etc. to get the normal meaning of 1024 instead, use the of prefixes such as kibibit, mebibyte, etc. see http://en.wikipedia.org/wiki/Binary_prefix for more information on them. - -=head3 More Advanced Unit Manipulation - -You can also define your own basic units like length, time and mass, you do this by syntax like the following - - name =!= basicunit - -'B' is some unique name for the type of measurement that is going to be represented and 'B' is the primary unit of measure for this "dimension" - -so lets say we wanted to be able to count pixels as units - - pixels =!= pixel - -and now you've got a basic unit B that you can use to define other things like how many pixels are in a VGA screen - - VGA := 640 * 480 pixels - -=head2 Flow Control - -Like all useful programming languages Math::Farnsworth has ways to do loops and branching - -=head3 If - -As you've seen above Math::Farnsworth does have B statements, they look very similar to the languages C or Perl or Java - - if ( condition ) { statements to run if the previous condition is true } else { the optional else clause to run if the previous condition is false }; - if (x > y) {z = x} else {z = y}; - -The braces around the statements are necessary as they are in Perl and Java. -You also need to have a semi-colon after the braces when you want to begin the next statement. - -=head3 While - -Farnsworth also has loops, they look exactly like they do in C or Perl or Java - - while ( condition ) { statements to run while the condition is true } - -This is currently the only kind of loop that exists in Farnsworth, however ALL types of loops can be made from this, which is an exercise currently outside the scope of this document -The braces around the statements are necessary as they are in Perl and Java. As with Bs you also need to have a semi-colon after the braces when you want to begin the next statement. - -NOTE: for loops are definitely going to be added, i just haven't gotten to them yet. - -=head2 Lambdas - -Lambdas are a very neat feature of the Math::Farnsworth language, they are best described as something very similar to a subroutine reference in perl. -When you create a lambda it keeps the environment with it that it was defined in (as far as variables are concerned anyway). This allows you to do things like create static variables between calls - -Note: if anyone can think of a better name for these feel free to contact me about it. -Also Note: the syntax for them MIGHT change as i begin to learn how to rewrite the parser to be smarter and fix a number of problems i have with it - -=head3 Defining a Lambda - -The basic syntax for defining a lambda is similar to how functions are defined - - variable = {`arguments` statements}; - distance = {`x, y` sqrt[x * x + y * y]}; - -As you can see here, a lambda is actually stored inside a variable rather than a different namespace like functions are, this allows you to have a variable contain the lambda and use it only inside the scope it was defined in, this also allows for fun results when nesting lambdas - -=head3 Calling Lambdas - -Calling a lambda is fairly simple, the syntax looks a lot like the syntax for doing unit conversion or calling a function implicitly. - - argument => lambda - [arguments] => lambda - -This syntax also makes it easy to chain several lambdas up to do multiple calculations and have the order of execution blatantly obvious - - [arguments] => lambda1 => lambda2 => lambda3 - -=head3 Nesting Lambdas - -Since i've mentioned it before and example is necessary of what nesting a lambda really means - - index = ([] => {`` var count=0; {`` count = count + 1}}); - -What we've got here is a lambda call inside of an expression that returns a lambda. Since lambdas carry the scopes that they were defined in around with them the lambda that B contains has access to the variable B and since it was defined outside of the nested lambda it does not get reset between calls, allowing it to continue incrementing B over and over. -And because B was declared in the first lambda it isn't available to anything outside of that scope, meaning that B cannot be altered by anything other than the lambda that B now contains. - -=head1 SEE ALSO - -L -L -L -L - -There is also an RT tracker for the module (this may change) setup at -L, you can also reach the tracker by sending an email to Efarnsworth.rt@gmail.comE - -=head1 AUTHOR - -Ryan Voots Esimcop@cpan.orgE - -=head1 COPYRIGHT AND LICENSE - -Copyright (C) 2008 by Ryan Voots - -This library is free software; you can redistribute it and/or modify -it under the same terms as Perl itself, either Perl version 5.8.0 or, -at your option, any later version of Perl 5 you may have available. - - -=cut diff --git a/deps/Math/Farnsworth/Docs/Functions.pm b/deps/Math/Farnsworth/Docs/Functions.pm deleted file mode 100644 index 1926b94..0000000 --- a/deps/Math/Farnsworth/Docs/Functions.pm +++ /dev/null @@ -1,276 +0,0 @@ -1; -__END__ -=head1 NAME - -Math::Farnsworth::Docs::Functions - A big reference to all the functions in the Math::Farnsworth Standard Library - -=head1 DESCRIPTION - -This document is intended to document all of the functions that Math::Farnsworth includes in its standard library. - -=head1 Array Functions - -=head2 push[] - - push[array, elements, ...] - -Push will take an array and place all arguments following the array onto the end. Just like a C. - -=head2 pop[] - - result = pop[array] - -Pop is the antithesis (ED NOTE: need better word!) to push, instead of placing an element on the end of the array, pop[] removes it. - -=head2 unshift[] - - unshift[array, elements, ...] - -Unshift is very similar to pop[]. However instead of putting the elements on the end of the array; unshift puts them at the beginning. - -=head2 shift[] - - shift[array] - -Just as pop is the antithesis (ED NOTE: need better word, STILL!) to push, shift[] is the antithesis to unshift[] - -=head2 sort[] - - sortedarray = sort[elements, ... ] - sortedarray = sort[array] - sortedarray = sort[{`a,b` a <=> b}, elements, ... >] - sortedarray = sort[{`a,b` a <=> b}, array] - -sort[] will take a series of numbers or strings and sort them into either alphabetical or numerical order. -If you give a lambda as the first argument to sort[] it will use that to do all of the logic for comparing each element of the array. -This lambda must perform the comparison in a stable manner or the results will not be deterministic. The lambda must take two arguments and then return either a -1, 0, or 1 as the B=E> operator does. - -=head2 map[] - - mappedarray = map[maplambda, array] - mappedarray = map[maplambda, elements, ...] - mappedarray = map[{`x` x + 10}, array] - mappedarray = map[{`x` x + 10}, elements, ...] - -map[] will take an array or set of elements and pass each element as the first argument to B for B to transform. -B should return the new value for the element to be used in B. - -=head2 length[] - - howmany = length[array] - -When you give length[] and array, it will return how many elements the array has. - -=head2 reverse[] - - reversedarray = reverse[array] - -reverse[] will reverse the order of the elements in array and return the result. - -=head2 min[] and max[] - - minimum = min[array] - minimum = min[elements, ...] - maximum = max[array] - maximum = max[elements, ...] - -These two functions give you the minimum or maximum element from their arguments. - -=head1 String Functions - -=head2 reverse[] - - reversedstring = reverse[string] - -reverse[] will reverse the order of all the characters in the string. - -=head2 length[] - - howlong = length[string] - -When length[] take either a string as its argument it will return the length of the string in characters, this means that a string with unicode characters like B<"日本語"> will have a length of B<3>. - -=head2 ord[] - - codepoint = ord[string] - -ord[] will give you the unicode codepoint of the first character of the string you pass it. - -=head2 chr[] - - string = chr[codepoint] - -chr[] will take a unicode codepoint and give you back a string containing only that character. - -=head2 index[] - - position = index[string, substring] - position = index[string, substring, pos] - -index[] will search in B for the first occurance of B and return its B. If B is not found in B it will return -1. -The optional parameter B will tell index how far into the string to start looking, 0 being the start of the string. - -=head2 eval[] - - result = eval[string] - -eval[] will take a string and evaluate it as if it were the Math::Farnsworth language and return the result. - -=head2 substrLen[] - - substring = substrLen[string, start, length] - -substrLen[] will pull out a part of B that starts at B and is B characters. If B is longer than the end of B then it will B will only contain the text up until the end of the string. - -=head2 substr[] - - substring = substr[string, start, end] - -substr[] will pull out a part of B that starts at B and ends at B - -=head2 left[] - - substring = left[string, length] - -left[] returns the left 'B' characters from 'B'. - -=head2 right[] - - substring = right[string, length] - -right[] returns the right 'B' characters from 'B'. - -=head1 Math Functions - -=head2 Trigonometry Functions - - sin[x] csc[x] - cos[x] sec[x] - tan[x] cot[x] - atan[x] arctan[x] - acos[x] arccos[x] - asin[x] arcsin[x] - - sinh[x] - cosh[x] - tanh[x] - atanh[x] arctanh[x] - acosh[x] arccosh[x] - asinh[x] arcsinh[x] - - atan2[x, y] - -I will not go into a detailed explination of what these functions are. They are the basic trigonometric functions, they all take a single number in and return the result. -atan2[x,y] is best explained by wikipedia L. - -=head2 Miscellaneous Math Functions - - sqrt[x] - -Returns the square root of B - - exp[x] - -Returns B. - - ln[x] - -Returns the natural logarithm of B - - log[x] - -returns the logarithm base 10 of B - - abs[x] - -Returns the absolute value of B - - gcd[x, y] - -Returns the greatest common divisor of B and B - - lcm[x, y] - -Returns the lowest common multiple of B and B - - quad[a, b, c] - quadratic[a, b, c] - -Returns an array containing the two solutions to the quadratic equation described by the equation - - a x^2 + b x + c - -=head2 Rounding Functions - - floor[x] ceil[x] - int[x] trunc[x] - - rint[x] round[x, digits] - -floor[] and ceil[] do what they say they do. Both int[] and trunc[] will in fact just truncate a floating point number to an integer, dropping all digits past the decimal point. -rint[] will round the to the nearest integer. round[x, digits] will round to a specified number of digits, 0 being an integer 1 meaning having one digit past the decimal point. - -=head2 Functions for Rational Numbers - - numerator[x] - denominator[x] - -Because Math::Farnsworth uses L internally for doing all calculations numbers may be represented as a rational number when possible rather than a floating point number in order to preserve precision. -When used on floating point numbers numerator[] will return the number back to you, and denominator[] will return 1. - -=head2 Prime Numbers - - isprime[x] - -Returns true if B is a prime number. - - prime[x] - -Returns the Bth prime number. - - nextprime[x] - -Returns the next prime number after B - - precprimep[x] - -Returns the preceeding prime number before B - -=head2 Complex Number Math Functions - - conj[x] # conjugate - norm[x] # normal - real[x] # gives back the real part of a complex number - imag[x] # gives back the imaginary part of a complex number - -=head2 Random Number Functions - - randmax[x] - -randmax[x] returns a random number between 0 and B. - - getrseed[] - -returns the current seed for the random number generator. - - setrseed[x] - -sets the seed for the random number generator to B. - - random[] - -returns a random number between 0 and 1 with 30 digits of precision (e.g. 10**30 different random numbers). - -=head1 Miscellaneous Functions - -=head2 now[] - - now[] - -now[] returns the current date and time as a Math::Farnsworth Date value. - -=head2 unit[] - - unit[unit] - -unit[] takes the name of a unit B as a string (in future releases it will take it as a string or barename), and will always return the value of the unit[] named as such. This allows you to have access to a unit even when someone has carelessly defined a variable that stomps on that unit. diff --git a/deps/Math/Farnsworth/Docs/Syntax.pm b/deps/Math/Farnsworth/Docs/Syntax.pm deleted file mode 100644 index a492e47..0000000 --- a/deps/Math/Farnsworth/Docs/Syntax.pm +++ /dev/null @@ -1,405 +0,0 @@ -1; -__END__ -# Below is stub documentation for your module. You'd better edit it! - -=head1 NAME - -Math::Farnsworth::Docs::Syntax - A bunch of examples of all the syntax in Math::Farnsworth - -=head1 SYNOPSIS - -This document is intended to help you understand how Math::Farnsworth syntax looks - -=head1 DESCRIPTION - -Math::Farnsworth is a programming language originally inspired by Frink (see http://futureboy.homeip.net/frinkdocs/ ). -However due to certain difficulties during the creation of it, the syntax has changed slightly and the capabilities are also different. -Some things Math::Farnsworth can do a little better than Frink, other areas Math::Farnsworth lacks (sometimes greatly). - -=head2 IMPLICIT MULTIPLICATION - -In Math::Farnsworth two tokens that are separated by a space or parenthesis are - -=head2 VARIABLES - -Variables in Math::Farnsworth are pretty simple to understand - - a = 1 - b = a + a - c = b * b - -You can also explicitly declare a variable so that it will only stay local to the scope that it is defined in, this allows you to define a variable that won't cause problems for anybody calling a function or lambda - - var i; - var x = 10; - -=cut -#find some way to work this in, it sounds good -# -#[00:53:24] simcop2387: what does " 10 * meters -#[00:53:33] " mean on the backend? -#[00:54:23] I thought "10 meteres" is a single unit.. -#[00:55:14] nope, 10 is a number, and meters is just a unit, they get multiplied together to make a value that carries the meters with it -#[00:55:38] what do you call the resulting value? -#[00:55:52] 10 meters -#[00:56:05] i'm not entirely sure what you're asking... -#[00:56:15] i've have an idea but its very vague -#[00:56:17] what do you call the structure which composes those values? -#[00:56:29] a "measurement" or what? -#[00:56:33] i guess -#[00:56:40] never really thought about it -#[00:57:00] might just be me. seems like it should have a name though -#[00:57:34] i think measurement would be correct, not sure where/how to fit it into the document yet -#[00:57:43] good thing to note around though -=pod - -=head3 Strings - -Like all good programming languages Math::Farnsworth has strings - - "Text goes here" - -=head4 String Escapes - -Math::Farnsworth currently only supports two escapes, this will be rectified in future versions of Math::Farnsworth but was not a priority for the first release which is intended to just be not much more than a proof of concept - - \" # to escape a quote inside a string - \\ # to escape a backslash inside a string - -=head4 Variable Interpolation - -Math::Farnsworth also supports interpolating variables inside of a string so that you can either stringify a number or just use them to produce nicer output. -The syntax looks something like this - - "There are $days until Halloween" - -Upon evaluating that string B<$days> will be replaced by the value of the variable B - -=head4 Expression Interpolation - -Math::Farnsworth also supports simple expressions to be interpolated inside of a string itself, the syntax is very similar to variable interpolation and can be used to interpolate a variable when you don't want to have some space around it. - - "One foot is the same as ${1.0 foot -> \"meters\"}." - -And the result will look like. - - "One foot is the same as 0.3048 meters." - -=head3 Dates - -Math::Farnsworth also supports dates as an inherent feature of the language meaning that you can use Math::Farnsworth to perform calculations involving dates -The syntax looks like this - - #March 3rd, 2008# - #2008-12-25# + 1 year - -Math::Farnsworth uses Date::Manip to do the parsing and calculations involving dates, so it can parse and work with any date format that Date::Manip supports - -=head3 Arrays - -Arrays in Math::Farnsworth are pretty simple to understand and create - - [element, element, element, ...] - -You can have any number of elements and they can contain anything that you can store in a variable (currently the only thing you cannot store in a variable is a function, but there is a solution to that, see below about Lambdas) - -=head4 Accessing elements of the Array - - NOTE: This section and its syntax is VERY likely to change in future releases - -You can access elements of arrays with syntax that looks like this - - a = [1,2,3] - b = a@0$ - -You can also do an array slice by putting multiple elements in between the @ and $. For example: - - a = [1,2,3] - b = a@0,2,1$ - -=head2 OPERATORS - -The Farnsworth Language is a simple language to learn, the basic operators +-/* are all there and do exactly what you think they should do (assuming you know any math or have programmed before) - -There are however two additional operators that you should be aware of to start with - -=head3 Logical Operators - -Farnsworth has logical operators for dealing with boolean values, it has the standard ones B<||> for OR, and B<&&> for AND, and B for NOT. It also has one more additional one B<^^> for XOR as I've found that to be useful in many situations - -=head3 per - -This is almost exactly the same as the division operator except that it has a different precedence. This allows you to do things like - - 10 meters per 3 hours - -This means the same as - - 10 meters / (3 hours) - -but it can be much easier to understand - -=head3 Implicit Multiplication - -White space or parenthesis between things (numbers, variables, function calls, etc.) means that you want to implicitly multiply the two tokens - - 10 meters - -is the same as - - 10 * meters - -note that space around operators such as +-*/ does not imply multiplication, this means that if you wanted to multiply something by a negative number you MUST use a *, otherwise it will think you want to subtract - -=head2 Functions - -Like most reasonable programming languages Math::Farnsworth has functions, the standard library contains many math related functions see L for a reference of them - -=head3 Defining - -To define a function you'll want to do something like this - - f{x} := x+x - -First we've got 'B' which is the name of the function, then we've got this weird little part following it 'B<{x}>' this defines the arguments that the functions takes, in this case its a single argument named 'B', next we've got 'B<:=>' this is the assignment operator for defining a function (it is also used for units, but we'll cover that later) then we've got the expression 'B' which is what the function actually does, in this case we're adding the argument to the function to itself - -Now lets have a look at a slightly more complicated function - - max{x,y} := { var z; if (x > y) {z = x} else {z = y}; z} - -here we've got a function 'B' that takes two arguments, 'B' and 'B', then we've got something new on the right side, 'B<{ var z; if (x E y) {z = x} else {z = y}; z}>', we've surrounded the expression on the right with ' B<{ }> ', this lets us use multiple statements to build up the function if you've programmed before you'll realize that we're separating each expression with a 'B<;>' - -the very last expression that gets evaluated, in this case, 'B' is what the function returns (NOTE: there are plans to add the ability to return at any point in the function but those have not been implemented yet) - -=head3 Calling Functions - -After defining a function you really should be able to call them shouldn't you? there are two basic ways to call functions in Farnsworth - -The simplest way is this - - max[1,2] - -this will call the function 'B' with the arguments 'B<1>'and 'B<2>' - -There is also another way to call functions indirectly, this way shouldn't be used in most cases as it can be confused with unit conversions which we will cover later - - [1,2] -> max - 10 -> f - -both of these methods call the functions to the right of 'B<-E>' using the expressions on the left as arguments. -This method should be used sparingly because it can be ambiguous and can actually cause problems when there is a unit the same name as a function that just happens to allow a proper conversion. -In the standard library there is a unit B (short for B) that will cause the following example to not work properly - - f{x} := {x * x} - 10 -> f - -This will not in fact call the function B, but will end up telling you how many Bs will fit into B<10>. -This is however a good way to do certain things that APPEAR to be a conversion between two things, but don't easily convert because there's some other factor involved. -Temperature conversions between Celsius and Kelvin are possible this way. - - C{x} := (x / K) - 273.15 - 10 K -> C - -and you'll get back the result B<-263.15>. That kind of conversion isn't possible to do with standard units as you'll begin to understand below. - -=head3 Default Parameters - -Arguments to functions in Math::Farnsworth can have default parameters so that they don't always have to be specified explicitly. -They are set when you create the function by setting the arguments equal to the default value - - f{x = 1} := {x * x} - -=head3 Type Constraints - -Arguments can also be told that they have to be of a certain type in order to be given to a function, otherwise an exception is raised and the execution of the code stops - -These also are create at the time you define the function - - f{x isa meter} := {x per 10 seconds} - -Currently type constraints have to be some expression that describes the type of input you are expecting, in this case we used "meter" however meter describes a length, and any expression that describes a length can be used as the argument to the function e.g. - - f[10 feet] - -is perfectly valid. There are plans to implement the ability to say something like 'B however they have not been implemented yet. -You can combine default arguments and constraints by specifying the default argument first, e.g. - - f{x = 10 cm isa meter} := {x per 10 seconds} - -=head3 Variable Number of Arguments - -Sometimes you want to be able to take any number of arguments in order to perform some action on many different things, this is possible in Math::Farnsworth. -You can do this by adding a constraint to the last argument to the function. - - dostuff{x, y isa ...} := {/*something*/}; - -From this example you can see that we use the type constraint 'B<...>'. What this does is tell Math::Farnsworth to take any additional arguments and place them into an array and pass that array as the variable B. -Here's an example of what use this can be to do something like recreate the C function from perl. - - map{sub isa {`x`}, x isa ...} := {var e; var out=[]; while(e = shift[x]) {push[out, (e => sub)]}; out}; - map[{`x` x+1}, 1,2,3]; - -What we've got here is the first argument B must be a Lambda (see below for more information on them). And the second argument swallows up ALL of the other arguments to the function allowing you to take any number of them. - -=head2 Units - -What are units? -Units are things like: inches, feet, meters, gallons, volts, liters, etc. - -Farnsworth tracks units throughout all calculations that you do with it this allows you to do things like add two lengths together, or multiply them to get an area. - -It also does unit conversions along the way allowing you to do things like 'B<1 foot + 12 inches> ' and Farnsworth will handle it for you correctly. - -Farnsworth handles this by converting everything into a single base unit when performing calculations, in the case of lengths it represents them all as meters - -=head3 Unit Conversions - -Since Farnsworth represents everything as a single unit it will always want to give you back your calculations in that base unit; This isn't always what you want. So you can tell it to convert between the units to get exactly what you are after. - - 1 foot + 12 inches - -When doing that calculation you would most likely want your answer back in 'B', however farnsworth gives you back something like - - 0.6096 m - -Now what the heck is that? You wanted feet didn't you? This is what the 'B<-E>' operator is for, it will make farnsworth tell you the result in any unit you wish, so lets try this again - - 1 foot + 12 inches -> feet - -and Farnsworth gives you back the single number 'B<2>'. That's the correct answer, but what if you wanted it to tell you 'B<2 feet>' instead? you can do this by putting the unit you want the result in in quotes that will tell Farnsworth that you want the answer to contain the unit also. So lets do this one more time - - 1 foot + 12 inches -> "feet" - -And Farnsworth will give you back - - 2 feet - -=head3 Unit Definitions - -Now that you know how to convert between units, lets talk about how to create your own, the basic syntax is - - UnitName := Expression - -This allows you to create any unit you would desire, say you want to be able to use smoots to measure things? - - smoot := 5 feet + 7 inches - -now you can talk about measurements like 'B<6.5 smoots>' in any other calculation, or convert any distance to smoots, e.g. 'B<1 au -E "smoots"> ' - -=head3 Unit Prefixes - -Farnsworth also supports the SI standard prefixes such as kilo, centi, nano, etc. - -It however supports them on ALL units, so you can in fact say 'B<1 kilosmoot>' to mean 1000 smoots. - -you can also define your own prefixes by doing this - - kibi :- 1024 - mibi :- 1024 * 1024 - -This allows you to add any prefixes you need to make a calculation simple and easy to do - -NOTE: bits and bytes use the SI units of 1000 for kilobit, megabit, etc. to get the normal meaning of 1024 instead, use the of prefixes such as kibibit, mebibyte, etc. see http://en.wikipedia.org/wiki/Binary_prefix for more information on them. - -=head3 More Advanced Unit Manipulation - -You can also define your own basic units like length, time and mass, you do this by syntax like the following - - name =!= basicunit - -'B' is some unique name for the type of measurement that is going to be represented and 'B' is the primary unit of measure for this "dimension" - -so lets say we wanted to be able to count pixels as units - - pixels =!= pixel - -and now you've got a basic unit B that you can use to define other things like how many pixels are in a VGA screen - - VGA := 640 * 480 pixels - -=head2 Flow Control - -Like all useful programming languages Math::Farnsworth has ways to do loops and branching - -=head3 If - -As you've seen above Math::Farnsworth does have B statements, they look very similar to the languages C or Perl or Java - - if ( condition ) { statements to run if the previous condition is true } else { the optional else clause to run if the previous condition is false }; - if (x > y) {z = x} else {z = y}; - -The braces around the statements are necessary as they are in Perl and Java. -You also need to have a semi-colon after the braces when you want to begin the next statement. - -=head3 While - -Farnsworth also has loops, they look exactly like they do in C or Perl or Java - - while ( condition ) { statements to run while the condition is true } - -This is currently the only kind of loop that exists in Farnsworth, however ALL types of loops can be made from this, which is an exercise currently outside the scope of this document -The braces around the statements are necessary as they are in Perl and Java. As with Bs you also need to have a semi-colon after the braces when you want to begin the next statement. - -NOTE: for loops are definitely going to be added, i just haven't gotten to them yet. - -=head2 Lambdas - -Lambdas are a very neat feature of the Math::Farnsworth language, they are best described as something very similar to a subroutine reference in perl. -When you create a lambda it keeps the environment with it that it was defined in (as far as variables are concerned anyway). This allows you to do things like create static variables between calls - -Note: if anyone can think of a better name for these feel free to contact me about it. -Also Note: the syntax for them MIGHT change as i begin to learn how to rewrite the parser to be smarter and fix a number of problems i have with it - -=head3 Defining a Lambda - -The basic syntax for defining a lambda is similar to how functions are defined - - variable = {`arguments` statements}; - distance = {`x, y` sqrt[x * x + y * y]}; - -As you can see here, a lambda is actually stored inside a variable rather than a different namespace like functions are, this allows you to have a variable contain the lambda and use it only inside the scope it was defined in, this also allows for fun results when nesting lambdas - -=head3 Calling Lambdas - -Calling a lambda is fairly simple, the syntax looks a lot like the syntax for doing unit conversion or calling a function implicitly. - - argument => lambda - [arguments] => lambda - -This syntax also makes it easy to chain several lambdas up to do multiple calculations and have the order of execution blatantly obvious - - [arguments] => lambda1 => lambda2 => lambda3 - -=head3 Nesting Lambdas - -Since i've mentioned it before and example is necessary of what nesting a lambda really means - - index = ([] => {`` var count=0; {`` count = count + 1}}); - -What we've got here is a lambda call inside of an expression that returns a lambda. Since lambdas carry the scopes that they were defined in around with them the lambda that B contains has access to the variable B and since it was defined outside of the nested lambda it does not get reset between calls, allowing it to continue incrementing B over and over. -And because B was declared in the first lambda it isn't available to anything outside of that scope, meaning that B cannot be altered by anything other than the lambda that B now contains. - -=head1 SEE ALSO - -L -L -L -L - -There is also an RT tracker for the module (this may change) setup at -L, you can also reach the tracker by sending an email to Efarnsworth.rt@gmail.comE - -=head1 AUTHOR - -Ryan Voots Esimcop@cpan.orgE - -=head1 COPYRIGHT AND LICENSE - -Copyright (C) 2008 by Ryan Voots - -This library is free software; you can redistribute it and/or modify -it under the same terms as Perl itself, either Perl version 5.8.0 or, -at your option, any later version of Perl 5 you may have available. - - -=cut diff --git a/deps/Math/Farnsworth/Error.pm b/deps/Math/Farnsworth/Error.pm deleted file mode 100644 index 6dcea5c..0000000 --- a/deps/Math/Farnsworth/Error.pm +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/perl - -package Math::Farnsworth::Error; - -use strict; -use warnings; - -use Data::Dumper; -use Carp; - -require Exporter; -our @ISA = qw(Exporter); - -our @EXPORT = qw(error); - -use overload '""' => \&tostring, - 'eq' => \&eq; - -sub error -{ - my $err = shift; - my $eobj = {}; - $eobj->{msg} = $err; - bless $eobj; - - die $eobj; -} - -sub tostring -{ - my $self = shift; - return $self->{msg}; -} - -sub eq -{ - my ($one, $two, $rev) = @_; - - my $str = $one->tostring(); - return $str eq $two; -} diff --git a/deps/Math/Farnsworth/Evaluate.pm b/deps/Math/Farnsworth/Evaluate.pm deleted file mode 100644 index 5435087..0000000 --- a/deps/Math/Farnsworth/Evaluate.pm +++ /dev/null @@ -1,759 +0,0 @@ -#!/usr/bin/perl - -package Math::Farnsworth::Evaluate; - -use strict; -use warnings; - -use Data::Dumper; -use Carp; - -use Math::Farnsworth::FunctionDispatch; -use Math::Farnsworth::Variables; -use Math::Farnsworth::Units; -use Math::Farnsworth::Parser; -use Math::Farnsworth::Value; -use Math::Farnsworth::Value::Pari; -use Math::Farnsworth::Value::Date; -use Math::Farnsworth::Value::String; -use Math::Farnsworth::Value::Undef; -use Math::Farnsworth::Value::Lambda; -use Math::Farnsworth::Value::Array; -use Math::Farnsworth::Value::Boolean; -use Math::Farnsworth::Output; -use Math::Farnsworth::Error; - -use Math::Pari ':hex'; #why not? - -sub new -{ - my $class = shift; - my $self = {}; - bless $self; - - my %opts = (@_); - - if (ref($opts{funcs}) eq "Math::Farnsworth::FunctionDispatch") - { - $self->{funcs} = $opts{funcs}; - } - else - { - $self->{funcs} = new Math::Farnsworth::FunctionDispatch(); - } - - if (ref($opts{vars}) eq "Math::Farnsworth::Variables") - { - $self->{vars} = $opts{vars}; - } - else - { - $self->{vars} = new Math::Farnsworth::Variables(); - } - - if (ref($opts{units}) eq "Math::Farnsworth::Units") - { - $self->{units} = $opts{units}; - } - else - { - $self->{units} = new Math::Farnsworth::Units(); - } - - if (ref($opts{parser}) eq "Math::Farnsworth::Parser") - { - $self->{parser} = $opts{parser}; - } - else - { - $self->{parser} = new Math::Farnsworth::Parser(); - } - - $self->{dumpbranches} = 0; - - return $self; -} - -sub eval -{ - my $self = shift; - my $code = shift; #i should probably take an array, so i can use arrays of things, but that'll be later - - $code =~ s/^\s*//; - $code =~ s/\s*$//; - - my $tree = $self->{parser}->parse($code); #should i catch the exceptions here? dunno - - #print Dumper($tree); - - $self->evalbranch($tree); -} - -#evaluate a single branch -sub evalbranch -{ - my $self = shift; - - my $branch = shift; - my $type = ref($branch); #this'll grab what kind from the bless on the tree - - my $return; #to make things simpler later on - - #print Data::Dumper->Dump([$branch],["BRANCH"]); - - if ($type eq "Add") - { - my $a = $self->makevalue($branch->[0]); - my $b = $self->makevalue($branch->[1]); - $return = $a + $b; - } - elsif ($type eq "Sub") - { - my $a = $self->makevalue($branch->[0]); - my $b = $self->makevalue($branch->[1]); - $return = $a - $b; - } - elsif ($type eq "Mul") - { - if ((ref($branch->[0]) eq "Fetch") && (ref($branch->[1]) eq "Array") && ($branch->[2] eq "imp")) - { - #we've got a new style function call! - my $a = $branch->[0][0]; #grab the function name - my $b = $self->makevalue($branch->[1]); - - #print "----------------FUNCCALL! $a\n"; - #print Dumper($a, $b); - - if ($self->{funcs}->isfunc($a)) #check if there is a func $a - { #$return = $self->{funcs}->callfunc($self, $name, $args, $branch); - $return = $self->{funcs}->callfunc($self, $a, $b, $branch); - } - else #otherwise we try to - { - $a = $self->makevalue($branch->[0]); #evaluate it, since it wasn't a function - - $return = $a * $b; #do the multiplication - } - } - else - { - my $a = $self->makevalue($branch->[0]); - my $b = $self->makevalue($branch->[1]); - - #print "-----------SUBMULT!\n"; - #print Dumper($a,$b); - - $return = $a * $b; - } - } - elsif ($type eq "Div") - { - my $a = $self->makevalue($branch->[0]); - my $b = $self->makevalue($branch->[1]); - #print Dumper($a, $b); - $return = $a / $b; - } - elsif ($type eq "Conforms") - { - my $a = $self->makevalue($branch->[0]); - my $b = $self->makevalue($branch->[1]); - $return = new Math::Farnsworth::Value::Boolean($a->conforms($b)); - } - elsif ($type eq "Mod") - { - my $a = $self->makevalue($branch->[0]); - my $b = $self->makevalue($branch->[1]); - $return = $a % $b; - } - elsif ($type eq "Pow") - { - my $a = $self->makevalue($branch->[0]); - my $b = $self->makevalue($branch->[1]); - $return = $a ** $b; - } - elsif ($type eq "And") - { - my $a = $self->makevalue($branch->[0]); - - if ($a->bool()) - { - my $b = $self->makevalue($branch->[1]); - $return = $a && $b ? 1 : 0; - $return = Math::Farnsworth::Value::Boolean->new($return); #make sure its the right type - } - else - { - $return = Math::Farnsworth::Value::Boolean->new(0); #make sure its the right type - } - } - elsif ($type eq "Or") - { - my $a = $self->makevalue($branch->[0]); - - if ($a->bool()) - { - $return = Math::Farnsworth::Value::Boolean->new(1); #make sure its the right type - } - else - { - my $b = $self->makevalue($branch->[1]); - $return = $a || $b ? 1 : 0; - $return = Math::Farnsworth::Value::Boolean->new($return); #make sure its the right type - } - } - elsif ($type eq "Xor") - { - my $a = $self->makevalue($branch->[0]); - my $b = $self->makevalue($branch->[1]); - $return = $a->bool() ^ $b->bool() ? 1 : 0; - $return = Math::Farnsworth::Value::Boolean->new($return); #make sure its the right type - } - elsif ($type eq "Not") - { - my $a = $self->makevalue($branch->[0]); - $return = $a->bool() ? 0 : 1; - $return = Math::Farnsworth::Value::Boolean->new($return); #make sure its the right type - } - elsif ($type eq "Gt") - { - my $a = $self->makevalue($branch->[0]); - my $b = $self->makevalue($branch->[1]); - $return = ($a > $b) ? 1 : 0; - $return = Math::Farnsworth::Value::Boolean->new($return); #make sure its the right type - } - elsif ($type eq "Lt") - { - my $a = $self->makevalue($branch->[0]); - my $b = $self->makevalue($branch->[1]); - $return = $a < $b ? 1 : 0; - $return = Math::Farnsworth::Value::Boolean->new($return); #make sure its the right type - } - elsif ($type eq "Ge") - { - my $a = $self->makevalue($branch->[0]); - my $b = $self->makevalue($branch->[1]); - $return = $a >= $b ? 1 : 0; - $return = Math::Farnsworth::Value::Boolean->new($return); #make sure its the right type - } - elsif ($type eq "Le") - { - my $a = $self->makevalue($branch->[0]); - my $b = $self->makevalue($branch->[1]); - $return = $a <= $b ? 1 : 0; - $return = Math::Farnsworth::Value::Boolean->new($return); #make sure its the right type - } - elsif ($type eq "Compare") - { - my $a = $self->makevalue($branch->[0]); - my $b = $self->makevalue($branch->[1]); - $return = $a <=> $b; - $return = Math::Farnsworth::Value::Pari->new($return); #make sure its the right type - } - elsif ($type eq "Eq") - { - my $a = $self->makevalue($branch->[0]); - my $b = $self->makevalue($branch->[1]); - $return = $a == $b ? 1 : 0; - $return = Math::Farnsworth::Value::Boolean->new($return); #make sure its the right type - } - elsif ($type eq "Ne") - { - my $a = $self->makevalue($branch->[0]); - my $b = $self->makevalue($branch->[1]); - $return = $a != $b ? 1 : 0; - $return = Math::Farnsworth::Value::Boolean->new($return); #make sure its the right type - } - elsif ($type eq "Ternary") - { - #turing completeness FTW - my $left = $self->makevalue($branch->[0]); - #$left = $left->bool() != new Math::Farnsworth::Value::Pari(0, $left->{dimen}); #shouldn't need it anymore, since i got ->bool working - $return = $left ? $self->makevalue($branch->[1]) : $self->makevalue($branch->[2]); - } - elsif ($type eq "If") - { - #turing completeness FTW - my $left = $self->makevalue($branch->[0]); - #$left = $left != new Math::Farnsworth::Value(0, $left->{dimen}); - - if ($left) - { - $return = $self->makevalue($branch->[1]); - } - else - { - $return = $self->makevalue($branch->[2]); - } - } - elsif ($type eq "Store") - { - my $lvalue = $self->makevalue($branch->[0]); - my $value = $self->makevalue($branch->[1]); - $return = $value; #make stores evaluate to the value on the right - #$self->{vars}->setvar($name, $value); - - my $cloned = $value->clone(); - warn "SETTING VALUES"; - warn Data::Dumper->Dump([$lvalue, $lvalue->getref(), $value, $cloned], [qw($lvalue \$ref $value $cloned)]); - ${$lvalue->getref()} = $cloned; - } - elsif ($type eq "DeclareVar") - { - my $name = $branch->[0]; - my $value; - #print "\n\n DECLARING $name\n"; - #print Dumper($branch); - - if (defined($branch->[1])) - { - $value = $self->makevalue($branch->[1]); - } - else - { - $value = $self->makevalue(bless [0], 'Num'); - } - - $return = $value; #make stores evaluate to the value on the right - $self->{vars}->declare($name, $value); - } - elsif ($type eq "FuncDef") - { - #print Dumper($branch); - my $name = $branch->[0]; - my $args = $branch->[1]; - my $value = $branch->[2]; #not really a value, but in fact the tree to run for the function - - my $nvars = new Math::Farnsworth::Variables($self->{vars}); #lamdbas get their own vars - my %nopts = (vars => $nvars, funcs => $self->{funcs}, units => $self->{units}, parser => $self->{parser}); - my $scope = $self->new(%nopts); - - my $vargs; - - for my $arg (@$args) - { - my $reference = $arg->[3]; - my $constraint = $arg->[2]; - my $default = $arg->[1]; - my $name = $arg->[0]; #name - - if (defined($default)) - { - $default = $self->makevalue($default); #should be right - } - - if (defined($constraint)) - { - #print Dumper($constraint); - $constraint = $self->makevalue($constraint); #should be right - #print Dumper($constraint); - } - - push @$vargs, [$name, $default, $constraint, $reference]; - } - - $self->{funcs}->addfunc($name, $vargs, $value, $scope); - $return = undef; #cause an error should someone manage to make it parse other than the way i think it should be - } - elsif ($type eq "FuncCall") - { - print "DEPRECIATED FUNCTION CALL!\n"; - my $name = $branch->[0]; - my $args = $self->makevalue($branch->[1]); #this is an array, need to evaluate it - - $return = $self->{funcs}->callfunc($self, $name, $args, $branch); - - #print "FUNCCALL RETURNED\n"; - #print Dumper($return); - - } - elsif ($type eq "Lambda") - { - my $args = $branch->[0]; - my $code = $branch->[1]; - - #print "==========LAMBDA==========\n"; - #print Data::Dumper->Dump([$args,$code], ["args", "code"]); - - my $nvars = new Math::Farnsworth::Variables($self->{vars}); #lamdbas get their own vars - my %nopts = (vars => $nvars, funcs => $self->{funcs}, units => $self->{units}, parser => $self->{parser}); - my $scope = $self->new(%nopts); - - #this should probably get a function in Math::Farnsworth::FunctionDispatch - my $vargs; - - for my $arg (@$args) - { - my $reference = $arg->[3]; - my $constraint = $arg->[2]; - my $default = $arg->[1]; - my $name = $arg->[0]; #name - - if ($reference) - { - #we've got a reference for lambdas! - carp "Passing arguments by reference for lambdas is unsupported at this time"; - } - - if (defined($default)) - { - $default = $self->makevalue($default); #should be right - } - - if (defined($constraint)) - { - #print Dumper($constraint); - $constraint = $self->makevalue($constraint); #should be right - #print Dumper($constraint); - } - - push @$vargs, [$name, $default, $constraint, $reference]; - } - - $return = new Math::Farnsworth::Value::Lambda($scope, $args, $code, $branch); - } - elsif ($type eq "LambdaCall") - { - my $left = $self->makevalue($branch->[0]); - my $right = $self->makevalue($branch->[1]); - - error "Right side of lamdbda call must evaluate to a Lambda\n" unless $right->istype("Lambda"); - - #need $args to be an array - my $args = $left->istype("Array") ? $left : new Math::Farnsworth::Value::Array([$left]); - - $return = $self->{funcs}->calllambda($right, $args); #needs to be updated - } - elsif (($type eq "Array") || ($type eq "SubArray")) - { - my $array = []; #fixes bug with empty arrays - for my $bs (@$branch) #iterate over all the elements - { - my $type = ref($bs); #find out what kind of thing we are - my $value = $self->makevalue($bs); - - #print "ARRAY FILL -- $type\n"; - -# if ($value->istype("Array")) -# { - #since we have an array, but its not in a SUBarray, we dereference it before the push - #push @$array, $value->getarray() unless ($type eq "SubArray"); - #push @$array, $value;# if ($type eq "SubArray"); - #} - #else - { - #print "ARRAY VALUE --- ".Dumper($value); - #its not an array or anything so we push it on - push @$array, $value; #we return an array ref! i need more error checking around for this later - } - } - $return = new Math::Farnsworth::Value::Array($array); - } - elsif ($type eq "ArgArray") - { - my $array = []; #autovivification wasn't working? - for my $bs (@$branch) #iterate over all the elements - { - my $type = ref($bs); #find out what kind of thing we are - my $value = $self->makevalue($bs); - - #even if it is an array we don't want to deref it here, because thats the wrong behavior, this will make things like push[a, 1,2,3] work properly - push @$array, $value; #we return an array ref! i need more error checking around for this later - } - $return = new Math::Farnsworth::Value::Array($array); - } - elsif ($type eq "ArrayFetch") - { - #print "\n\nAFETCH\n"; - my $var = $self->makevalue($branch->[0]); #need to check if this is an array, and die if not - my $listval = $self->makevalue($branch->[1]); - my @rval; - - #print Data::Dumper->Dump([$branch, $var, $listval], ["branch","var","listval"]); - - for ($listval->getarray()) - { - my $index = $_->getpari()*1.0; - #print STDERR "ARFET: ".$_->toperl()."\n"; - #ok this line FOR WHATEVER REASON, makes Math::Pari.xs die in isnull(), WHY i don't know, there's something wrong here somewhere - #my $float = $_ * (Math::Farnsworth::Value::Pari->new(1.0)); #makes rationals work right - - my $input = $var->getarrayref()->[$index]; - - #error "Array out of bounds\n" #old message, check is down below now; - $var->getarrayref()->[$index] = TYPE_UNDEF unless defined $input; - $input = $var->getarrayref()->[$index] unless defined $input; #reset the value if needed, this code should be redone but i don't feel like it right now XXX - - $input->setref(\$var->getarrayref()->[$index]); - push @rval, $input; - } - - #print Dumper(\@rval); - - if (@rval > 1) - { - my $pr = new Math::Farnsworth::Value::Array([@rval]); - $return = $pr; - $return->setref(\$return); #i think this should work fine - } - else - { - $return = $rval[0]; - } - } - elsif ($type eq "ArrayStore") - { - my $var = $self->makevalue(bless [$branch->[0]], 'Fetch'); #need to check if this is an array, and die if not - my $listval = $self->makevalue($branch->[1]); - my $rval = $self->makevalue($branch->[2]); - - #print Dumper($branch, $var, $listval); - - if ($listval->getarray() > 1) - { - error "Assigning to slices not implemented yet\n"; - } - - error "Only numerics may be given as array indexes!" unless ($listval->getarrayref()->[0]->istype("Pari")); - - my $num = $listval->getarrayref()->[0]->getpari() + 0; #the +0 makes sure its coerced into a number - - $var->getarrayref()->[$num] = $rval; - - for my $value ($var->getarray()) - { - $value = $self->makevalue(bless [0], 'Num') if !defined($value); - } - - $return = $rval; - } - elsif ($type eq "While") - { - my $cond = $branch->[0]; #what to check each time - my $stmts = $branch->[1]; #what to run each time - - my $condval = $self->makevalue($cond); - while ($condval) - { - my $v = $self->makevalue($stmts); - $condval = $self->makevalue($cond); - } - - $return = undef; #cause errors - } - elsif ($type eq "Stmt") - { - for my $bs (@$branch) #iterate over all the statements - { - if (defined($bs)) - { - my $r = $self->makevalue($bs); - $return = $r if defined $r; #this has interesting semantics! - } - } - } - elsif ($type eq "Paren") - { - $return = $self->makevalue($branch->[0]); - } - elsif ($type eq "SetDisplay") - { - print Dumper($branch); - my $combo = $branch->[0][0]; #is a string? - my $right = $branch->[1]; - - Math::Farnsworth::Output->setdisplay($combo, $right); - } - elsif ($type eq "UnitDef") - { - my $unitsize = $self->makevalue($branch->[1]); - my $name = $branch->[0]; - $self->{units}->addunit($name, $unitsize); - } - elsif ($type eq "DefineDimen") - { - my $unit = $branch->[1]; - my $dimen = $branch->[0]; - $self->{units}->adddimen($dimen, $unit); - } - elsif ($type eq "DefineCombo") - { - my $combo = $branch->[1]; #should get me a string! - my $value = $self->makevalue($branch->[0]); - Math::Farnsworth::Output::addcombo($combo, $value); - } - elsif (($type eq "SetPrefix") || ($type eq "SetPrefixAbrv")) - { - my $name = $branch->[0]; - my $value = $self->makevalue($branch->[1]); - #carp "SETTING PREFIX0: $name : $value : ".Dumper($branch->[1]) if ($name eq "m"); - $self->{units}->setprefix($name, $value); - } - elsif ($type eq "Trans") - { - my $left = $self->makevalue($branch->[0]); - my $rights = eval {$self->makevalue($branch->[1])}; - #print Dumper($@); - my $right = $rights; - - if (!$@ && defined($rights) && $rights->istype("String")) #if its a string we do some fun stuff - { - print "STRINGED\n"; - $right = $self->eval($rights->getstring()); #we need to set $right to the evaluation $rights - #print Dumper($rights, $right); - print "ERRORED: ".Dumper($@); - } - - if (!$@) - { - if ($left->conforms($right)) #only do this if they are the same - { - my $dispval = ($left / $right); - - #$return = $left; - %$return = %$left; #ok this makes NO SENSE as to WHY it would behave like it was... - bless $return, ref($left); - - if ($rights->istype("String")) - { - #right side was a string, use it - $return->{outmagic} = [$dispval, $rights]; - } - else - { - $return->{outmagic} = [$dispval]; - } - } - elsif ($self->{funcs}->isfunc($branch->[1][0])) - { - $left = $left->istype("Array") ? $left : new Math::Farnsworth::Value::Array([$left]); - $return = $self->{funcs}->callfunc($self, $branch->[1][0], $left); - - if ($rights->istype("String")) - { - #right side was a string, use it - my $nm = {%$return}; #do a shallow copy! - bless $nm, ref($return); #rebless it - $return->{outmagic} = [$nm, $rights]; - } - } - else - { - error "Conformance error, left side has different units than right side ".Dumper($branch->[1])."\n"; - } - } - else - { - #$right doesn't evaluate... so we check for a function? - $left = $left->istype("Array") ? $left : new Math::Farnsworth::Value::Array([$left]); - $return = $self->{funcs}->callfunc($self, $branch->[1][0], $left); - - if (defined($rights) && $rights->istype("String")) - { - #right side was a string, use it - my $nm = {%$return}; #do a shallow copy! - bless $nm, ref($return); #rebless it - $return->{outmagic} = [$nm, $rights]; - } - } - } - - if (!defined($return)) - { - #this creates a "true" undefined value for returning, this makes things funner! it also introduced a bug from naive coding above, which has been fixed - $return = new Math::Farnsworth::Value::Undef(); - } - - return $return; -} - -sub makevalue -{ - my $self = shift; - my $input = shift; - -# print "MAKEVALUE---------\n"; -# print Dumper($input); - - if (ref($input) eq "Num") - { - #need to make a value here with Math::Farnsworth::Value! - my $val = new Math::Farnsworth::Value::Pari($input->[0]); - return $val; - } - if (ref($input) eq "HexNum") - { - #need to make a value here with Math::Farnsworth::Value! - #print "HEX VALUE: ".$input->[0]."\n"; - my $value = eval $input->[0]; #this SHOULD work, shouldn't be a security risk since its validated through the lexer and parser. - my $val = new Math::Farnsworth::Value::Pari($value); - return $val; - } - elsif (ref($input) eq "Fetch") - { - #this needs to decide between variable and unit, but that'll come later - #esp since i also have to have this overridable for functions! - - my $name = $input->[0]; - if ($self->{vars}->isvar($name)) - { - return $self->{vars}->getvar($input->[0]); - } - elsif ($self->{units}->isunit($name)) - { - #print "FETCH: $name\n" if ($name eq "milli"); - return $self->{units}->getunit($name); - } - - die "Undefined symbol '$name'\n"; - } - elsif (ref($input) eq "String") #we've got a string that should be a value! - { - my $value = $input->[0]; - #here it comes in with quotes, so lets remove them - #$value =~ s/^"(.*)"$/$1/; #no longer needed - #$value =~ s/\\"/"/g; #i'm gonna move these into the constructor i think - #$value =~ s/\\\\/\\/g; - $value =~ s/\\(.)/qq("\\$1")/eeg; - my $ss = sub - { - my $var =shift; - $var =~ s/^[\$]//; - my $output = undef; - if ($var !~ /^{.*}$/) - { - $output = new Math::Farnsworth::Output($self->{units}, $self->{vars}->getvar($var), $self); - } - else - { - $var =~ s/[{}]//g; - $output = new Math::Farnsworth::Output($self->{units}, $self->eval($var), $self); - } - - "".$output; - }; - $value =~ s/(?($1)/eg; - my $val = new Math::Farnsworth::Value::String($value); - return $val; - } - elsif (ref($input) eq "Date") - { - #print "\n\n\nMaking DATE!\n\n\n"; - my $val = new Math::Farnsworth::Value::Date($input->[0]); -# print Dumper($val); - return $val; - } - elsif (ref($input) eq "VarArg") - { - #warn "Got a VarArg, code untested, want to mark when i get them\n"; #just so i can track down the inevitable crash - return "VarArg"; - } - elsif (ref($input) =~ /Math::Farnsworth::Value/) - { - warn "Got a Math::Farnsworth::Value::*, i PROBABLY shouldn't be getting these, i'm just going to let it fall through"; - return $input; - } - - return $self->evalbranch($input); -} - -1; diff --git a/deps/Math/Farnsworth/FunctionDispatch.pm b/deps/Math/Farnsworth/FunctionDispatch.pm deleted file mode 100644 index 052625b..0000000 --- a/deps/Math/Farnsworth/FunctionDispatch.pm +++ /dev/null @@ -1,301 +0,0 @@ -package Math::Farnsworth::FunctionDispatch; - -use strict; -use warnings; - -use Data::Dumper; - -use Math::Farnsworth::Variables; -use Math::Farnsworth::Value::Array; -use Math::Farnsworth::Error; - -use Carp; - -sub new -{ - my $self = {}; - bless $self, (shift); -} - -sub addfunc -{ - my $self = shift; - my $name = shift; - my $args = shift; - my $value = shift; - my $scope = shift; - - #i should really have some error checking here - $self->{funcs}{$name} = {name=>$name, args=>$args, value=>$value, parentscope=>$scope}; -} - -sub getfunc -{ - my $self = shift; - my $name = shift; #which one to get, we return the hashref - return $self->{funcs}{$name}; -} - -sub isfunc -{ - my $self = shift; - my $name = shift; - - return exists($self->{funcs}{$name}); -} - -sub setupargs -{ - my $self = shift; - my $eval = shift; - my $args = shift; - my $argtypes = shift; - my $name = shift; #name to display - #my $branch = shift; - - my $vars = $eval->{vars}; #get the scope we need - -ARG:for my $argc (0..$#$argtypes) - { - my $n = $argtypes->[$argc][0]; #the rest are defaults and constraints - my $v = $args->getarrayref()->[$argc]; - - my $const = $argtypes->[$argc][2]; - - if (ref($const) eq "VarArg") - { - warn "Working around bug in lambdas!"; - $const = "VarArg"; - } - - if (!defined($v))# || ($v->{dimen}{dimen}{"undef"})) #uncomment for undef== default value - { - #i need a default value! - if (!defined($argtypes->[$argc][1]) && defined($argtypes->[$argc][0]) && (defined($const) && ref($const) !~ /Math::Farnsworth::Value/ && $const ne "VarArg")) - { - die "Required argument $argc to function $name\[\] missing\n"; - } - - $v = $argtypes->[$argc][1]; - } - - if (defined($const) && ref($const) =~ /Math::Farnsworth::Value/) - { - #we have a constraint - if (!$v->conforms($const)) - { - die "Constraint not met on argument $argc to $name\[\]\n"; - } - } - elsif (defined($const) && $const eq "VarArg") - { - #we've got a variable argument, it needs to slurp all the rest of the arguments into an array! - my $last = $#{$args->getarrayref()}; - my @vargs = @{$args->getarrayref()}[$argc..$last]; - my $v = new Math::Farnsworth::Value::Array(\@vargs); - $vars->declare($n, $v); #set the variable - last ARG; #don't parse ANY more arguments - } - - if (defined $n) #happens when no arguments! so we check if the name is defined - { - #print "SETVAR $n: "; - #print Dumper($argtypes->[$argc]); - #print Dumper($vars->{vars}); - if (!$argtypes->[$argc][3]) #make sure that it shouldn't be byref - { - $vars->declare($n, $v); - } - else - { - #it should be by ref - if ($v->getref()) - { - $vars->setref($n, $v->getref()); - } - else - { - error "Can't get reference from expression for argument $argc"; - } - } - - #print Dumper($vars->{vars}); - } - } -} - -#should i really have this here? or should i have it in evaluate.pm? -sub callfunc -{ - my $self = shift; - my $eval = shift; - my $name = shift; - my $args = shift; - my $branches = shift; - - my $argtypes = $self->{funcs}{$name}{args}; - - my $fval = $self->{funcs}{$name}{value}; - - #print "-------------ATTEMPTING TO CALL FUNCTION!-------------\n"; - #print "FUNCTION NAME : $name\n"; - #print "Dumper of func: ".Dumper($fval); - #print "--------------------THAT IS ALL\n"; - - die "Function $name is not defined\n" unless defined($fval); - die "Number of arguments not correct to $name\[\]\n" unless $self->checkparams($args, $argtypes); #this should check.... - -# print Dumper($args); - - my $neval; - - if (defined $self->{funcs}{$name}{parentscope}) - { - $neval = $self->{funcs}{$name}{parentscope}; - - my $nvars = new Math::Farnsworth::Variables($neval->{vars}); - - my %nopts = (vars => $nvars, funcs => $self, units => $neval->{units}, parser => $neval->{parser}); - $neval = $neval->new(%nopts); - } - else - { - #this should get scrapped once i fix the other modules! - carp "SETTING UP PARENT SCOPE OUT OF NO WHERE!"; - my $nvars = new Math::Farnsworth::Variables($eval->{vars}); - - my %nopts = (vars => $nvars, funcs => $self, units => $eval->{units}, parser => $eval->{parser}); - $neval = $eval->new(%nopts); -# $self->{funcs}{$name}{parentscope} = $neval; #store it for later! - } - - #print "NEWSCOPE! ".$neval->{vars}."\n"; - - #eval #just for fucks sake! - #{ - # my $facts = $neval->{vars}->getvar("facts"); - # print "FACTS!\n"; - # print Dumper($facts, "$facts"); - #}; - - #carp "$@" if $@; - - $self->setupargs($neval, $args, $argtypes, $name, $branches); #setup the arguments - - if (ref($fval) ne "CODE") - { - return $self->callbranch($neval, $fval, $name); - } - else - { - #we have a code ref, so we need to call it - return $fval->($args, $neval, $branches, $eval); - } -} - -sub calllambda -{ - my $self = shift; - my $lambda = shift; - my $args = shift; -# my $refscope = shift; -# my $branch = shift; #new for lambdas! - - my $argtypes = $lambda->getargs(); - my $fval = $lambda->getcode(); - my $eval = $lambda->getscope(); - - #print "LAMBDA---------------\n"; - #print Dumper($argtypes, $args, $fval); - - my $nvars = new Math::Farnsworth::Variables($eval->{vars}); - - my %nopts = (vars => $nvars, funcs => $self, units => $eval->{units}, parser => $eval->{parser}); - my $neval = $eval->new(%nopts); - - die "Number of arguments not correct to lambda\n" unless $self->checkparams($args, $argtypes); #this shoul - - $self->setupargs($neval, $args, $argtypes, "lambda"); - return $self->callbranch($neval, $fval); -} - -sub callbranch -{ - my $self = shift; - my $eval = shift; - my $branches = shift; - my $name = shift; - - -# print "CALLBRANCHES :: "; -# print $name if defined $name; -# print " :: $eval\n"; - - return $eval->evalbranch($branches); -} - -#this was supposed to be the checks for types and such, but now its something else entirely, mostly -sub checkparams -{ - my $self = shift; - my $args = shift; - my $argtypes = shift; - - my $vararg = 0; - - my $neededargs = 0; - my $badargs = 0; - - for my $argt (@$argtypes) - { - $neededargs++ unless (defined($argt->[1]) || !defined($argt->[0])); - $badargs++ if (!defined($argt->[0])); - } - - #might want to change the !~ to something else? - #warn "Strange bug here to investigate, lambdas produce blessed array refs for vararg... wtf"; - $vararg = 1 if (grep {defined($_->[2]) && ref($_->[2]) !~ /Math::Farnsworth::Value/ && (($_->[2] eq "VarArg") || (ref($_->[2]) eq "VarArg"))} @{$argtypes}); #find out if there is a vararg arg - - #print "NEEDED: $neededargs :: $vararg\n"; - #print Data::Dumper->Dump([$argtypes, $args->getarrayref()], [qw(argtypes args)]); - - return 1 if ($vararg || ($args->getarray() <= (@{$argtypes}-$badargs) && $args->getarray() >= $neededargs)); - - #return 0 unless (ref($args) eq "Math::Farnsworth::Value") && ($args->{dimen}->compare({dimen=>{array=>1}})); - - return 0; -} - -sub getref -{ - my $self = shift; - my $argc = shift; - my $branch = shift; - my $name = shift; - - #print "\n\nGETREF\n"; - #print Dumper($branch); - - if (ref $branch->[1] ne "Array") - { - #this should add support for some other stuff - error "Cannot get a reference if function/lambda is called without []"; - } - - my $argexpr = $branch->[1][$argc]; - - #print Dumper($argbranches->[$argc]); - - if (ref $argexpr ne "Fetch") - { - error "Argument $argc to $name\[\] is not referencable"; - } - - my $ref = $self->{funcs}{$name}->{scope}{vars}->getref($argexpr->[0]); - - print Dumper($argexpr, $ref); - - return $ref; -} - -1; diff --git a/deps/Math/Farnsworth/Functions/.svn/entries b/deps/Math/Farnsworth/Functions/.svn/entries deleted file mode 100644 index f8a5c73..0000000 --- a/deps/Math/Farnsworth/Functions/.svn/entries +++ /dev/null @@ -1,130 +0,0 @@ -10 - -dir -475 -svn://erxz.com/bb3/branches/perlbuut/deps/Math/Farnsworth/Functions -svn://erxz.com/bb3 - - - -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - -dcb1cea6-7f7e-4c78-8a22-148ace8ce36e - -StdMath.pm -file - - - - -2009-10-03T22:54:20.000000Z -659e14514d2615774db75d8e94b0f784 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -16418 - -GoogleTranslate.pm -file - - - - -2009-10-03T22:54:20.000000Z -863c7a8460ea3e51ef5f99762e66725d -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -5411 - -Standard.pm -file - - - - -2009-10-03T22:54:20.000000Z -c30c503937a76fea9c5e9c33ef6df2f4 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -14193 - diff --git a/deps/Math/Farnsworth/Functions/.svn/text-base/GoogleTranslate.pm.svn-base b/deps/Math/Farnsworth/Functions/.svn/text-base/GoogleTranslate.pm.svn-base deleted file mode 100644 index 9ecf639..0000000 --- a/deps/Math/Farnsworth/Functions/.svn/text-base/GoogleTranslate.pm.svn-base +++ /dev/null @@ -1,198 +0,0 @@ -package Math::Farnsworth::Functions::GoogleTranslate; - -use strict; -use warnings; - -use Data::Dumper; - -use Math::Farnsworth::Value; - -use REST::Google::Translate; -use HTML::Entities; - -use Encode; - -#note that this is fairly C centric! - -my $defaultcode = "en"; - - my %langs = ( - - #ar=>"Arabic", bg=>"Bulgarian", ca=>"Catalan", cs=>"Czech", - # da=>"Danish", de=>"German", el=>"Greek", en=>"English", - # es=>"Spanish", fi=>"Finnish", fr=>"French", hi=>"Hindi", - # hr=>"Croatian", id=>"Indonesian", it=>"Italian", iw=>"Hebrew", - # ja=>"Japanese", ko=>"Korean", lt=>"Lithuanian", lv=>"Latvian", - # nl=>"Dutch", no=>"Norwegian", pl=>"Polish", pt=>"Portuguese", - # "pt-PT" => "Portuguese", ro=>"Romanian", ru=>"Russian", sk=>"Slovak", sl=>"Slovenian", - # sr=>"Serbian", sv=>"Swedish", tl=>"Filipino", uk=>"Ukrainian", - # vi=>"Vietnamese", "zh-CN"=>"Chinese_Simplified", "zh-CN"=>"Chinese", #bug here! two chineses! i should really allow array refs here so that i can have all kinds of names for things! - # "zh-TW"=>"Chinese_Traditional"); - -ar=>"Arabic", -bg=>"Bulgarian", -ca=>"Catalan", -cs=>"Czech", -da=>"Danish", -de=>"German", -el=>"Greek", -en=>"English", -es=>"Spanish", -et=>"Estonian", -fi=>"Finnish", -fr=>"French", -gl=>"Galician", -hi=>"Hindi", -hr=>"Croatian", -hu=>"Hungarian", -id=>"Indonesian", -it=>"Italian", -iw=>"Hebrew", -ja=>"Japanese", -ko=>"Korean", -"lt"=>"Lithuanian", -lv=>"Latvian", -mt=>"Maltese", -nl=>"Dutch", -no=>"Norwegian", -pl=>"Polish", -pt=>"Portuguese", -"pt-PT" => "Portuguese", -ro=>"Romanian", -ru=>"Russian", -sk=>"Slovak", -sl=>"Slovenian", -sq=>"Albanian", -sr=>"Serbian", -sv=>"Swedish", -th=>"Thai", -tl=>"Filipino", -tr=>"Turkish", -uk=>"Ukrainian", -vi=>"Vietnamese", -"zh-CN"=>"Chinese", -"zh-TW"=>"Chinese_Traditional", -); - -sub init -{ - my $env = shift; - - REST::Google::Translate->http_referer('http://farnsworth.sexypenguins.com/'); #for now, i need a real website for this! - - my $string = new Math::Farnsworth::Value::String(""); - - #generate lang to lang - for my $x (keys %langs) - { - for my $y (keys %langs) - { - if ($x ne $y) - { - #no need to generate names for DutchToDutch! - my $name = $langs{$x}."To".$langs{$y}; - - #closures in perl will give me this! closures FTW! - $env->{funcs}->addfunc($name, [["in", undef, $string, 0]], sub {translate($x,$y,@_)},$env); - } - } - } - - #now generate ToLang Lang, and FromLang - for my $x (keys %langs) - { - my $name = $langs{$x}; - - #closures in perl will give me this! closures FTW! - if ($x ne $defaultcode) - { - $env->{funcs}->addfunc($name, [["in", undef, $string, 0]], sub {translate("",$x,@_)},$env); - $env->{funcs}->addfunc("Is".$name, [["in", undef, $string, 0]], sub {islang($x, @_)},$env); - $env->{funcs}->addfunc("To".$name, [["in", undef, $string, 0]], sub {translate("",$x,@_)},$env); - $env->{funcs}->addfunc("From".$name, [["in", undef, $string, 0]], sub {translate($x, $defaultcode,@_)},$env); - } - else - { - $env->{funcs}->addfunc("Is".$name, [["in", undef, $string, 0]], sub {islang($x, @_)},$env); - $env->{funcs}->addfunc($name, [["in", undef, $string, 0]], sub {translate("",$defaultcode,@_)},$env); - $env->{funcs}->addfunc("To".$name, [["in", undef, $string, 0]], sub {translate("",$defaultcode,@_)},$env); - } - } - - $env->{funcs}->addfunc("DetectLanguage", [["in", undef, $string, 0]], \&detectlang,$env); -} - -sub callgoogle -{ - my ($langa, $langb) = (shift(), shift()); #get the two targets - my $totranslate= shift; - - my $res = REST::Google::Translate->new( - q => $totranslate, - langpair => "$langa|$langb", - ); - - #print Dumper($res); - - die "response status failure when translating [$langa -> $langb], ".$res->responseStatus, " details follow, ".$res->responseDetails if $res->responseStatus != 200; - - return $res; #if its undef, its undef! i should really make some kind of error checking here -} - -sub translate -{ - my ($langa, $langb) = (shift(), shift()); #get the two targets - my ($args, $eval, $branches)= @_; - - if ($langa eq "") - { - if ($args->getarrayref()->[0]->getlang() ne "") #if it is set to something other than "1" - { - $langa = $args->getarrayref()->[0]->getlang(); - } - } - - my $response = callgoogle($langa, $langb, $args->getarrayref()->[0]->getstring()); - my $translated = $response->responseData->translatedText; - - #print "TRANSLATED: $langa|$langb '$translated'\n"; - - $translated = new Math::Farnsworth::Value::String(decode_entities($translated), $langb); - - return $translated; -} - -sub detectlang -{ - my ($args, $eval, $branches)= @_; - - if ($args->getarrayref()->[0]->getlang() ne "") #if it is set to something other than "1" - { - my $lang = $args->getarrayref()->[0]->getlang(); - my $txt = $langs{$lang}; - return new Math::Farnsworth::Value::String($txt, "en"); #NOT INTERNATIONALIZED NAMES! - } - - my $response = callgoogle("", "en", $args->getarrayref()->[0]->getstring()); - my $translated = $response->{responseData}{detectedSourceLanguage}; - - #print "DETECTED: '$translated'\n"; - - $translated = $langs{$translated} || $translated; #either its got a name, or we return the code - - $translated = new Math::Farnsworth::Value::String($translated, "en"); - - return $translated; -} - -sub islang -{ - my ($lang) = shift(); - my ($args, $eval, $branches)= @_; - - my $text = $args->getarrayref()->[0]->getstring(); - - return new Math::Farnsworth::Value::String($text, $lang); -} - -1; diff --git a/deps/Math/Farnsworth/Functions/.svn/text-base/Standard.pm.svn-base b/deps/Math/Farnsworth/Functions/.svn/text-base/Standard.pm.svn-base deleted file mode 100644 index 28885c3..0000000 --- a/deps/Math/Farnsworth/Functions/.svn/text-base/Standard.pm.svn-base +++ /dev/null @@ -1,458 +0,0 @@ -package Math::Farnsworth::Functions::Standard; - -use strict; -use warnings; - -use Math::Farnsworth::Value; -use Math::Farnsworth::Error; -use utf8; - -use Data::Dumper; - -use Math::Pari; - -sub init -{ - my $env = shift; - - #i should really make some stuff to make this easier - #maybe some subs in Math::Farnsworth::Value that get exported - #my $array = new Math::Farnsworth::Value::Array([]); - #my $string = new Math::Farnsworth::Value::String(""); - #my $lambda = new Math::Farnsworth::Value::Lambda(); - #my $number = new Math::Farnsworth::Value::Pari(0); - #my $date = new Math::Farnsworth::Value::Date("today"); #create a date type for use - - $env->eval("push{arr byref isa [], x isa ...} := {arr = arr + x};"); - $env->eval("unshift{arr byref isa [], x isa ...} := {arr =x+arr};"); - - #$env->{funcs}->addfunc("push", [["arr", undef, $array, 0], ["in", undef, "VarArg", 0]],\&push); #actually i might rewrite this in farnsworth now that it can do it - $env->{funcs}->addfunc("pop", [["arr", undef, TYPE_ARRAY, 0]],\&pop); #eventually this maybe too - $env->{funcs}->addfunc("shift", [["arr", undef, TYPE_ARRAY, 1]], \&shift); - #$env->{funcs}->addfunc("unshift", [["arr", undef, $array, 0], ["in", undef, "VarArg", 0]], \&unshift); - $env->{funcs}->addfunc("sort", [["sortsub", undef, TYPE_LAMBDA, 0],["arr", undef, TYPE_ARRAY, 0]],\&sort); - - $env->{funcs}->addfunc("length", [["in", undef, undef, 0]],\&length); - - $env->{funcs}->addfunc("ord", [["in", undef, TYPE_STRING, 0]],\&ord); - $env->{funcs}->addfunc("chr", [["in", undef, TYPE_PLAIN, 0]],\&chr); - $env->{funcs}->addfunc("index", [["str", undef, TYPE_STRING, 0],["substr", undef, TYPE_STRING, 0],["pos", TYPE_PLAIN, TYPE_PLAIN, 0]],\&index); - $env->{funcs}->addfunc("eval", [["str", undef, TYPE_STRING, 0]],\&eval); - - $env->eval('dbgprint{x isa ...} := {var z; var n = 0; var p; while(n != length[x]) {p = shift[x]; if (p conforms "") {z = p} else {z = "$p"}; _dbgprint[z]}}'); - $env->{funcs}->addfunc("_dbgprint", [["str", undef, TYPE_STRING, 0]], \&dbgprint); - $env->{funcs}->addfunc("__dbgbranches", [[undef, undef, undef, 0]], \&dbgbranch); - - $env->eval('map{sub isa {`x`}, x isa ...} := {var xx=[]+x; if (length[xx] == 1 && xx@0$ conforms []) {xx = x@0$}; if (length[xx] == 1 && !(xx conforms [])) {xx = [xx]}; var z=[]+xx; var e; var out=[]; while(length[z]) {e = shift[z]; dbgprint[e]; push[out,e => sub]}; dbgprint[out]; out}'); - - $env->{funcs}->addfunc("substrLen", [["str", undef, TYPE_STRING, 0],["left", undef, TYPE_PLAIN, 0],["length", undef, TYPE_PLAIN, 0]],\&substrlen); #this one works like perls - $env->eval("substr{str,left,right}:={substrLen[str,left,right-left]}"); - $env->eval("left{str,pos}:={substrLen[str,0,pos]}"); - $env->eval("right{str,pos}:={substrLen[str,length[str]-pos,pos]}"); - - $env->{funcs}->addfunc("reverse", [["in", undef, undef, 0]],\&reverse); - - $env->eval("now{x = \"UTC\" isa \"\"} := {setzone[#today#, x]}"); - $env->{funcs}->addfunc("setzone", [["date", undef, TYPE_DATE, 0],["zone", undef, TYPE_STRING, 0]], \&setzone); - - $env->{funcs}->addfunc("unit", [["in", undef, undef, 0]], \&unit); - $env->{funcs}->addfunc("units", [["in", undef, undef, 0]], \&units); - $env->{funcs}->addfunc("error", [["in", undef, TYPE_STRING, 0]], \&doerror); - $env->{funcs}->addfunc("match", [["regex", undef, TYPE_STRING, 0], ["input", undef, TYPE_STRING, 0], ["options",TYPE_STRING,TYPE_STRING, 0]], \&match); - - $env->eval('max{x isa ...} := {if (length[x] == 1 && x@0$ conforms []) {x = x@0$}; var z=[x]; var m = pop[z]; var n = length[z]; var q; while((n=n-1)>=0){q=pop[z]; q>m?m=q:0}; m}'); - $env->eval('min{x isa ...} := {if (length[x] == 1 && x@0$ conforms []) {x = x@0$}; var z=[x]; var m = pop[z]; var n = length[z]; var q; while((n=n-1)>=0){q=pop[z]; q>", "/var/www/farnsworth/htdocs/test/debuglog.log"); -$log->autoflush(1); - -sub dbgprint -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("str"); #i should clean this up more too - my $string = $input->getstring(); - - print "DEBUGLOG: $string\n"; - print $log "$string\n"; - - return Math::Farnsworth::Value::Pari->new(1); -} - -sub dbgbranch -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - $eval->{dumpbranches} = 1- $eval->{dumpbranches}; - - return Math::Farnsworth::Value::Pari->new($eval->{dumpbranches}); -} - -sub doerror -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - error $input->getstring(); -} - -sub match -{ - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("input"); - my $regex = $eval->{vars}->getvar("regex"); - my $options = $eval->{vars}->getvar("options"); - - error $@ if $@; -} - -sub units -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - error "Need number with units for units[]" unless $input->istype("Pari"); - - my $units = $input->getdimen(); - - return Math::Farnsworth::Value::Pari->new(1.0, $units); -} - -sub setzone -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $date = $eval->{vars}->getvar("date"); #i should clean this up more too - my $zone = $eval->{vars}->getvar("zone"); #i should clean this up more too - - $date->getdate()->set_time_zone($zone->getstring()); - - return $date; -} - -sub unit -{ - #args is... a Math::Farnsworth::Value array - my ($args, $eval, $branches)= @_; - - #print Dumper($branches); - - if ((ref($branches->[1][0]) ne "Fetch") || (!$eval->{units}->isunit($branches->[1][0][0]))) - { - die "First argument to unit[] must be a unit name"; - } - - my $unitvar = $eval->{units}->getunit($branches->[1][0][0]); - - return $unitvar; #if its undef, its undef! i should really make some kind of error checking here -} - -sub sort -{ - #args is... a Math::Farnsworth::Value array - my ($args, $eval, $branches)= @_; - - my $argcount = $args->getarray(); - - my $sortlambda; - - if (ref($args->getarrayref()->[0]) eq "Math::Farnsworth::Value::Lambda") - { - $sortlambda = shift(@{$args->getarrayref}); - } - else - { - #i should really do this outside the sub ONCE, but i'm lazy for now - $sortlambda = $eval->eval("{|a,b| a <=> b}"); - } - - my $sortsub = sub - { - my $val = $eval->evalbranch(bless [(bless [$a, $b], 'Array'), $sortlambda], 'LambdaCall'); - - 0+$val->toperl(); #return this, just to make sure the value is right - }; - - my @sorts; - - if ($args->getarray() > 1) - { - #we've been given a bunch of things, assume we need to sort them like that - push @sorts, $args->getarray(); - } - elsif (($args->getarray() == 1) && (ref($args->getarrayref()->[0]) eq "Math::Farnsworth::Value::Array")) - { - #given an array as a second value, dereference it since its the only thing we've got - push @sorts, $args->getarrayref()->[0]->getarray(); - } - else - { - #ok you want me to sort ONE thing? i'll sort that one thing, in O(1) time! - return $args->getarrayref()->[0]; - } - - my @rets = CORE::sort $sortsub @sorts; - - #print "SORT RETURNING!\n"; - #print Dumper(\@rets); - - return new Math::Farnsworth::Value::Array([@rets]); -} - -sub push -{ - #args is... a Math::Farnsworth::Value array - my ($args, $eval, $branches)= @_; - - if ((ref($branches->[1][0]) ne "Fetch") || (!$eval->{vars}->isvar($branches->[1][0][0]))) - { - die "First argument to push must be a variable"; - } - - my $arrayvar = $eval->{vars}->getvar($branches->[1][0][0]); - - unless (ref($arrayvar) eq "Math::Farnsworth::Value::Array") - { - die "First argument to push must be an array"; - } - - #ok type checking is done, do the push! - - my @input = $args->getarray(); - shift @input; #remove the original array value - - #i should probably flatten arrays here so that; a=[1,2,3]; push[a,a]; will result in a = [1,2,3,1,2,3]; instead of a = [1,2,3,[1,2,3]]; - - CORE::push @{$arrayvar->getarrayref()}, @input; - - return new Math::Farnsworth::Value::Pari(0+@input); #returns number of items pushed -} - -sub unshift -{ - #args is... a Math::Farnsworth::Value array - my ($args, $eval, $branches)= @_; - - if ((ref($branches->[1][0]) ne "Fetch") || (!$eval->{vars}->isvar($branches->[1][0][0]))) - { - die "First argument to push must be a variable"; - } - - my $arrayvar = $eval->{vars}->getvar($branches->[1][0][0]); - - unless (ref($arrayvar) eq "Math::Farnsworth::Value::Array") - { - die "First argument to push must be an array"; - } - - #ok type checking is done, do the push! - - my @input = $args->getarray(); - shift @input; #remove the original array value - - #i should probably flatten arrays here so that; a=[1,2,3]; push[a,a]; will result in a = [1,2,3,1,2,3]; instead of a = [1,2,3,[1,2,3]]; - - CORE::unshift @{$arrayvar->getarrayref()}, @input; - - return new Math::Farnsworth::Value::Pari(0+@input); -} - -sub pop -{ - #args is... a Math::Farnsworth::Value array - my ($args, $eval, $branches)= @_; - - if ((ref($branches->[1][0]) ne "Fetch") || (!$eval->{vars}->isvar($branches->[1][0][0]))) - { - die "Argument to pop must be a variable"; - } - - my $arrayvar = $eval->{vars}->getvar($branches->[1][0][0]); - - unless (ref($arrayvar) eq "Math::Farnsworth::Value::Array") - { - die "Argument to pop must be an array"; - } - - #ok type checking is done, do the pop - - my $retval = CORE::pop @{$arrayvar->getarrayref()}; - - return $retval; #pop returns the value of the element removed -} - -sub shift -{ - #args is... a Math::Farnsworth::Value array - my ($args, $eval, $branches)= @_; - - my $var = $eval->{vars}->getvar("arr"); - my $varref = $var->getref(); - - error "Need lvalue for input to shift[]" unless defined $varref; - - #if ((ref($branches->[1][0]) ne "Fetch") || (!$eval->{vars}->isvar($branches->[1][0][0]))) - #{ - # die "Argument to shift must be a variable"; - #} - - #my $arrayvar = $eval->{vars}->getvar($branches->[1][0][0]); - - unless (ref($var) eq "Math::Farnsworth::Value::Array") - { - die "Argument to shift must be an array"; - } - - #ok type checking is done, do the pop - - my $retval = CORE::shift @{${$varref}->getarrayref()}; - - return $retval; #pop returns the value of the element removed -} - -sub length -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - my @argsarry = $args->getarray(); - - my @rets; - - for my $arg (@argsarry) - { - if (ref($arg) eq "Math::Farnsworth::Value::Array") - { - CORE::push @rets, Math::Farnsworth::Value::Pari->new(scalar $arg->getarray()); - } - elsif (ref($arg) eq "Math::Farnsworth::Value::String") - { - CORE::push @rets, Math::Farnsworth::Value::Pari->new(length $arg->getstring()); - } - else - { - #until i decide how this should work on regular numbers, just do this - CORE::push @rets, Math::Farnsworth::Value::Pari->new(0); - } - } - - if (@rets > 1) - { - return Math::Farnsworth::Value::Array->new(\@rets); - } - else - { - return $rets[0]; - } -} - -sub reverse -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - my @argsarry = $args->getarray(); - - my @rets; - - for my $arg (reverse @argsarry) #this will make reverse[1,2,3,4] return [4,3,2,1] - { - if (ref($arg) eq "Math::Farnsworth::Value::Array") - { - CORE::push @rets, Math::Farnsworth::Value::Array->new([reverse $arg->getarray()]); - } - elsif (ref($arg) eq "Math::Farnsworth::Value::String") - { - CORE::push @rets, Math::Farnsworth::Value::String->new("".reverse($arg->getstring())); - } - else - { - CORE::push @rets, $arg; #should i make it print the reverse of all its arguments? yes, lets fix that - } - } - - if (@rets > 1) - { - return Math::Farnsworth::Value::Array->new(\@rets); - } - else - { - return $rets[0]; - } -} - -sub substrlen -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - my @arg = $args->getarray(); - - if (ref $arg[0] eq "Math::Farnsworth::Value::String") - { - #do i need to do something to convert these to work? (the 1,2 anyway?) - my $ns = substr($arg[0]->getstring(), $arg[1]->toperl(), $arg[2]->toperl()); - #print "SUBSTR :: $ns\n"; - return Math::Farnsworth::Value::String->new($ns); - } - else - { - die "substr and friends only works on strings"; - } -} - -sub ord -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - my $ns = ord($input->getstring()); - return Math::Farnsworth::Value::Pari->new($ns); -} - -sub chr -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - my $ns = chr($input->toperl()); - return Math::Farnsworth::Value::String->new($ns); -} - -sub index -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $string = $eval->{vars}->getvar("str")->getstring(); - my $substr = $eval->{vars}->getvar("substr")->getstring(); - my $pos = $eval->{vars}->getvar("pos")->toperl(); - - my $ns = index $string, $substr, $pos; #substr($arg[0]{pari}, "".$arg[1]{pari}, "".$arg[2]{pari}); - return Math::Farnsworth::Value::Pari->new($ns); #give string flag of 1, since we don't know what language is intended -} - -sub eval -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches, $reval)= @_; - my $evalstr = $eval->{vars}->getvar("str")->getstring(); - -# my $nvars = new Math::Farnsworth::Variables($eval->{vars}); -# my %nopts = (vars => $nvars, funcs => $eval->{funcs}, units => $eval->{units}, parser => $eval->{parser}); -# my $neval = $eval->new(%nopts); - - return $reval->eval($evalstr); -} - -1; diff --git a/deps/Math/Farnsworth/Functions/.svn/text-base/StdMath.pm.svn-base b/deps/Math/Farnsworth/Functions/.svn/text-base/StdMath.pm.svn-base deleted file mode 100644 index 62da53c..0000000 --- a/deps/Math/Farnsworth/Functions/.svn/text-base/StdMath.pm.svn-base +++ /dev/null @@ -1,453 +0,0 @@ -package Math::Farnsworth::Functions::StdMath; - -use strict; -use warnings; - -use Math::Pari; -use Data::Dumper; -use Math::Farnsworth::Value::Pari; -use Math::Farnsworth::Value::Array; -use Math::Farnsworth::Value::Lambda; -use Math::Farnsworth::Value::Boolean; - -sub init -{ - my $env = shift; - - my $array = new Math::Farnsworth::Value::Array([]); - my $string = new Math::Farnsworth::Value::String(""); - my $lambda = new Math::Farnsworth::Value::Lambda(); - my $number = new Math::Farnsworth::Value::Pari(0); - - $env->{funcs}->addfunc("ln", [["in", undef, $number, 0]],\&log,$env); - $env->eval("log{x isa 1} := {ln[x]/ln[10]}"); - $env->{funcs}->addfunc("sin", [["in", undef, $number, 0]],\&sin,$env); - $env->{funcs}->addfunc("cos", [["in", undef, $number, 0]],\&cos,$env); - $env->{funcs}->addfunc("tan", [["in", undef, $number, 0]],\&tan,$env); - $env->eval("csc{x isa 1} := {1/sin[x]}"); - $env->eval("sec{x isa 1} := {1/cos[x]}"); - $env->eval("cot{x isa 1} := {1/tan[x]}"); - $env->eval("atan2{x isa 1,y isa 1} := {var s=x^2+y^2; var r=y+x i; -i * ln[r / sqrt[s]]}"); - $env->{funcs}->addfunc("sinh", [["in", undef, $number, 0]],\&sinh,$env); - $env->{funcs}->addfunc("cosh", [["in", undef, $number, 0]],\&cosh,$env); - $env->{funcs}->addfunc("tanh", [["in", undef, $number, 0]],\&tanh,$env); - $env->{funcs}->addfunc("arcsin", [["in", undef, $number, 0]],\&arcsin,$env); - $env->{funcs}->addfunc("arccos", [["in", undef, $number, 0]],\&arccos,$env); - $env->{funcs}->addfunc("arctan", [["in", undef, $number, 0]],\&arctan,$env); - $env->{funcs}->addfunc("arcsinh", [["in", undef, $number, 0]],\&arcsinh,$env); - $env->{funcs}->addfunc("arccosh", [["in", undef, $number, 0]],\&arccosh,$env); - $env->{funcs}->addfunc("arctanh", [["in", undef, $number, 0]],\&arctanh,$env); - $env->{funcs}->addfunc("asin", [["in", undef, $number, 0]],\&arcsin,$env); - $env->{funcs}->addfunc("acos", [["in", undef, $number, 0]],\&arccos,$env); - $env->{funcs}->addfunc("atan", [["in", undef, $number, 0]],\&arctan,$env); - $env->{funcs}->addfunc("asinh", [["in", undef, $number, 0]],\&arcsinh,$env); - $env->{funcs}->addfunc("acosh", [["in", undef, $number, 0]],\&arccosh,$env); - $env->{funcs}->addfunc("atanh", [["in", undef, $number, 0]],\&arctanh,$env); - $env->{funcs}->addfunc("abs", [["in", undef, undef, 0]],\&abs,$env); - $env->{funcs}->addfunc("floor", [["in", undef, undef, 0]],\&floor,$env); - $env->{funcs}->addfunc("ceil", [["in", undef, undef, 0]],\&ceil,$env); - $env->{funcs}->addfunc("int", [["in", undef, undef, 0]],\&int,$env); - $env->{funcs}->addfunc("rint", [["in", undef, undef, 0]],\&rint,$env); - $env->eval("round{x, d isa 1} := {var m = x * 10 ** d; rint[m] * 10 ** -d+0.0};"); - $env->{funcs}->addfunc("trunc", [["in", undef, undef, 0]],\&int,$env); - $env->{funcs}->addfunc("numerator", [["in", undef, $number, 0]],\&numerator,$env); - $env->{funcs}->addfunc("denominator", [["in", undef, $number, 0]],\&denominator,$env); - - $env->{funcs}->addfunc("real", [["in", undef, $number, 0]],\&real,$env); - $env->{funcs}->addfunc("imag", [["in", undef, $number, 0]],\&imag,$env); - $env->eval("imaginary{x isa 1} := imag[x]"); - $env->{funcs}->addfunc("conj", [["in", undef, $number, 0]],\&conj,$env); - $env->{funcs}->addfunc("norm", [["in", undef, $number, 0]],\&norm,$env); - - $env->{funcs}->addfunc("isprime", [["in", undef, $number, 0]],\&isprime,$env); - $env->{funcs}->addfunc("prime", [["in", undef, $number, 0]],\&prime,$env); - $env->{funcs}->addfunc("precprime", [["in", undef, $number, 0]],\&precprime,$env); - $env->{funcs}->addfunc("nextprime", [["in", undef, $number, 0]],\&nextprime,$env); - $env->{funcs}->addfunc("factor", [["in", undef, $number, 0]],\&factor,$env); - - $env->{funcs}->addfunc("randmax", [["in", undef, $number, 0]],\&randmax,$env); - $env->{funcs}->addfunc("getrseed", [[]],\&getrseed,$env); - $env->{funcs}->addfunc("setrseed", [[]],\&setrseed,$env); - $env->eval("random{} := randmax[10**30]/10.0**30"); - $env->eval("quad{a isa 1, b isa 1, c isa 1} := [(-b + sqrt[b^2 - 4 a c]) / 2a, (-b - sqrt[b^2 - 4 a c]) / 2a]"); - $env->eval("quadratic{a, b, c} := quad[a,b,c]"); - - $env->{funcs}->addfunc("gcd", [["left", undef, $number, 0],["right", undef, $number, 0]],\&gcd,$env); - $env->{funcs}->addfunc("lcm", [["left", undef, $number, 0],["right", undef, $number, 0]],\&lcm,$env); - - #these functions are simple enough to implement in farnsworth itself, so why not - $env->{funcs}->addfunc("sqrt", [["in", undef, undef, 0]],\&sqrt,$env); #putting in like this to see if it brings better luck - $env->eval("i := sqrt[-1]"); #since we have a better sqrt, use it to make a better i -# $env->eval("sqrt{x} := {x ^ 0.5}"); - $env->eval("exp{x isa 1} := {e ^ x}"); - $env->eval("inv{x} := {1/x}"); - $env->eval("recip{x} := {1/x}"); - - #$env->eval("_tohex{x isa 1} := { if(x < 16) { substrLen[\"0123456789abcdef\", x, 1] } else { _tohex[floor[x/16]] + _tohex[x%16] } }; tohex{x isa 1} := {\"0x\"+_tohex[x]}"); - -} - -sub sqrt -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - my $units = $input->getdimen(); - $units = $units->mult(PARI '1/2'); #half them all! - - return Math::Farnsworth::Value::Pari->new(Math::Pari::sqrt($input->getpari()), $units); -} - -sub sin -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::sin($input->getpari())); -} - -sub cos -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::cos($input->getpari())); -} - -sub tan -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::tan($input->getpari())); -} - -sub arcsin -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::asin($input->getpari())); -} - -sub arccos -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::acos($input->getpari())); -} - -sub arctan -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::atan($input->getpari())); -} - -sub sinh -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::sinh($input->getpari())); -} - -sub cosh -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::cosh($input->getpari())); -} - -sub tanh -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::tanh($input->getpari())); -} - -sub arcsinh -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::asinh($input->getpari())); -} - -sub arccosh -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::acosh($input->getpari())); -} - -sub arctanh -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::atanh($input->getpari())); -} - -sub abs -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::abs($input->getpari()), $input->getdimen()); -} - -sub floor -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::floor($input->getpari()), $input->getdimen()); -} - -sub ceil -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::ceil($input->getpari()), $input->getdimen()); -} - -sub int -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - my $e = PARI '0'; - my $r = Math::Farnsworth::Value::Pari->new(Math::Pari::truncate($input->getpari(),$e), $input->getdimen()); - print Data::Dumper->Dump([$r], ["\$r"]); - return $r; -} - -sub numerator -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - #bug? should i make it pull the positive dimensions? - return Math::Farnsworth::Value::Pari->new(Math::Pari::numerator($input->getpari())); -} - -sub denominator -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - #bug? should i make it pull the negative dimensions? - return Math::Farnsworth::Value::Pari->new(Math::Pari::denominator($input->getpari())); -} - -sub real -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::real($input->getpari()), $input->getdimen()); -} - -sub imag -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::imag($input->getpari()), $input->getdimen()); -} - -sub conj -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::conj($input->getpari()), $input->getdimen()); -} - -sub norm -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::norm($input->getpari()), $input->getdimen()); -} - -sub isprime -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Boolean->new(Math::Pari::isprime($input->getpari())); -} - -sub prime -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::prime($input->getpari())); -} - -sub nextprime -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::nextprime($input->getpari())); -} - -sub precprime -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::precprime($input->getpari())); -} - -sub factor -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::factor($input->getpari())); -} - -sub randmax -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::random($input->getpari())); -} - -sub setrseed -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - my $oldseed = Math::Pari::getrand(); - Math::Pari::setrand($input->getpari()); - - return Math::Farnsworth::Value::Pari->new($oldseed); -} - -sub getrseed -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - return Math::Farnsworth::Value::Pari->new(Math::Pari::getrand()); -} - -sub rint -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - #die "Argument to rint[] is not a numeric value" unless $input->isPARI(); - my $e = PARI '0'; - return Math::Farnsworth::Value::Pari->new(Math::Pari::round($input->getpari(), $e), $input->getdimen()); -} - -sub gcd -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $left = $eval->{vars}->getvar("left"); #i should clean this up more too - my $right = $eval->{vars}->getvar("right"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::gcd($left->getpari(), $right->getpari())); -} - -sub lcm -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $left = $eval->{vars}->getvar("left"); #i should clean this up more too - my $right = $eval->{vars}->getvar("right"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::lcm($left->getpari(), $right->getpari())); -} - -sub log -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::log($input->getpari())); -} - -1; diff --git a/deps/Math/Farnsworth/Functions/GoogleTranslate.pm b/deps/Math/Farnsworth/Functions/GoogleTranslate.pm deleted file mode 100644 index 9ecf639..0000000 --- a/deps/Math/Farnsworth/Functions/GoogleTranslate.pm +++ /dev/null @@ -1,198 +0,0 @@ -package Math::Farnsworth::Functions::GoogleTranslate; - -use strict; -use warnings; - -use Data::Dumper; - -use Math::Farnsworth::Value; - -use REST::Google::Translate; -use HTML::Entities; - -use Encode; - -#note that this is fairly C centric! - -my $defaultcode = "en"; - - my %langs = ( - - #ar=>"Arabic", bg=>"Bulgarian", ca=>"Catalan", cs=>"Czech", - # da=>"Danish", de=>"German", el=>"Greek", en=>"English", - # es=>"Spanish", fi=>"Finnish", fr=>"French", hi=>"Hindi", - # hr=>"Croatian", id=>"Indonesian", it=>"Italian", iw=>"Hebrew", - # ja=>"Japanese", ko=>"Korean", lt=>"Lithuanian", lv=>"Latvian", - # nl=>"Dutch", no=>"Norwegian", pl=>"Polish", pt=>"Portuguese", - # "pt-PT" => "Portuguese", ro=>"Romanian", ru=>"Russian", sk=>"Slovak", sl=>"Slovenian", - # sr=>"Serbian", sv=>"Swedish", tl=>"Filipino", uk=>"Ukrainian", - # vi=>"Vietnamese", "zh-CN"=>"Chinese_Simplified", "zh-CN"=>"Chinese", #bug here! two chineses! i should really allow array refs here so that i can have all kinds of names for things! - # "zh-TW"=>"Chinese_Traditional"); - -ar=>"Arabic", -bg=>"Bulgarian", -ca=>"Catalan", -cs=>"Czech", -da=>"Danish", -de=>"German", -el=>"Greek", -en=>"English", -es=>"Spanish", -et=>"Estonian", -fi=>"Finnish", -fr=>"French", -gl=>"Galician", -hi=>"Hindi", -hr=>"Croatian", -hu=>"Hungarian", -id=>"Indonesian", -it=>"Italian", -iw=>"Hebrew", -ja=>"Japanese", -ko=>"Korean", -"lt"=>"Lithuanian", -lv=>"Latvian", -mt=>"Maltese", -nl=>"Dutch", -no=>"Norwegian", -pl=>"Polish", -pt=>"Portuguese", -"pt-PT" => "Portuguese", -ro=>"Romanian", -ru=>"Russian", -sk=>"Slovak", -sl=>"Slovenian", -sq=>"Albanian", -sr=>"Serbian", -sv=>"Swedish", -th=>"Thai", -tl=>"Filipino", -tr=>"Turkish", -uk=>"Ukrainian", -vi=>"Vietnamese", -"zh-CN"=>"Chinese", -"zh-TW"=>"Chinese_Traditional", -); - -sub init -{ - my $env = shift; - - REST::Google::Translate->http_referer('http://farnsworth.sexypenguins.com/'); #for now, i need a real website for this! - - my $string = new Math::Farnsworth::Value::String(""); - - #generate lang to lang - for my $x (keys %langs) - { - for my $y (keys %langs) - { - if ($x ne $y) - { - #no need to generate names for DutchToDutch! - my $name = $langs{$x}."To".$langs{$y}; - - #closures in perl will give me this! closures FTW! - $env->{funcs}->addfunc($name, [["in", undef, $string, 0]], sub {translate($x,$y,@_)},$env); - } - } - } - - #now generate ToLang Lang, and FromLang - for my $x (keys %langs) - { - my $name = $langs{$x}; - - #closures in perl will give me this! closures FTW! - if ($x ne $defaultcode) - { - $env->{funcs}->addfunc($name, [["in", undef, $string, 0]], sub {translate("",$x,@_)},$env); - $env->{funcs}->addfunc("Is".$name, [["in", undef, $string, 0]], sub {islang($x, @_)},$env); - $env->{funcs}->addfunc("To".$name, [["in", undef, $string, 0]], sub {translate("",$x,@_)},$env); - $env->{funcs}->addfunc("From".$name, [["in", undef, $string, 0]], sub {translate($x, $defaultcode,@_)},$env); - } - else - { - $env->{funcs}->addfunc("Is".$name, [["in", undef, $string, 0]], sub {islang($x, @_)},$env); - $env->{funcs}->addfunc($name, [["in", undef, $string, 0]], sub {translate("",$defaultcode,@_)},$env); - $env->{funcs}->addfunc("To".$name, [["in", undef, $string, 0]], sub {translate("",$defaultcode,@_)},$env); - } - } - - $env->{funcs}->addfunc("DetectLanguage", [["in", undef, $string, 0]], \&detectlang,$env); -} - -sub callgoogle -{ - my ($langa, $langb) = (shift(), shift()); #get the two targets - my $totranslate= shift; - - my $res = REST::Google::Translate->new( - q => $totranslate, - langpair => "$langa|$langb", - ); - - #print Dumper($res); - - die "response status failure when translating [$langa -> $langb], ".$res->responseStatus, " details follow, ".$res->responseDetails if $res->responseStatus != 200; - - return $res; #if its undef, its undef! i should really make some kind of error checking here -} - -sub translate -{ - my ($langa, $langb) = (shift(), shift()); #get the two targets - my ($args, $eval, $branches)= @_; - - if ($langa eq "") - { - if ($args->getarrayref()->[0]->getlang() ne "") #if it is set to something other than "1" - { - $langa = $args->getarrayref()->[0]->getlang(); - } - } - - my $response = callgoogle($langa, $langb, $args->getarrayref()->[0]->getstring()); - my $translated = $response->responseData->translatedText; - - #print "TRANSLATED: $langa|$langb '$translated'\n"; - - $translated = new Math::Farnsworth::Value::String(decode_entities($translated), $langb); - - return $translated; -} - -sub detectlang -{ - my ($args, $eval, $branches)= @_; - - if ($args->getarrayref()->[0]->getlang() ne "") #if it is set to something other than "1" - { - my $lang = $args->getarrayref()->[0]->getlang(); - my $txt = $langs{$lang}; - return new Math::Farnsworth::Value::String($txt, "en"); #NOT INTERNATIONALIZED NAMES! - } - - my $response = callgoogle("", "en", $args->getarrayref()->[0]->getstring()); - my $translated = $response->{responseData}{detectedSourceLanguage}; - - #print "DETECTED: '$translated'\n"; - - $translated = $langs{$translated} || $translated; #either its got a name, or we return the code - - $translated = new Math::Farnsworth::Value::String($translated, "en"); - - return $translated; -} - -sub islang -{ - my ($lang) = shift(); - my ($args, $eval, $branches)= @_; - - my $text = $args->getarrayref()->[0]->getstring(); - - return new Math::Farnsworth::Value::String($text, $lang); -} - -1; diff --git a/deps/Math/Farnsworth/Functions/Standard.pm b/deps/Math/Farnsworth/Functions/Standard.pm deleted file mode 100644 index 28885c3..0000000 --- a/deps/Math/Farnsworth/Functions/Standard.pm +++ /dev/null @@ -1,458 +0,0 @@ -package Math::Farnsworth::Functions::Standard; - -use strict; -use warnings; - -use Math::Farnsworth::Value; -use Math::Farnsworth::Error; -use utf8; - -use Data::Dumper; - -use Math::Pari; - -sub init -{ - my $env = shift; - - #i should really make some stuff to make this easier - #maybe some subs in Math::Farnsworth::Value that get exported - #my $array = new Math::Farnsworth::Value::Array([]); - #my $string = new Math::Farnsworth::Value::String(""); - #my $lambda = new Math::Farnsworth::Value::Lambda(); - #my $number = new Math::Farnsworth::Value::Pari(0); - #my $date = new Math::Farnsworth::Value::Date("today"); #create a date type for use - - $env->eval("push{arr byref isa [], x isa ...} := {arr = arr + x};"); - $env->eval("unshift{arr byref isa [], x isa ...} := {arr =x+arr};"); - - #$env->{funcs}->addfunc("push", [["arr", undef, $array, 0], ["in", undef, "VarArg", 0]],\&push); #actually i might rewrite this in farnsworth now that it can do it - $env->{funcs}->addfunc("pop", [["arr", undef, TYPE_ARRAY, 0]],\&pop); #eventually this maybe too - $env->{funcs}->addfunc("shift", [["arr", undef, TYPE_ARRAY, 1]], \&shift); - #$env->{funcs}->addfunc("unshift", [["arr", undef, $array, 0], ["in", undef, "VarArg", 0]], \&unshift); - $env->{funcs}->addfunc("sort", [["sortsub", undef, TYPE_LAMBDA, 0],["arr", undef, TYPE_ARRAY, 0]],\&sort); - - $env->{funcs}->addfunc("length", [["in", undef, undef, 0]],\&length); - - $env->{funcs}->addfunc("ord", [["in", undef, TYPE_STRING, 0]],\&ord); - $env->{funcs}->addfunc("chr", [["in", undef, TYPE_PLAIN, 0]],\&chr); - $env->{funcs}->addfunc("index", [["str", undef, TYPE_STRING, 0],["substr", undef, TYPE_STRING, 0],["pos", TYPE_PLAIN, TYPE_PLAIN, 0]],\&index); - $env->{funcs}->addfunc("eval", [["str", undef, TYPE_STRING, 0]],\&eval); - - $env->eval('dbgprint{x isa ...} := {var z; var n = 0; var p; while(n != length[x]) {p = shift[x]; if (p conforms "") {z = p} else {z = "$p"}; _dbgprint[z]}}'); - $env->{funcs}->addfunc("_dbgprint", [["str", undef, TYPE_STRING, 0]], \&dbgprint); - $env->{funcs}->addfunc("__dbgbranches", [[undef, undef, undef, 0]], \&dbgbranch); - - $env->eval('map{sub isa {`x`}, x isa ...} := {var xx=[]+x; if (length[xx] == 1 && xx@0$ conforms []) {xx = x@0$}; if (length[xx] == 1 && !(xx conforms [])) {xx = [xx]}; var z=[]+xx; var e; var out=[]; while(length[z]) {e = shift[z]; dbgprint[e]; push[out,e => sub]}; dbgprint[out]; out}'); - - $env->{funcs}->addfunc("substrLen", [["str", undef, TYPE_STRING, 0],["left", undef, TYPE_PLAIN, 0],["length", undef, TYPE_PLAIN, 0]],\&substrlen); #this one works like perls - $env->eval("substr{str,left,right}:={substrLen[str,left,right-left]}"); - $env->eval("left{str,pos}:={substrLen[str,0,pos]}"); - $env->eval("right{str,pos}:={substrLen[str,length[str]-pos,pos]}"); - - $env->{funcs}->addfunc("reverse", [["in", undef, undef, 0]],\&reverse); - - $env->eval("now{x = \"UTC\" isa \"\"} := {setzone[#today#, x]}"); - $env->{funcs}->addfunc("setzone", [["date", undef, TYPE_DATE, 0],["zone", undef, TYPE_STRING, 0]], \&setzone); - - $env->{funcs}->addfunc("unit", [["in", undef, undef, 0]], \&unit); - $env->{funcs}->addfunc("units", [["in", undef, undef, 0]], \&units); - $env->{funcs}->addfunc("error", [["in", undef, TYPE_STRING, 0]], \&doerror); - $env->{funcs}->addfunc("match", [["regex", undef, TYPE_STRING, 0], ["input", undef, TYPE_STRING, 0], ["options",TYPE_STRING,TYPE_STRING, 0]], \&match); - - $env->eval('max{x isa ...} := {if (length[x] == 1 && x@0$ conforms []) {x = x@0$}; var z=[x]; var m = pop[z]; var n = length[z]; var q; while((n=n-1)>=0){q=pop[z]; q>m?m=q:0}; m}'); - $env->eval('min{x isa ...} := {if (length[x] == 1 && x@0$ conforms []) {x = x@0$}; var z=[x]; var m = pop[z]; var n = length[z]; var q; while((n=n-1)>=0){q=pop[z]; q>", "/var/www/farnsworth/htdocs/test/debuglog.log"); -$log->autoflush(1); - -sub dbgprint -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("str"); #i should clean this up more too - my $string = $input->getstring(); - - print "DEBUGLOG: $string\n"; - print $log "$string\n"; - - return Math::Farnsworth::Value::Pari->new(1); -} - -sub dbgbranch -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - $eval->{dumpbranches} = 1- $eval->{dumpbranches}; - - return Math::Farnsworth::Value::Pari->new($eval->{dumpbranches}); -} - -sub doerror -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - error $input->getstring(); -} - -sub match -{ - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("input"); - my $regex = $eval->{vars}->getvar("regex"); - my $options = $eval->{vars}->getvar("options"); - - error $@ if $@; -} - -sub units -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - error "Need number with units for units[]" unless $input->istype("Pari"); - - my $units = $input->getdimen(); - - return Math::Farnsworth::Value::Pari->new(1.0, $units); -} - -sub setzone -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $date = $eval->{vars}->getvar("date"); #i should clean this up more too - my $zone = $eval->{vars}->getvar("zone"); #i should clean this up more too - - $date->getdate()->set_time_zone($zone->getstring()); - - return $date; -} - -sub unit -{ - #args is... a Math::Farnsworth::Value array - my ($args, $eval, $branches)= @_; - - #print Dumper($branches); - - if ((ref($branches->[1][0]) ne "Fetch") || (!$eval->{units}->isunit($branches->[1][0][0]))) - { - die "First argument to unit[] must be a unit name"; - } - - my $unitvar = $eval->{units}->getunit($branches->[1][0][0]); - - return $unitvar; #if its undef, its undef! i should really make some kind of error checking here -} - -sub sort -{ - #args is... a Math::Farnsworth::Value array - my ($args, $eval, $branches)= @_; - - my $argcount = $args->getarray(); - - my $sortlambda; - - if (ref($args->getarrayref()->[0]) eq "Math::Farnsworth::Value::Lambda") - { - $sortlambda = shift(@{$args->getarrayref}); - } - else - { - #i should really do this outside the sub ONCE, but i'm lazy for now - $sortlambda = $eval->eval("{|a,b| a <=> b}"); - } - - my $sortsub = sub - { - my $val = $eval->evalbranch(bless [(bless [$a, $b], 'Array'), $sortlambda], 'LambdaCall'); - - 0+$val->toperl(); #return this, just to make sure the value is right - }; - - my @sorts; - - if ($args->getarray() > 1) - { - #we've been given a bunch of things, assume we need to sort them like that - push @sorts, $args->getarray(); - } - elsif (($args->getarray() == 1) && (ref($args->getarrayref()->[0]) eq "Math::Farnsworth::Value::Array")) - { - #given an array as a second value, dereference it since its the only thing we've got - push @sorts, $args->getarrayref()->[0]->getarray(); - } - else - { - #ok you want me to sort ONE thing? i'll sort that one thing, in O(1) time! - return $args->getarrayref()->[0]; - } - - my @rets = CORE::sort $sortsub @sorts; - - #print "SORT RETURNING!\n"; - #print Dumper(\@rets); - - return new Math::Farnsworth::Value::Array([@rets]); -} - -sub push -{ - #args is... a Math::Farnsworth::Value array - my ($args, $eval, $branches)= @_; - - if ((ref($branches->[1][0]) ne "Fetch") || (!$eval->{vars}->isvar($branches->[1][0][0]))) - { - die "First argument to push must be a variable"; - } - - my $arrayvar = $eval->{vars}->getvar($branches->[1][0][0]); - - unless (ref($arrayvar) eq "Math::Farnsworth::Value::Array") - { - die "First argument to push must be an array"; - } - - #ok type checking is done, do the push! - - my @input = $args->getarray(); - shift @input; #remove the original array value - - #i should probably flatten arrays here so that; a=[1,2,3]; push[a,a]; will result in a = [1,2,3,1,2,3]; instead of a = [1,2,3,[1,2,3]]; - - CORE::push @{$arrayvar->getarrayref()}, @input; - - return new Math::Farnsworth::Value::Pari(0+@input); #returns number of items pushed -} - -sub unshift -{ - #args is... a Math::Farnsworth::Value array - my ($args, $eval, $branches)= @_; - - if ((ref($branches->[1][0]) ne "Fetch") || (!$eval->{vars}->isvar($branches->[1][0][0]))) - { - die "First argument to push must be a variable"; - } - - my $arrayvar = $eval->{vars}->getvar($branches->[1][0][0]); - - unless (ref($arrayvar) eq "Math::Farnsworth::Value::Array") - { - die "First argument to push must be an array"; - } - - #ok type checking is done, do the push! - - my @input = $args->getarray(); - shift @input; #remove the original array value - - #i should probably flatten arrays here so that; a=[1,2,3]; push[a,a]; will result in a = [1,2,3,1,2,3]; instead of a = [1,2,3,[1,2,3]]; - - CORE::unshift @{$arrayvar->getarrayref()}, @input; - - return new Math::Farnsworth::Value::Pari(0+@input); -} - -sub pop -{ - #args is... a Math::Farnsworth::Value array - my ($args, $eval, $branches)= @_; - - if ((ref($branches->[1][0]) ne "Fetch") || (!$eval->{vars}->isvar($branches->[1][0][0]))) - { - die "Argument to pop must be a variable"; - } - - my $arrayvar = $eval->{vars}->getvar($branches->[1][0][0]); - - unless (ref($arrayvar) eq "Math::Farnsworth::Value::Array") - { - die "Argument to pop must be an array"; - } - - #ok type checking is done, do the pop - - my $retval = CORE::pop @{$arrayvar->getarrayref()}; - - return $retval; #pop returns the value of the element removed -} - -sub shift -{ - #args is... a Math::Farnsworth::Value array - my ($args, $eval, $branches)= @_; - - my $var = $eval->{vars}->getvar("arr"); - my $varref = $var->getref(); - - error "Need lvalue for input to shift[]" unless defined $varref; - - #if ((ref($branches->[1][0]) ne "Fetch") || (!$eval->{vars}->isvar($branches->[1][0][0]))) - #{ - # die "Argument to shift must be a variable"; - #} - - #my $arrayvar = $eval->{vars}->getvar($branches->[1][0][0]); - - unless (ref($var) eq "Math::Farnsworth::Value::Array") - { - die "Argument to shift must be an array"; - } - - #ok type checking is done, do the pop - - my $retval = CORE::shift @{${$varref}->getarrayref()}; - - return $retval; #pop returns the value of the element removed -} - -sub length -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - my @argsarry = $args->getarray(); - - my @rets; - - for my $arg (@argsarry) - { - if (ref($arg) eq "Math::Farnsworth::Value::Array") - { - CORE::push @rets, Math::Farnsworth::Value::Pari->new(scalar $arg->getarray()); - } - elsif (ref($arg) eq "Math::Farnsworth::Value::String") - { - CORE::push @rets, Math::Farnsworth::Value::Pari->new(length $arg->getstring()); - } - else - { - #until i decide how this should work on regular numbers, just do this - CORE::push @rets, Math::Farnsworth::Value::Pari->new(0); - } - } - - if (@rets > 1) - { - return Math::Farnsworth::Value::Array->new(\@rets); - } - else - { - return $rets[0]; - } -} - -sub reverse -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - my @argsarry = $args->getarray(); - - my @rets; - - for my $arg (reverse @argsarry) #this will make reverse[1,2,3,4] return [4,3,2,1] - { - if (ref($arg) eq "Math::Farnsworth::Value::Array") - { - CORE::push @rets, Math::Farnsworth::Value::Array->new([reverse $arg->getarray()]); - } - elsif (ref($arg) eq "Math::Farnsworth::Value::String") - { - CORE::push @rets, Math::Farnsworth::Value::String->new("".reverse($arg->getstring())); - } - else - { - CORE::push @rets, $arg; #should i make it print the reverse of all its arguments? yes, lets fix that - } - } - - if (@rets > 1) - { - return Math::Farnsworth::Value::Array->new(\@rets); - } - else - { - return $rets[0]; - } -} - -sub substrlen -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - my @arg = $args->getarray(); - - if (ref $arg[0] eq "Math::Farnsworth::Value::String") - { - #do i need to do something to convert these to work? (the 1,2 anyway?) - my $ns = substr($arg[0]->getstring(), $arg[1]->toperl(), $arg[2]->toperl()); - #print "SUBSTR :: $ns\n"; - return Math::Farnsworth::Value::String->new($ns); - } - else - { - die "substr and friends only works on strings"; - } -} - -sub ord -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - my $ns = ord($input->getstring()); - return Math::Farnsworth::Value::Pari->new($ns); -} - -sub chr -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - my $ns = chr($input->toperl()); - return Math::Farnsworth::Value::String->new($ns); -} - -sub index -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $string = $eval->{vars}->getvar("str")->getstring(); - my $substr = $eval->{vars}->getvar("substr")->getstring(); - my $pos = $eval->{vars}->getvar("pos")->toperl(); - - my $ns = index $string, $substr, $pos; #substr($arg[0]{pari}, "".$arg[1]{pari}, "".$arg[2]{pari}); - return Math::Farnsworth::Value::Pari->new($ns); #give string flag of 1, since we don't know what language is intended -} - -sub eval -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches, $reval)= @_; - my $evalstr = $eval->{vars}->getvar("str")->getstring(); - -# my $nvars = new Math::Farnsworth::Variables($eval->{vars}); -# my %nopts = (vars => $nvars, funcs => $eval->{funcs}, units => $eval->{units}, parser => $eval->{parser}); -# my $neval = $eval->new(%nopts); - - return $reval->eval($evalstr); -} - -1; diff --git a/deps/Math/Farnsworth/Functions/StdMath.pm b/deps/Math/Farnsworth/Functions/StdMath.pm deleted file mode 100644 index 62da53c..0000000 --- a/deps/Math/Farnsworth/Functions/StdMath.pm +++ /dev/null @@ -1,453 +0,0 @@ -package Math::Farnsworth::Functions::StdMath; - -use strict; -use warnings; - -use Math::Pari; -use Data::Dumper; -use Math::Farnsworth::Value::Pari; -use Math::Farnsworth::Value::Array; -use Math::Farnsworth::Value::Lambda; -use Math::Farnsworth::Value::Boolean; - -sub init -{ - my $env = shift; - - my $array = new Math::Farnsworth::Value::Array([]); - my $string = new Math::Farnsworth::Value::String(""); - my $lambda = new Math::Farnsworth::Value::Lambda(); - my $number = new Math::Farnsworth::Value::Pari(0); - - $env->{funcs}->addfunc("ln", [["in", undef, $number, 0]],\&log,$env); - $env->eval("log{x isa 1} := {ln[x]/ln[10]}"); - $env->{funcs}->addfunc("sin", [["in", undef, $number, 0]],\&sin,$env); - $env->{funcs}->addfunc("cos", [["in", undef, $number, 0]],\&cos,$env); - $env->{funcs}->addfunc("tan", [["in", undef, $number, 0]],\&tan,$env); - $env->eval("csc{x isa 1} := {1/sin[x]}"); - $env->eval("sec{x isa 1} := {1/cos[x]}"); - $env->eval("cot{x isa 1} := {1/tan[x]}"); - $env->eval("atan2{x isa 1,y isa 1} := {var s=x^2+y^2; var r=y+x i; -i * ln[r / sqrt[s]]}"); - $env->{funcs}->addfunc("sinh", [["in", undef, $number, 0]],\&sinh,$env); - $env->{funcs}->addfunc("cosh", [["in", undef, $number, 0]],\&cosh,$env); - $env->{funcs}->addfunc("tanh", [["in", undef, $number, 0]],\&tanh,$env); - $env->{funcs}->addfunc("arcsin", [["in", undef, $number, 0]],\&arcsin,$env); - $env->{funcs}->addfunc("arccos", [["in", undef, $number, 0]],\&arccos,$env); - $env->{funcs}->addfunc("arctan", [["in", undef, $number, 0]],\&arctan,$env); - $env->{funcs}->addfunc("arcsinh", [["in", undef, $number, 0]],\&arcsinh,$env); - $env->{funcs}->addfunc("arccosh", [["in", undef, $number, 0]],\&arccosh,$env); - $env->{funcs}->addfunc("arctanh", [["in", undef, $number, 0]],\&arctanh,$env); - $env->{funcs}->addfunc("asin", [["in", undef, $number, 0]],\&arcsin,$env); - $env->{funcs}->addfunc("acos", [["in", undef, $number, 0]],\&arccos,$env); - $env->{funcs}->addfunc("atan", [["in", undef, $number, 0]],\&arctan,$env); - $env->{funcs}->addfunc("asinh", [["in", undef, $number, 0]],\&arcsinh,$env); - $env->{funcs}->addfunc("acosh", [["in", undef, $number, 0]],\&arccosh,$env); - $env->{funcs}->addfunc("atanh", [["in", undef, $number, 0]],\&arctanh,$env); - $env->{funcs}->addfunc("abs", [["in", undef, undef, 0]],\&abs,$env); - $env->{funcs}->addfunc("floor", [["in", undef, undef, 0]],\&floor,$env); - $env->{funcs}->addfunc("ceil", [["in", undef, undef, 0]],\&ceil,$env); - $env->{funcs}->addfunc("int", [["in", undef, undef, 0]],\&int,$env); - $env->{funcs}->addfunc("rint", [["in", undef, undef, 0]],\&rint,$env); - $env->eval("round{x, d isa 1} := {var m = x * 10 ** d; rint[m] * 10 ** -d+0.0};"); - $env->{funcs}->addfunc("trunc", [["in", undef, undef, 0]],\&int,$env); - $env->{funcs}->addfunc("numerator", [["in", undef, $number, 0]],\&numerator,$env); - $env->{funcs}->addfunc("denominator", [["in", undef, $number, 0]],\&denominator,$env); - - $env->{funcs}->addfunc("real", [["in", undef, $number, 0]],\&real,$env); - $env->{funcs}->addfunc("imag", [["in", undef, $number, 0]],\&imag,$env); - $env->eval("imaginary{x isa 1} := imag[x]"); - $env->{funcs}->addfunc("conj", [["in", undef, $number, 0]],\&conj,$env); - $env->{funcs}->addfunc("norm", [["in", undef, $number, 0]],\&norm,$env); - - $env->{funcs}->addfunc("isprime", [["in", undef, $number, 0]],\&isprime,$env); - $env->{funcs}->addfunc("prime", [["in", undef, $number, 0]],\&prime,$env); - $env->{funcs}->addfunc("precprime", [["in", undef, $number, 0]],\&precprime,$env); - $env->{funcs}->addfunc("nextprime", [["in", undef, $number, 0]],\&nextprime,$env); - $env->{funcs}->addfunc("factor", [["in", undef, $number, 0]],\&factor,$env); - - $env->{funcs}->addfunc("randmax", [["in", undef, $number, 0]],\&randmax,$env); - $env->{funcs}->addfunc("getrseed", [[]],\&getrseed,$env); - $env->{funcs}->addfunc("setrseed", [[]],\&setrseed,$env); - $env->eval("random{} := randmax[10**30]/10.0**30"); - $env->eval("quad{a isa 1, b isa 1, c isa 1} := [(-b + sqrt[b^2 - 4 a c]) / 2a, (-b - sqrt[b^2 - 4 a c]) / 2a]"); - $env->eval("quadratic{a, b, c} := quad[a,b,c]"); - - $env->{funcs}->addfunc("gcd", [["left", undef, $number, 0],["right", undef, $number, 0]],\&gcd,$env); - $env->{funcs}->addfunc("lcm", [["left", undef, $number, 0],["right", undef, $number, 0]],\&lcm,$env); - - #these functions are simple enough to implement in farnsworth itself, so why not - $env->{funcs}->addfunc("sqrt", [["in", undef, undef, 0]],\&sqrt,$env); #putting in like this to see if it brings better luck - $env->eval("i := sqrt[-1]"); #since we have a better sqrt, use it to make a better i -# $env->eval("sqrt{x} := {x ^ 0.5}"); - $env->eval("exp{x isa 1} := {e ^ x}"); - $env->eval("inv{x} := {1/x}"); - $env->eval("recip{x} := {1/x}"); - - #$env->eval("_tohex{x isa 1} := { if(x < 16) { substrLen[\"0123456789abcdef\", x, 1] } else { _tohex[floor[x/16]] + _tohex[x%16] } }; tohex{x isa 1} := {\"0x\"+_tohex[x]}"); - -} - -sub sqrt -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - my $units = $input->getdimen(); - $units = $units->mult(PARI '1/2'); #half them all! - - return Math::Farnsworth::Value::Pari->new(Math::Pari::sqrt($input->getpari()), $units); -} - -sub sin -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::sin($input->getpari())); -} - -sub cos -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::cos($input->getpari())); -} - -sub tan -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::tan($input->getpari())); -} - -sub arcsin -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::asin($input->getpari())); -} - -sub arccos -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::acos($input->getpari())); -} - -sub arctan -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::atan($input->getpari())); -} - -sub sinh -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::sinh($input->getpari())); -} - -sub cosh -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::cosh($input->getpari())); -} - -sub tanh -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::tanh($input->getpari())); -} - -sub arcsinh -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::asinh($input->getpari())); -} - -sub arccosh -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::acosh($input->getpari())); -} - -sub arctanh -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::atanh($input->getpari())); -} - -sub abs -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::abs($input->getpari()), $input->getdimen()); -} - -sub floor -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::floor($input->getpari()), $input->getdimen()); -} - -sub ceil -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::ceil($input->getpari()), $input->getdimen()); -} - -sub int -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - my $e = PARI '0'; - my $r = Math::Farnsworth::Value::Pari->new(Math::Pari::truncate($input->getpari(),$e), $input->getdimen()); - print Data::Dumper->Dump([$r], ["\$r"]); - return $r; -} - -sub numerator -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - #bug? should i make it pull the positive dimensions? - return Math::Farnsworth::Value::Pari->new(Math::Pari::numerator($input->getpari())); -} - -sub denominator -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - #bug? should i make it pull the negative dimensions? - return Math::Farnsworth::Value::Pari->new(Math::Pari::denominator($input->getpari())); -} - -sub real -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::real($input->getpari()), $input->getdimen()); -} - -sub imag -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::imag($input->getpari()), $input->getdimen()); -} - -sub conj -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::conj($input->getpari()), $input->getdimen()); -} - -sub norm -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::norm($input->getpari()), $input->getdimen()); -} - -sub isprime -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Boolean->new(Math::Pari::isprime($input->getpari())); -} - -sub prime -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::prime($input->getpari())); -} - -sub nextprime -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::nextprime($input->getpari())); -} - -sub precprime -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::precprime($input->getpari())); -} - -sub factor -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::factor($input->getpari())); -} - -sub randmax -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::random($input->getpari())); -} - -sub setrseed -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - my $oldseed = Math::Pari::getrand(); - Math::Pari::setrand($input->getpari()); - - return Math::Farnsworth::Value::Pari->new($oldseed); -} - -sub getrseed -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - return Math::Farnsworth::Value::Pari->new(Math::Pari::getrand()); -} - -sub rint -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - #die "Argument to rint[] is not a numeric value" unless $input->isPARI(); - my $e = PARI '0'; - return Math::Farnsworth::Value::Pari->new(Math::Pari::round($input->getpari(), $e), $input->getdimen()); -} - -sub gcd -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $left = $eval->{vars}->getvar("left"); #i should clean this up more too - my $right = $eval->{vars}->getvar("right"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::gcd($left->getpari(), $right->getpari())); -} - -sub lcm -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $left = $eval->{vars}->getvar("left"); #i should clean this up more too - my $right = $eval->{vars}->getvar("right"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::lcm($left->getpari(), $right->getpari())); -} - -sub log -{ - #with an array we give the number of elements, with a string we give the length of the string - my ($args, $eval, $branches)= @_; - - my $input = $eval->{vars}->getvar("in"); #i should clean this up more too - - return Math::Farnsworth::Value::Pari->new(Math::Pari::log($input->getpari())); -} - -1; diff --git a/deps/Math/Farnsworth/Output.pm b/deps/Math/Farnsworth/Output.pm deleted file mode 100644 index fe7aedb..0000000 --- a/deps/Math/Farnsworth/Output.pm +++ /dev/null @@ -1,660 +0,0 @@ -package Math::Farnsworth::Output; - -use strict; -use warnings; - -use overload '""' => \&tostring; - -use Data::Dumper; -use Date::Manip; -use Carp qw(cluck carp confess); - -our %combos; -our %displays; - -#these primarily are used for display purposes -sub addcombo -{ - my $name = shift; - my $value = shift; #this is a valueless list of dimensions - - $combos{$name} = $value; -} - -#this returns the name of the combo that matches the current dimensions of a Math::Farnsworth::Value::Pari -sub findcombo -{ - my $self = shift; - my $value = shift; - - for my $combo (keys %combos) - { - my $cv = $combos{$combo}; #grab the value - return $combo if ($value->getdimen()->compare($cv->getdimen())); - } - - return undef; #none found -} - -#this sets a display for a combo first, then for a dimension -sub setdisplay -{ - my $self = shift; - my $name = shift; #this only works on things created by =!= or |||, i might try to extend that later but i don't think i need to, since you can just create a name with ||| when you need it - my $branch = shift; - - #I SHOULD CHECK FOR THE NAME!!!!! - #print Dumper($name, $branch); - - if (exists($combos{$name})) - { - $displays{$name} = $branch; - } - else - { - die "No such dimension/combination as $name\n"; - } -} - -sub getdisplay -{ - my $self = shift; - my $name = shift; - - if (defined($name) && exists($displays{$name})) - { - return $displays{$name}; #guess i'll just do the rest in there? - } - - return undef; -} - -sub new -{ - shift; #remove the class - my $self = {}; - $self->{units} = shift; - $self->{obj} = shift; - $self->{eval} = shift; - - #warn Dumper($self->{obj}); - die "Attempting to make output class of non Math::Farnsworth::Value" unless ref($self->{obj}) =~ /Math::Farnsworth::Value/; - confess "Forgot to add \$eval to params!" unless ref($self->{eval}) eq "Math::Farnsworth::Evaluate"; - - bless $self; -} - -sub tostring -{ - my $self = shift; - my $value = $self->{obj}; - - return $self->getoutstring($value); -} - -#this takes a set of dimensions and returns what to display -sub getoutstring -{ - my $self = shift; #i'll implement this later too -# my $dimen = shift; #i take a Math::Farnsworth::Dimension object! - my $value = shift; #the value so we can stringify it - - my @returns; - - if (defined($value->{outmagic})) - { - if (ref($value->{outmagic}[1]) eq "Math::Farnsworth::Value::String") - { - #ok we were given a string! - my $number = $value->{outmagic}[0]; - my $string = $value->{outmagic}[1]; - return $self->getoutstring($number) . " ".$string->getstring(); - } - elsif (exists($value->{outmagic}[0]) && (ref($value->{outmagic}[0]) ne "Math::Farnsworth::Value::Array")) - { - #ok we were given a value without the string - my $number = $value->{outmagic}[0]; - return $self->getoutstring($number); - } - else - { - print Dumper($value); - die "Unhandled output magic, this IS A BUG!"; - } - } - elsif (ref($value) eq "Math::Farnsworth::Value::Boolean") - { - return $value ? "True" : "False" - #these should do something! - } - elsif (ref($value) eq "Math::Farnsworth::Value::String") - { - #I NEED FUNCTIONS TO HANDLE ESCAPING AND UNESCAPING!!!! - my $val = $value->getstring(); - $val =~ s/\\/\\\\/g; - $val =~ s/"/\\"/g; - return '"'.$val.'"'; - } - elsif (ref($value) eq "Math::Farnsworth::Value::Array") - { - my @array; #this will be used to build the output - for my $v ($value->getarray()) - { - #print Dumper($v); - push @array, $self->getoutstring($v); - } - - return '['.(join ' , ', @array).']'; - } - elsif (ref($value) eq "Math::Farnsworth::Value::Date") - { - return $value->getdate()->strftime("# %F %H:%M:%S.%3N %Z #");#UnixDate($value->{pari}, "# %C #"); #output in ISO format for now - } - elsif (ref($value) eq "Math::Farnsworth::Value::Lambda") - { - - return $self->deparsetree($value->getbranches()); - } - elsif (ref($value) eq "Math::Farnsworth::Value::Undef") - { - return "undef"; - } - elsif (ref($value) eq "HASH") - { - warn "RED ALERT!!!! WE've got a BAD CASE HERE. We've got an UNBLESSED HASH"; - warn Dumper($value); - - return "undef"; - } - elsif (my $disp = $self->getdisplay($self->findcombo($value))) - { - #$disp should now contain the branches to be used on the RIGHT side of the -> - #wtf do i put on the left? i'm going to send over the Math::Farnsworth::Value, this generates a warning but i can remove that after i decide that its correct - - print "SUPERDISPLAY:\n"; - my $branch = bless [$value, $disp], 'Trans'; - print Dumper($branch); - my $newvalue = eval {$self->{eval}->evalbranch($branch);}; - return $self->getoutstring($newvalue); - } - else - { - my $dimen = $value->getdimen(); - #added a sort so its stable, i'll need this... - for my $d (sort {$a cmp $b} keys %{$dimen->{dimen}}) - { - my $exp = ""; - #print Dumper($dimen->{dimen}, $exp); - my $dv = "".($dimen->{dimen}{$d}); - my $realdv = "".(0.0+$dimen->{dimen}{$d}); #use this for comparing below, that way i can keep rational exponents when possible - - $dv =~ s/([.]\d+?)0+$/$1/; - $dv =~ s/E/e/; #make floating points clearer - - $exp = "^".($dv =~ /^[\d\.]+$/? $dv :"(".$dv.")") unless ($realdv eq "1"); - - push @returns, $self->{units}->getdimen($d).$exp; - } - - if (my $combo = $self->findcombo($value)) #this should be a method? - { - push @returns, "/* $combo */"; - } - - - my $prec = Math::Pari::setprecision(); - Math::Pari::setprecision(15); #set it to 15? - my $pv = "".(Math::Pari::pari_print($value->getpari())); - my $parenflag = $pv =~ /^[\d\.e]+$/i; - my $rational = $pv =~ m|/|; - - $pv =~ s/E/e/; #make floating points clearer - - if ($pv =~ m|/|) #check for rationality - { - my $nv = "".Math::Pari::pari_print($value->getpari() * 1.0); #attempt to force a floating value - $nv =~ s/([.]\d+?)0+$/$1/ ; - $pv .= " /* apx ($nv) */"; - } - - $pv = ($parenflag? $pv :"(".$pv.")"); #check if its a simple value, or complex, if it is complex, add parens - $pv =~ s/([.]\d+?)0+$/$1/ ; - - Math::Pari::setprecision($prec); #restore it before calcs - return $pv." ".join " ", @returns; - } -} - -sub deparsetree -{ - my $self = shift; - my $branch = shift; - - my $type = ref($branch); - my $return; - - if ($type eq "Add") - { - my $a = $self->deparsetree($branch->[0]); - my $b = $self->deparsetree($branch->[1]); - return $a . " + " . $b; - } - elsif ($type eq "Sub") - { - my $a = $self->deparsetree($branch->[0]); - my $b = $self->deparsetree($branch->[1]); - return $a . " - " . $b; - } - elsif ($type eq "Mul") - { - my $a = $self->deparsetree($branch->[0]); - my $b = $self->deparsetree($branch->[1]); - my $t = $branch->[2]; - - return $a . ($t eq 'imp' ? '' : ' * ') . $b; #NOTE: this should listen to the 'imp' or '*' in the tree! - } - elsif ($type eq "Div") - { - my $a = $self->deparsetree($branch->[0]); - my $b = $self->deparsetree($branch->[1]); - my $t = $branch->[2]; - - $return = $a . " $t " . $b; - } - elsif ($type eq "Conforms") - { - my $a = $self->deparsetree($branch->[0]); - my $b = $self->deparsetree($branch->[1]); - return "$a conforms $b"; - } - elsif ($type eq "Mod") - { - my $a = $self->deparsetree($branch->[0]); - my $b = $self->deparsetree($branch->[1]); - return "$a % $b"; - } - elsif ($type eq "Pow") - { - my $a = $self->deparsetree($branch->[0]); - my $b = $self->deparsetree($branch->[1]); - return "$a ^ $b"; - } - elsif ($type eq "And") - { - my $a = $self->deparsetree($branch->[0]); - my $b = $self->deparsetree($branch->[1]); - - return "$a && $b"; - } - elsif ($type eq "Or") - { - my $a = $self->deparsetree($branch->[0]); - my $b = $self->deparsetree($branch->[1]); - - return "$a || $b"; - } - elsif ($type eq "Xor") - { - my $a = $self->deparsetree($branch->[0]); - my $b = $self->deparsetree($branch->[1]); - return "$a ^^ $b"; - } - elsif ($type eq "Not") - { - my $a = $self->deparsetree($branch->[0]); - return "!$a"; - } - elsif ($type eq "Gt") - { - my $a = $self->deparsetree($branch->[0]); - my $b = $self->deparsetree($branch->[1]); - return "$a > $b"; - } - elsif ($type eq "Lt") - { - my $a = $self->deparsetree($branch->[0]); - my $b = $self->deparsetree($branch->[1]); - return "$a < $b"; - } - elsif ($type eq "Ge") - { - my $a = $self->deparsetree($branch->[0]); - my $b = $self->deparsetree($branch->[1]); - return "$a >= $b"; - } - elsif ($type eq "Le") - { - my $a = $self->deparsetree($branch->[0]); - my $b = $self->deparsetree($branch->[1]); - return "$a <= $b"; - } - elsif ($type eq "Compare") - { - my $a = $self->deparsetree($branch->[0]); - my $b = $self->deparsetree($branch->[1]); - return "$a <=> $b"; - } - elsif ($type eq "Eq") - { - my $a = $self->deparsetree($branch->[0]); - my $b = $self->deparsetree($branch->[1]); - return "$a == $b"; - } - elsif ($type eq "Ne") - { - my $a = $self->deparsetree($branch->[0]); - my $b = $self->deparsetree($branch->[1]); - return "$a != $b"; - } - elsif ($type eq "Ternary") - { - my $left = $self->deparsetree($branch->[0]); - my $one = $self->deparsetree($branch->[1]); - my $two = $self->deparsetree($branch->[2]); - - return "$left ? $one : $two"; - } - elsif ($type eq "If") - { - my $return = ""; - my $left = $self->deparsetree($branch->[0]); - my $std = $self->deparsetree($branch->[1]); - - $return = "if ($left) { $std }"; - - if ($branch->[2]) - { - my $else = $self->deparsetree($branch->[2]); - $return .= " else { $else }"; - } - - #$return .= ";"; #NOTE: DO I NEED THIS? probably not! - - return $return; - } - elsif ($type eq "Store") - { - my $name = $branch->[0]; - my $value = $self->deparsetree($branch->[1]); - - return "$name = $value"; - } - elsif ($type eq "DeclareVar") - { - my $name = $branch->[0]; - - my $return = "var $name"; - - if (defined($branch->[1])) - { - my $val = $self->deparsetree($branch->[1]); - $return .= " = $val"; - } - - return $return; - } - elsif ($type eq "FuncDef") - { - #print Dumper($branch); - my $name = $branch->[0]; - my $args = $branch->[1]; - my $value = $self->deparsetree($branch->[2]); #not really a value, but in fact the tree to run for the function - - my $return = "${name}{"; - - my $vargs = ""; - - for my $arg (@$args) - { - my $foobs=""; - my $constraint = $arg->[2]; - my $default = $arg->[1]; - my $name = $arg->[0]; #name - - $foobs = $name; - if (defined($default)) - { - $foobs .= " = ".$self->deparsetree($default); #should be right - } - - if (defined($constraint)) - { - #print Dumper($constraint); - $foobs .= " isa ".$self->deparsetree($constraint); #should be right - #print Dumper($constraint); - } - - $vargs .= $foobs; - } - - $return .= "$vargs} := { $value }"; - } - elsif ($type eq "FuncCall") - { - my $name = $branch->[0]; - my $args = $self->deparsetree($branch->[1]); #this is an array, need to evaluate it - - return "$name\[$args\]"; - } - elsif ($type eq "Lambda") - { - my $args = $branch->[0]; - my $code = $self->deparsetree($branch->[1]); - - my $vargs = ""; - - for my $arg (@$args) - { - my $foobs=""; - my $reference = $arg->[3]; - my $constraint = $arg->[2]; - my $default = $arg->[1]; - my $name = $arg->[0]; #name - - $foobs = $name; - if ($reference) - { - $foobs .= " byref "; #should be right - } - - if (defined($default)) - { - $foobs .= " = ".$self->deparsetree($default); #should be right - } - - if (defined($constraint)) - { - #print Dumper($constraint); - $foobs .= " isa ".$self->deparsetree($constraint); #should be right - #print Dumper($constraint); - } - - $vargs .= $foobs; - } - - return "{`$vargs` $code}"; - } - elsif ($type eq "LambdaCall") - { - my $left = $self->deparsetree($branch->[0]); - my $right = $self->deparsetree($branch->[1]); - - return "$left => $right"; - } - elsif (($type eq "Array") || ($type eq "SubArray")) - { - my $array = []; #fixes bug with empty arrays - for my $bs (@$branch) #iterate over all the elements - { - my $type = ref($bs); #find out what kind of thing we are - my $value = $self->deparsetree($bs); - - #since we have an array, but its not in a SUBarray, we dereference it before the push - push @$array, $value; - #push @$array, '['.$value.']' if ($type eq "SubArray"); - } - return '[ '.(join ', ',@$array).' ]'; - - } - elsif ($type eq "ArgArray") - { - my $array = []; - for my $bs (@$branch) #iterate over all the elements - { - my $value = $self->deparsetree($bs); - - push @$array, $value; #we return an array ref! i need more error checking around for this later - } - return join ', ', @$array; - } - elsif ($type eq "ArrayFetch") - { - my $var = $self->deparsetree($branch->[0]); #need to check if this is an array, and die if not - my $listval = $self->deparsetree($branch->[1]); - - $listval = substr $listval, 1,length($listval)-2; #strip the [] - - return "$var\@$listval\$"; - } - elsif ($type eq "ArrayStore") - { - my $var = $self->deparsetree(bless [$branch->[0]], 'Fetch'); #need to check if this is an array, and die if not - my $listval = $self->deparsetree($branch->[1]); - my $rval = $self->deparsetree($branch->[2]); - - $listval = substr $listval, 1,length($listval)-2; #strip the [] - - return "$var\@$listval\$ = $rval"; - } - elsif ($type eq "While") - { - my $cond = $self->deparsetree($branch->[0]); #what to check each time - my $stmts = $self->deparsetree($branch->[1]); #what to run each time - - return "while ($cond) { $stmts }" - } - elsif ($type eq "Stmt") - { - my $return = ""; - for my $bs (@$branch) #iterate over all the statements - { my $r = $self->deparsetree($bs); - $return .= "$r; " if defined $r; #this has interesting semantics! - } - return $return; - } - elsif ($type eq "Paren") - { - return '(' . $self->deparsetree($branch->[0]) . ')'; - } - elsif ($type eq "SetDisplay") - { - my $combo = $branch->[0][0]; #is a string? - my $right = $self->deparsetree($branch->[1]); - - return "$combo :-> $right"; - } - elsif ($type eq "UnitDef") - { - my $unitsize = $self->deparsetree($branch->[1]); - my $name = $branch->[0]; - - return "$name := $unitsize"; - } - elsif ($type eq "DefineDimen") - { - my $unit = $branch->[1]; - my $dimen = $branch->[0]; - - return "$dimen =!= $unit"; - } - elsif ($type eq "DefineCombo") - { - my $combo = $branch->[1]; #should get me a string! - my $value = $self->deparsetree($branch->[0]); - - return "$value ||| $combo"; - } - elsif (($type eq "SetPrefix") || ($type eq "SetPrefixAbrv")) - { - my $name = $branch->[0]; - my $value = $self->deparsetree($branch->[1]); - - return "$name ::- $value"; - } - elsif ($type eq "Trans") - { - my $left = $self->deparsetree($branch->[0]); - my $right = $self->deparsetree($branch->[1]); - - return "$left -> $right"; - } - elsif (($type eq "Num") || ($type eq "Fetch") || ($type eq "HexNum")) - { - return $branch->[0]; #its already a string! - } - elsif ($type eq "String") - { - return '"'.$branch->[0].'"'; - } - elsif ($type eq "Date") - { - return "#".$branch->[0]."#"; - } - elsif ($type eq "VarArg") - { - return "..."; - } - elsif (!defined($branch)) - { - return ""; #got an undefined value, just make it blank - } - else - { -# cluck "Unhandled input!"; - return '/*'.Dumper($branch).'*/'; - } -} - -sub makevalue -{ - confess "MAKEVALUE WAS CALLED!\n"; -} - -1; -__END__ - -# Below is stub documentation for your module. You'd better edit it! - -=head1 NAME - -Math::Farnsworth::Output - Wrapper class for making output simpler - -=head1 SYNOPSIS - - use Math::Farnsworth; - - my $hubert = Math::Farnsworth->new(); - - my $result = $hubert->runString("10 km -> miles"); - - my $result = $hubert->runFile("file.frns"); - - print $result; - -=head1 METHODS - -This has only one method that a user should be aware of, C; you can call this directly on the object, e.g. $result->tostring() - -=head1 AUTHOR - -Ryan Voots Esimcop@cpan.orgE - -=head1 COPYRIGHT AND LICENSE - -Copyright (C) 2008 by Ryan Voots - -This library is free software; you can redistribute it and/or modify -it under the same terms as Perl itself, either Perl version 5.8.0 or, -at your option, any later version of Perl 5 you may have available. - -=cut diff --git a/deps/Math/Farnsworth/Parser.pm b/deps/Math/Farnsworth/Parser.pm deleted file mode 100644 index 40b03e0..0000000 --- a/deps/Math/Farnsworth/Parser.pm +++ /dev/null @@ -1,3693 +0,0 @@ -#################################################################### -# -# This file was generated using Parse::Yapp version 1.05. -# -# Don't edit this file, use source file instead. -# -# ANY CHANGE MADE HERE WILL BE LOST ! -# -#################################################################### -package Math::Farnsworth::Parser; -use vars qw ( @ISA ); -use strict; - -@ISA= qw ( Parse::Yapp::Driver ); -#Included Parse/Yapp/Driver.pm file---------------------------------------- -{ -# -# Module Parse::Yapp::Driver -# -# This module is part of the Parse::Yapp package available on your -# nearest CPAN -# -# Any use of this module in a standalone parser make the included -# text under the same copyright as the Parse::Yapp module itself. -# -# This notice should remain unchanged. -# -# (c) Copyright 1998-2001 Francois Desarmenien, all rights reserved. -# (see the pod text in Parse::Yapp module for use and distribution rights) -# - -package Parse::Yapp::Driver; - -require 5.004; - -use strict; - -use vars qw ( $VERSION $COMPATIBLE $FILENAME ); - -$VERSION = '1.05'; -$COMPATIBLE = '0.07'; -$FILENAME=__FILE__; - -use Carp; - -#Known parameters, all starting with YY (leading YY will be discarded) -my(%params)=(YYLEX => 'CODE', 'YYERROR' => 'CODE', YYVERSION => '', - YYRULES => 'ARRAY', YYSTATES => 'ARRAY', YYDEBUG => ''); -#Mandatory parameters -my(@params)=('LEX','RULES','STATES'); - -sub new { - my($class)=shift; - my($errst,$nberr,$token,$value,$check,$dotpos); - my($self)={ ERROR => \&_Error, - ERRST => \$errst, - NBERR => \$nberr, - TOKEN => \$token, - VALUE => \$value, - DOTPOS => \$dotpos, - STACK => [], - DEBUG => 0, - CHECK => \$check }; - - _CheckParams( [], \%params, \@_, $self ); - - exists($$self{VERSION}) - and $$self{VERSION} < $COMPATIBLE - and croak "Yapp driver version $VERSION ". - "incompatible with version $$self{VERSION}:\n". - "Please recompile parser module."; - - ref($class) - and $class=ref($class); - - bless($self,$class); -} - -sub YYParse { - my($self)=shift; - my($retval); - - _CheckParams( \@params, \%params, \@_, $self ); - - if($$self{DEBUG}) { - _DBLoad(); - $retval = eval '$self->_DBParse()';#Do not create stab entry on compile - $@ and die $@; - } - else { - $retval = $self->_Parse(); - } - $retval -} - -sub YYData { - my($self)=shift; - - exists($$self{USER}) - or $$self{USER}={}; - - $$self{USER}; - -} - -sub YYErrok { - my($self)=shift; - - ${$$self{ERRST}}=0; - undef; -} - -sub YYNberr { - my($self)=shift; - - ${$$self{NBERR}}; -} - -sub YYRecovering { - my($self)=shift; - - ${$$self{ERRST}} != 0; -} - -sub YYAbort { - my($self)=shift; - - ${$$self{CHECK}}='ABORT'; - undef; -} - -sub YYAccept { - my($self)=shift; - - ${$$self{CHECK}}='ACCEPT'; - undef; -} - -sub YYError { - my($self)=shift; - - ${$$self{CHECK}}='ERROR'; - undef; -} - -sub YYSemval { - my($self)=shift; - my($index)= $_[0] - ${$$self{DOTPOS}} - 1; - - $index < 0 - and -$index <= @{$$self{STACK}} - and return $$self{STACK}[$index][1]; - - undef; #Invalid index -} - -sub YYCurtok { - my($self)=shift; - - @_ - and ${$$self{TOKEN}}=$_[0]; - ${$$self{TOKEN}}; -} - -sub YYCurval { - my($self)=shift; - - @_ - and ${$$self{VALUE}}=$_[0]; - ${$$self{VALUE}}; -} - -sub YYExpect { - my($self)=shift; - - keys %{$self->{STATES}[$self->{STACK}[-1][0]]{ACTIONS}} -} - -sub YYLexer { - my($self)=shift; - - $$self{LEX}; -} - - -################# -# Private stuff # -################# - - -sub _CheckParams { - my($mandatory,$checklist,$inarray,$outhash)=@_; - my($prm,$value); - my($prmlst)={}; - - while(($prm,$value)=splice(@$inarray,0,2)) { - $prm=uc($prm); - exists($$checklist{$prm}) - or croak("Unknow parameter '$prm'"); - ref($value) eq $$checklist{$prm} - or croak("Invalid value for parameter '$prm'"); - $prm=unpack('@2A*',$prm); - $$outhash{$prm}=$value; - } - for (@$mandatory) { - exists($$outhash{$_}) - or croak("Missing mandatory parameter '".lc($_)."'"); - } -} - -sub _Error { - print "Parse error.\n"; -} - -sub _DBLoad { - { - no strict 'refs'; - - exists(${__PACKAGE__.'::'}{_DBParse})#Already loaded ? - and return; - } - my($fname)=__FILE__; - my(@drv); - open(DRV,"<$fname") or die "Report this as a BUG: Cannot open $fname"; - while() { - /^\s*sub\s+_Parse\s*{\s*$/ .. /^\s*}\s*#\s*_Parse\s*$/ - and do { - s/^#DBG>//; - push(@drv,$_); - } - } - close(DRV); - - $drv[0]=~s/_P/_DBP/; - eval join('',@drv); -} - -#Note that for loading debugging version of the driver, -#this file will be parsed from 'sub _Parse' up to '}#_Parse' inclusive. -#So, DO NOT remove comment at end of sub !!! -sub _Parse { - my($self)=shift; - - my($rules,$states,$lex,$error) - = @$self{ 'RULES', 'STATES', 'LEX', 'ERROR' }; - my($errstatus,$nberror,$token,$value,$stack,$check,$dotpos) - = @$self{ 'ERRST', 'NBERR', 'TOKEN', 'VALUE', 'STACK', 'CHECK', 'DOTPOS' }; - -#DBG> my($debug)=$$self{DEBUG}; -#DBG> my($dbgerror)=0; - -#DBG> my($ShowCurToken) = sub { -#DBG> my($tok)='>'; -#DBG> for (split('',$$token)) { -#DBG> $tok.= (ord($_) < 32 or ord($_) > 126) -#DBG> ? sprintf('<%02X>',ord($_)) -#DBG> : $_; -#DBG> } -#DBG> $tok.='<'; -#DBG> }; - - $$errstatus=0; - $$nberror=0; - ($$token,$$value)=(undef,undef); - @$stack=( [ 0, undef ] ); - $$check=''; - - while(1) { - my($actions,$act,$stateno); - - $stateno=$$stack[-1][0]; - $actions=$$states[$stateno]; - -#DBG> print STDERR ('-' x 40),"\n"; -#DBG> $debug & 0x2 -#DBG> and print STDERR "In state $stateno:\n"; -#DBG> $debug & 0x08 -#DBG> and print STDERR "Stack:[". -#DBG> join(',',map { $$_[0] } @$stack). -#DBG> "]\n"; - - - if (exists($$actions{ACTIONS})) { - - defined($$token) - or do { - ($$token,$$value)=&$lex($self); -#DBG> $debug & 0x01 -#DBG> and print STDERR "Need token. Got ".&$ShowCurToken."\n"; - }; - - $act= exists($$actions{ACTIONS}{$$token}) - ? $$actions{ACTIONS}{$$token} - : exists($$actions{DEFAULT}) - ? $$actions{DEFAULT} - : undef; - } - else { - $act=$$actions{DEFAULT}; -#DBG> $debug & 0x01 -#DBG> and print STDERR "Don't need token.\n"; - } - - defined($act) - and do { - - $act > 0 - and do { #shift - -#DBG> $debug & 0x04 -#DBG> and print STDERR "Shift and go to state $act.\n"; - - $$errstatus - and do { - --$$errstatus; - -#DBG> $debug & 0x10 -#DBG> and $dbgerror -#DBG> and $$errstatus == 0 -#DBG> and do { -#DBG> print STDERR "**End of Error recovery.\n"; -#DBG> $dbgerror=0; -#DBG> }; - }; - - - push(@$stack,[ $act, $$value ]); - - $$token ne '' #Don't eat the eof - and $$token=$$value=undef; - next; - }; - - #reduce - my($lhs,$len,$code,@sempar,$semval); - ($lhs,$len,$code)=@{$$rules[-$act]}; - -#DBG> $debug & 0x04 -#DBG> and $act -#DBG> and print STDERR "Reduce using rule ".-$act." ($lhs,$len): "; - - $act - or $self->YYAccept(); - - $$dotpos=$len; - - unpack('A1',$lhs) eq '@' #In line rule - and do { - $lhs =~ /^\@[0-9]+\-([0-9]+)$/ - or die "In line rule name '$lhs' ill formed: ". - "report it as a BUG.\n"; - $$dotpos = $1; - }; - - @sempar = $$dotpos - ? map { $$_[1] } @$stack[ -$$dotpos .. -1 ] - : (); - - $semval = $code ? &$code( $self, @sempar ) - : @sempar ? $sempar[0] : undef; - - splice(@$stack,-$len,$len); - - $$check eq 'ACCEPT' - and do { - -#DBG> $debug & 0x04 -#DBG> and print STDERR "Accept.\n"; - - return($semval); - }; - - $$check eq 'ABORT' - and do { - -#DBG> $debug & 0x04 -#DBG> and print STDERR "Abort.\n"; - - return(undef); - - }; - -#DBG> $debug & 0x04 -#DBG> and print STDERR "Back to state $$stack[-1][0], then "; - - $$check eq 'ERROR' - or do { -#DBG> $debug & 0x04 -#DBG> and print STDERR -#DBG> "go to state $$states[$$stack[-1][0]]{GOTOS}{$lhs}.\n"; - -#DBG> $debug & 0x10 -#DBG> and $dbgerror -#DBG> and $$errstatus == 0 -#DBG> and do { -#DBG> print STDERR "**End of Error recovery.\n"; -#DBG> $dbgerror=0; -#DBG> }; - - push(@$stack, - [ $$states[$$stack[-1][0]]{GOTOS}{$lhs}, $semval ]); - $$check=''; - next; - }; - -#DBG> $debug & 0x04 -#DBG> and print STDERR "Forced Error recovery.\n"; - - $$check=''; - - }; - - #Error - $$errstatus - or do { - - $$errstatus = 1; - &$error($self); - $$errstatus # if 0, then YYErrok has been called - or next; # so continue parsing - -#DBG> $debug & 0x10 -#DBG> and do { -#DBG> print STDERR "**Entering Error recovery.\n"; -#DBG> ++$dbgerror; -#DBG> }; - - ++$$nberror; - - }; - - $$errstatus == 3 #The next token is not valid: discard it - and do { - $$token eq '' # End of input: no hope - and do { -#DBG> $debug & 0x10 -#DBG> and print STDERR "**At eof: aborting.\n"; - return(undef); - }; - -#DBG> $debug & 0x10 -#DBG> and print STDERR "**Dicard invalid token ".&$ShowCurToken.".\n"; - - $$token=$$value=undef; - }; - - $$errstatus=3; - - while( @$stack - and ( not exists($$states[$$stack[-1][0]]{ACTIONS}) - or not exists($$states[$$stack[-1][0]]{ACTIONS}{error}) - or $$states[$$stack[-1][0]]{ACTIONS}{error} <= 0)) { - -#DBG> $debug & 0x10 -#DBG> and print STDERR "**Pop state $$stack[-1][0].\n"; - - pop(@$stack); - } - - @$stack - or do { - -#DBG> $debug & 0x10 -#DBG> and print STDERR "**No state left on stack: aborting.\n"; - - return(undef); - }; - - #shift the error token - -#DBG> $debug & 0x10 -#DBG> and print STDERR "**Shift \$error token and go to state ". -#DBG> $$states[$$stack[-1][0]]{ACTIONS}{error}. -#DBG> ".\n"; - - push(@$stack, [ $$states[$$stack[-1][0]]{ACTIONS}{error}, undef ]); - - } - - #never reached - croak("Error in driver logic. Please, report it as a BUG"); - -}#_Parse -#DO NOT remove comment - -1; - -} -#End of include-------------------------------------------------- - - -#line 20 "Farnsworth.yp" - -use Data::Dumper; #boobs -my $s; # warning - not re-entrant -my $fullstring; -my $charcount; - - -sub new { - my($class)=shift; - ref($class) - and $class=ref($class); - - my($self)=$class->SUPER::new( yyversion => '1.05', - yystates => -[ - {#State 0 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 17, - "var" => 20, - 'DATE' => 4, - "while" => 22, - 'STRING' => 7, - "if" => 10, - "(" => 26, - 'HEXNUMBER' => 25, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - DEFAULT => -1, - GOTOS => { - 'exprval2' => 2, - 'stma' => 18, - 'lambda' => 3, - 'exprval' => 19, - 'ifstartcond' => 21, - 'arrayfetchexpr' => 5, - 'if' => 8, - 'assignexpr' => 6, - 'stmt' => 23, - 'exprval1' => 9, - 'while' => 24, - 'expr' => 12, - 'multexpr' => 14 - } - }, - {#State 1 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 27, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 2 - DEFAULT => -47 - }, - {#State 3 - DEFAULT => -84 - }, - {#State 4 - DEFAULT => -87 - }, - {#State 5 - DEFAULT => -48 - }, - {#State 6 - DEFAULT => -89 - }, - {#State 7 - DEFAULT => -88 - }, - {#State 8 - DEFAULT => -12 - }, - {#State 9 - DEFAULT => -46 - }, - {#State 10 - ACTIONS => { - "(" => 29 - } - }, - {#State 11 - ACTIONS => { - 'HEXNUMBER' => 25, - "(" => 26, - 'NAME' => 30, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'exprval' => 31, - 'arrayfetchexpr' => 5 - } - }, - {#State 12 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "+" => 36, - "**" => 35, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "^" => 40, - "*" => 42, - "per" => 43, - ":->" => 44, - "!=" => 45, - "|||" => 46, - "?" => 49, - "&&" => 48, - "||" => 47, - "^^" => 50, - "/" => 52, - "->" => 51, - "=" => 53, - "=>" => 54, - "<=" => 56, - "<=>" => 55, - ">" => 57 - }, - DEFAULT => -5 - }, - {#State 13 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - "," => 58, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - DEFAULT => -29, - GOTOS => { - 'exprval2' => 2, - 'lambda' => 3, - 'exprval' => 19, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6, - 'exprval1' => 9, - 'array' => 59, - 'expr' => 60, - 'multexpr' => 14 - } - }, - {#State 14 - DEFAULT => -58 - }, - {#State 15 - DEFAULT => -42 - }, - {#State 16 - ACTIONS => { - 'NAME' => 62 - }, - DEFAULT => -39, - GOTOS => { - 'arglist' => 63, - 'argelement' => 61 - } - }, - {#State 17 - ACTIONS => { - "[" => 64, - "::-" => 68, - ":=" => 65, - "=!=" => 67, - "{" => 66, - ":-" => 69 - }, - DEFAULT => -44 - }, - {#State 18 - ACTIONS => { - '' => 70 - } - }, - {#State 19 - ACTIONS => { - "\@" => 71, - 'HEXNUMBER' => 25, - "(" => 26, - 'NUMBER' => 15, - 'NAME' => 30 - }, - DEFAULT => -56, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'exprval' => 72, - 'arrayfetchexpr' => 5 - } - }, - {#State 20 - ACTIONS => { - 'NAME' => 73 - } - }, - {#State 21 - ACTIONS => { - "\n" => 74, - "{" => 75 - }, - GOTOS => { - 'ifstmts' => 76 - } - }, - {#State 22 - ACTIONS => { - "(" => 77 - } - }, - {#State 23 - ACTIONS => { - "\n" => 79, - ";" => 78 - }, - DEFAULT => -2 - }, - {#State 24 - DEFAULT => -13 - }, - {#State 25 - DEFAULT => -43 - }, - {#State 26 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 80, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 27 - ACTIONS => { - "**" => 35, - "^" => 40 - }, - DEFAULT => -57 - }, - {#State 28 - ACTIONS => { - "[" => 64, - "::-" => 68, - "{" => 66, - ":-" => 69 - }, - DEFAULT => -44 - }, - {#State 29 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 81, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 30 - DEFAULT => -44 - }, - {#State 31 - ACTIONS => { - "\@" => 71 - }, - DEFAULT => -71 - }, - {#State 32 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 82, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 33 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 83, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 34 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 84, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 35 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 85, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 36 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 86, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 37 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 87, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 38 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 88, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 39 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 89, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 40 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 90, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 41 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 91, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 42 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 92, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 43 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 93, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 44 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 94, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 45 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 95, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 46 - ACTIONS => { - 'NAME' => 96 - } - }, - {#State 47 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 97, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 48 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 98, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 49 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 99, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 50 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 100, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 51 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 101, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 52 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 102, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 53 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 103, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 54 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 104, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 55 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 105, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 56 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 106, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 57 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 107, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 58 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - "," => 58, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - DEFAULT => -29, - GOTOS => { - 'exprval2' => 2, - 'lambda' => 3, - 'exprval' => 19, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6, - 'exprval1' => 9, - 'array' => 108, - 'expr' => 60, - 'multexpr' => 14 - } - }, - {#State 59 - ACTIONS => { - "]" => 109 - } - }, - {#State 60 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "+" => 36, - "**" => 35, - "," => 110, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "^" => 40, - "*" => 42, - "per" => 43, - "!=" => 45, - "?" => 49, - "&&" => 48, - "||" => 47, - "^^" => 50, - "/" => 52, - "->" => 51, - "=" => 53, - "=>" => 54, - "<=" => 56, - "<=>" => 55, - ">" => 57 - }, - DEFAULT => -28 - }, - {#State 61 - ACTIONS => { - "," => 111 - }, - DEFAULT => -41 - }, - {#State 62 - ACTIONS => { - "isa" => 114, - "byref" => 112, - "=" => 113 - }, - DEFAULT => -36 - }, - {#State 63 - ACTIONS => { - "`" => 115 - } - }, - {#State 64 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - "," => 58, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - DEFAULT => -29, - GOTOS => { - 'exprval2' => 2, - 'lambda' => 3, - 'exprval' => 19, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6, - 'exprval1' => 9, - 'array' => 116, - 'expr' => 60, - 'multexpr' => 14 - } - }, - {#State 65 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 117, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 66 - ACTIONS => { - 'NAME' => 62 - }, - DEFAULT => -39, - GOTOS => { - 'arglist' => 118, - 'argelement' => 61 - } - }, - {#State 67 - ACTIONS => { - 'NAME' => 119 - } - }, - {#State 68 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 120, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 69 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 121, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 70 - DEFAULT => 0 - }, - {#State 71 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - "," => 58, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - DEFAULT => -29, - GOTOS => { - 'exprval2' => 2, - 'lambda' => 3, - 'exprval' => 19, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6, - 'exprval1' => 9, - 'array' => 122, - 'expr' => 60, - 'multexpr' => 14 - } - }, - {#State 72 - ACTIONS => { - "\@" => 71 - }, - DEFAULT => -53 - }, - {#State 73 - ACTIONS => { - "=" => 123 - }, - DEFAULT => -6 - }, - {#State 74 - ACTIONS => { - "{" => 75 - }, - GOTOS => { - 'ifstmts' => 124 - } - }, - {#State 75 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 17, - "var" => 20, - 'DATE' => 4, - "while" => 22, - 'STRING' => 7, - "if" => 10, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - DEFAULT => -1, - GOTOS => { - 'exprval2' => 2, - 'stma' => 125, - 'lambda' => 3, - 'exprval' => 19, - 'ifstartcond' => 21, - 'arrayfetchexpr' => 5, - 'if' => 8, - 'assignexpr' => 6, - 'stmt' => 23, - 'exprval1' => 9, - 'while' => 24, - 'expr' => 12, - 'multexpr' => 14 - } - }, - {#State 76 - ACTIONS => { - "else" => 126 - }, - DEFAULT => -16 - }, - {#State 77 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 128, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 78 - ACTIONS => { - "-" => 1, - 'DATE' => 4, - 'STRING' => 7, - "if" => 10, - "!" => 11, - "[" => 13, - 'NUMBER' => 15, - "{`" => 16, - 'NAME' => 17, - "var" => 20, - "while" => 22, - "(" => 26, - 'HEXNUMBER' => 25 - }, - DEFAULT => -1, - GOTOS => { - 'exprval2' => 2, - 'stma' => 129, - 'lambda' => 3, - 'exprval' => 19, - 'ifstartcond' => 21, - 'arrayfetchexpr' => 5, - 'if' => 8, - 'assignexpr' => 6, - 'stmt' => 23, - 'exprval1' => 9, - 'while' => 24, - 'expr' => 12, - 'multexpr' => 14 - } - }, - {#State 79 - ACTIONS => { - "-" => 1, - 'DATE' => 4, - 'STRING' => 7, - "if" => 10, - "!" => 11, - "[" => 13, - 'NUMBER' => 15, - "{`" => 16, - 'NAME' => 17, - "var" => 20, - "while" => 22, - "(" => 26, - 'HEXNUMBER' => 25 - }, - DEFAULT => -1, - GOTOS => { - 'exprval2' => 2, - 'stma' => 130, - 'lambda' => 3, - 'exprval' => 19, - 'ifstartcond' => 21, - 'arrayfetchexpr' => 5, - 'if' => 8, - 'assignexpr' => 6, - 'stmt' => 23, - 'exprval1' => 9, - 'while' => 24, - 'expr' => 12, - 'multexpr' => 14 - } - }, - {#State 80 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "+" => 36, - "**" => 35, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "^" => 40, - "*" => 42, - "per" => 43, - ")" => 131, - "!=" => 45, - "?" => 49, - "||" => 47, - "&&" => 48, - "^^" => 50, - "/" => 52, - "->" => 51, - "=" => 53, - "=>" => 54, - "<=" => 56, - "<=>" => 55, - ">" => 57 - } - }, - {#State 81 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "+" => 36, - "**" => 35, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "^" => 40, - "*" => 42, - "per" => 43, - ")" => 132, - "!=" => 45, - "?" => 49, - "||" => 47, - "&&" => 48, - "^^" => 50, - "/" => 52, - "->" => 51, - "=" => 53, - "=>" => 54, - "<=" => 56, - "<=>" => 55, - ">" => 57 - } - }, - {#State 82 - ACTIONS => { - "%" => 37, - " " => 41, - "*" => 42, - "**" => 35, - "^" => 40, - "per" => 43, - "/" => 52 - }, - DEFAULT => -60 - }, - {#State 83 - ACTIONS => { - "-" => 32, - "<" => 34, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "*" => 42, - "<=" => 56, - ">" => 57, - "**" => 35, - "+" => 36, - "^" => 40, - "per" => 43, - "!=" => 45, - "/" => 52, - "<=>" => 55 - }, - DEFAULT => -66 - }, - {#State 84 - ACTIONS => { - "-" => 32, - "<" => undef, - "%" => 37, - "==" => undef, - ">=" => undef, - " " => 41, - "*" => 42, - "<=" => undef, - ">" => undef, - "**" => 35, - "+" => 36, - "^" => 40, - "per" => 43, - "!=" => undef, - "/" => 52, - "<=>" => undef - }, - DEFAULT => -72 - }, - {#State 85 - ACTIONS => { - "**" => 35, - "^" => 40 - }, - DEFAULT => -65 - }, - {#State 86 - ACTIONS => { - "%" => 37, - " " => 41, - "*" => 42, - "**" => 35, - "^" => 40, - "per" => 43, - "/" => 52 - }, - DEFAULT => -59 - }, - {#State 87 - ACTIONS => { - "**" => 35, - "^" => 40 - }, - DEFAULT => -63 - }, - {#State 88 - ACTIONS => { - "-" => 32, - "<" => undef, - "%" => 37, - "==" => undef, - ">=" => undef, - " " => 41, - "*" => 42, - "<=" => undef, - ">" => undef, - "**" => 35, - "+" => 36, - "^" => 40, - "per" => 43, - "!=" => undef, - "/" => 52, - "<=>" => undef - }, - DEFAULT => -76 - }, - {#State 89 - ACTIONS => { - "-" => 32, - "<" => undef, - "%" => 37, - "==" => undef, - ">=" => undef, - " " => 41, - "*" => 42, - "<=" => undef, - ">" => undef, - "**" => 35, - "+" => 36, - "^" => 40, - "per" => 43, - "!=" => undef, - "/" => 52, - "<=>" => undef - }, - DEFAULT => -75 - }, - {#State 90 - ACTIONS => { - "**" => 35, - "^" => 40 - }, - DEFAULT => -64 - }, - {#State 91 - ACTIONS => { - "**" => 35, - "^" => 40 - }, - DEFAULT => -55 - }, - {#State 92 - ACTIONS => { - "**" => 35, - "^" => 40 - }, - DEFAULT => -52 - }, - {#State 93 - ACTIONS => { - "%" => 37, - " " => 41, - "*" => 42, - "**" => 35, - "^" => 40, - "/" => 52 - }, - DEFAULT => -62 - }, - {#State 94 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "+" => 36, - "**" => 35, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "^" => 40, - "*" => 42, - "per" => 43, - "!=" => 45, - "?" => 49, - "||" => 47, - "&&" => 48, - "^^" => 50, - "/" => 52, - "->" => 51, - "=" => 53, - "=>" => 54, - "<=" => 56, - "<=>" => 55, - ">" => 57 - }, - DEFAULT => -9 - }, - {#State 95 - ACTIONS => { - "-" => 32, - "<" => undef, - "%" => 37, - "==" => undef, - ">=" => undef, - " " => 41, - "*" => 42, - "<=" => undef, - ">" => undef, - "**" => 35, - "+" => 36, - "^" => 40, - "per" => 43, - "!=" => undef, - "/" => 52, - "<=>" => undef - }, - DEFAULT => -78 - }, - {#State 96 - DEFAULT => -11 - }, - {#State 97 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "*" => 42, - "<=" => 56, - ">" => 57, - "**" => 35, - "+" => 36, - "^" => 40, - "per" => 43, - "!=" => 45, - "/" => 52, - "<=>" => 55 - }, - DEFAULT => -69 - }, - {#State 98 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "*" => 42, - "<=" => 56, - ">" => 57, - "**" => 35, - "+" => 36, - "^" => 40, - "per" => 43, - "!=" => 45, - "/" => 52, - "<=>" => 55 - }, - DEFAULT => -68 - }, - {#State 99 - ACTIONS => { - ":" => 133, - "-" => 32, - "conforms" => 33, - "<" => 34, - "+" => 36, - "**" => 35, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "^" => 40, - "*" => 42, - "per" => 43, - "!=" => 45, - "?" => 49, - "||" => 47, - "&&" => 48, - "^^" => 50, - "/" => 52, - "->" => 51, - "=" => 53, - "=>" => 54, - "<=" => 56, - "<=>" => 55, - ">" => 57 - } - }, - {#State 100 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "*" => 42, - "<=" => 56, - ">" => 57, - "**" => 35, - "+" => 36, - "^" => 40, - "per" => 43, - "!=" => 45, - "/" => 52, - "<=>" => 55 - }, - DEFAULT => -70 - }, - {#State 101 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "*" => 42, - "||" => 47, - "<=" => 56, - ">" => 57, - "**" => 35, - "+" => 36, - "^" => 40, - "per" => 43, - "!=" => 45, - "&&" => 48, - "?" => 49, - "^^" => 50, - "/" => 52, - "<=>" => 55 - }, - DEFAULT => -86 - }, - {#State 102 - ACTIONS => { - "**" => 35, - "^" => 40 - }, - DEFAULT => -61 - }, - {#State 103 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "*" => 42, - "||" => 47, - "->" => 51, - "=>" => 54, - "<=" => 56, - ">" => 57, - "**" => 35, - "+" => 36, - "^" => 40, - "per" => 43, - "!=" => 45, - "&&" => 48, - "?" => 49, - "^^" => 50, - "/" => 52, - "=" => 53, - "<=>" => 55 - }, - DEFAULT => -49 - }, - {#State 104 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "*" => 42, - "||" => 47, - "<=" => 56, - ">" => 57, - "**" => 35, - "+" => 36, - "^" => 40, - "per" => 43, - "!=" => 45, - "&&" => 48, - "?" => 49, - "^^" => 50, - "/" => 52, - "<=>" => 55 - }, - DEFAULT => -85 - }, - {#State 105 - ACTIONS => { - "-" => 32, - "<" => undef, - "%" => 37, - "==" => undef, - ">=" => undef, - " " => 41, - "*" => 42, - "<=" => undef, - ">" => undef, - "**" => 35, - "+" => 36, - "^" => 40, - "per" => 43, - "!=" => undef, - "/" => 52, - "<=>" => undef - }, - DEFAULT => -77 - }, - {#State 106 - ACTIONS => { - "-" => 32, - "<" => undef, - "%" => 37, - "==" => undef, - ">=" => undef, - " " => 41, - "*" => 42, - "<=" => undef, - ">" => undef, - "**" => 35, - "+" => 36, - "^" => 40, - "per" => 43, - "!=" => undef, - "/" => 52, - "<=>" => undef - }, - DEFAULT => -74 - }, - {#State 107 - ACTIONS => { - "-" => 32, - "<" => undef, - "%" => 37, - "==" => undef, - ">=" => undef, - " " => 41, - "*" => 42, - "<=" => undef, - ">" => undef, - "**" => 35, - "+" => 36, - "^" => 40, - "per" => 43, - "!=" => undef, - "/" => 52, - "<=>" => undef - }, - DEFAULT => -73 - }, - {#State 108 - DEFAULT => -30 - }, - {#State 109 - DEFAULT => -83 - }, - {#State 110 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - "," => 58, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - DEFAULT => -29, - GOTOS => { - 'exprval2' => 2, - 'lambda' => 3, - 'exprval' => 19, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6, - 'exprval1' => 9, - 'array' => 134, - 'expr' => 60, - 'multexpr' => 14 - } - }, - {#State 111 - ACTIONS => { - 'NAME' => 62 - }, - DEFAULT => -39, - GOTOS => { - 'arglist' => 135, - 'argelement' => 61 - } - }, - {#State 112 - ACTIONS => { - "isa" => 136 - }, - DEFAULT => -38 - }, - {#State 113 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 137, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 114 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - "..." => 140, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval2' => 2, - 'lambda' => 3, - 'exprval' => 19, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6, - 'exprval1' => 9, - 'expr' => 138, - 'multexpr' => 14, - 'constraint' => 139 - } - }, - {#State 115 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 17, - "var" => 20, - 'DATE' => 4, - "while" => 22, - 'STRING' => 7, - "if" => 10, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - DEFAULT => -1, - GOTOS => { - 'exprval2' => 2, - 'stma' => 141, - 'lambda' => 3, - 'exprval' => 19, - 'ifstartcond' => 21, - 'arrayfetchexpr' => 5, - 'if' => 8, - 'assignexpr' => 6, - 'stmt' => 23, - 'exprval1' => 9, - 'while' => 24, - 'expr' => 12, - 'multexpr' => 14 - } - }, - {#State 116 - ACTIONS => { - "]" => 142 - } - }, - {#State 117 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "+" => 36, - "**" => 35, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "^" => 40, - "*" => 42, - "per" => 43, - "!=" => 45, - "?" => 49, - "||" => 47, - "&&" => 48, - "^^" => 50, - "/" => 52, - "->" => 51, - "=" => 53, - "=>" => 54, - "<=" => 56, - "<=>" => 55, - ">" => 57 - }, - DEFAULT => -8 - }, - {#State 118 - ACTIONS => { - "}" => 143 - } - }, - {#State 119 - DEFAULT => -10 - }, - {#State 120 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "*" => 42, - "||" => 47, - "->" => 51, - "=>" => 54, - "<=" => 56, - ">" => 57, - "**" => 35, - "+" => 36, - "^" => 40, - "per" => 43, - "!=" => 45, - "&&" => 48, - "?" => 49, - "^^" => 50, - "/" => 52, - "=" => 53, - "<=>" => 55 - }, - DEFAULT => -79 - }, - {#State 121 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "*" => 42, - "||" => 47, - "->" => 51, - "=>" => 54, - "<=" => 56, - ">" => 57, - "**" => 35, - "+" => 36, - "^" => 40, - "per" => 43, - "!=" => 45, - "&&" => 48, - "?" => 49, - "^^" => 50, - "/" => 52, - "=" => 53, - "<=>" => 55 - }, - DEFAULT => -80 - }, - {#State 122 - ACTIONS => { - "\$" => 144 - } - }, - {#State 123 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 145, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 124 - ACTIONS => { - "else" => 146 - }, - DEFAULT => -18 - }, - {#State 125 - ACTIONS => { - "}" => 148 - } - }, - {#State 126 - ACTIONS => { - "\n" => 149, - "{" => 75 - }, - GOTOS => { - 'ifstmts' => 150 - } - }, - {#State 127 - ACTIONS => { - "else" => 151 - } - }, - {#State 128 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "+" => 36, - "**" => 35, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "^" => 40, - "*" => 42, - "per" => 43, - ")" => 152, - "!=" => 45, - "?" => 49, - "||" => 47, - "&&" => 48, - "^^" => 50, - "/" => 52, - "->" => 51, - "=" => 53, - "=>" => 54, - "<=" => 56, - "<=>" => 55, - ">" => 57 - } - }, - {#State 129 - DEFAULT => -3 - }, - {#State 130 - DEFAULT => -4 - }, - {#State 131 - DEFAULT => -45 - }, - {#State 132 - DEFAULT => -14 - }, - {#State 133 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 153, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 134 - DEFAULT => -27 - }, - {#State 135 - DEFAULT => -40 - }, - {#State 136 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - "..." => 140, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval2' => 2, - 'lambda' => 3, - 'exprval' => 19, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6, - 'exprval1' => 9, - 'expr' => 138, - 'multexpr' => 14, - 'constraint' => 154 - } - }, - {#State 137 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "+" => 36, - "**" => 35, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "^" => 40, - "*" => 42, - "per" => 43, - "!=" => 45, - "?" => 49, - "||" => 47, - "&&" => 48, - "^^" => 50, - "/" => 52, - "->" => 51, - "=" => 53, - "isa" => 155, - "=>" => 54, - "<=" => 56, - "<=>" => 55, - ">" => 57 - }, - DEFAULT => -35 - }, - {#State 138 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "+" => 36, - "**" => 35, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "^" => 40, - "*" => 42, - "per" => 43, - "!=" => 45, - "?" => 49, - "||" => 47, - "&&" => 48, - "^^" => 50, - "/" => 52, - "->" => 51, - "=" => 53, - "=>" => 54, - "<=" => 56, - "<=>" => 55, - ">" => 57 - }, - DEFAULT => -31 - }, - {#State 139 - DEFAULT => -34 - }, - {#State 140 - DEFAULT => -32 - }, - {#State 141 - ACTIONS => { - "}" => 156 - } - }, - {#State 142 - DEFAULT => -54 - }, - {#State 143 - ACTIONS => { - ":=" => 157 - } - }, - {#State 144 - DEFAULT => -50 - }, - {#State 145 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "+" => 36, - "**" => 35, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "^" => 40, - "*" => 42, - "per" => 43, - "!=" => 45, - "?" => 49, - "||" => 47, - "&&" => 48, - "^^" => 50, - "/" => 52, - "->" => 51, - "=" => 53, - "=>" => 54, - "<=" => 56, - "<=>" => 55, - ">" => 57 - }, - DEFAULT => -7 - }, - {#State 146 - ACTIONS => { - "\n" => 158, - "{" => 75 - }, - GOTOS => { - 'ifstmts' => 159 - } - }, - {#State 147 - ACTIONS => { - "else" => 160 - } - }, - {#State 148 - DEFAULT => -15 - }, - {#State 149 - ACTIONS => { - "{" => 75 - }, - GOTOS => { - 'ifstmts' => 161 - } - }, - {#State 150 - DEFAULT => -17 - }, - {#State 151 - ACTIONS => { - "\n" => 162, - "{" => 75 - }, - GOTOS => { - 'ifstmts' => 163 - } - }, - {#State 152 - ACTIONS => { - "{" => 164 - } - }, - {#State 153 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "*" => 42, - "||" => 47, - "<=" => 56, - ">" => 57, - "**" => 35, - "+" => 36, - "^" => 40, - "per" => 43, - "!=" => 45, - "&&" => 48, - "?" => 49, - "^^" => 50, - "/" => 52, - "<=>" => 55 - }, - DEFAULT => -67 - }, - {#State 154 - DEFAULT => -37 - }, - {#State 155 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - "..." => 140, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval2' => 2, - 'lambda' => 3, - 'exprval' => 19, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6, - 'exprval1' => 9, - 'expr' => 138, - 'multexpr' => 14, - 'constraint' => 165 - } - }, - {#State 156 - DEFAULT => -51 - }, - {#State 157 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 28, - 'DATE' => 4, - "{" => 167, - 'STRING' => 7, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - GOTOS => { - 'exprval1' => 9, - 'exprval2' => 2, - 'expr' => 166, - 'lambda' => 3, - 'exprval' => 19, - 'multexpr' => 14, - 'arrayfetchexpr' => 5, - 'assignexpr' => 6 - } - }, - {#State 158 - ACTIONS => { - "{" => 75 - }, - GOTOS => { - 'ifstmts' => 168 - } - }, - {#State 159 - DEFAULT => -19 - }, - {#State 160 - ACTIONS => { - "\n" => 169, - "{" => 75 - }, - GOTOS => { - 'ifstmts' => 170 - } - }, - {#State 161 - DEFAULT => -24 - }, - {#State 162 - ACTIONS => { - "{" => 75 - }, - GOTOS => { - 'ifstmts' => 171 - } - }, - {#State 163 - DEFAULT => -23 - }, - {#State 164 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 17, - "var" => 20, - 'DATE' => 4, - "while" => 22, - 'STRING' => 7, - "if" => 10, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - DEFAULT => -1, - GOTOS => { - 'exprval2' => 2, - 'stma' => 172, - 'lambda' => 3, - 'exprval' => 19, - 'ifstartcond' => 21, - 'arrayfetchexpr' => 5, - 'if' => 8, - 'assignexpr' => 6, - 'stmt' => 23, - 'exprval1' => 9, - 'while' => 24, - 'expr' => 12, - 'multexpr' => 14 - } - }, - {#State 165 - DEFAULT => -33 - }, - {#State 166 - ACTIONS => { - "-" => 32, - "conforms" => 33, - "<" => 34, - "%" => 37, - "==" => 38, - ">=" => 39, - " " => 41, - "*" => 42, - "||" => 47, - "->" => 51, - "=>" => 54, - "<=" => 56, - ">" => 57, - "**" => 35, - "+" => 36, - "^" => 40, - "per" => 43, - "!=" => 45, - "&&" => 48, - "?" => 49, - "^^" => 50, - "/" => 52, - "=" => 53, - "<=>" => 55 - }, - DEFAULT => -81 - }, - {#State 167 - ACTIONS => { - "{`" => 16, - "-" => 1, - 'NAME' => 17, - "var" => 20, - 'DATE' => 4, - "while" => 22, - 'STRING' => 7, - "if" => 10, - 'HEXNUMBER' => 25, - "(" => 26, - "!" => 11, - "[" => 13, - 'NUMBER' => 15 - }, - DEFAULT => -1, - GOTOS => { - 'exprval2' => 2, - 'stma' => 173, - 'lambda' => 3, - 'exprval' => 19, - 'ifstartcond' => 21, - 'arrayfetchexpr' => 5, - 'if' => 8, - 'assignexpr' => 6, - 'stmt' => 23, - 'exprval1' => 9, - 'while' => 24, - 'expr' => 12, - 'multexpr' => 14 - } - }, - {#State 168 - DEFAULT => -21 - }, - {#State 169 - ACTIONS => { - "{" => 75 - }, - GOTOS => { - 'ifstmts' => 174 - } - }, - {#State 170 - DEFAULT => -20 - }, - {#State 171 - DEFAULT => -25 - }, - {#State 172 - ACTIONS => { - "}" => 175 - } - }, - {#State 173 - ACTIONS => { - "}" => 176 - } - }, - {#State 174 - DEFAULT => -22 - }, - {#State 175 - DEFAULT => -26 - }, - {#State 176 - DEFAULT => -82 - } -], - yyrules => -[ - [#Rule 0 - '$start', 2, undef - ], - [#Rule 1 - 'stma', 0, -sub -#line 30 "Farnsworth.yp" -{undef} - ], - [#Rule 2 - 'stma', 1, -sub -#line 31 "Farnsworth.yp" -{ bless [ $_[1] ], 'Stmt' } - ], - [#Rule 3 - 'stma', 3, -sub -#line 32 "Farnsworth.yp" -{ bless [ $_[1], ref($_[3]) eq "Stmt" ? @{$_[3]} : $_[3]], 'Stmt' } - ], - [#Rule 4 - 'stma', 3, -sub -#line 33 "Farnsworth.yp" -{ bless [ $_[1], ref($_[3]) eq "Stmt" ? @{$_[3]} : $_[3]], 'Stmt' } - ], - [#Rule 5 - 'stmt', 1, -sub -#line 37 "Farnsworth.yp" -{ $_[1] } - ], - [#Rule 6 - 'stmt', 2, -sub -#line 38 "Farnsworth.yp" -{ bless [ $_[2] ], 'DeclareVar' } - ], - [#Rule 7 - 'stmt', 4, -sub -#line 39 "Farnsworth.yp" -{ bless [ $_[2], $_[4] ], 'DeclareVar' } - ], - [#Rule 8 - 'stmt', 3, -sub -#line 40 "Farnsworth.yp" -{ bless [@_[1,3]], 'UnitDef' } - ], - [#Rule 9 - 'stmt', 3, -sub -#line 41 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'SetDisplay' } - ], - [#Rule 10 - 'stmt', 3, -sub -#line 42 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'DefineDimen' } - ], - [#Rule 11 - 'stmt', 3, -sub -#line 43 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'DefineCombo' } - ], - [#Rule 12 - 'stmt', 1, undef - ], - [#Rule 13 - 'stmt', 1, undef - ], - [#Rule 14 - 'ifstartcond', 4, -sub -#line 48 "Farnsworth.yp" -{$_[3]} - ], - [#Rule 15 - 'ifstmts', 3, -sub -#line 50 "Farnsworth.yp" -{$_[2]} - ], - [#Rule 16 - 'if', 2, -sub -#line 54 "Farnsworth.yp" -{bless [@_[1,2], undef], 'If'} - ], - [#Rule 17 - 'if', 4, -sub -#line 55 "Farnsworth.yp" -{bless [@_[1,2,4]], 'If'} - ], - [#Rule 18 - 'if', 3, -sub -#line 56 "Farnsworth.yp" -{bless [@_[1,3], undef], 'If'} - ], - [#Rule 19 - 'if', 5, -sub -#line 57 "Farnsworth.yp" -{bless [@_[1,3,5]], 'If'} - ], - [#Rule 20 - 'if', 6, -sub -#line 58 "Farnsworth.yp" -{bless [@_[1,3,6]], 'If'} - ], - [#Rule 21 - 'if', 6, -sub -#line 59 "Farnsworth.yp" -{bless [@_[1,3,6]], 'If'} - ], - [#Rule 22 - 'if', 7, -sub -#line 60 "Farnsworth.yp" -{bless [@_[1,3,7]], 'If'} - ], - [#Rule 23 - 'if', 5, -sub -#line 61 "Farnsworth.yp" -{bless [@_[1,2,5]], 'If'} - ], - [#Rule 24 - 'if', 5, -sub -#line 62 "Farnsworth.yp" -{bless [@_[1,2,5]], 'If'} - ], - [#Rule 25 - 'if', 6, -sub -#line 63 "Farnsworth.yp" -{bless [@_[1,2,6]], 'If'} - ], - [#Rule 26 - 'while', 7, -sub -#line 71 "Farnsworth.yp" -{ bless [ @_[3,6] ], 'While' } - ], - [#Rule 27 - 'array', 3, -sub -#line 78 "Farnsworth.yp" -{bless [ ( ref($_[1]) eq 'Array' ? ( bless [@{$_[1]}], 'SubArray' ) : $_[1] ), ref($_[3]) eq 'Array' ? @{$_[3]} : $_[3] ], 'Array' } - ], - [#Rule 28 - 'array', 1, -sub -#line 79 "Farnsworth.yp" -{bless [ ( ref($_[1]) eq 'Array' ? ( bless [@{$_[1]}], 'SubArray' ) : $_[1] ) ], 'Array'} - ], - [#Rule 29 - 'array', 0, -sub -#line 80 "Farnsworth.yp" -{bless [], 'Array'} - ], - [#Rule 30 - 'array', 2, -sub -#line 81 "Farnsworth.yp" -{bless [ undef, ref($_[2]) eq 'Array' ? @{$_[2]} : $_[2] ], 'Array' } - ], - [#Rule 31 - 'constraint', 1, undef - ], - [#Rule 32 - 'constraint', 1, -sub -#line 85 "Farnsworth.yp" -{bless [], 'VarArg'} - ], - [#Rule 33 - 'argelement', 5, -sub -#line 88 "Farnsworth.yp" -{bless [ $_[1], $_[3], $_[5], 0], 'Argele'} - ], - [#Rule 34 - 'argelement', 3, -sub -#line 89 "Farnsworth.yp" -{bless [ $_[1], undef, $_[3], 0], 'Argele'} - ], - [#Rule 35 - 'argelement', 3, -sub -#line 90 "Farnsworth.yp" -{bless [ $_[1], $_[3], undef, 0], 'Argele'} - ], - [#Rule 36 - 'argelement', 1, -sub -#line 91 "Farnsworth.yp" -{bless [ $_[1], undef, undef, 0], 'Argele'} - ], - [#Rule 37 - 'argelement', 4, -sub -#line 92 "Farnsworth.yp" -{bless [ $_[1], undef, $_[4], 1], 'Argele'} - ], - [#Rule 38 - 'argelement', 2, -sub -#line 93 "Farnsworth.yp" -{bless [ $_[1], undef, undef, 1], 'Argele'} - ], - [#Rule 39 - 'argelement', 0, undef - ], - [#Rule 40 - 'arglist', 3, -sub -#line 97 "Farnsworth.yp" -{ bless [ $_[1], ref($_[3]) eq 'Arglist' ? @{$_[3]} : $_[3] ], 'Arglist' } - ], - [#Rule 41 - 'arglist', 1, -sub -#line 98 "Farnsworth.yp" -{bless [ $_[1] ], 'Arglist'} - ], - [#Rule 42 - 'exprval1', 1, -sub -#line 101 "Farnsworth.yp" -{ bless [ $_[1] ], 'Num' } - ], - [#Rule 43 - 'exprval1', 1, -sub -#line 102 "Farnsworth.yp" -{ bless [ $_[1] ], 'HexNum' } - ], - [#Rule 44 - 'exprval2', 1, -sub -#line 106 "Farnsworth.yp" -{ bless [ $_[1] ], 'Fetch' } - ], - [#Rule 45 - 'exprval2', 3, -sub -#line 107 "Farnsworth.yp" -{ bless [$_[2]], 'Paren' } - ], - [#Rule 46 - 'exprval', 1, undef - ], - [#Rule 47 - 'exprval', 1, undef - ], - [#Rule 48 - 'exprval', 1, undef - ], - [#Rule 49 - 'assignexpr', 3, -sub -#line 115 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'Store' } - ], - [#Rule 50 - 'arrayfetchexpr', 4, -sub -#line 118 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'ArrayFetch' } - ], - [#Rule 51 - 'lambda', 5, -sub -#line 121 "Farnsworth.yp" -{bless [ @_[2,4] ], 'Lambda'} - ], - [#Rule 52 - 'multexpr', 3, -sub -#line 124 "Farnsworth.yp" -{ bless [ @_[1,3], '*'], 'Mul' } - ], - [#Rule 53 - 'multexpr', 2, -sub -#line 125 "Farnsworth.yp" -{ bless [ @_[1,2], 'imp'], 'Mul' } - ], - [#Rule 54 - 'multexpr', 4, -sub -#line 128 "Farnsworth.yp" -{ bless [ (bless [$_[1]], 'Fetch'), $_[3], 'imp' ], 'Mul' } - ], - [#Rule 55 - 'multexpr', 3, -sub -#line 129 "Farnsworth.yp" -{ bless [ @_[1,3], ''], 'Mul' } - ], - [#Rule 56 - 'expr', 1, -sub -#line 133 "Farnsworth.yp" -{ $_[1] } - ], - [#Rule 57 - 'expr', 2, -sub -#line 134 "Farnsworth.yp" -{ bless [ $_[2] , (bless ['-1'], 'Num'), '-name'], 'Mul' } - ], - [#Rule 58 - 'expr', 1, undef - ], - [#Rule 59 - 'expr', 3, -sub -#line 136 "Farnsworth.yp" -{ bless [ @_[1,3]], 'Add' } - ], - [#Rule 60 - 'expr', 3, -sub -#line 137 "Farnsworth.yp" -{ bless [ @_[1,3]], 'Sub' } - ], - [#Rule 61 - 'expr', 3, -sub -#line 138 "Farnsworth.yp" -{ bless [ @_[1,3], '/'], 'Div' } - ], - [#Rule 62 - 'expr', 3, -sub -#line 139 "Farnsworth.yp" -{ bless [ @_[1,3], 'per' ], 'Div' } - ], - [#Rule 63 - 'expr', 3, -sub -#line 140 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'Mod' } - ], - [#Rule 64 - 'expr', 3, -sub -#line 141 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'Pow' } - ], - [#Rule 65 - 'expr', 3, -sub -#line 142 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'Pow' } - ], - [#Rule 66 - 'expr', 3, -sub -#line 143 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'Conforms' } - ], - [#Rule 67 - 'expr', 5, -sub -#line 144 "Farnsworth.yp" -{ bless [@_[1,3,5]], 'Ternary' } - ], - [#Rule 68 - 'expr', 3, -sub -#line 145 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'And' } - ], - [#Rule 69 - 'expr', 3, -sub -#line 146 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'Or' } - ], - [#Rule 70 - 'expr', 3, -sub -#line 147 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'Xor' } - ], - [#Rule 71 - 'expr', 2, -sub -#line 148 "Farnsworth.yp" -{ bless [ $_[2] ], 'Not' } - ], - [#Rule 72 - 'expr', 3, -sub -#line 149 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'Lt' } - ], - [#Rule 73 - 'expr', 3, -sub -#line 150 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'Gt' } - ], - [#Rule 74 - 'expr', 3, -sub -#line 151 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'Le' } - ], - [#Rule 75 - 'expr', 3, -sub -#line 152 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'Ge' } - ], - [#Rule 76 - 'expr', 3, -sub -#line 153 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'Eq' } - ], - [#Rule 77 - 'expr', 3, -sub -#line 154 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'Compare' } - ], - [#Rule 78 - 'expr', 3, -sub -#line 155 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'Ne' } - ], - [#Rule 79 - 'expr', 3, -sub -#line 156 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'SetPrefix' } - ], - [#Rule 80 - 'expr', 3, -sub -#line 157 "Farnsworth.yp" -{ bless [ @_[1,3] ], 'SetPrefixAbrv' } - ], - [#Rule 81 - 'expr', 6, -sub -#line 158 "Farnsworth.yp" -{ bless [@_[1,3], (bless [$_[6]], 'Stmt')], 'FuncDef' } - ], - [#Rule 82 - 'expr', 8, -sub -#line 159 "Farnsworth.yp" -{ bless [@_[1,3,7]], 'FuncDef' } - ], - [#Rule 83 - 'expr', 3, -sub -#line 160 "Farnsworth.yp" -{ $_[2] } - ], - [#Rule 84 - 'expr', 1, undef - ], - [#Rule 85 - 'expr', 3, -sub -#line 162 "Farnsworth.yp" -{bless [@_[1,3]], 'LambdaCall'} - ], - [#Rule 86 - 'expr', 3, -sub -#line 164 "Farnsworth.yp" -{ bless [ @_[1,3]], 'Trans' } - ], - [#Rule 87 - 'expr', 1, -sub -#line 165 "Farnsworth.yp" -{ bless [ $_[1] ], 'Date' } - ], - [#Rule 88 - 'expr', 1, -sub -#line 166 "Farnsworth.yp" -{ bless [ $_[1] ], 'String' } - ], - [#Rule 89 - 'expr', 1, undef - ] -], - @_); - bless($self,$class); -} - -#line 169 "Farnsworth.yp" - - -sub yylex - { - #i THINK this isn't what i want, since whitespace is significant in a few areas - #i'm going to instead shrink all whitespace down to no more than one space - #$s =~ s/\G\s{2,}/ /c; #don't need global? - $s =~ /\G\s*(?=\s)/gc; - - #1 while $s =~ /\G\s+/cg; #remove extra whitespace? - - $s =~ m|\G\s*/\*.*?\*/\s*|gcs and redo; #skip C comments - $s =~ m|\G\s*//.*\n?|gc and redo; -# $s =~ s|\G/\*.*?\*/||g; - - #i want a complete number regex - $s =~ /\G(0x[[:xdigit:]]+)/igc and return 'HEXNUMBER', $1; - $s =~ /\G(0b[01]+)/igc and return 'HEXNUMBER', $1; #binary - $s =~ /\G(0[0-7]+)/igc and return 'HEXNUMBER', $1; #octal - $s =~ /\G((\d+(\.\d*)?|\.\d+)([Ee][Ee]?[-+]?\d+))/gc - and return 'NUMBER', $1; - $s =~ /\G((\d+(\.\d*)?|\.\d+))/gc - and return 'NUMBER', $1; - $s =~ /\G(0[xX][0-9A-Fa-f])/gc and return $1; - - #token out the date - $s =~ /\G\s*#([^#]*)#\s*/gc and return 'DATE', $1; - - $s =~ /\G\s*"((\\.|[^"\\])*)"/gc #" bad syntax highlighters are annoying - and return "STRING", $1; - - #i'll probably ressurect this later too - #$s =~ /\G(do|for|elsif|else|if|print|while)\b/cg and return $1; - - $s =~ /\G\s*(while|conforms|else|if)\b\s*/cg and return $1; - - #seperated this to shorten the lines, and hopefully to make parts of it more readable - $s =~ /\G\s*(:=|==|!=|<=>|>=|<=|=>|->|:->|\*\*)\s*/icg and return lc $1; - $s =~ /\G\s*(var\b|per\b|isa\b|byref\b|\:?\:\-|\=\!\=|\|\|\|)\s*/icg and return lc $1; - $s =~ /\G\s*(\})/cg and return $1; - $s =~ /\G\s*(\+|\*|-|\/|\%|\^\^?|=|;|\n|\{\s*\`|\{|\}|\>|\<|\?|\:|\,|\&\&|\|\||\!|\||\.\.\.|\`)\s*/cg and return $1; - $s =~ /\G\s*(\)|\])/cg and return $1; #freaking quirky lexers! - $s =~ /\G(\(|\[)\s*/cg and return $1; - $s =~ /\G(\w[\w\d]*)/cg and return 'NAME', $1; #i need to handle -NAME later on when evaluating, or figure out a sane way to do it here - $s =~ /\G(.)/cgs and return $1; - return ''; - } - - -sub yylexwatch -{ - my @r = &yylex; - #print Dumper(\@r,[pos $s]); - #$charcount+=pos $s; - #$s = substr($s, pos $s); - return @r; -} - -sub yyerror - { - my $pos = pos $s; - substr($fullstring,$pos,0) = '<###YYLEX###>'; - $fullstring =~ s/^/### /mg; - die "### Syntax Error \@ $pos of\n$fullstring\n"; - } - -sub parse - { - $charcount=0; - my $self = shift; - $s = join ' ', @_; - $fullstring = $s; #preserve it for errors - my $code = eval - { $self->new(yylex => \&yylexwatch, yyerror => \&yyerror)->YYParse }; - die $@ if $@; - $code - } - -1; - -# vim: filetype=yacc - -1; diff --git a/deps/Math/Farnsworth/Units.pm b/deps/Math/Farnsworth/Units.pm deleted file mode 100644 index d253ef4..0000000 --- a/deps/Math/Farnsworth/Units.pm +++ /dev/null @@ -1,134 +0,0 @@ -package Math::Farnsworth::Units; - -use strict; -use warnings; - -use Data::Dumper; -use Math::Farnsworth::Value::Pari; -use Math::Pari; -use Math::Farnsworth::Output; - -sub new -{ - #i should make a constructor that copies, but that'll come later - my $self = {units=>{1=>new Math::Farnsworth::Value::Pari(1)}, dimens=>{}}; #hack to make things work right - bless $self; -} - -sub addunit -{ - my $self = shift; - my $name = shift; - my $value = shift; - - $self->{units}{$name} = $value; - $self->{units}{$name."s"} = $value; #HACK! -} - -sub getunit -{ - my $self = shift; - my $name = shift; - - my $return; - - if ($self->_isunit($name)) - { - $return = $self->{units}{$name}; - } - elsif ($self->hasprefix($name)) - { - my ($preval, undef, $realname) = $self->getprefix($name); -# print "GETTING PREFIXES: $name :: $preval :: $realname ::".Dumper($preval, $realname) if (($name eq "mg") || ($name eq "l") || $name eq "milli"); - - $return = $preval * $self->{units}{$realname}; - } - -# print "GETTING UNIT: $name : $return : ".Dumper($return) if (($name eq "mg") || ($name eq "l") || $name eq "milli"); - return $return; -} - -sub hasprefix -{ - my $self = shift; - my $name = shift; - - #sort them by length, solves issues with longer ones not being found first - my @keys = keys %{$self->{prefix}}; - for my $pre (sort {length($b) <=> length($a)} @keys) - { - if ($name =~ /^\Q$pre\E(.*)$/) - { - return 1 if ($self->_isunit($1) || !length($1)); - } - } - return 0; #no prefix! -} - -sub getprefix -{ - my $self = shift; - my $name = shift; - - #sort them by length, solves issues with longer ones not being found first - for my $pre (sort {length($b) <=> length($a)} keys %{$self->{prefix}}) - { - #print "CHECKING PREFIX: $pre\n" if ($name eq "mg"); - if ($name =~ /^\Q$pre\E(.*)$/) - { - my $u = $1; - #print "FOUND: $name == $pre * $u\n"; - #print Dumper($self->{prefix}{$pre}) if ($name eq "mg"); - $u = 1 unless length($1); #to make certain things work right - return ($self->{prefix}{$pre},$pre,$u) if ($self->_isunit($1) || !length($1)); - } - } - return undef; #to cause errors when not there -} - -sub isunit -{ - my $self = shift; - my $name = shift; - - return $self->hasprefix($name) || $self->_isunit($name); -} - -sub _isunit -{ - my $self = shift; - my $name = shift; - return exists($self->{units}{$name}); -} - -sub adddimen -{ - my $self = shift; - my $name = shift; - my $default = shift; #primitive unit for the dimension, all other units are defined against this - my $val = new Math::Farnsworth::Value::Pari(1, {$name => 1}); #i think this is right - Math::Farnsworth::Output::addcombo($name,$val); - $self->{dimens}{$name} = $default; - $self->addunit($default, $val); -} - -#is this useful? yes, need it for display -sub getdimen -{ - my $self = shift; - my $name = shift; - - return $self->{dimens}{$name}; -} - -sub setprefix -{ - my $self = shift; - my $name = shift; - my $value = shift; - - #print "SETTING PREFIX: $name : $value\n" if ($name eq "m"); - $self->{prefix}{$name} = $value; -} - -1; diff --git a/deps/Math/Farnsworth/Units/.svn/entries b/deps/Math/Farnsworth/Units/.svn/entries deleted file mode 100644 index 7c50f8a..0000000 --- a/deps/Math/Farnsworth/Units/.svn/entries +++ /dev/null @@ -1,164 +0,0 @@ -10 - -dir -475 -svn://erxz.com/bb3/branches/perlbuut/deps/Math/Farnsworth/Units -svn://erxz.com/bb3 - - - -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - -dcb1cea6-7f7e-4c78-8a22-148ace8ce36e - -Pi10-6.html -file - - - - -2009-10-03T22:54:20.000000Z -6d6b635905be718ae36d75d97a224cc9 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -7903 - -Currency.pm -file - - - - -2009-10-03T22:54:20.000000Z -9c0d2dc08ca7e23c42d3b36f35718b33 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -2634 - -e.2mil -file - - - - -2009-10-03T22:54:20.000000Z -7a410a19b6daa4924c39bc8b792d10c6 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -11940 - -Standard.pm -file - - - - -2009-10-03T22:54:20.000000Z -ab48e500fb3e87ef2a1aafe52d19b8c8 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -191122 - diff --git a/deps/Math/Farnsworth/Units/.svn/text-base/Currency.pm.svn-base b/deps/Math/Farnsworth/Units/.svn/text-base/Currency.pm.svn-base deleted file mode 100644 index b5a668a..0000000 --- a/deps/Math/Farnsworth/Units/.svn/text-base/Currency.pm.svn-base +++ /dev/null @@ -1,79 +0,0 @@ -package Math::Farnsworth::Units::Currency; - -use strict; -use warnings; - -use Data::Dumper; - -use Math::Farnsworth::Value; -use Math::Farnsworth::Value::Pari; - -use Finance::Currency::Convert::XE; - -{#this is a REALLY BAD THING TO DO BUT I DON'T WANT NO ROUNDING AT THIS LEVEL - no warnings; - package Finance::Currency::Convert::XE; - - sub _format - { - return "%f"; - } -} - -#note that this is fairly C centric! - -my $defaultcurrency = "USD"; - -my $obj = Finance::Currency::Convert::XE->new(target => $defaultcurrency) - || die "Failed to create object\n" ; - -my @currencies = $obj->currencies; #go get a list of symbols - -#this is a quick and dirty list of proper names and symbols for defining them below -my %symbols = (Afghanis=>'AFN',Baht=>'THB',Balboa=>'PAB',Bolivares_Fuertes=>'VEF',Bolivianos=>'BOB',Cedis=>'GHC', Colon=>'CRC',Colones=>'SVC', - Convertible_Marka=>'BAM',Cordobas=>'NIO',Denars=>'MKD',Dinars=>'RSD',Dollars=>'USD',Dong=>'VND',Euro=>'EUR',Forint=>'HUF',Francs=>'CHF',Guarani=>'PYG', - Guilders=>'ANG',Hryvnia=>'UAH',Kips=>'LAK',Koruny=>'CZK',Krone=>'NOK',Kroner=>'DKK',Kronor=>'SEK',Kronur=>'ISK',Krooni=>'EEK',Kuna=>'HRK',Lati=>'LVL', - Leke=>'ALL',Lempiras=>'HNL',Leva=>'BGN',Liras=>'TRL',Lira=>'TRY',Litai=>'LTL',Meticais=>'MZN',Nairas=>'NGN',New_Dollars=>'TWD',New_Lei=>'RON', - New_Manats=>'AZN',New_Shekels=>'ILS',Pesos=>'MXN',Pounds=>'GBP',Pulas=>'BWP',Quetzales=>'GTQ',Rand=>'ZAR',Reais=>'BRL',Ringgits=>'MYR',Riyals=>'SAR', - Rubles=>'BYR',Rubles=>'RUB',Rupees=>'INR',Rupiahs=>'IDR',Shillings=>'SOS',Soms=>'KGS',Sums=>'UZS',Switzerland_Francs=>'CHF',Tenge=>'KZT',Tugriks=>'MNT', - Won=>'KRW',Yen=>'JPY',Yuan_Renminbi=>'CNY',Zimbabwe_Dollars=>'ZWD',Zlotych=>'PLN'); - -sub init -{ - my $env = shift; - #doupdate([],$env,[]); #ignore this for now - - $env->{funcs}->addfunc("updatecurrencies", [[undef, undef, undef, 0]], \&doupdate); -} - -sub doupdate -{ - my ($args, $env, $branches)= @_; - - for my $x (@currencies) - { - print "Fetching currency $x\n"; - my $currentval = $obj->convert( - 'value' => '1.00', - 'source' => $x, - 'format' => 'number' - ) || die "Could not convert: " . $obj->error . "\n"; - $env->eval("$x := $currentval dollars;"); - } - - for my $name (keys %symbols) - { - print "Setting up $name\n"; - eval {$env->eval("$name := ".$symbols{$name});}; - if ($@) - { - warn $@ if ("".$@ =~ "Undefined symbol"); #ignore ones that aren't there anymore, dunno WHY that happens though, i blame XE - die $@ if ("".$@ !~ "Undefined symbol"); #ignore ones that aren't there anymore, dunno WHY that happens though, i blame XE - } - } - - return undef; -} - -1; - diff --git a/deps/Math/Farnsworth/Units/.svn/text-base/Pi10-6.html.svn-base b/deps/Math/Farnsworth/Units/.svn/text-base/Pi10-6.html.svn-base deleted file mode 100644 index cbdd994..0000000 --- a/deps/Math/Farnsworth/Units/.svn/text-base/Pi10-6.html.svn-base +++ /dev/null @@ -1 +0,0 @@ -3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632788659361533818279682303019520353018529689957736225994138912497217752834791315155748572424541506959508295331168617278558890750983817546374649393192550604009277016711390098488240128583616035637076601047101819429555961989467678374494482553797747268471040475346462080466842590694912933136770289891521047521620569660240580381501935112533824300355876402474964732639141992726042699227967823547816360093417216412199245863150302861829745557067498385054945885869269956909272107975093029553211653449872027559602364806654991198818347977535663698074265425278625518184175746728909777727938000816470600161452491921732172147723501414419735685481613611573525521334757418494684385233239073941433345477624168625189835694855620992192221842725502542568876717904946016534668049886272327917860857843838279679766814541009538837863609506800642251252051173929848960841284886269456042419652850222106611863067442786220391949450471237137869609563643719172874677646575739624138908658326459958133904780275900994657640789512694683983525957098258226205224894077267194782684826014769909026401363944374553050682034962524517493996514314298091906592509372216964615157098583874105978859597729754989301617539284681382686838689427741559918559252459539594310499725246808459872736446958486538367362226260991246080512438843904512441365497627807977156914359977001296160894416948685558484063534220722258284886481584560285060168427394522674676788952521385225499546667278239864565961163548862305774564980355936345681743241125150760694794510965960940252288797108931456691368672287489405601015033086179286809208747609178249385890097149096759852613655497818931297848216829989487226588048575640142704775551323796414515237462343645428584447952658678210511413547357395231134271661021359695362314429524849371871101457654035902799344037420073105785390621983874478084784896833214457138687519435064302184531910484810053706146806749192781911979399520614196634287544406437451237181921799983910159195618146751426912397489409071864942319615679452080951465502252316038819301420937621378559566389377870830390697920773467221825625996615014215030680384477345492026054146659252014974428507325186660021324340881907104863317346496514539057962685610055081066587969981635747363840525714591028970641401109712062804390397595156771577004203378699360072305587631763594218731251471205329281918261861258673215791984148488291644706095752706957220917567116722910981690915280173506712748583222871835209353965725121083579151369882091444210067510334671103141267111369908658516398315019701651511685171437657618351556508849099898599823873455283316355076479185358932261854896321329330898570642046752590709154814165498594616371802709819943099244889575712828905923233260972997120844335732654893823911932597463667305836041428138830320382490375898524374417029132765618093773444030707469211201913020330380197621101100449293215160842444859637669838952286847831235526582131449576857262433441893039686426243410773226978028073189154411010446823252716201052652272111660396665573092547110557853763466820653109896526918620564769312570586356620185581007293606598764861179104533488503461136576867532494416680396265797877185560845529654126654085306143444318586769751456614068007002378776591344017127494704205622305389945613140711270004078547332699390814546646458807972708266830634328587856983052358089330657574067954571637752542021149557615814002501262285941302164715509792592309907965473761255176567513575178296664547791745011299614890304639947132962107340437518957359614589019389713111790429782856475032031986915140287080859904801094121472213179476477726224142548545403321571853061422881375850430633217518297986622371721591607716692547487389866549494501146540628433663937900397692656721463853067360965712091807638327166416274888800786925602902284721040317211860820419000422966171196377921337575114959501566049631862947265473642523081770367515906735023507283540567040386743513622224771589150495309844489333096340878076932599397805419341447377441842631298608099888687413260472156951623965864573021631598193195167353812974167729478672422924654366800980676928238280689964004824354037014163149658979409243237896907069779422362508221688957383798623001593776471651228935786015881617557829735233446042815126272037343146531977774160319906655418763979293344195215413418994854447345673831624993419131814809277771038638773431772075456545322077709212019051660962804909263601975988281613323166636528619326686336062735676303544776280350450777235547105859548702790814356240145171806246436267945612753181340783303362542327839449753824372058353114771199260638133467768796959703098339130771098704085913374641442822772634659470474587847787201927715280731767907707157213444730605700733492436931138350493163128404251219256517980694113528013147013047816437885185290928545201165839341965621349143415956258658655705526904965209858033850722426482939728584783163057777560688876446248246857926039535277348030480290058760758251047470916439613626760449256274204208320856611906254543372131535958450687724602901618766795240616342522577195429162991930645537799140373404328752628889639958794757291746426357455254079091451357111369410911939325191076020825202618798531887705842972591677813149699009019211697173727847684726860849003377024242916513005005168323364350389517029893922334517220138128069650117844087451960121228599371623130171144484640903890644954440061986907548516026327505298349187407866808818338510228334508504860825039302133219715518430635455007668282949304137765527939751754613953984683393638304746119966538581538420568533862186725233402830871123282789212507712629463229563989898935821167456270102183564622013496715188190973038119800497340723961036854066431939509790190699639552453005450580685501956730229219139339185680344903982059551002263535361920419947455385938102343955449597783779023742161727111723643435439478221818528624085140066604433258885698670543154706965747458550332323342107301545940516553790686627333799585115625784322988273723198987571415957811196358330059408730681216028764962867446047746491599505497374256269010490377819868359381465741268049256487985561453723478673303904688383436346553794986419270563872931748723320837601123029911367938627089438799362016295154133714248928307220126901475466847653576164773794675200490757155527819653621323926406160136358155907422020203187277605277219005561484255518792530343513984425322341576233610642506390497500865627109535919465897514131034822769306247435363256916078154781811528436679570611086153315044521274739245449454236828860613408414863776700961207151249140430272538607648236341433462351897576645216413767969031495019108575984423919862916421939949072362346468441173940326591840443780513338945257423995082965912285085558215725031071257012668302402929525220118726767562204154205161841634847565169998116141010029960783869092916030288400269104140792886215078424516709087000699282120660418371806535567252532567532861291042487761825829765157 diff --git a/deps/Math/Farnsworth/Units/.svn/text-base/Standard.pm.svn-base b/deps/Math/Farnsworth/Units/.svn/text-base/Standard.pm.svn-base deleted file mode 100644 index dd207a1..0000000 --- a/deps/Math/Farnsworth/Units/.svn/text-base/Standard.pm.svn-base +++ /dev/null @@ -1,4124 +0,0 @@ -package Math::Farnsworth::Units::Standard; - -use Encode; - -sub init -{ - my $env = shift; - - while() - { - $_=decode('UTF-8', $_); #fixes unicode variables - chomp; - s|//.*$||; - s|\s*$||; - $env->eval($_) if ($_ !~ /^\s*$/); - } - - close(DATA); -} - -1; -__DATA__ -//This file is borrowed and slightly modified from the original Frink Data file for non changing units -// -// Frink data file for non-changing units. -// -// This file is used by the Frink calculating tool/programming language: -// http://futureboy.us/frinkdocs/ -// -// If you got to this page from a web search because you're trying to do a -// unit conversion or manipulation, try it at the following URL: -// -// http://futureboy.us/frink/ -// -// Alan Eliasen -// eliasen@mindspring.com -// -// -// This file is adapted, modified, and extended from the units database for use -// with GNU units, a units conversion program by Adrian Mariano -// adrian@cam.cornell.edu, who did a damn fine job collecting much of this. -// -// -// Most units data was drawn from -// 1. NIST Special Publication 811, 1995 Edition -// 2. CRC Handbook of Chemistry and Physics 70th edition -// 3. Oxford English Dictionary -// 4. Websters New Universal Unabridged Dictionary -// 5. Units of Measure by Stephen Dresner -// 6. A Dictionary of English Weights and Measures by Ronald Zupko -// 7. British Weights and Measures by Ronald Zupko -// 8. Realm of Measure by Isaac Asimov -// 9. United States standards of weights and measures, their -// creation and creators by Arthur H. Frazier. -// 10. French weights and measures before the Revolution: a -// dictionary of provincial and local units by Ronald Zupko -// 11. Weights and Measures: their ancient origins and their -// development in Great Britain up to AD 1855 by FG Skinner -// 12. The World of Measurements by H. Arthur Klein -// 13. For Good Measure by William Johnstone -// 14. NTC's Encyclopedia of International Weights and Measures -// by William Johnstone -// 15. Sizes by John Lord -// 16. Sizesaurus by Stephen Strauss -// 17. CODATA Recommended Values of Physical Constants available at -// http://physics.nist.gov/cuu/Constants/index.html -// -// Thanks to Jeff Conrad for assistance in ferreting out unit definitions. -// - -///////////////////////////////////////////////////////////////////////////// -// // -// Primitive units. Any unit defined to contain a '!' character is a // -// primitive unit which will not be reduced any further. All units should // -// reduce to primitive units. // -// // -///////////////////////////////////////////////////////////////////////////// - -// Prefixes -// These are defined with the symbol :- to indicate a prefix which cannot -// stand by itself (must be attached to a unit) -// or with the symbol ::- for a prefix which can be either attached to a unit -// or defines a standalone unit. -// -// A number specifed like "1ee20" with integers for the factor and the -// exponent are treated as exact numbers. - -yotta ::- (1ee24) // 1E24 Greek or Latin octo, "eight" -zetta ::- 1ee21 // 1E21 Latin septem, "seven" -exa ::- 1ee18 // 1E18 Greek hex, "six" -peta ::- 1ee15 // 1E15 Greek pente, "five" -tera ::- 1ee12 // 1E12 Greek teras, "monster" -giga ::- 1ee9 // 1E9 Greek gigas, "giant" -mega ::- 1ee6 // 1E6 Greek megas, "large" -myria ::- 1ee4 // 1E4 Not an official SI prefix -kilo ::- 1000 // 1E3 Greek chilioi, "thousand" -hecto ::- 100 // 1E2 Greek hekaton, "hundred" -deca ::- 10 // 1E1 Greek deka, "ten" -deka ::- 10 -deci ::- 1/10 // 1E-1 Latin decimus, "tenth" -centi ::- 1/100 // 1E-2 Latin centum, "hundred" -milli ::- 1/1000 // 1E-3 Latin mille, "thousand" -micro ::- 1ee-6 // 1E-6 Latin micro/Greek mikros,"small" -nano ::- 1ee-9 // 1E-9 Latin nanus or Greek nanos,"dwarf" -pico ::- 1ee-12 // 1E-12 Spanish pico, "a bit" -femto ::- 1ee-15 // 1E-15 Danish-Norwegian femten,"fifteen" -atto ::- 1ee-18 // 1E-18 Danish-Norwegian atten,"eighteen" -zepto ::- 1ee-21 // 1E-21 Latin septem, "seven" -yocto ::- 1ee-24 // 1E-24 Greek or Latin octo, "eight" - -Y :- yotta -Z :- zetta -E :- exa -P :- peta -T :- tera -G :- giga -M :- mega -k :- kilo -h :- hecto -da :- deka -d :- deci -c :- centi -m :- milli - // Alan's notes: - // I'd like to put a mu in here for micro. - // Should we adopt the questionable Electrical Engineer policy of using - // "u" to indicate micro? I've added "uF" for microfarad later on to - // tackle the most common case. -//\u00b5 :- micro // Unicode "MICRO SIGN" //unicode like this doesn't work! in fact all unicode might not... -µ :- micro -u :- micro -n :- nano -p :- pico -f :- femto -a :- atto -z :- zepto -y :- yocto - - -// -// SI units -// - -length =!= m // Length of the path traveled by light in a vacuum -meter := m // during 1/299792458 seconds (exactly.) - // Originally meant to be one ten-millionth - // of the length along a meridian from the equator - // to a pole, but the measurement was off. - // - // Alan's notes: - // The earth's circumference would then be exactly 40 - // million meters (which is a good thing to memorize.) - -time =!= s // Duration of 9192631770 periods of the radiation -second := s // corresponding to the transition between the two hyperfine - // levels of the ground state of the cesium-133 atom - -mass =!= kg // Mass of the international prototype, whatever that is. - // - // Alan's editorializing: - // I dislike having a prefixed unit as the base reference. - // What a horrible decision. Why don't you just have it go to - // ten and make ten a little louder? - -kilogram := kg -gram := (1/1000) kg -grams := gram - -current =!= A // The current which produces a force of 2e-7 N/m between two -ampere := A // infinitely long wires that are 1 meter apart -amp := ampere - // Alan's editorializing: - // I'd actually much rather define this in terms of the charge - // of a fundamental particle. electroncharge/sec - // is less arbitrary. I'd actually prefer to have the base - // unit be charge instead of current. - -temperature =!= K // "1/273.16 of the thermodynamic temperature of the triple -kelvin := K // point of water." Note that there is a minor discrepancy - // between this value and the 273.15 K figure used to set - // the zero point of the Celsius scale. The *size* of a - // Kelvin or a degree Celsius is the same, but you need - // to remember that the offset point is slightly different. - // Use the Celsius[x] functions defined below to convert - // between these unit systems. - -currency =!= dollar// The US dollar is chosen arbitrarily to be the primitive - // unit of money. The dollar must be defined for use - // in the CPISource (providing historical purchasing power - // of the dollar) and for CurrencySource (providing - // exchange rate information - // (and things like the price of Gold)) so - // you can change the fundamental unit of currency, but you - // have to be able to turn it into a dollar if you want - // to use these other sources. - // If you want to define your own base currency, and you want - // currency conversions to still work, you - // should (for now) define the base currency as its 3-letter - // ISO-4217 currency code (say, "EUR" or "JPY"). This will - // allow the - // currency converter to unambiguously figure out which - // currency you mean. The units "Euro", "euro", the Euro - // symbol \u20ac, the Japanese Yen symbol \u00a5, - // the U.K. pound symbol \u0163, and "dollar" are - // special cases that also work. - // - // If you change your base currency, you might get a few - // errors about units below that are defined in terms of the - // dollar. You can probably comment those out and never miss - // them. If you have a 3-letter ISO code for your base - // currency, it'll figure out what a "dollar" is later, so - // you shouldn't need to hard-code in a conversion rate. - -substance =!= mol // The amount of substance of a system which contains as many -mole := mol // elementary entities as there are atoms in 0.012 kg of - // carbon 12. The elementary entities must be specified and - // may be atoms, molecules, ions, electrons, or other - // particles or groups of particles. It is understood that - // unbound atoms of carbon 12, at rest and in the ground - // state, are referred to. - // - // Alan's editorializing: - // As useful as a mole may be, I really think that a mole is - // insufficient by itself. It has to be a mole OF - // something. How do you represent that? - -radian := 1 -radians := radian // The angle subtended at the center of a circle by an arc - // equal in length to the radius of the circle. - // A circle thus subtends an angle of 2 pi radians. - // - // Alan's editorializing: - // Despite what other units programs might have you believe, - // radians ARE dimensionless units and making them their own - // unit leads to all sorts of arbitrary convolutions in - // calculations (at the possible expense of some inclarity if - // you don't know what you're doing.) - // If you really want radians to be a fundamental unit, - // replace the above with "angle =!= radian" - // (This will give you a bit of artificiality in calculations.) - -sr := 1 // Solid angle which cuts off an area of the surface of -steradian := sr// the sphere equal to that of a square with sides of - // length equal to the radius of the sphere. - // A sphere thus subtends 4 pi steradians. - // Also a dimensionless unit (length^2/length^2) - // If you really want steradians to be a fundamental unit, - // replace the above with "solid_angle =!= sr" - // (This will give you a bit of artificiality in calculations.) - -information =!= bit// Basic unit of information (entropy). The entropy in bits - // of a random variable over a finite alphabet is defined - // to be the sum of -p(i)*log2(p(i)) over the alphabet where - // p(i) is the probability that the random variable takes - // on the value i. - // - // Alan's editorializing: That irrelevant non-sequitur - // about entropy isn't my doing. What does that have to - // do with the bit itself? I'm also considering changing - // bits to be dimensionless units--it makes problems in - // information theory come out more reasonably. -bits := bit - -luminous_intensity =!= cd -candela := cd // Official definition: - // "The candela is the luminous intensity, in a given - // direction, of a source that emits monochromatic radiation - // of frequency 540 x 10^12 hertz and that has a radiant - // intensity in that direction of 1/683 watt per steradian." - // - // (This differs from radiant - // intensity (W/sr) in that it is adjusted for human - // perceptual dependence on wavelength. The frequency of - // 540e12 Hz (yellow) is where human perception is most - // efficient.) - // - // Alan's editorializing: - // I think the candela is a scam, and I am completely - // opposed to it. Some good-for-nothing lighting "engineers" - // or psychologists probably got this perceptually-rigged - // abomination into the whole otherwise scientific endeavor. - // - // What an unbelievably useless and stupid unit. Is light - // at 540.00000001 x 10^12 Hz (or any other frequency) zero - // candela? Is this expected to be an impulse function at - // this frequency? Oh, wait, the Heisenberg Uncertainty - // Principle makes this impossible. No mention for - // correction (ideally along the blackbody curve) for other - // wavelengths? Damn you, 16th CGPM! Damn you all to hell! - -// Define the default symbol for the imaginary unit, that is, the square -// root of negative one. -i := (-1) ^ (1/2) //this is intrinsic to Math::PARI, i don't need to do anything special for it // if you include Functions::StdMath this gets redefined with the more accurate sqrt[] - -// Define unit combinations -//1 ||| dimensionless //POINTLESS! - -m^2 ||| area -m^3 ||| volume - -s^-1 ||| frequency - -m s^-1 ||| velocity -m s^-2 ||| acceleration -m kg s^-1 ||| momentum - -m kg s^-2 ||| force -m^2 kg s^-3 ||| power -m^-1 kg s^-2 ||| pressure -m^2 kg s^-2 ||| energy -m^2 kg s^-1 ||| angular_momentum -m^2 kg ||| moment_of_inertia - -m^3 s^-1 ||| flow - -m^-3 kg ||| mass_density -m^3 kg ||| specific_volume - -A m^-2 ||| electric_current_density - -dollar kg^-1 ||| price_per_mass - - -// -// Names of some numbers -// - -semi :- 1/2 -demi :- 1/2 -hemi :- 1/2 -half ::- 1/2 -third ::- 1/3 -quarter ::- 1/4 -eighth ::- 1/8 - -uni :- 1 -bi :- 2 -tri :- 3 - - -one := 1 -two := 2 -double := 2 -three := 3 -triple := 3 -treble := 3 -four := 4 -quadruple := 4 -five := 5 -quintuple := 5 -six := 6 -sextuple := 6 -seven := 7 -septuple := 7 -eight := 8 -nine := 9 -ten := 10 -twenty := 20 -thirty := 30 -forty := 40 -fifty := 50 -sixty := 60 -seventy := 70 -eighty := 80 -ninety := 90 - -hundred := 100 -thousand := 1000 -million := 1ee6 -billion := 1ee9 -trillion := 1ee12 -quadrillion := 1ee15 -quintillion := 1ee18 -sextillion := 1ee21 -septillion := 1ee24 -octillion := 1ee27 -nonillion := 1ee30 -noventillion := nonillion -decillion := 1ee33 -undecillion := 1ee36 -duodecillion := 1ee39 -tredecillion := 1ee42 -quattuordecillion := 1ee45 -quindecillion := 1ee48 -sexdecillion := 1ee51 -septendecillion := 1ee54 -octodecillion := 1ee57 -novemdecillion := 1ee60 -vigintillion := 1ee63 -centillion := 1ee303 - -googol := 1ee100 - -// These number terms were described by N. Chuquet and De la Roche in the 16th -// century as being successive powers of a million. These definitions are -// still used in most European countries. The current US definitions for these -// numbers arose in the 17th century and don't make nearly as much sense. -// These numbers are listed in the CRC Concise Encyclopedia of Mathematics by -// Eric W. Weisstein. -brbillion := million^2 -brtrillion := million^3 -brquadrillion := million^4 -brquintillion := million^5 -brsextillion := million^6 -brseptillion := million^7 -broctillion := million^8 -brnonillion := million^9 -brnoventillion := brnonillion -brdecillion := million^10 -brundecillion := million^11 -brduodecillion := million^12 -brtredecillion := million^13 -brquattuordecillion := million^14 -brquindecillion := million^15 -brsexdecillion := million^16 -brseptdecillion := million^17 -broctodecillion := million^18 -brnovemdecillion := million^19 -brvigintillion := million^20 - -// These numbers fill the gaps left by the European system above. - -milliard := 1000 million -billiard := 1000 million^2 -trilliard := 1000 million^3 -quadrilliard := 1000 million^4 -quintilliard := 1000 million^5 -sextilliard := 1000 million^6 -septilliard := 1000 million^7 -octilliard := 1000 million^8 -nonilliard := 1000 million^9 -noventilliard := nonilliard -decilliard := 1000 million^10 - -// For consistency - -brmilliard := milliard -brbilliard := billiard -brtrilliard := trilliard -brquadrilliard := quadrilliard -brquintilliard := quintilliard -brsextilliard := sextilliard -brseptilliard := septilliard -broctilliard := octilliard -brnonilliard := nonilliard -brnoventilliard := noventilliard -brdecilliard := decilliard - -// The British Centillion would be 1ee600. The googolplex is another -// familiar large number equal to 10^googol. These numbers give overflows. - - -////////////////////////////////////////////////////////////////////////////// -// // -// Derived units which can be reduced to the primitive units // -// // -////////////////////////////////////////////////////////////////////////////// - -// -// Named SI derived units (officially accepted) -// - -newton := kg m / s^2 // force -newtons := newton -N := newton -pascal := N/m^2 // pressure or stress -pascals := pascal -Pa := pascal -joule := N m // energy -joules := joule -J := joule -watt := J/s // power -watts := watt -W := watt - -J m^-2 ||| surface_tension - -coulomb := A s // charge -coulombs := coulomb -coulomb ||| charge -coulomb m^-2 ||| surface_charge_density -coulomb m^-3 ||| electric_charge_density -C := coulomb - -volt := W/A // potential difference -volts := volt -V := volt -volt ||| electric_potential -V / m ||| electric_field_strength -A / m ||| magnetic_field_strength - -ohm := V/A // electrical resistance -//\u2126 := ohm // Official Unicode codepoint OHM SIGN -//\u03a9 := ohm // "Preferred" Unicode codepoint for ohm - // GREEK CAPITAL LETTER OMEGA -ohms := ohm -ohm ||| electric_resistance - -siemens := A/V // electrical conductance -S := siemens -siemens ||| electric_conductance - -farad := C/V // capacitance -farads := farad -farad ||| capacitance - -F := farad -uF := microfarad // Concession to electrical engineers - // without adding the questionable "u" - // as a general prefix. - -weber := V s // magnetic flux -weber ||| magnetic_flux -Wb := weber - -henry := Wb/A // inductance -henry ||| inductance -henries := henry // Irregular plural -H := henry - -tesla := Wb/m^2 // magnetic flux density -tesla ||| magnetic_flux_density -T := tesla - -hertz := s^-1 // frequency -Hz := hertz - -J/K ||| heat_capacity -J kg^-1 K^-1 ||| specific_heat_capacity - -// -// time -// - -sec := s -minute := 60 s -minutes := minute -min := minute -mins := min -hour := 60 min -hours := hour -hr := hour -day := 24 hr -days := day -d := day -da := day -week := 7 day -weeks := week -wk := week -sennight := 7 day -fortnight := 14 day -fortnights := fortnight -blink := 1ee-5 day // Actual human blink takes 1/3 second -ce := 1ee-2 day - -// -// units derived easily from SI units -// - -gm := gram -g := gram -tonne := 1000 kg -t := tonne -metricton := tonne -sthene := tonne m / s^2 -funal := sthene -pieze := sthene / m^2 -quintal := 100 kg -bar := 1ee5 Pa // About 1 atm -vac := millibar -micron := micrometer// One millionth of a meter -bicron := picometer // One brbillionth of a meter -cc := cm^3 -are := 100 m^2 -liter := 1000 cc // The liter was defined in 1901 as the -oldliter := 1.000028 dm^3// space occupied by 1 kg of pure water at -l := liter // the temperature of its maximum density - // under a pressure of 1 atm. This was - // supposed to be 1000 cubic cm, but it - // was discovered that the original - // measurement was off. In 1964, the - // liter was redefined to be exactly 1000 - // cubic centimeters. -L := liter // This unit and its symbol l were adopted by - // the CIPM in 1879. The alternative symbol for - // the liter, L, was adopted by the CGPM in 1979 - // in order to avoid the risk of confusion - // between the letter l and the number 1. Thus, - // although both l and L are internationally - // accepted symbols for the liter, to avoid this - // risk the preferred symbol for use in the - // United States is L. -mho := siemens // Inverse of ohm, hence ohm spelled backward -galvat := ampere // Named after Luigi Galvani - -angstrom := 1ee-10 m // Convenient for describing molecular sizes -//\u212b := angstrom // Official Unicode codepoint for - // Angstrom symbol: ANGSTROM SIGN -//\u00c5 := angstrom // "Preferred" Unicode codepoint for - // Angstrom symbol: - // LATIN CAPITAL LETTER A WITH RING ABOVE - -xunit := 1.00202e-13 meter// Used for measuring wavelengths -siegbahn := xunit // of X-rays. It is defined to be - // 1/3029.45 of the spacing of calcite - // planes at 18 degC. It was intended - // to be exactly 1e-13 m, but was - // later found to be off slightly. -fermi := 1ee-15 m // Convenient for describing nuclear sizes - // Nuclear radius is from 1 to 10 fermis -barn := 1ee-28 m^2 // Used to measure cross section for - // particle physics collision, said to - // have originated in the phrase "big as - // a barn". -shed := 1ee-24 barn// Defined to be a smaller companion to the - // barn, but it's too small to be of - // much use. -brewster := micron^2/N // measures stress-optical coef -diopter := m^-1 // measures reciprocal of lens focal length -fresnel := 1ee12 Hz // occasionally used in spectroscopy -shake := 1ee-8 sec -svedberg := 1ee-13 s // Used for measuring the sedimentation - // coefficient for centrifuging. -gamma := microgram -lambda := microliter -spat := 1ee12 m // Rarely used for astronomical measurements -preece := 1ee13 ohm m// resistivity -planck := J s // action of one joule over one second -sturgeon := henry^-1 // magnetic reluctance -sturgeon ||| magnetic_reluctance - -daraf := 1/farad // elastance (farad spelled backwards) -leo := 10 m/s^2 -poiseuille := N s / m^2 // viscosity -mayer := J/(g K) // specific heat capacity -mired := microK^-1 // reciprocal color temperature. The name - // abbreviates micro reciprocal degree. -crocodile := megavolt // used informally in UK physics labs -metricounce := 25 g -mounce := metricounce -finsenunit := 1ee5 W/m^2 // Measures intensity of ultraviolet light - // with wavelength 296.7 nm. -fluxunit := 1ee-26 W/(m^2 Hz)// Used in radio astronomy to measure - // the energy incident on the receiving - // body across a specified frequency - // bandwidth. [12] -jansky := fluxunit // K. G. Jansky identified radio waves coming -Jy := jansky // from outer space in 1931. - -// Basic constants - -pi := 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632788659361533818279682303019520353018529689957736225994138912497217752834791315155748572424541506959508295331168617278558890750983817546374649393192550604009277016711390098488240128583616035637076601047101819429555961989467678374494482553797747268471040475346462080466842590694912933136770289891521047521620569660240580381501935112533824300355876402474964732639141992726042699227967823547816360093417216412199245863150302861829745557067498385054945885869269956909272107975093029553211653449872027559602364806654991198818347977535663698074265425278625518184175746728909777727938000816470600161452491921732172147723501414419735685481613611573525521334757418494684385233239073941433345477624168625189835694855620992192221842725502542568876717904946016534668049886272327917860857843838279679766814541009538837863609506800642251252051173929848960841284886269456042419652850222106611863067442786220391949450471237137869609563643719172874677646575739624138908658326459958133904780275900994657640789512694683983525957098258226205224894077267194782684826014769909026401363944374553050682034962524517493996514314298091906592509372216964615157098583874105978859597729754989301617539284681382686838689427741559918559252459539594310499725246808459872736446958486538367362226260991246080512438843904512441365497627807977156914359977001296160894416948685558484063534220722258284886481584560285060168427394522674676788952521385225499546667278239864565961163548862305774564980355936345681743241125150760694794510965960940252288797108931456691368672287489405601015033086179286809208747609178249385890097149096759852613655497818931297848216829989487226588048575640142704775551323796414515237462343645428584447952658678210511413547357395231134271661021359695362314429524849371871101457654035902799344037420073105785390621983874478084784896833214457138687519435064302184531910484810053706146806749192781911979399520614196634287544406437451237181921799983910159195618146751426912397489409071864942319615679452080951465502252316038819301420937621378559566389377870830390697920773467221825625996615014215030680384477345492026054146659252014974428507325186660021324340881907104863317346496514539057962685610055081066587969981635747363840525714591028970641401109712062804390397595156771577004203378699360072305587631763594218731251471205329281918261861258673215791984148488291644706095752706957220917567116722910981690915280173506712748583222871835209353965725121083579151369882091444210067510334671103141267111369908658516398315019701651511685171437657618351556508849099898599823873455283316355076479185358932261854896321329330898570642046752590709154814165498594616371802709819943099244889575712828905923233260972997120844335732654893823911932597463667305836041428138830320382490375898524374417029132765618093773444030707469211201913020330380197621101100449293215160842444859637669838952286847831235526582131449576857262433441893039686426243410773226978028073189154411010446823252716201052652272111660396665573092547110557853763466820653109896526918620564769312570586356620185581007293606598764861179104533488503461136576867532494416680396265797877185560845529654126654085306143444318586769751456614068007002378776591344017127494704205622305389945613140711270004078547332699390814546646458807972708266830634328587856983052358089330657574067954571637752542021149557615814002501262285941302164715509792592309907965473761255176567513575178296664547791745011299614890304639947132962107340437518957359614589019389713111790429782856475032031986915140287080859904801094121472213179476477726224142548545403321571853061422881375850430633217518297986622371721591607716692547487389866549494501146540628433663937900397692656721463853067360965712091807638327166416274888800786925602902284721040317211860820419000422966171196377921337575114959501566049631862947265473642523081770367515906735023507283540567040386743513622224771589150495309844489333096340878076932599397805419341447377441842631298608099888687413260472156951623965864573021631598193195167353812974167729478672422924654366800980676928238280689964004824354037014163149658979409243237896907069779422362508221688957383798623001593776471651228935786015881617557829735233446042815126272037343146531977774160319906655418763979293344195215413418994854447345673831624993419131814809277771038638773431772075456545322077709212019051660962804909263601975988281613323166636528619326686336062735676303544776280350450777235547105859548702790814356240145171806246436267945612753181340783303362542327839449753824372058353114771199260638133467768796959703098339130771098704085913374641442822772634659470474587847787201927715280731767907707157213444730605700733492436931138350493163128404251219256517980694113528013147013047816437885185290928545201165839341965621349143415956258658655705526904965209858033850722426482939728584783163057777560688876446248246857926039535277348030480290058760758251047470916439613626760449256274204208320856611906254543372131535958450687724602901618766795240616342522577195429162991930645537799140373404328752628889639958794757291746426357455254079091451357111369410911939325191076020825202618798531887705842972591677813149699009019211697173727847684726860849003377024242916513005005168323364350389517029893922334517220138128069650117844087451960121228599371623130171144484640903890644954440061986907548516026327505298349187407866808818338510228334508504860825039302133219715518430635455007668282949304137765527939751754613953984683393638304746119966538581538420568533862186725233402830871123282789212507712629463229563989898935821167456270102183564622013496715188190973038119800497340723961036854066431939509790190699639552453005450580685501956730229219139339185680344903982059551002263535361920419947455385938102343955449597783779023742161727111723643435439478221818528624085140066604433258885698670543154706965747458550332323342107301545940516553790686627333799585115625784322988273723198987571415957811196358330059408730681216028764962867446047746491599505497374256269010490377819868359381465741268049256487985561453723478673303904688383436346553794986419270563872931748723320837601123029911367938627089438799362016295154133714248928307220126901475466847653576164773794675200490757155527819653621323926406160136358155907422020203187277605277219005561484255518792530343513984425322341576233610642506390497500865627109535919465897514131034822769306247435363256916078154781811528436679570611086153315044521274739245449454236828860613408414863776700961207151249140430272538607648236341433462351897576645216413767969031495019108575984423919862916421939949072362346468441173940326591840443780513338945257423995082965912285085558215725031071257012668302402929525220118726767562204154205161841634847565169998116141010029960783869092916030288400269104140792886215078424516709087000699282120660418371806535567252532567532861291042487761825829765157 - -//\u03c0 := pi // Unicode character for pi - // as a mathematical constant - // GREEK SMALL LETTER PI - -degree := pi/180 radian -degrees := degree - - -e := 2.718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427427466391932003059921817413596629043572900334295260595630738132328627943490763233829880753195251019011573834187930702154089149934884167509244761460668082264800168477411853742345442437107539077744992069551702761838606261331384583000752044933826560297606737113200709328709127443747047230696977209310141692836819025515108657463772111252389784425056953696770785449969967946864454905987931636889230098793127736178215424999229576351482208269895193668033182528869398496465105820939239829488793320362509443117301238197068416140397019837679320683282376464804295311802328782509819455815301756717361332069811250996181881593041690351598888519345807273866738589422879228499892086805825749279610484198444363463244968487560233624827041978623209002160990235304369941849146314093431738143640546253152096183690888707016768396424378140592714563549061303107208510383750510115747704171898610687396965521267154688957035035402123407849819334321068170121005627880235193033224745015853904730419957777093503660416997329725088687696640355570716226844716256079882651787134195124665201030592123667719432527867539855894489697096409754591856956380236370162112047742722836489613422516445078182442352948636372141740238893441247963574370263755294448337998016125492278509257782562092622648326277933386566481627725164019105900491644998289315056604725802778631864155195653244258698294695930801915298721172556347546396447910145904090586298496791287406870504895858671747985466775757320568128845920541334053922000113786300945560688166740016984205580403363795376452030402432256613527836951177883863874439662532249850654995886234281899707733276171783928034946501434558897071942586398772754710962953741521115136835062752602326484728703920764310059584116612054529703023647254929666938115137322753645098889031360205724817658511806303644281231496550704751025446501172721155519486685080036853228183152196003735625279449515828418829478761085263981395599006737648292244375287184624578036192981971399147564488262603903381441823262515097482798777996437308997038886778227138360577297882412561190717663946507063304527954661855096666185664709711344474016070462621568071748187784437143698821855967095910259686200235371858874856965220005031173439207321139080329363447972735595527734907178379342163701205005451326383544000186323991490705479778056697853358048966906295119432473099587655236812859041383241160722602998330535370876138939639177957454016137223618789365260538155841587186925538606164779834025435128439612946035291332594279490433729908573158029095863138268329147711639633709240031689458636060645845925126994655724839186564209752685082307544254599376917041977780085362730941710163434907696423722294352366125572508814779223151974778060569672538017180776360346245927877846585065605078084421152969752189087401966090665180351650179250461950136658543663271254963990854914420001457476081930221206602433009641270489439039717719518069908699860663658323227870937650226014929101151717763594460202324930028040186772391028809786660565118326004368850881715723866984224220102495055188169480322100251542649463981287367765892768816359831247788652014117411091360116499507662907794364600585194199856016264790761532103872755712699251827568798930276176114616254935649590379804583818232336861201624373656984670378585330527583333793990752166069238053369887956513728559388349989470741618155012539706464817194670834819721448889879067650379590366967249499254527903372963616265897603949857674139735944102374432970935547798262961459144293645142861715858733974679189757121195618738578364475844842355558105002561149239151889309946342841393608038309166281881150371528496705974162562823609216807515017772538740256425347087908913729172282861151591568372524163077225440633787593105982676094420326192428531701878177296023541306067213604600038966109364709514141718577701418060644363681546444005331608778314317444081194942297559931401188868331483280270655383300469329011574414756313999722170380461709289457909627166226074071874997535921275608441473782330327033016823719364800217328573493594756433412994302485023573221459784328264142168487872167336701061509424345698440187331281010794512722373788612605816566805371439612788873252737389039289050686532413806279602593038772769778379286840932536588073398845721874602100531148335132385004782716937621800490479559795929059165547050577751430817511269898518840871856402603530558373783242292418562564425502267215598027401261797192804713960068916382866527700975276706977703643926022437284184088325184877047263844037953016690546593746161932384036389313136432713768884102681121989127522305625675625470172508634976536728860596675274086862740791285657699631378975303466061666980421826772456053066077389962421834085988207186468262321508028828635974683965435885668550377313129658797581050121491620765676995065971534476347032085321560367482860837865680307306265763346977429563464371670939719306087696349532884683361303882943104080029687386911706666614680001512114344225602387447432525076938707777519329994213727721125884360871583483562696166198057252661220679754062106208064988291845439530152998209250300549825704339055357016865312052649561485724925738620691740369521353373253166634546658859728665945113644137033139367211856955395210845840724432383558606310680696492485123263269951460359603729725319836842336390463213671011619282171115028280160448805880238203198149309636959673583274202498824568494127386056649135252670604623445054922758115170931492187959271800194096886698683703730220047531433818109270803001720593553052070070607223399946399057131158709963577735902719628506114651483752620956534671329002599439766311454590268589897911583709341937044115512192011716488056694593813118384376562062784631049034629395002945834116482411496975832601180073169943739350696629571241027323913874175492307186245454322203955273529524024590380574450289224688628533654221381572213116328811205214648980518009202471939171055539011394331668151582884368760696110250517100739276238555338627255353883096067164466237092264680967125406186950214317621166814009759528149390722260111268115310838731761732323526360583817315103459573653822353499293582283685100781088463434998351840445170427018938199424341009057537625776757111809008816418331920196262341628816652137471732547772778348877436651882875215668571950637193656539038944936642176400312152787022236646363575550356557694888654950027085392361710550213114741374410613444554419210133617299628569489919336918472947858072915608851039678195942983318648075608367955149663644896559294818785178403877332624705194505041984774201418394773120281588684570729054405751060128525805659470304683634459265255213700806875200959345360731622611872817392807462309468536782310609792159936001994623799343421068781349734695924646975250624695861690917857397659519939299399556754271465491045686070209901260681870498417807917392407194599632306025470790177452751318680998228473086076653686685551646770291133682756310722334672611370549079536583453863719623585631261838715677411873852772292259474337378569553845624680101390572787101651296663676445187246565373040244368414081448873295784734849000301947788802046032466084287535184836495919508288832320652212810419044804724794929134228495197002260131043006241071797150279343326340799596053144605323048852897291765987601666781193793237245385720960758227717848336161358261289622611812945592746276713779448758675365754486140761193112595851265575973457301533364263076798544338576171533346232527057200530398828949903425956623297578248873502925916682589445689465599265845476269452878051650172067478541788798227680653665064191097343452887833862172615626958265447820567298775642632532159429441803994321700009054265076309558846589517170914760743713689331946909098190450129030709956622662030318264936573369841955577696378762491885286568660760056602560544571133728684020557441603083705231224258722343885412317948138855007568938112493538631863528708379984569261998179452336408742959118074745341955142035172618420084550917084568236820089773945584267921427347756087964427920270831215015640634134161716644806981548376449157390012121704154787259199894382536495051477137939914720521952907939613762110723849429061635760459623125350606853765142311534966568371511660422079639446662116325515772907097847315627827759878813649195125748332879377157145909106484164267830994972367442017586226940215940792448054125536043131799269673915754241929660731239376354213923061787675395871143610408940996608947141834069836299367536262154524729846421375289107988438130609555262272083751862983706678722443019579379378607210725427728907173285487437435578196651171661833088112912024520404868220007234403502544820283425418788465360259150644527165770004452109773558589762265548494162171498953238342160011406295071849042778925855274303522139683567901807640604213830730877446017084268827226117718084266433365178000217190344923426426629226145600433738386833555534345300426481847398921562708609565062934040526494324426144566592129122564889356965500915430642613425266847259491431423939884543248632746184284665598533231221046625989014171210344608427161661900125719587079321756969854401339762209674945418540711844643394699016269835160784892451405894094639526780735457970030705116368251948770118976400282764841416058720618418529718915401968825328930914966534575357142731848201638464483249903788606900807270932767312758196656394114896171683298045513972950668760474091542042842999354102582911350224169076943166857424252250902693903481485645130306992519959043638402842926741257342244776558417788617173726546208549829449894678735092958165263207225899236876845701782303809656788311228930580914057261086588484587310165815116753332767488701482916741970151255978257270740643180860142814902414678047232759768426963393577354293018673943971638861176420900406866339885684168100387238921448317607011668450388721236436704331409115573328018297798873659091665961240202177855885487617616198937079438005666336488436508914480557103976521469602766258359905198704230017946553678856743028597460014378548323706870119007849940493091891918164932725977403007487968148488234293202301212803232746039221968752834051690697419425761467397811071546418627336909158497318501118396048253351874843892317729261354302493256289637136197728545662292446164449728459786771157412567030787188510933634448014967524061853656953207417053348678275482781541556196691105510147279904038689722046555083317078239480878599050194756310898412414467282186545997159663901564194175182093593261631688838013275875260146050767609839262572641112013528859131784829947568247256488553335727977220554356812630253574821658541400080531482069713726214975557605189048162237679041492674260007104592269531483518813746388710427354476762357793399397063239660496914530327388787455790593493777232014295480334500069525698093528288778371067058556774948137385863038576282304069400566534058488752700530883245918218349431804983419963998145877343586311594057044368351528538360944295596436067609022174189688354813164399743776415836524223464261959739045545068069523285075186871944906476779188672030641863075105351214985105120731384664871754751838297999018931775155063998101646641459210240683829460320853555405814715927322067756766921366408150590080695254061062853640829327662193193993386162383606911176778544823612932685819996523927548842743541440288453645559512473554613940315495209739705189624015797683263945063323045219264504965173546677569929571898969047090273028854494541669979199294803825498028594602905276314558031651406622917122342937580614399348491436210799357673731794896425248881372043557928751138585697338197608352442324046677802094839963994668483377470672548361884827300064831916382602211055522124673332318446300550448184991699662208774614021615702102960331858872733329877935257018239386124402686833955587060775816995439846956854067117444493247951957215941964586373612691552645757478698596424217659289686238350637043393981167139754473622862550680368266413554144804899 - - // Base of natural logarithm - // 'e' was previously used to be - // the charge of the electron, but - // changed to this. Mathematicians and - // particle physicists may battle this - // out. - -EulerMascheroniConstant := 0.577215664901532860606512 - // See http://en.wikipedia.org/wiki/Euler-Mascheroni_constant - -c := 299792458 m/s // speed of light in vacuum (exact) -light := c -lightspeed := c // sure, why not. - -mu0 := 4 pi 1e-7 N/A^2 // permeability of vacuum (exact) -magneticconstant := mu0 -permeabilityofvacuum := mu0 -mu0 ||| permeability - -epsilon0 := 1/(mu0 c^2) // permittivity of vacuum (exact) - // This is equivalent to about - // 8.85e-12 farads/meter -permittivityofvacuum := epsilon0 -electricconstant := epsilon0 - -epsilon0 ||| permittivity -energy := c^2 // convert mass to energy - -electroncharge := 1.60217653e-19 C // electron charge, also called e - // but that's reserved for the - // base of the natural logarithm - // This is the 2002 CODATA recommended - // value. Standard uncertainty is - // +/- 14 in the last 2 digits. - // http://physics.nist.gov/cgi-bin/cuu/Value?e - -h := 6.6260693e-34 J s // Planck's constant, given by 2002 - // CODATA figures. There is a standard - // uncertainty in the last 2 digits of +/- 11 - // http://physics.nist.gov/cgi-bin/cuu/Value?h - - -classicalElectronRadius := 2.817940325e-15 m // 2002 CODATA value - // http://physics.nist.gov/cgi-bin/cuu/Value?re - // uncertainty is +/- 28 in the last 2 digits -r_e := classicalElectronRadius - -ThomsonCrossSection := 0.665245873e-28 m^2 // 2002 CODATA value - // http://physics.nist.gov/cgi-bin/cuu/Value?sigmae - // The "classical" cross-section of an electron when - // illuminated by radiation. - // Uncertainty is +/- 13 in the last 2 digits. -sigma_e := ThomsonCrossSection -sigma_t := ThomsonCrossSection - - -plancksconstant := h -//\u210e := h // Official Unicode char for Planck's const. -hbar := h / (2 pi) -//\u210f := hbar // Official Unicode char for Planck/2 pi - -G := 6.6742e-11 N m^2 / kg^2 // Newtonian gravity constant - // From 2002 CODATA figures. There is a standard uncertainty in the - // last two figures of +/- 10 - // Given by http://physics.nist.gov/cgi-bin/cuu/Value?bg - -coulombconst := 1/(4 pi epsilon0) // listed as "k" sometimes - -au := 149597870691. m // astronomical unit, the average - // radius of earth's orbit around the - // sun, as defined by the IAU (1976). - // Estimated error +/- 30 m - - // Actually, the official definition from the IAU is: - // "the distance from the Sun at which a particle of - // negligible mass, in an unperturbed circular orbit, - // would have an orbital period of 365.2568983 days - // (a Gaussian year)." Gee, thanks for that helpful - // definition, guys. - -ua := au // The SI defines this abbreviation as its preferred - // version - -astronomicalunit := au - - -// -// angular measure -// - -circle := 2 pi radian -degree := (1/360) circle -arcdegree := degree -deg := degree -arcdeg := arcdegree -arcminute := (1/60) degree -arcmin := arcminute -arcsecond := (1/60) arcmin -arcsec := arcsecond -mas := milliarcsecond -rightangle := 90 degrees -quadrant := (1/4) circle -quintant := (1/5) circle -sextant := (1/6) circle - -sign := (1/12) circle// Angular extent of one sign of the zodiac -turn := circle -revolution := turn -rev := turn -pulsatance := radian / sec -gon := (1/100) rightangle // measure of grade -grade := gon -centesimalminute := (1/100) grade -centesimalsecond := (1/100) centesimalminute -milangle := (1/6400) circle // Official NIST definition. - // Another choice is 1ee-3 radian. -pointangle := (1/32) circle -centrad := (1/100) radian // Used for angular deviation of light - // through a prism. - -brad := (1/256) circle // Binary radian--used to fit angular measurements into - // a byte. Questionable but what the hell. - -// -// Solid angle measure -// - -sphere := 4 pi sr -squaredegree := (1/180^2) pi^2 sr -squareminute := (1/60^2) squaredegree -squaresecond := (1/60^2) squareminute -squarearcmin := squareminute -squarearcsec := squaresecond -sphericalrightangle := (1/2) pi sr -octant := (1/2) pi sr - -// -// Concentration measures -// - -percent := 1/100 -proof := 1/200 // Alcohol content measured by volume at - // 60 degrees Fahrenheit. This is a USA - // measure. In Europe proof=percent. -ppm := 1ee-6 -partspermillion := ppm -ppb := 1ee-9 -partsperbillion := ppb // USA billion -ppt := 1ee-12 -partspertrillion := ppt // USA trillion -karat := 1/24 // measure of gold purity -fine := 1/1000 // Measure of gold purity -caratgold := karat -gammil := mg/l -basispoint := (1/100) percent// Used in finance - -// -// Temperature difference -// The units below are NOT an absolute temperature measurement in Fahrenheit, -// but represents the size of a degree in the specified systems. -degcelsius := K -degreeCelsius := K // Per http://physics.nist.gov/Pubs/SP811/sec04.html#4.2.1.1 -degC := K // The *size* of a degree in the Celsius scale. - // This is identical to the size of a Kelvin. - // WARNING: This should only be used when - // you're indicating the *difference* between - // two temperatures, (say, how much energy to - // raise the temperature of a gram of water by 5 - // degrees Celsius, *not* for absolute - // temperatures. (I wonder if they should go - // entirely to eliminate this confusion...) - // For calculating absolute temperatures, use - // the Celsius[] or C[] functions below. - // - // In 1741 Anders Celsius introduced a - // Temperature scale with water boiling at 0 - // degrees and freezing at 100 degrees at - // standard pressure. After his death the - // fixed points were reversed and the scale - // was called the centigrade scale. Due to - // the difficulty of accurately measuring the - // temperature of melting ice at standard - // pressure, the centigrade scale was replaced - // in 1954 by the Celsius scale which is - // defined by subtracting 273.15 from the - // temperature in Kelvins. This definition - // differed slightly from the old centigrade - // definition, but the Kelvin scale depends on - // the triple point of water rather than a - // melting point, so it can be measured - // accurately. - -zerocelsius := 273.15 K // Defined by the 10th CGPM, 1954, Resolution 3; - // CR, 79. The triple point of water was defined - // at the same time to be 273.16 Kelvin, and - // the reference temperature 273.15 K (the ice - // point) to be the scale difference between - // Kelvin and Celsius. So, the size of a Kelvin - // and a degree Celsius are the same, but - // the zero point of the Celsius scale is actually - // set to .01 Kelvin below the triple point. - - -degfahrenheit := (5/9) degC // The *size* of a degree in the Fahrenheit scale. -degreeFahrenheit := degfahrenheit // The *size* of a degree in the Fahrenheit scale. -degF := degfahrenheit // WARNING: These should only be used when - // you're indicating the *difference* between - // two temperatures, (say, how much energy to - // raise the temperature of a gram of water by 5 - // degrees Fahrenheit, *not* for absolute - // temperatures. (I wonder if they should go - // entirely to eliminate this confusion...) - // For calculating absolute temperatures, use - // the Fahrenheit[] or F[] functions below. - // - // Fahrenheit defined his temperature scale - // by setting 0 to the coldest temperature - // he could produce and by setting 96 degrees - // to body heat (for reasons unknown). - - -//\u2109 := degfahrenheit // Single Unicode codepoint for - // DEGREE FAHRENHEIT - -degreesRankine := (5/9) K -degreesrankine := degreesRankine // The Rankine scale has the -degrankine := degreesRankine // Fahrenheit degree, but its zero -degreerankine := degrankine // is at absolute zero. -degR := degrankine -Rankine := degreesrankine - -degreaumur := (10/8) degC // The Reaumur scale was used in Europe and - // particularly in France. It is defined - // to be 0 at the freezing point of water - // and 80 at the boiling point. Reaumur - // apparently selected 80 because it is - // divisible by many numbers. - -// Function for converting Fahrenheit to/from standard units - -// This is a less legible version of the revised function below -Fahrenheit{x} := (x conforms K) ? ((x - zerocelsius) / K) * 9/5 + 32 : ((x conforms 1) ? ((x-32) * 5/9) K + zerocelsius : "Error") - -//Fahrenheit[x] := -//{ -// if (x conforms K) // If x is already a temperature, convert to F -// return ((x - zerocelsius) / K) * 9/5 + 32 -// else -// if (x conforms 1) // If x is a pure number, treat as Fahrenheit degrees -// return ((x-32) * 5/9) K + zerocelsius -// else -// return "Error" -//} - -// TODO: Change the implementation of the following idiom so that it aliases -// the function instead of chaining function calls. -F{x} := Fahrenheit[x] - -// Function for converting Celsius to/from standard units -Celsius{x} := (x conforms K) ? (x-zerocelsius) / K : ((x conforms 1) ? (x K + zerocelsius) : "Error") - -C{x} := Celsius[x] - -Reaumur{x} := (x conforms K) ? (8/10 (x-zerocelsius)) / K : ((x conforms 1) ? (10/8 * x * K + zerocelsius) : "Error") - -// Physical constants -// - -gravity := (980665/100000) m/s^2 // std acceleration of gravity - // (exact) -g_n := gravity -gee := gravity -gravities := gravity // Irregular plural -force := gravity // use to turn masses into forces - -// Various conventional values - -atm := 101325 Pa // Standard atmospheric pressure (exact) -atmosphere := atm -Hg := 13.5951 gram / cm^3 // Density of mercury (defined) -mercurydensity := Hg -water := gram / cm^3 // Standard density of water (defined) -H2O := water -wc := water // water column -mach := 331.46 m/s // speed of sound in dry air at STP -standardtemp := 273.15 K // standard temperature -stdtemp := standardtemp - -// Physico-chemical constants - -// Atomic mass unit is given by the 2002 CODATA value -// http://physics.nist.gov/cgi-bin/cuu/Value?u -atomicmassunit := 1.66053886e-27 kg // atomic mass unit - // error is +/- 28 in last 2 digits - // (defined to be 1/12 of the mass of - // carbon 12) - -m_u := atomicmassunit -u := atomicmassunit // 1/12 of the mass of carbon 12) -amu := atomicmassunit - -amu_chem := 1.66026e-27 kg // 1/16 of the weighted average mass of - // the 3 naturally occuring neutral - // isotopes of oxygen - -amu_phys := 1.65981e-27 kg // 1/16 of the mass of a neutral - // oxygen 16 atom - -dalton := u // Maybe this should be amu_chem? -avogadro := grams/(amu mol) // size of a mole -N_A := avogadro - -gasconstant := 8.314472 J / (mol K) // molar gas constant, 2006 CODATA - // value. Standard uncertainty is - // +/- 15 in last 2 digits - // http://physics.nist.gov/cgi-bin/cuu/Value?r - -R := gasconstant -boltzmann := R / N_A // Boltzmann's constant -boltzmannsconstant := boltzmann // Boltzmann's constant -k := boltzmann -molarvolume := mol R stdtemp / atm // Volume occupied by one mole of an - // ideal gas at STP. - -molar := mol / l // Unit of concentration (moles/liter) -Molar := molar // Sometimes capitalized - -molar ||| concentration_by_volume - -molal := mol / kg // Unit of concentration (moles/kg) - -molal ||| concentration_by_mass - -m^3/mol ||| molar_volume - -loschmidt := avogadro mol / molarvolume// Molecules per cubic meter of an - // ideal gas at STP. Loschmidt did - // work similar to Avogadro. -stefanboltzmann := 2 pi^5 k^4 / (15 h^3 c^2) // The radiant emittance by a - // blackbody -sigma := stefanboltzmann // at temperature T is given by - // sigma T^4. - -wiendisplacement := 2.8977685e-3 m K // Wien's Displacement Law gives the - // frequency at which the the Planck - // spectrum has maximum intensity. - // The relation is lambda T = b where - // lambda is wavelength, T is - // temperature and b is the Wien - // displacement. This relation is - // used to determine the temperature - // of stars. This is the 2002 - // CODATA value. Standard - // uncertainty is +/- 51 in last 2 - // digits. - -K_J := 2 electroncharge/h // Josephson Constant - // Direct measurement of the volt is difficult. Until - // recently, laboratories kept Weston cadmium cells as - // a reference, but they could drift. In 1987 the - // CGPM officially recommended the use of the - // Josephson effect as a laboratory representation of - // the volt. The Josephson effect occurs when two - // superconductors are separated by a thin insulating - // layer. A "supercurrent" flows across the insulator - // with a frequency that depends on the potential - // applied across the superconductors. This frequency - // can be very accurately measured. The Josephson - // constant K_J, which is equal to 2e/h, relates the - // measured frequency to the potential. The value - // given here is the officially specified value for - // use beginning in 1990. The 1998 recommended value - // of the constant is 483597.898 GHz/V. - -R_K := h/electroncharge^2 - // Measurement of the ohm also presents difficulties. - // The old approach involved maintaining resistances - // that were subject to drift. The new standard is - // based on the Hall effect. When a current carrying - // ribbon is placed in a magnetic field, a potential - // difference develops across the ribbon. The ratio - // of the potential difference to the current is - // called the Hall resistance. Klaus von Klitzing - // discovered in 1980 that the Hall resistance varies - // in discrete jumps when the magnetic field is very - // large and the temperature very low. This enables - // accurate realization of the resistance h/e^2 in the - // lab. This is approximately equal to 25812.807 ohms - - -// Density of mercury and water at different temperatures using the standard -// force of gravity. - -// Hg10C := 13.5708 gram / cm^3 // These units, when used to form -// Hg20C := 13.5462 gram / cm^3 // pressure measures, are not accurate -// Hg23C := 13.5386 gram / cm^3 // because of considerations of the -// Hg30C := 13.5217 gram / cm^3 // revised practical temperature scale. -// Hg40C := 13.4973 gram / cm^3 -// Hg60F := 13.5574 gram / cm^3 -// H2O0C := 0.99987 gram / cm^3 -// H2O5C := 0.99999 gram / cm^3 -// H2O10C := 0.99973 gram / cm^3 -// H2O15C := 0.99913 gram / cm^3 -// H2O18C := 0.99862 gram / cm^3 -// H2O20C := 0.99823 gram / cm^3 -// H2O25C := 0.99707 gram / cm^3 -// H2O50C := 0.98807 gram / cm^3 -// H2O100C := 0.95838 gram / cm^3 - - -// Masses of elementary particles, as given by 2002 CODATA-recommended values. -// http://physics.nist.gov/cuu/Constants/index.html - -electronmass := 9.1093826e-31 kg // +/- 16 in last 2 digits -m_e := electronmass - -protonmass := 1.67262171e-27 kg // +/- 27 in last 2 digits -m_p := protonmass - -neutronmass := 1.67492728e-27 kg // +/- 29 in last 2 digits -m_n := neutronmass - -muonmass := 1.88353140e-28 kg // +/- 33 in last 2 digits -m_mu := muonmass -m_muon := muonmass - -deuteronmass := 3.34358335e-27 kg // +/- 57 in last 2 digits -m_d := deuteronmass - -alphaparticlemass := 6.6446565e-27 kg // +/- 11 in last 2 digits -m_alpha := alphaparticlemass - -taumass := 3.16777e-27 kg // +/- 52 in last 2 digits -m_tau := taumass - - -// Atomic constants - -alpha := 7.297352568e-3 // 2002 CODATA value - // http://physics.nist.gov/cgi-bin/cuu/Value?alph - // Standard uncertainty is +/- 24 in the last 2 - // decimal places. - // This can also be given by: - // mu0 c electroncharge^2 / (2 h) - // The fine structure constant was - // introduced to explain fine - // structure visible in spectral - // lines. -finestructureconstant := alpha - -// Rydberg constant -Rydberg_constant := 10973731.568525 m^-1 // 2002 CODATA value - // http://physics.nist.gov/cgi-bin/cuu/Value?ryd - // The standard uncertainty is +/- 73 in the last 2 decimal places. - -Rinfinity := Rydberg_constant //m_e c alpha^2 / (2 h) - - // The wavelengths of a spectral series -R_H := 10967760 /m // can be expressed as - // 1/lambda = R (1/m^2 - 1/n^2). - // where R is a number that various - // slightly from element to element. - // For hydrogen, R_H is the value, - // and for heavy elements, the value - // approaches Rinfinity. - -bohrradius := alpha / (4 pi Rinfinity) - -// Planck constants - -planckmass := (hbar c / G)^(1/2) -m_P := planckmass -plancktime := hbar / (planckmass c^2) -t_P := plancktime -plancklength := plancktime c -l_P := plancklength - -// particle wavelengths: the compton wavelength of a particle is -// defined as h / m c where m is the mass of the particle. - -electronwavelength := h / (m_e c) -lambda_C := electronwavelength -Comptonwavelength := electronwavelength - -protonwavelength := h / (m_p c) -lambda_C_p := protonwavelength -neutronwavelength := h / (m_n c) -lambda_C_n := neutronwavelength - - -// Magnetic moments - -bohrmagneton := electroncharge hbar / (2 electronmass) -mu_B := bohrmagneton -nuclearmagneton := electroncharge hbar / (2 protonmass) -mu_N := nuclearmagneton - - -// Values below are from 2002 CODATA values - -muonmagneticmoment := -4.49044799e-26 J/T // +/- 40 in last 2 digits -mu_mu := muonmagneticmoment - -protonmagneticmoment := 1.41060671e-26 J/T // +/- 12 in last 2 digits -mu_p := protonmagneticmoment - -electronmagneticmoment:= -928.476412e-26 J/T // +/- 80 in last 2 digits -mu_e := electronmagneticmoment - -neutronmagneticmoment := -0.96623645e-26 J/T // +/- 24 in last 2 digits -mu_n := neutronmagneticmoment - -deuteronmagneticmoment := 0.433073482e-26 J/T // +/- 38 in last 2 digits -mu_d := deuteronmagneticmoment - - -// -// United States units -// - -// linear measure - -// The US Metric Law of 1866 gave the exact relation 1 meter = 39.37 inches. -// From 1893 until 1959, the foot was exactly 1200/3937 meters. In 1959 -// the definition was changed to bring the US into agreement with other -// countries. Since then, the foot has been exactly 0.3048 meters. At the -// same time it was decided that any data expressed in feet derived from -// geodetic surveys within the US would continue to use the old definition. - -inch := 254/100 cm -inches := inch -foot := 12 inch -feet := foot -ft := foot -survey ::- 1200/3937 m/ft // Ratio to give survey length -geodetic ::- survey -statute ::- survey -int :- 3937/1200 ft/m // Convert US Survey measures to - // international measures - -inches := inch // Wacky plural -in := inch -yard := 3 ft -yards := yard -yd := yard -mile := 5280 ft -miles := mile - -line := 1/12 inch // Also defined as '.1 in' or as '1e-8 Wb' -rod := 11/2 surveyyard -rd := rod -perch := rod -furlong := 40 rod // From "furrow long" -statutemile := statute mile -league := 3 statute mile - -// Calories: energy to raise a gram of water one degree celsius - -cal_IT := 41868/10000 J // International Table calorie -cal_th := 4184/1000 J // Thermochemical calorie -cal_fifteen := 4.18580 J // Energy to go from 14.5 to 15.5 degC -cal_twenty := 4.18190 J // Energy to go from 19.5 to 20.5 degC -cal_mean := 4.19002 J // 1/100 energy to go from 0 to 100 degC -calorie := cal_IT -cal := calorie -calorie_IT := cal_IT -thermcalorie := cal_th -calorie_th := thermcalorie -Calorie := kilocalorie // the food Calorie -thermie := 1ee6 cal_fifteen// Heat required to raise the - // temperature of a tonne of - // water from 14.5 to 15.5 degC. - -// -// Units derived from physical constants -// - -inHg := inch gravity Hg // Inches of mercury -inH2O := inch gravity water -inchmercury := inHg -inchesmercury := inHg // Irregular plural -mmH2O := mm gravity water -mmHg := mm gravity Hg - -kgf := kg gravity -technicalatmosphere := kgf / cm^2 -at := technicalatmosphere -hyl := kgf s^2 / m // Also gram-force s^2/m according to [15] -torr := 101325/760 Pa // Exactly defined. Differs from mmHg by - // about 1 part in 7 million. -Torr := torr // Accepted symbol is Torr - // These units, both named after Evangelista -tor := Pa // Torricelli, should not be confused. - // Acording to [15] the torr is actually - // atm/760 which is slightly different. - -eV := electroncharge V // Energy acquired by a particle with charge e -electronvolt := eV // when it is accelerated through 1 V -lightyear := c 365.25 day // The 365.25 day year is specified in - // NIST publication 811 -ly := lightyear -lightsecond := c s -lightminute := c min -parsec := au radian / arcsec // Unit of length equal to distance -pc := parsec // from the sun to a point having - // heliocentric parallax of 1 - // arcsec (derived from parallax - // second) The formula should use - // tangent, but the error is about - // 1e-12. -rydberg := h c Rinfinity // Rydberg energy -crith := 0.089885 gram // The crith is the mass of one - // liter of hydrogen at standard - // temperature and pressure. -amagatvolume := molarvolume -amagat := mol/amagatvolume // Used to measure gas densities -lorentz := bohrmagneton / (h c)// Used to measure the extent - // that the frequency of light - // is shifted by a magnetic field. -cminv := h c / cm // Unit of energy used in infrared -invcm := cminv // spectroscopy. -wavenumber := cminv -kcal_mol := kcal / (mol N_A) // kcal/mol is used as a unit of - // energy by physical chemists. -// -// CGS system based on centimeter, gram and second -// - -dyne := cm gram / s^2 // force -dyn := dyne -erg := cm dyne // energy -poise := gram / (cm s) // viscosity, honors Jean Poiseuille -P := poise -poise ||| viscosity - -rhe := poise^-1 // reciprocal viscosity -rhe ||| reciprocal_viscosity - -stokes := cm^2 / s // kinematic viscosity -St := stokes -stokes ||| kinematic_viscosity -stoke := stokes -lentor := stokes // old name -Gal := cm / s^2 // acceleration, used in geophysics -galileo := Gal // for earth's gravitational field - // (note that "gal" is for gallon - // but "Gal" is the standard symbol - // for the gal which is evidently a - // shortened form of "galileo".) -barye := dyne/cm^2 // pressure -barad := barye // old name -kayser := 1/cm // Proposed as a unit for wavenumber -balmer := kayser // Even less common name than "kayser" -kine := cm/s // velocity -bole := g cm / s // momentum -pond := gram force -glug := gram force s^2 / cm// Mass which is accelerated at - // 1 cm/s^2 by 1 gram force -darcy := centipoise cm^2 /(s atm)// Measures permeability to fluid flow. - // One darcy is the permeability of a - // medium that allows a flow of cc/s of - // a liquid of centipoise viscosity - // under a pressure gradient of atm/cm. -mohm := cm / (dyn s) // mobile ohm, measure of mechanical -mobileohm := mohm // mobility -mechanicalohm := dyn s / cm // mechanical resistance -acousticalohm := dyn s / cm^5 // ratio of the sound pressure of - // 1 dyn/cm^2 to a source of strength - // 1 cm^3/s - -ray := acousticalohm -rayl := dyn s / cm^3 // Specific acoustical resistance -eotvos := 1ee-9 Gal/cm // Change in gravitational acceleration - // over horizontal distance - -// Electromagnetic units derived from the abampere - -abampere := 10 A // Current which produces a force of -abamp := abampere // 2 dyne/cm between two infinitely -aA := abampere // long wires that are 1 cm apart -biot := aA // alternative name for abamp -Bi := biot -abcoulomb := abamp sec -abcoul := abcoulomb -abvolt := dyne cm / (abamp sec) -abfarad := abampere sec / abvolt -abhenry := abvolt sec / abamp -abohm := abvolt / abamp -abmho := abohm^-1 -gauss := abvolt sec / cm^2 -Gs := gauss -maxwell := abvolt sec // Also called the "line" -Mx := maxwell -oersted := gauss / mu0 -Oe := oersted -gilbert := gauss cm / mu0 -Gb := gilbert -Gi := gilbert -unitpole := 4 pi maxwell - -// Gaussian system: electromagnetic units derived from statampere. -// -// Note that the Gaussian units are often used in such a way that Coulomb's law -// has the form F= q1 * q2 / r^2. The constant 1/(4*pi*epsilon0) -// is incorporated -// into the units. From this, we can get the relation force=charge^2/dist^2. -// This means that the simplification esu^2 = dyne cm^2 can be used to simplify -// units in the Gaussian system, with the curious result that capacitance can -// be measured in cm, resistance in sec/cm, and inductance in sec^2/cm. These -// units are given the names statfarad, statohm and stathenry below. - -statampere := 10 A cm / (s c) -statamp := statampere -statvolt := dyne cm / (statamp sec) -statcoulomb := statamp s -esu := statcoulomb -statcoul := statcoulomb -statfarad := statamp sec / statvolt -cmcapacitance := statfarad -stathenry := statvolt sec / statamp -statohm := statvolt / statamp -statmho := statohm^-1 -statmaxwell := statvolt sec -franklin := statcoulomb -debye := 1ee-18 statcoul cm// unit of electrical dipole moment -debye ||| electrical_dipole_moment -helmholtz := debye/angstrom^2 // Dipole moment per area -jar := 1000 statfarad // approx capacitance of Leyden jar - -// -// Some historical eletromagnetic units -// - -intampere := 0.999835 A // Defined as the current which in one -intamp := intampere // second deposits .001118 gram of - // silver from an aqueous solution of - // silver nitrate. -intfarad := 0.999505 F -intvolt := 1.00033 V -intohm := 1.000495 ohm // Defined as the resistance of a - // uniform column of mercury containing - // 14.4521 gram in a column 1.063 m - // long and maintained at 0 degC. -daniell := 1.042 V // Meant to be electromotive force of a - // Daniell cell, but in error by .04 V -faraday := N_A electroncharge mol // Charge that must flow to deposit or -faraday_phys := 96521.9 C // liberate one gram equivalent of any -faraday_chem := 96495.7 C // element. (The chemical and physical - // values are off slightly from what is - // obtained by multiplying by amu_chem - // or amu_phys. These values are from - // a 1991 NIST publication.) Note that - // there is a Faraday constant which is - // equal to N_A e and hence has units of - // C/mol. -kappline := 6000 maxwell // Named by and for Gisbert Kapp -siemensunit := 0.9534 ohm // Resistance of a meter long column of - // mercury with a 1 mm cross section. - -// -// Photometric units -// - -candle := 1.02 candela // Standard unit for luminous intensity -hefnerunit := 0.9 candle // in use before candela -hefnercandle := hefnerunit // -violle := 20.17 cd // luminous intensity of 1 cm^2 of - // platinum at its temperature of - // solidification (2045 K) - -lumen := cd sr // Luminous flux -lm := lumen // - -talbot := lumen s // Luminous energy -lumberg := talbot -talbot ||| luminous_energy - -m^-2 cd sr ||| illuminance -lux := lm/m^2 // Illuminance or exitance (luminous -lx := lux // flux incident on or coming from -phot := lumen / cm^2 // a surface) -ph := phot // -footcandle := lumen/ft^2 // Illuminance from a 1 candela source - // at a distance of one foot -metercandle := lumen/m^2 // Illuminance from a 1 candela source - // at a distance of one meter - -mcs := metercandle s// luminous energy per area, used to - // measure photographic exposure - -// Luminance measures - -nit := cd/m^2 // Luminance: the intensity per projected -stilb := cd / cm^2 // area of an extended luminous source. -sb := stilb // (nit is from latin nitere = to shine.) - -apostilb := cd/(pi m^2) -asb := apostilb -blondel := apostilb // Named after a French scientist. -nox := 1ee-3 lux // These two units were proposed for -skot := 1ee-3 apostilb// measurements relating to dark adapted - // eyes. - -// Equivalent luminance measures. These units are units which measure -// the luminance of a surface with a specified exitance which obeys -// Lambert's law. (Lambert's law specifies that luminous intensity of -// a perfectly diffuse luminous surface is proportional to the cosine -// of the angle at which you view the luminous surface.) - -equivalentlux := cd / (pi m^2) // luminance of a 1 lux surface -equivalentphot := cd / (pi cm^2) // luminance of a 1 phot surface -lambert := cd / (pi cm^2) -footlambert := cd / (pi ft^2) - -// Some luminance data from the IES Lighting Handbook, 8th ed, 1993 - -sunlum := 1.6e9 cd/m^2 // at zenith -sunillum := 100e3 lux // clear sky -sunillum_o := 10e3 lux // overcast sky -sunlum_h := 6e6 cd/m^2 // value at horizon -skylum := 8000 cd/m^2 // average, clear sky -skylum_o := 2000 cd/m^2 // average, overcast sky -moonlum := 2500 cd/m^2 - -// -// Astronomical time measurements -// - -anomalisticyear := 365.2596 days // The time between successive - // perihelion passages of the - // earth. -siderealyear := 365.256360417 day // The time for the earth to make - // one revolution around the sun - // relative to the stars. -tropicalyear := 365.242198781 day // The mean interval between vernal - // equinoxes. Differs from the - // sidereal year by 1 part in - // 26000 due to precession of the - // earth about its rotational axis - // combined with precession of the - // perihelion of the earth's - // orbit. -gaussianyear := 365.2690 days // The orbital period of a body in - // circular orbit at a distance of - // 1 au from the sun. Calculated - // from Kepler's third law. -siderealday := 23.934469444 hour // The sidereal day is the interval -siderealhour := 1/24 siderealday // between two successive transits -siderealminute := 1/60 siderealhour // of a star over the meridian, -siderealsecond := 1/60 siderealminute// or the time required for the - // earth to make one rotation - // relative to the stars. The - // more usual solar day is the - // time required to make a - // rotation relative to the sun. - // Because the earth moves in its - // orbit, it has to turn a bit - // extra to face the sun again, - // hence the solar day is slightly - // longer. -anomalisticmonth := 27.55454977 day // Time from perigee to perigee -nodicalmonth := 27.2122199 day // The nodes are the points where -draconicmonth := nodicalmonth // an orbit crosses the ecliptic. -draconiticmonth := nodicalmonth // This is the time required to - // travel from the ascending node - // to the next ascending node. -siderealmonth := 27.321661 day // Time required for the moon to - // orbit the earth -lunarmonth := 29.5305555 day // Time between full moons. Full -synodicmonth := lunarmonth // moon occur when the sun and -lunation := synodicmonth // moon are on opposite sides of -lune := 1/30 lunation // the earth. Since the earth -lunour := 1/24 lune // moves around the sun, the moon - // has to revolve a bit farther to - // get into the full moon - // configuration. -year := tropicalyear -yr := year -years := year - -month := 1/12 year // This is obviously an average for the - // limiting case... so is accurate in the - // long term but useless for adding an - // offset to a specific date. - -mo := month -decade := 10 years -century := 100 years -centuries := century // Irregular plural -millennium := 1000 years -millennia := millennium -solaryear := year -lunaryear := 12 lunarmonth -calendaryear := 365 day -commonyear := 365 day -leapyear := 366 day -julianyear := 365.25 day -juliancentury := 36525 day -juliancenturies := 36525 day -gregorianyear := 365.2425 day -islamicyear := 354 day // A year of 12 lunar months. They -islamicleapyear := 355 day // began counting on July 16, AD 622 - // when Muhammad emigrated to Medina - // (the year of the Hegira). They need - // 11 leap days in 30 years to stay in - // sync with the lunar year which is a - // bit longer than the 29.5 days of the - // average month. -islamicmonth := 1/12 islamicyear// They have 29 day and 30 day months. -cron := 1ee6 years -lustrum := 5 years // The Lustrum was a Roman - // purification ceremony that took - // place every five years. - // Classically educated Englishmen - // used this term. - -// The following are sidereal days unless otherwise noted - -mercuryday := 58.6462 day -venusday := 243.01 day // retrograde -earthday := siderealday -marssiderealday := 24 hours + 37 min + 22.663 sec -marsday := marssiderealday -marssolarday := 24 hours + 39 min + 35.24409 sec -jupiterday := 0.41354 day -saturnday := 0.4375 day -uranusday := 0.65 day // retrograde -neptuneday := 0.768 day -plutoday := 6.3867 day - -// Solar days - -// Planetary sidereal years - -mercuryyear := 86.96 day -venusyear := 224.68 day -earthyear := siderealyear -marsyear := 686.95 day -jupiteryear := 11.862 tropicalyear -saturnyear := 29.458 tropicalyear -uranusyear := 84.012 tropicalyear -neptuneyear := 164.798 tropicalyear -plutoyear := 248.5 tropicalyear - -// -// Some other astronomical values -// - -sunmass := 1.9891e30 kg -sunradius := 6.96e8 m -sunpower := 3.86e26 watts - -landarea := 148.847e6 km^2 -oceanarea := 361.254e6 km^2 - -moonmass := 7.3483e22 kg -moonradius := 1738 km // mean value - -// Distances -sundist := 1.0000010178 au// mean earth-sun distance -sundist_near := 1.471e11 m // earth-sun distance at perihelion -sundist_far := 1.521e11 m // earth-sun distance at aphelion - -// Average distances between planets and the sun. -mercurydist := 57910. Mm -venusdist := 108200. Mm -earthdist := sundist -marsdist := 227940. Mm -jupiterdist := 778330. Mm -saturndist := 1429400. Mm -uranusdist := 2870990. Mm -neptunedist := 4497070. Mm -plutodist := 5913520. Mm - -moondist := 384400. km // mean earth-moon distance - -mercurymass := 0.33022e24 kg -venusmass := 4.8690e24 kg -marsmass := 0.64191e24 kg -earthmass := 5.9742e24 kg -jupitermass := 1898.8e24 kg -saturnmass := 568.5e24 kg -uranusmass := 86.625e24 kg -neptunemass := 102.78e24 kg -plutomass := 0.0127e24 kg - -mercuryradius := 2439. km -venusradius := 6052. km -marsradius := 3397. km -earthradius := 6371.01 km // mean +/- 0.02 km -jupiterradius := 71492. km -saturnradius := 60268. km -uranusradius := 25559. km -neptuneradius := 24764. km -plutoradius := 1137. km - -// These use the WGS84 datum, which is currently most commonly used -// in mapping. -earthradius_equatorial := 6378137. m -earthradius_polar := 6356752.3142 m -earth_flattening := (earthradius_equatorial-earthradius_polar)/earthradius_equatorial - // http://www.uwgb.edu/dutchs/UsefulData/UTMFormulas.HTM - // http://ssd.jpl.nasa.gov/phys_props_earth.html - -// Larger moons... their distances are the average distances from their planet. - -// Mars -phobosdist := 9378.5 km -phobosmass := 1.08e16 kg - -deimosdist := 23458. km -deimosmass := 1.8e15 kg - -// Jupiter -iodist := 422000. km -ioradius := 1815. km -iomass := 8.93e22 kg - -europadist := 670900. km -europaradius := 1569. km -europamass := 4.80e22 kg - -ganymededist := 1070000. km -ganymederadius := 2631. km -ganymedemass := 1.48e23 kg - -callistodist := 1883000. km -callistoradius := 2400. km -callistomass := 1.08e23 kg - -// Saturn -titandist := 1221850. km -titanradius := 2575. km -titanmass := 1.35e23 kg - -// Pluto -charondist := 19640. km -charonradius := 586. km -charonmass := 1.90e21 kg - -moongravity := 1.62 m/s^2 - -// General cosmological observations -hubbleconstant := 71 km/s/megaparsec // WMAP data, +0.04/-0.03 (factor) -H_0 := hubbleconstant - -atomicmass := electronmass -atomiccharge := electroncharge -atomicaction := hbar - - -// Inverse time units -annually := 1/year -annual := annually -yearly := annual -daily := 1/day -weekly := 1/week -monthly := 1/month -hourly := 1/hour - - -// Perfect intervals - -octave := 2 -majorthird := 5/4 -minorthird := 6/5 -musicalfourth := 4/3 -musicalfifth := 3/2 -majorsecond := musicalfifth^2 / octave -majorsixth := musicalfourth majorthird -minorsixth := musicalfourth minorthird -majorseventh := musicalfifth majorthird -minorseventh := musicalfifth minorthird - -pythagoreanthird := majorsecond musicalfifth^2 / octave -syntoniccomma := pythagoreanthird / majorthird -pythagoreancomma := musicalfifth^12 / octave^7 - -// Equal tempered definitions - -semitone := octave^(1/12) - - -// -// The Hartree system of atomic units, derived from fundamental units -// of mass (of electron), action (planck's constant), charge, and -// the coulomb constant. - -// Fundamental units -// derived units (Warning: accuracy is lost from deriving them this way) - -atomiclength := bohrradius -atomictime := hbar^3/(coulombconst^2 atomicmass electroncharge^4) - // Period of first Bohr orbit -atomicvelocity := atomiclength / atomictime -atomicenergy := hbar / atomictime -hartree := atomicenergy -Hartree := hartree - -// -// These thermal units treat entropy as charge, from [5] -// - -thermalcoulomb := J/K // entropy -thermalampere := W/K // entropy flow -thermalfarad := J/K^2 -thermalohm := K^2/W // thermal resistance -fourier := thermalohm -thermalhenry := J K^2/W^2 // thermal inductance -thermalvolt := K // thermal potential difference - - - -// surveyor's measure - -surveyorschain := 66 surveyft -surveyorspole := 1/4 surveyorschain -surveyorslink := 1/100 surveyorschain -chain := surveyorschain -surveychain := chain -ch := chain -link := surveyorslink -acre := 43560 surveyfoot^2 // NIST Handbook 44 has a - // typographical error (forgetting - // to underline feet in one place - // on middle of page C-16 in 2003 - // edition) with - // respect to this, but it's - // clear from corroborating - // different figures in that - // document and NIST Special - // Publication 811, Sec. B.6, - // that the survey foot is - // the proper definition. Have - // filed errata with NIST and - // requested confirmation. - // 2003-08-27 - -intacre := 43560 ft^2 // Acre based on international ft -acrefoot := acre surveyfoot -acrefeet := acrefoot // Irregular plural -section := surveymile^2 -township := 36 section -homestead := 160 acre // Area of land granted by the 1862 Homestead - // Act of the United States Congress -gunterschain := surveyorschain - -engineerschain := 100 ft -engineerslink := 1/100 engineerschain -ramsdenschain := engineerschain -ramsdenslink := engineerslink - - -// nautical measure - -fathom := 6 surveyft // Originally defined as the distance from - // fingertip to fingertip with arms fully - // extended. -fathoms := fathom -nauticalmile := 1852 m // Supposed to be one minute of latitude at - // the equator. That value is about 1855 m. - // Early estimates of the earth's circumference - // were a bit off. The value of 1852 m was - // made the international standard in 1929. - // The US did not accept this value until - // July 1, 1954. The UK switched in 1970. - // The value of this unit was adopted by the - // First International Extraordinary - // Hydrographic Conference, Monaco, 1929, - // under the name "International nautical mile." - -oldUSnauticalmile := 6080.20 feet // Used in U.S. before July 1, 1954 -oldUSknot := oldUSnauticalmile / hour - -cable := 720 surveyfoot // NIST Handbook 44, 2003 Appendix C -cablelength := cable -cableslength := cable - -metriccable := 200 m // Used by France and Spain - -navycablelength := 720 surveyft -marineleague := 3 nauticalmile -knot := nauticalmile / hr -shackle := 15 fathoms // Adopted 1949 by British navy -oldUKRNshackle := 12.5 fathoms // Used by Royal Navy until 1949 -watch := 4 hours // time a sentry stands watch or a ship's - // crew is on duty. -bell := 1/8 watch // Bell would be sounded every 30 minutes. - -datamile := 6000 feet // Defined by U.S. Department of Defense - // as a unit used in radar measurements. - -// Avoirdupois weight -// These are actually defined as mass units to follow the recommendations -// of the SI. - -pound := 45359237/100000000 kg // Defined exactly -pounds := pound - -lb := pound // From the latin libra -lbs := pound -grain := 1/7000 pound // The grain is the same in all three - // weight systems. It was originally - // defined as the weight of a barley - // corn taken from the middle of the - // ear. -gr := grain -ounce := 1/16 pound -oz := ounce -dram := 1/16 ounce -drams := dram -dr := dram -hundredweight := 100 pounds // This is the USA hundredweight -cwt := hundredweight -shorthundredweight := hundredweight -ton := 2000 lb -shortton := ton -shortquarter := 1/4 shortton - - -// Troy Weight. In 1828 the troy pound was made the first United States -// standard weight. It was to be used to regulate coinage. - -troypound := 5760 grain -troyounce := 1/12 troypound -ozt := troyounce -pennyweight := 1/20 troyounce // Abbreviated "d" in reference to a -dwt := pennyweight // Frankish coin called the "denier" - // minted in the late 700's. There - // were 240 deniers to the pound. -assayton := mg ton / troyounce // mg / assayton = troyounce / ton - -// Some other jewelers units - -metriccarat := 2/10 gram -metricgrain := 50 mg -carat := metriccarat -ct := carat -jewelerspoint := 1/100 carat -silversmithpoint := 1/4000 inch - - -// Apothecaries' weight - -appound := troypound -apounce := troyounce -apdram := 1/8 apounce -scruple := 1/3 apdram - -// Liquid measure - -gallon := 231 in^3 -gallons := gallon -gal := gallon -quart := 1/4 gallon -quarts := quart -qt := quart -pint := 1/2 qt -pints := pint -pt := pint -gill := 1/4 pint -gills := gill -fluidounce := 1/16 pint -fluidounces := fluidounce -floz := fluidounce -fluiddram := 1/8 floz -fluiddrams := fluiddram -fldr := fluiddram -minim := 1/60 fldr -liquidbarrel := 31.5 gallon -petroleumbarrel := 42 gallon // Originated in Pennsylvania oil - // fields, from the winetierce -barrel := petroleumbarrel -oilbarrel := petroleumbarrel -bbl := barrel -hogshead := 63 gallon -firkin := 9 gallon - -// Dry measures: The Winchester Bushel was defined by William III in 1702 and -// legally adopted in the US in 1836. - -drybarrel := 7056 in^3 -bushel := 2150.42 in^3 // Volume of 8 inch cylinder with 18.5 -bushels := bushel -bu := bushel // inch diameter (rounded) -peck := 1/4 bushel -pecks := peck -pk := peck -drygallon := 1/2 peck -dryquart := 1/4 drygallon -drypint := 1/2 dryquart - -// Grain measures. The bushel as it is used by farmers in the USA is actually -// a measure of mass which varies for different commodities. Canada uses the -// same bushel masses for most commodities, but not for oats. - -wheatbushel := 60 lb -soybeanbushel := 60 lb -cornbushel := 56 lb -ryebushel := 56 lb -barleybushel := 48 lb -oatbushel := 32 lb -ricebushel := 45 lb -canada_oatbushel := 34 lb - -// Wine and Spirits measure - -pony := 1 floz -jigger := 1.5 floz // Can vary between 1 and 2 floz -shot := jigger // Sometimes 1 floz -eushot := 20 ml // EU standard spirits measure - // See http://bundesrecht.juris.de/eo_1988/anhang_c_119.html -fifth := 1/5 gallon -winebottle := 750 ml // US industry standard, 1979 -winesplit := 1/4 winebottle -wineglass := 4 floz -magnum := 1.5 liter // Standardized in 1979, but given - // as 2 qt in some references -metrictenth := 375 ml -metricfifth := 750 ml -metricquart := 1 liter - -// French champagne bottle sizes - -split := 200 ml -jeroboam := 2 magnum -rehoboam := 3 magnum -methuselah := 4 magnum -salmanazar := 6 magnum -balthazar := 8 magnum -nebuchadnezzar := 10 magnum - -// Shoe measures - -shoeiron := 1/48 inch // Used to measure leather in soles -shoeounce := 1/64 inch // Used to measure non-sole shoe leather - -// -// USA slang units -// - -buck := dollar -fin := 5 dollar -sawbuck := 10 dollar -key := kg // usually of marijuana, 60's -lid := 1 oz // Another 60's weed unit -footballfield := 100 yards -marathon := 26 miles + 385 yards - -// -// British -// - -british :- 1200000/3937014 m/ft // The UK lengths were defined by - // a bronze bar manufactured in - // 1844. Measurement of that bar - // revealed the dimensions given - // here. - -// Old nautical definitions -// See: http://www.hemyockcastle.co.uk/nautical.htm -oldbrnauticalmile := 6080 ft // Used until 1970 when the UK -oldbrknot := oldbrnauticalmile / hr // switched to the international -oldbrcable := 1/10 oldbrnauticalmile // nautical mile. -geographicalmile := oldbrnauticalmile -admiraltymile := oldbrnauticalmile -admiraltyknot := oldbrknot -admiraltycable := oldbrcable -seamile := 6000 ft -cablet := 120 fathoms -hawserlaidcable := 130 fathoms - -oldrussiancable := 100 fathoms -oldhollandcable := 123 fathoms -oldportugalcable:= 141 fathoms - -// British Imperial weight is mostly the same as US weight. A few extra -// units are added here. - -clove := 7 lb -stone := 14 lb -brhundredweight := 8 stone -brquartermass := 1/4 brhundredweight -longhundredweight := brhundredweight -longton := 20 brhundredweight -brton := longton -brassayton := mg brton / troyounce - -// British Imperial volume measures - -brgallon := 454609/100000 l // The British Imperial gallon was -canadiangallon := brgallon // defined in 1824 to be the volume of -cangallon := brgallon // water which weighed 10 pounds at 62 - // deg F with a pressure of 30 inHg. - // In 1963 it was defined to be the space - // occupied by 10 pounds of distilled - // water of density 0.998859 g/ml weighed - // in air of density 0.001217 g/ml - // against weights of density 8.136 g/ml. - // The value given here is given by [1] - // as an exact value. -imperialgallon := brgallon -brquart := 1/4 brgallon -imperialquart := brquart -brpint := 1/2 brquart -imperialpint := brpint -brfloz := 1/20 brpint // Note difference in definition -imperialfloz := brfloz -brdram := 1/8 brfloz -imperialdram := brdram -brminim := 1/60 brdram -imperialminim := brminim -brscruple := 1/3 brdram -imperialscruple := brscruple -fluidscruple := brscruple -brfluidounce := brfloz -imperialfluidounce := brfloz -brgill := 1/4 brpint -imperialgill := brgill -brpeck := 2 brgallon -imperialpeck := brpeck -brbarrel := 36 brgallon // Used for beer -imperialbarrel := brbarrel -brbushel := 4 brpeck -imperialbushel := brbushel -brheapedbushel := 1.278 brbushel -brquarter := 8 brbushel -brchaldron := 36 brbushel - -// Obscure British volume measures. These units are generally traditional -// measures whose definitions have fluctuated over the years. Often they -// depended on the quantity being measured. They are given here in terms of -// British Imperial measures. For example, the puncheon may have historically -// been defined relative to the wine gallon or beer gallon or ale gallon -// rather than the British Imperial gallon. - -bag := 4 brbushel -bucket := 4 brgallon -last := 40 brbushel -noggin := brgill -pottle := 1/2 brgallon -pin := 4.5 brgallon -puncheon := 72 brgallon -seam := 8 brbushel -coomb := 4 brbushel -boll := 6 brbushel -firlot := 1/4 boll -brfirkin := 9 brgallon // Used for ale and beer -cran := 37.5 brgallon // measures herring, about 750 fish -barrelbulk := 5 feet^3 -brhogshead := 63 brgallon -registerton := 100 ft^3 // Used for internal capacity of ships -shippington := 40 ft^3 // Used for ship's cargo freight or timber -brshippington := 42 ft^3 // -freightton := shippington// Both register ton and shipping ton derive - // from the "tun cask" of wine. -displacementton := 35 ft^3 // Approximate volume of a longton weight of - // sea water used to measure ship displacement -waterton := 224 brgallon -strike := 70.5 l // 16th century unit, sometimes - // defined as .5, 2, or 4 bushels - // depending on the location. It - // probably doesn't make a lot of - // sense to define in terms of imperial - // bushels. Zupko gives a value of - // 2 Winchester grain bushels or about - // 70.5 liters. - -// obscure British lengths - -barleycorn := 1/3 britishinch // Given in Realm of Measure as the - // difference between successive shoe sizes -nail := 1/16 britishyard // Originally the width of the thumbnail, - // or 1/16 ft. This took on the general - // meaning of 1/16 and settled on the - // nail of a yard or 1/16 yards as its - // final value. [12] -pole := 16.5 britishft -rope := 20 britishft -englishell := 45 britishinch -flemishell := 27 britishinch -ell := englishell // supposed to be measure from elbow to - // fingertips -span := 9 britishinch // supposed to be distance from thumb - // to pinky with full hand extension -goad := 4.5 britishft // used for cloth - -// misc obscure British units - -rood := 1/4 acre -englishcarat := 3.163 grain // Originally intended to be 4 grain - // but this value ended up being - // used in the London diamond market -mancus := 2 oz -mast := 2.5 lb -basebox := 31360 in^2 // Used in metal plating - -// alternate spellings - -metre := meter -gramme := gram -litre := liter -dioptre := diopter - -// -// Units derived the human body (may not be very accurate) -// - -geometricpace := 5 ft // distance between points where the same - // foot hits the ground -pace := 2.5 ft// distance between points where alternate - // feet touch the ground -USmilitarypace := 30 in // United States official military pace -USdoubletimepace := 36 in // United States official doubletime pace -fingerbreadth := 7/8 in// The finger is defined as either the width -fingerlength := 4.5 in// or length of the finger -finger := fingerbreadth -hand := 4 inch// width of hand -palmwidth := hand // The palm is a unit defined as either the width -palmlength := 8 in // or the length of the hand - -// -// Cooking measures -// - -// US measures - -cup := 8 floz -cups := cup -tablespoon := 1/16 cup -tablespoons := tablespoon -tbl := tablespoon -tbsp := tablespoon -Tbsp := tablespoon -Tsp := tablespoon -teaspoon := 1/3 tablespoon -tsp := teaspoon -metriccup := 250 ml - -// US can sizes. - -number1can := 10 floz -number2can := 19 floz -number2_5can := 3.5 cups -number3can := 4 cups -number5can := 7 cups -number10can := 105 floz - -// British measures - -brcup := 1/2 brpint -brteacup := 1/3 brpint -brtablespoon := 15 ml // Also 5/8 brfloz, approx 17.7 ml -brteaspoon := 1/3 brtablespoon // Also 1/4 brtablespoon -dessertspoon := 2 brteaspoon -brtsp := brteaspoon -brtbl := brtablespoon -dsp := dessertspoon - -// Australian - -australiatablespoon := 20 ml -austbl := australiatablespoon - -// Chinese -// Thai measurements are very similar so the name must be qualified -chinesecatty := 1/2 kg -oldchinesecatty := 4/3 lbs // Before metric conversion. -chinesetael := 1/16 oldchinesecatty -chinesemace := 1/10 chinesetael -oldchinesepicul := 100 oldchinesecatty -chinesepicul := 100 chinesecatty // Chinese usage - -// Thai weights -thaitical := 15 grams -thaibaht := thaitical // New name for thaitical, not to be confused with - // the Thai currency called "Thailand_baht". -thaisalung := 1/4 thaitical -thaifung := 1/2 thaisalung -thaisatang := 1/100 thaitical -thaisadtahng := thaisatang // Alternate transliteration -thaitamlung := 4 thaitical -thaicatty := 10 thaitamlung -thaichang := 2 thaicatty -thaihap := 50 thaichang -thaipicul := thaihap -thaikoyan := 20 thaipicul - - -// Japanese - -japancup := 200 ml - -jo := 71 inches * 35.5 inches // The area of a standard tatami mat. -tatamimat := jo - -tsubo := 2 jo // Used in agriculture - -// densities of cooking ingredients from The Cake Bible by Rose Levy Beranbaum -// so you can convert '2 cups sugar' to grams, for example, or in the other -// direction grams could be converted to 'cup flour_scooped'. - -butter := 8. oz/cup -butter_clarified := 6.8 oz/cup -cocoa_butter := 9. oz/cup -shortening := 6.75 oz/cup // vegetable shortening -stickbutter := 1/4 lb -vegetable_oil := 7.5 oz/cup -cakeflour_sifted := 3.5 oz/cup // The density of flour depends on the -cakeflour_spooned := 4. oz/cup // measuring method. "Scooped", or -cakeflour_scooped := 4.5 oz/cup // "dip and sweep" refers to dipping a -flour_sifted := 4. oz/cup // measure into a bin, and then sweeping -flour_spooned := 4.25 oz/cup // the excess off the top. "Spooned" -flour_scooped := 5. oz/cup // means to lightly spoon into a measure -breadflour_sifted := 4.25 oz/cup // and then sweep the top. Sifted means -breadflour_spooned := 4.5 oz/cup // sifting the flour directly into a -breadflour_scooped := 5.5 oz/cup // measure and then sweeping the top. -cornstarch := 120. grams/cup -dutchcocoa_sifted := 75. g/cup // These are for Dutch processed cocoa -dutchcocoa_spooned := 92. g/cup -dutchcocoa_scooped := 95. g/cup -cocoa_sifted := 75. g/cup // These are for nonalkalized cocoa -cocoa_spooned := 82. g/cup -cocoa_scooped := 95. g/cup -heavycream := 232. g/cup -milk := 242. g/cup -sourcream := 242. g/cup -molasses := 11.25 oz/cup -cornsyrup := 11.5 oz/cup -honey := 11.75 oz/cup -sugar := 200. g/cup -powdered_sugar := 4. oz/cup -brownsugar_light := 217. g/cup // packed -brownsugar_dark := 239. g/cup - -baking_powder := 4.6 grams / tsp -salt := 6 g / tsp -koshersalt := 2.8 g / tsp // Diamond Crystal salt, from package - // Note that Morton kosher salt is - // much denser. - -ethanol := .7893 g/cm^3 // Density of ethanol -alcohol := ethanol // For now, density of ethanol -methanol := .79130 g/cm^3 // Density of methanol - -// Egg weights and volumes for a USA large egg - -egg := 50. grams -eggwhite := 30. grams -eggyolk := 18.6 grams -eggvolume := 3. tablespoons + 1/2 tsp -eggwhitevolume := 2. tablespoons -eggyolkvolume := 3.5 tsp - - -// -// Units derived from imperial system -// - -ouncedal := oz ft / s^2 // force which accelerates an ounce - // at 1 ft/s^2 -poundal := lb ft / s^2 // same thing for a pound -tondal := ton ft / s^2 // and for a ton -pdl := poundal -psi := pound force / inch^2 -psia := psi // absolute pressure -tsi := ton force / inch^2 -reyn := psi sec -lbf := lb force -slug := lbf s^2 / ft -slugf := slug force -slinch := lbf s^2 / inch // Mass unit derived from inch second -slinchf := slinch force // pound-force system. Used in space - // applications where in/sec^2 was a - // natural acceleration measure. -geepound := slug -tonf := ton force -lbm := lb -kip := 1000 lbf // from kilopound -mil := 1/1000 inch -thou := 1/1000 inch -circularinch := 1/4 pi in^2 // area of a one-inch diameter circle -circularmil := 1/4 pi mil^2// area of one-mil diameter circle -cmil := circularmil -cental := 100 pound -centner := cental -caliber := 1/100 inch // for measuring bullets -duty := ft lbf -celo := ft / s^2 -jerk := ft / s^3 -australiapoint := 1/100 inch // The "point" is used to measure rainfall - // in Australia -sabin := ft^2 // Measure of sound absorption equal to the - // absorbing power of one square foot of - // a perfectly absorbing material. The - // sound absorptivity of an object is the - // area times a dimensionless - // absorptivity coefficient. -standardgauge := 4 ft + 8.5 in // Standard width between railroad track -flag := 5 ft^2 // Construction term referring to sidewalk. -rollwallpaper := 30 ft^2 // Area of roll of wall paper -fillpower := in^3 / ounce // Density of down at standard pressure. - // The best down has 750-800 fillpower. -pinlength := 1/16 inch // A//17 pin is 17/16 in long in the USA. -buttonline := 1/40 inch // The line was used in 19th century USA - // to measure width of buttons. -scoopnumber := quart^-1 // Ice cream scoops are labeled with a - // number specifying how many scoops - // fill a quart. -// -// Other units of work, energy, power, etc -// - - -// Btu definitions: energy to raise a pound of water 1 degF -// "Btu" is the correct capitalization. -Btu := cal lb degrankine / (gram K)// international table BTU -btu := Btu -BTU := btu -britishthermalunit := Btu -Btu_IT := Btu -btu_IT := Btu_IT -Btu_th := cal_th lb degrankine / (gram K) -btu_th := Btu_th -Btu_mean := cal_mean lb degrankine / (gram K) -btu_mean := Btu_mean -quad := quadrillion Btu - -ECtherm := 105506000 J // Exact definition, close to 1e5 Btu -UStherm := 105480400 J // Exact definition -therm := UStherm - -// The horsepower is supposedly the power of one horse pulling. Obviously -// different people had different horses. - -horsepower := 550 foot pound force / sec // Invented by James Watt -hp := horsepower -metrichorsepower := 75 kilogram force meter / sec -electrichorsepower := 746 W -boilerhorsepower := 9809.50 W -waterhorsepower := 746.043 W -brhorsepower := 745.70 W -donkeypower := 250 W -Wh := watt hour - -// Thermal insulance and conductivity. - -Rvalue := degrankine ft^2 hr / Btu // r-value, U.S. insulation figure -Cvalue := 1/Rvalue // C-value U.S. insulation conductance rating -kvalue := Btu in / (ft^2 hr degF) // k-value, insulation conductance/in thick -Uvalue := 1/Rvalue -europeanUvalue := watt / (m^2 K) -RSI := K m^2 / W // SI insulation figure - -// The following definitions are per NIST Special Publication 811: -// http://physics.nist.gov/Pubs/SP811/appenB9.html -W / (m K) ||| thermal_conductivity -m^2 K / W ||| thermal_insulance -K / W ||| thermal_resistance -m K / W ||| thermal_resistivity - -// Term not defined by SI, somewhat questionable. Used in building trade. -W / (m^2 K) ||| thermal_conductance - -// Defined by the BIPM, -// http://www.bipm.org/pdf/si-brochure.pdf -J/kg ||| specific_energy -W/m^2 ||| heat_flux_density -J/mol ||| molar_energy -J/(mol K) ||| molar_heat_capacity - - -// kvalue is defined as the amount of -// heat that will be transmitted through a one inch thick piece of -// homogenous material, one square foot in size, in one hour, when -// there is a one degree Fahrenheit temperature difference. -// -// Cvalue is the kvalue multiplied by the thickness in inches and thus -// gives the thermal conductance of a real piece of material with a given -// thickness. -// Rvalue is the reciprocal of this, and refers to the thermal insulance of a -// real piece of material of a given, concrete thickness. - -clo := 0.155 K m^2 / W// Supposed to be the insulance - // required to keep a resting person - // comfortable indoors. The value - // given is from NIST and the CRC, - // but [5] gives a slightly different - // value of 0.875 ft^2 degF hr / Btu. -// Misc other measures - -clausius := 1ee3 cal/K // A unit of physical entropy -langley := thermcalorie/cm^2 -poncelet := 100 kg force m / s -tonrefrigeration := ton 144 Btu / (lb day)// One ton refrigeration is - // the rate of heat extraction required - // turn one ton of water to ice in - // a day. Ice is defined to have a - // latent heat of 144 Btu/lb. - -tonsrefrigeration := tonrefrigeration // Irregular plural -tonref := tonrefrigeration -refrigeration := tonref / ton -frigorie := 1000 cal_fifteen// Used in refrigeration engineering. - - -// Energy in combustible fuels - -TNT := 4184000000 J/ton // So you can write tons TNT, this - // is a defined, not measured, value -PETN := 6.01e6 J/kg // An explosive compound, - // Pentaerythrite tetranitrate - // used in plastic explosive like Semtex -gasoline := 1.4e8 J/gallon // So you can convert energy - // to gallons gasoline -gasoline_density := 0.694 g / cm^3 //Density at 300K, according to, http://wiki.answers.com/Q/How_does_temperature_affect_the_density_of_gasoline_or_petrol -natural_gas := 1.09e6 J/foot^3 // Energy in natural gas -naturalgas := natural_gas -propane := 9.63e7 J/gallon // Energy in liquid propane -kerosene := 1.42e8 J/gallon // Energy in liquid kerosene -oil := 41.868 GJ/metricton -coal := 18.20 GJ/metricton - -// -// Permeability: The permeability or permeance, n, of a substance determines -// how fast vapor flows through the substance. The formula W = n A dP -// holds where W is the rate of flow (in mass/time), n is the permeability, -// A is the area of the flow path, and dP is the vapor pressure difference. -// -// Alan's Veto: These are damned, damned sketchy, and are going to go. - -// perm_0C := grain / (hr ft^2 inHg) -// perm_zero := perm_0C -// perm_0 := perm_0C -// perm := perm_0C -//perm_23C := grain / (hr ft^2 in-Hg23C) -//perm_twentythree := perm_23C - -// -// Counting measures -// - -unity := 1 -pair := 2 -couple := 2 -brace := 2 -nest := 3 -dickers := 10 -dozen := 12 -bakersdozen := 13 -score := 20 -flock := 40 -timer := 40 -shock := 60 -gross := 144 -greatgross := 12 gross - -// Paper counting measure - -shortquire := 24 -quire := 25 -shortream := 480 -ream := 500 -reams := ream -perfectream := 516 -bundle := 2 reams -bale := 5 bundle - -// -// Paper measures -// - -// USA paper sizes - -lettersize := 8.5 inch 11 inch -legalsize := 8.5 inch 14 inch -ledgersize := 11 inch 17 inch -executivesize := 7.25 inch 10.5 inch -Apaper := 8.5 inch 11 inch -Bpaper := 11 inch 17 inch -Cpaper := 17 inch 22 inch -Dpaper := 22 inch 34 inch -Epaper := 34 inch 44 inch - -// The metric paper sizes are defined so that if a sheet is cut in half -// along the short direction, the result is two sheets which are -// similar to the original sheet. This means that for any metric size, -// the long side is close to sqrt(2) times the length of the short -// side. Each series of sizes is generated by repeated cuts in half, -// with the values rounded down to the nearest millimeter. - -A0paper := 841 mm 1189 mm // The basic size in the A series -A1paper := 594 mm 841 mm // is defined to have an area of -A2paper := 420 mm 594 mm // one square meter. -A3paper := 297 mm 420 mm -A4paper := 210 mm 297 mm -A5paper := 148 mm 210 mm -A6paper := 105 mm 148 mm -A7paper := 74 mm 105 mm -A8paper := 52 mm 74 mm -A9paper := 37 mm 52 mm -A10paper := 26 mm 37 mm - -B0paper := 1000 mm 1414 mm // The basic B size has an area -B1paper := 707 mm 1000 mm // of sqrt(2) square meters. -B2paper := 500 mm 707 mm -B3paper := 353 mm 500 mm -B4paper := 250 mm 353 mm -B5paper := 176 mm 250 mm -B6paper := 125 mm 176 mm -B7paper := 88 mm 125 mm -B8paper := 62 mm 88 mm -B9paper := 44 mm 62 mm -B10paper := 31 mm 44 mm - -C0paper := 917 mm 1297 mm // The basic C size has an area -C1paper := 648 mm 917 mm // of sqrt(sqrt(2)) square meters. -C2paper := 458 mm 648 mm -C3paper := 324 mm 458 mm // Intended for envelope sizes -C4paper := 229 mm 324 mm -C5paper := 162 mm 229 mm -C6paper := 114 mm 162 mm -C7paper := 81 mm 114 mm -C8paper := 57 mm 81 mm -C9paper := 40 mm 57 mm -C10paper := 28 mm 40 mm - -// gsm (Grams per Square Meter), a sane, metric paper weight measure - -gsm := grams / meter^2 - -// In the USA, a collection of crazy historical paper measures are used. Paper -// is measured as a weight of a ream of that particular type of paper. This is -// sometimes called the "substance" or "basis" (as in "substance 20" paper). -// The standard sheet size or "basis size" varies depending on the type of -// paper. As a result, 20 pound bond paper and 50 pound text paper are actually -// about the same weight. The different sheet sizes were historically the most -// convenient for printing or folding in the different applications. These -// different basis weights are standards maintained by American Society for -// Testing Materials (ASTM) and the American Forest and Paper Association -// (AF&PA). - -poundbookpaper := lb / 25 inch 38 inch ream -lbbook := poundbookpaper -poundtextpaper := poundbookpaper -lbtext := poundtextpaper -poundoffsetpaper := poundbookpaper // For offset printing -lboffset := poundoffsetpaper -poundbiblepaper := poundbookpaper // Designed to be lightweight, thin, -lbbible := poundbiblepaper // strong and opaque. -poundtagpaper := lb / 24 inch 36 inch ream -lbtag := poundtagpaper -poundbagpaper := poundtagpaper -lbbag := poundbagpaper -poundnewsprintpaper := poundtagpaper -lbnewsprint := poundnewsprintpaper -poundposterpaper := poundtagpaper -lbposter := poundposterpaper -poundtissuepaper := poundtagpaper -lbtissue := poundtissuepaper -poundwrappingpaper := poundtagpaper -lbwrapping := poundwrappingpaper -poundwaxingpaper := poundtagpaper -lbwaxing := poundwaxingpaper -poundglassinepaper := poundtagpaper -lbglassine := poundglassinepaper -poundcoverpaper := lb / 20 inch 26 inch ream -lbcover := poundcoverpaper -poundindexpaper := lb / 25.5 inch 30.5 inch ream -lbindex := poundindexpaper -poundindexbristolpaper := poundindexpaper -lbindexbristol := poundindexpaper -poundbondpaper := lb / 17 inch 22 inch ream // Bond paper is stiff and -lbbond := poundbondpaper // durable for repeated -poundwritingpaper := poundbondpaper // filing, and it resists -lbwriting := poundwritingpaper // ink penetration. -poundledgerpaper := poundbondpaper -lbledger := poundledgerpaper -poundcopypaper := poundbondpaper -lbcopy := poundcopypaper -poundblottingpaper := lb / 19 inch 24 inch ream -lbblotting := poundblottingpaper -poundblankspaper := lb / 22 inch 28 inch ream -lbblanks := poundblankspaper -poundpostcardpaper := lb / 22.5 inch 28.5 inch ream -lbpostcard := poundpostcardpaper -poundweddingbristol := poundpostcardpaper -lbweddingbristol := poundweddingbristol -poundbristolpaper := poundweddingbristol -lbbristol := poundbristolpaper -poundboxboard := lb / (1000 ft^2) -lbboxboard := poundboxboard -poundpaperboard := poundboxboard -lbpaperboard := poundpaperboard - -// When paper is marked in units of M, it means the weight of 1000 sheets of the -// given size of paper. To convert this to paper weight, divide by the size of -// the paper in question. - -paperM := lb / 1000 - -// -// Old French distance measures, from French Weights and Measures -// Before the Revolution by Zupko -// - -frenchfoot := 4500/13853 m // pied de roi, the standard of Paris. -pied := frenchfoot // Half of the hashimicubit, -frenchfeet := frenchfoot // instituted by Charlemagne. -frenchinch := 1/12 frenchfoot // This exact definition comes from -frenchthumb := frenchinch // a law passed on 10 Dec 1799 which -pouce := frenchthumb // fixed the meter at - // 3 frenchfeet + 11.296 lignes. -frenchline := 1/12 frenchinch // This is supposed to be the size -ligne := frenchline // of the average barleycorn -frenchpoint := 1/12 frenchline -toise := 6 frenchfeet -arpent := 180^2 pied^2 // The arpent is 100 square perches, - // but the perche seems to vary a lot - // and can be 18 feet, 20 feet, or 22 - // feet. This measure was described - // as being in common use in Canada in - // 1934 (Websters 2nd). The value - // given here is the Paris standard - // arpent. - -// -// Printing -// - -fournierpoint := 0.1648 inch / 12 // First definition of the printers - // point made by Pierre Fournier who - // defined it in 1737 as 1/12 of a - // cicero which was 0.1648 inches. -olddidotpoint := 1/72 frenchinch // Fran¿ois Ambroise Didot, one of - // a family of printers, changed - // Fournier's definition around 1770 - // to fit to the French units then in - // use. -bertholdpoint := 1/2660 m // H. Berthold tried to create a - // metric version of the didot point - // in 1878. -INpoint := 0.4 mm // This point was created by a - // group directed by Fermin Didot in - // 1881 and is associated with the - // imprimerie nationale. It doesn't - // seem to have been used much. -germandidotpoint := 0.376065 mm // Exact definition appears in DIN - // 16507, a German standards document - // of 1954. Adopted more broadly in - // 1966 by ??? -metricpoint := 3/8 mm // Proposed in 1977 by Eurograf - -point := 13837/1000000 inch // exact, NIST Handbook 44, Appendix 3 -printerspoint := point - -texscaledpoint := 1/65536 point // The TeX typesetting system uses -texsp := texscaledpoint // this for all computations. -computerpoint := 1/72 inch // The American point was rounded -computerpica := 12 computerpoint // to an even 1/72 inch by computer -postscriptpoint := computerpoint // people at some point. -pspoint := postscriptpoint -Q := 1/4 mm // Used in Japanese phototypesetting - // Q is for quarter -frenchprinterspoint := olddidotpoint -didotpoint := germandidotpoint // This seems to be the dominant value -europeanpoint := didotpoint // for the point used in Europe -cicero := 12 didotpoint - -stick := 2 inches - -// Type sizes - -excelsior := 3 point -brilliant := 3.5 point -diamond := 4 point -pearl := 5 point -agate := 5.5 point -ruby := agate // British -nonpareil := 6 point -mignonette := 6.5 point -emerald := mignonette// British -minion := 7 point -brevier := 8 point -bourgeois := 9 point -longprimer := 10 point -smallpica := 11 point -pica := 12 point -english := 14 point -columbian := 16 point -greatprimer := 18 point -paragon := 20 point -meridian := 44 point -canon := 48 point - -// German type sizes -nonplusultra := 2 didotpoint -brillant := 3 didotpoint -diamant := 4 didotpoint -perl := 5 didotpoint -nonpareille := 6 didotpoint -kolonel := 7 didotpoint -petit := 8 didotpoint -borgis := 9 didotpoint -korpus := 10 didotpoint -corpus := korpus -garamond := korpus -mittel := 14 didotpoint -tertia := 16 didotpoint -text := 18 didotpoint -kleine_kanon := 32 didotpoint -kanon := 36 didotpoint -grosse_kanon := 42 didotpoint -missal := 48 didotpoint -kleine_sabon := 72 didotpoint -grosse_sabon := 84 didotpoint - -// -// Information theory units -// - -nat := 0.69314718056 bits // Entropy measured base e -hartley := 3.32192809488 bits // log2(10) bits, or the entropy - // of a uniformly distributed - // random variable over 10 - // symbols. -// -// Computer -// - -bps := bit/sec // Sometimes the term "baud" is - // incorrectly used to refer to - // bits per second. Baud refers - // to symbols per second. Modern - // modems transmit several bits - // per symbol. -byte := 8 bit // Not all machines had 8 bit - // bytes, but these days most of - // them do. But beware: for - // transmission over modems, a - // few extra bits are used so - // there are actually 10 bits per - // byte. -nybble := 4 bits // Half of a byte. Sometimes - // equal to different lengths - // such as 3 bits. -nibble := nybble - -// In computers, "kilo" tends to mean a multiple of 1024 or 2^10. -// This obviously interferes with the standard meanings. -// -// In December 1998 the International Electrotechnical Commission (IEC), the -// leading international organization for worldwide standardization in -// electrotechnology, approved as an IEC International Standard names and -// symbols for prefixes for binary multiples for use in the fields of data -// processing and data transmission. One would say "kibibit" to mean 1024 bits -// -// http://physics.nist.gov/cuu/Units/binary.html - -// Prefixes -kibi ::- 2^10 // kilobinary -mebi ::- 2^20 // megabinary -gibi ::- 2^30 // gigabinary -tebi ::- 2^40 // terabinary -pebi ::- 2^50 // petabinary -exbi ::- 2^60 // exabinary - -// Official symbols -Ki :- kibi -Mi :- mebi -Gi :- gibi -Ti :- tebi -Pi :- pebi -Ei :- exbi - -jiffy := 1/100 sec // This is defined in the Jargon File -jiffies := jiffy // (http://www.jargon.org) as being the - // duration of a clock tick for measuring - // wall-clock time. Supposedly the value - // used to be 1/60 sec or 1/50 sec - // depending on the frequency of AC power, - // but then 1/100 sec became more common. - // On linux systems, this term is used and - // for the Intel based chips, it does have - // the value of .01 sec. The Jargon File - // also lists two other definitions: - // millisecond, and the time taken for - // light to travel one foot. -// -// yarn and cloth measures -// - -// yarn linear density - -m kg^-1 ||| reciprocal_linear_mass_density - -woolyarnrun := 1600 yard/pound// 1600 yds of "number 1 yarn" weighs - // a pound. -yarncut := 300 yard/pound // Less common system used in - // Pennsylvania for wool yarn -cottonyarncount := 840 yard/pound -linenyarncount := 300 yard/pound // Also used for hemp and ramie -worstedyarncount := 1680 ft/pound -metricyarncount := meter/gram -kg/m ||| linear_mass_density -tex := gram / km // rational metric yarn measure, meant -denier := 1/9 tex // used for silk and rayon -manchesteryarnnumber := drams/(1000 yards)// old system used for silk -pli := lb/in -typp := 1000 yd/lb -asbestoscut := 100 yd/lb // used for glass and asbestos yarn - -drex := 0.1 tex // to be used for any kind of yarn - - -// yarn and cloth length - -skeincotton := 80*54 inch // 80 turns of thread on a reel with a - // 54 in circumference (varies for other - // kinds of thread) -cottonbolt := 120 ft // cloth measurement -woolbolt := 210 ft -bolt := cottonbolt -heer := 600 yards -cut := 300 yards // used for wet-spun linen yarn -lea := 300 yards - -// -// drug dosage -// - -mcg := microgram // Frequently used for vitamins -iudiptheria := 62.8 microgram // IU is for international unit -iupenicillin := 0.6 microgram -iuinsulin := 41.67 microgram -drop := 1/20 ml // The drop was an old "unit" that was - // replaced by the minim. But I was - // told by a pharmacist that in his - // profession, the conversion of 20 - // drops per ml is actually used. -bloodunit := 450 ml // For whole blood. For blood - // components, a blood unit is the - // quanity of the component found in a - // blood unit of whole blood. The - // human body contains about 12 blood - // units of whole blood. - -// -// fixup units for times when prefix handling doesn't do the job -// - -hectare := hectoare -ha := hectare -megohm := megaohm -kilohm := kiloohm -microhm := microohm - -cent := 1/100 dollar - -// British currency -// -// These have been supplanted by the PoundSource definitions which include -// historical exchange rates for years back to 1600. -// -//shilling := 1/20 britainpound // Before decimalisation, there -//oldpence := 1/12 shilling // were 20 shillings to a pound, - // each of twelve old pence -//quid := britainpound // Slang names -//fiver := 5 quid -//tenner := 10 quid - -// -// Units used for measuring volume of wood -// - -cord := 4 ft * 4 ft * 8 ft// 4 ft by 4 ft by 8 ft bundle of wood -facecord := 1/2 cord -cordfoot := 1/8 cord // One foot long section of a cord -cordfeet := cordfoot -rick := 4 ft 8 ft 16 inches // Stack of firewood - -housecord := 1/3 cord // Used to sell firewood for residences, - // often confusingly called a "cord" -boardfoot := ft^2 inch // Usually 1 inch thick wood -boardfeet := boardfoot -fbm := boardfoot // feet board measure -stere := m^3 -st := stere -timberfoot := ft^3 // Used for measuring solid blocks of wood -standard := 120 12 ft 11 in 1.5 in // This is the St Petersburg or - // Pittsburg standard. Apparently the - // term is short for "standard hundred" - // which was meant to refer to 100 pieces - // of wood (deals). However, this - // particular standard is equal to 120 - // deals which are 12 ft by 11 in by 1.5 - // inches (not the standard deal). - -// In Britain, the deal is apparently any piece of wood over 6 feet long, over -// 7 wide and 2.5 inches thick. The OED doesn't give a standard size. A piece -// of wood less than 7 inches wide is called a "batten". This unit is now used -// exclusively for fir and pine. - -deal := 12 ft 11 in 2.5 in // The standard North American deal [OED] -wholedeal := 1/2 deal // If it's half as thick as the standard - // deal it's called a "whole deal"! -splitdeal := 1/2 wholedeal // And half again as thick is a split deal. - - -// -// Gas and Liquid flow units -// - -// Some horribly-named flow units that I've never seen used other than once -// (unexplained) in the Guinness Book of World Records which has degraded into -// tabloid trash. -cumec := m^3/s -cusec := ft^3/s - -// Conventional abbreviations for fluid flow units - -gph := gal/hr -gpm := gal/min -mgd := megagal/day -cf := ft^3 -ccf := 100 cf // sorta dubious, but used. -cfs := cf/s -cfh := cf/hour -cfm := cf/min -lpm := liter/min - -// Miner's inch: This is an old historic unit used in the Western United -// States. It is generally defined as the rate of flow through a one square -// inch hole at a specified depth such as 4 inches. In the late 19th century, -// volume of water was sometimes measured in the "24 hour inch". Values for the -// miner's inch were fixed by state statues. (This information is from a web -// site operated by the Nevada Division of Water Planning: The Water Words -// Dictionary at http://www.state.nv.us/cnr/ndwp/dict-1/waterwds.htm.) - -minersinchAZ := 1.5 ft^3/min -minersinchCA := 1.5 ft^3/min -minersinchMT := 1.5 ft^3/min -minersinchNV := 1.5 ft^3/min -minersinchOR := 1.5 ft^3/min -minersinchID := 1.2 ft^3/min -minersinchKS := 1.2 ft^3/min -minersinchNE := 1.2 ft^3/min -minersinchNM := 1.2 ft^3/min -minersinchND := 1.2 ft^3/min -minersinchSD := 1.2 ft^3/min -minersinchUT := 1.2 ft^3/min -minersinchCO := 1.56 ft^3/min -minersinchBC := 1.68 ft^3/min // British Columbia - -// In vacuum science and some other applications, gas flow is measured -// as the product of volumetric flow and pressure. This is useful -// because it makes it easy to compare with the flow at standard -// pressure (one atmosphere). It also directly relates to the number -// of gas molecules per unit time, and hence to the mass flow if the -// molecular mass is known. - -sccm := atm cc/min // 's' is for "standard" to indicate -sccs := atm cc/sec // flow at standard pressure -scfh := atm ft^3/hour // -scfm := atm ft^3/min -slpm := atm liter/min -slph := atm liter/hour -lusec := liter micron Hg force / s // Used in vacuum science - -// Wire gauge: this area is a nightmare with huge charts of wire gauge -// diameters that usually have no clear origin. There are at least 5 competing -// wire gauge systems to add to the confusion. - -// The use of wire gauge is related to the manufacturing method: a metal rod is -// heated and drawn through a hole. The size change can't be too big. To get -// smaller wires, the process is repeated with a series of smaller holes. - -// American Wire Gauge (AWG) or Brown & Sharpe Gauge appears to be the most -// important gauge. ASTM B-258 specifies that this gauge is based on geometric -// interpolation between gauge 0000, which is 0.46 inches exactly, and gauge 36 -// which is 0.005 inches exactly. Therefore, the diameter in inches of a wire -// is given by the formula 1/200 92^((36-g)/39). Note that 92^(1/39) is close -// to 2^(1/6), so diameter is approximately halved for every 6 gauges. For the -// repeated zero values, use negative numbers in the formula. The same document -// also specifies rounding rules which seem to be ignored by makers of tables. -// Gauges up to 44 are to be specified with up to 4 significant figures, but no -// closer than 0.0001 inch. Gauges from 44 to 56 are to be rounded to the -// nearest 0.00001 inch. The table below gives 4 significant figures for all -// gauges. -// -// In addition to being used to measure wire thickness, this gauge is used to -// measure the thickness of sheets of aluminum, copper, and most metals other -// than steel, iron and zinc. - -// The numbers below are DIAMETERS. -wire0000gauge := 0.4600 in -wire000gauge := 0.4096 in -wire00gauge := 0.3648 in -wire0gauge := 0.3249 in -wire1gauge := 0.2893 in -wire2gauge := 0.2576 in -wire3gauge := 0.2294 in -wire4gauge := 0.2043 in -wire5gauge := 0.1819 in -wire6gauge := 0.1620 in -wire7gauge := 0.1443 in -wire8gauge := 0.1285 in -wire9gauge := 0.1144 in -wire10gauge := 0.1019 in -wire11gauge := 0.09074 in -wire12gauge := 0.08081 in -wire13gauge := 0.07196 in -wire14gauge := 0.06408 in -wire15gauge := 0.05707 in -wire16gauge := 0.05082 in -wire17gauge := 0.04526 in -wire18gauge := 0.04030 in -wire19gauge := 0.03589 in -wire20gauge := 0.03196 in -wire21gauge := 0.02846 in -wire22gauge := 0.02535 in -wire23gauge := 0.02257 in -wire24gauge := 0.02010 in -wire25gauge := 0.01790 in -wire26gauge := 0.01594 in -wire27gauge := 0.01420 in -wire28gauge := 0.01264 in -wire29gauge := 0.01126 in -wire30gauge := 0.01003 in -wire31gauge := 0.008928 in -wire32gauge := 0.007950 in -wire33gauge := 0.007080 in -wire34gauge := 0.006305 in -wire35gauge := 0.005615 in -wire36gauge := 0.005000 in -wire37gauge := 0.004453 in -wire38gauge := 0.003965 in -wire39gauge := 0.003531 in -wire40gauge := 0.003145 in -wire41gauge := 0.002800 in -wire42gauge := 0.002494 in -wire43gauge := 0.002221 in -wire44gauge := 0.001978 in -wire45gauge := 0.001761 in -wire46gauge := 0.001568 in -wire47gauge := 0.001397 in -wire48gauge := 0.001244 in -wire49gauge := 0.001108 in -wire50gauge := 0.0009863 in -wire51gauge := 0.0008783 in -wire52gauge := 0.0007822 in -wire53gauge := 0.0006966 in -wire54gauge := 0.0006203 in -wire55gauge := 0.0005524 in -wire56gauge := 0.0004919 in - -// Next we have the SWG, the Imperial or British Standard Wire Gauge. This one -// is piecewise linear, so it is not generated by a simple formula. It was used -// for aluminum sheets. - -brwire0000000gauge := 0.500 in -brwire000000gauge := 0.464 in -brwire00000gauge := 0.432 in -brwire0000gauge := 0.400 in -brwire000gauge := 0.372 in -brwire00gauge := 0.348 in -brwire0gauge := 0.324 in -brwire1gauge := 0.300 in -brwire2gauge := 0.276 in -brwire3gauge := 0.252 in -brwire4gauge := 0.232 in -brwire5gauge := 0.212 in -brwire6gauge := 0.192 in -brwire7gauge := 0.176 in -brwire8gauge := 0.160 in -brwire9gauge := 0.144 in -brwire10gauge := 0.128 in -brwire11gauge := 0.116 in -brwire12gauge := 0.104 in -brwire13gauge := 0.092 in -brwire14gauge := 0.080 in -brwire15gauge := 0.072 in -brwire16gauge := 0.064 in -brwire17gauge := 0.056 in -brwire18gauge := 0.048 in -brwire19gauge := 0.040 in -brwire20gauge := 0.036 in -brwire21gauge := 0.032 in -brwire22gauge := 0.028 in -brwire23gauge := 0.024 in -brwire24gauge := 0.022 in -brwire25gauge := 0.0200 in -brwire26gauge := 0.0180 in -brwire27gauge := 0.0164 in -brwire28gauge := 0.0149 in -brwire29gauge := 0.0136 in -brwire30gauge := 0.0124 in -brwire31gauge := 0.0116 in -brwire32gauge := 0.0108 in -brwire33gauge := 0.0100 in -brwire34gauge := 0.0092 in -brwire35gauge := 0.0084 in -brwire36gauge := 0.0076 in -brwire37gauge := 0.0068 in -brwire38gauge := 0.0060 in -brwire39gauge := 0.0052 in -brwire40gauge := 0.0048 in -brwire41gauge := 0.0044 in -brwire42gauge := 0.0040 in -brwire43gauge := 0.0036 in -brwire44gauge := 0.0032 in -brwire45gauge := 0.0028 in -brwire46gauge := 0.0024 in -brwire47gauge := 0.0020 in -brwire48gauge := 0.0016 in -brwire49gauge := 0.0012 in -brwire50gauge := 0.0010 in - -// The following is from the Appendix to ASTM B 258 -// -// For example, in U.S. gage, the standard for sheet metal is based on the -// weight of the metal, not on the thickness. 16-gage is listed as approximately -// .0625 inch thick and 40 ounces per square foot (the original standard was -// based on wrought iron at .2778 pounds per cubic inch; steel has almost -// entirely superseded wrought iron for sheet use, at .2833 pounds per cubic -// inch). Smaller numbers refer to greater thickness. There is no formula for -// converting gage to thickness or weight. -// -// It's rather unclear from the passage above whether the plate gauge values are -// therefore wrong if steel is being used. Reference [15] states that steel is -// in fact measured using this gauge (under the name Manufacturers' Standard -// Gauge) with a density of 501.84 lb/ft3 = 0.2904 lb/in3 used for steel. -// But this doesn't seem to be the correct density of steel (.2833 lb/in3 is -// closer), and nobody else lists these values. -// -// This gauge was established in 1893 for purposes of taxation. - -plate000000gauge := 15/32 in // 300 oz / ft^2 -plate00000gauge := 14/32 in // 280 oz / ft^2 -plate0000gauge := 13/32 in // 260 oz / ft^2 -plate000gauge := 12/32 in // 240 oz / ft^2 -plate00gauge := 11/32 in // 220 oz / ft^2 -plate0gauge := 10/32 in // 200 oz / ft^2 -plate1gauge := 9/32 in // 180 oz / ft^2 -plate2gauge := 17/64 in // 170 oz / ft^2 -plate3gauge := 16/64 in // 160 oz / ft^2 -plate4gauge := 15/64 in // 150 oz / ft^2 -plate5gauge := 14/64 in // 140 oz / ft^2 -plate6gauge := 13/64 in // 130 oz / ft^2 -plate7gauge := 12/64 in // 120 oz / ft^2 -plate8gauge := 11/64 in // 110 oz / ft^2 -plate9gauge := 10/64 in // 100 oz / ft^2 -plate10gauge := 9/64 in // 90 oz / ft^2 -plate11gauge := 8/64 in // 80 oz / ft^2 -plate12gauge := 7/64 in // 70 oz / ft^2 -plate13gauge := 6/64 in // 60 oz / ft^2 -plate14gauge := 5/64 in // 50 oz / ft^2 -plate15gauge := 9/128 in // 45 oz / ft^2 -plate16gauge := 8/128 in // 40 oz / ft^2 -plate17gauge := 9/160 in // 36 oz / ft^2 -plate18gauge := 8/160 in // 32 oz / ft^2 -plate19gauge := 7/160 in // 28 oz / ft^2 -plate20gauge := 6/160 in // 24 oz / ft^2 -plate21gauge := 11/320 in // 22 oz / ft^2 -plate22gauge := 10/320 in // 20 oz / ft^2 -plate23gauge := 9/320 in // 18 oz / ft^2 -plate24gauge := 8/320 in // 16 oz / ft^2 -plate25gauge := 7/320 in // 14 oz / ft^2 -plate26gauge := 6/320 in // 12 oz / ft^2 -plate27gauge := 11/640 in // 11 oz / ft^2 -plate28gauge := 10/640 in // 10 oz / ft^2 -plate29gauge := 9/640 in // 9 oz / ft^2 -plate30gauge := 8/640 in // 8 oz / ft^2 -plate31gauge := 7/640 in // 7 oz / ft^2 -plate32gauge := 13/1280 in // 6.5 oz / ft^2 -plate33gauge := 12/1280 in // 6 oz / ft^2 -plate34gauge := 11/1280 in // 5.5 oz / ft^2 -plate35gauge := 10/1280 in // 5 oz / ft^2 -plate36gauge := 9/1280 in // 4.5 oz / ft^2 -plate37gauge := 17/2560 in // 4.25 oz / ft^2 -plate38gauge := 16/2560 in // 4 oz / ft^2 - -// Zinc sheet metal gauge - -zinc1gauge := 0.002 in -zinc2gauge := 0.004 in -zinc3gauge := 0.006 in -zinc4gauge := 0.008 in -zinc5gauge := 0.010 in -zinc6gauge := 0.012 in -zinc7gauge := 0.014 in -zinc8gauge := 0.016 in -zinc9gauge := 0.018 in -zinc10gauge := 0.020 in -zinc11gauge := 0.024 in -zinc12gauge := 0.028 in -zinc13gauge := 0.032 in -zinc14gauge := 0.036 in -zinc15gauge := 0.040 in -zinc16gauge := 0.045 in -zinc17gauge := 0.050 in -zinc18gauge := 0.055 in -zinc19gauge := 0.060 in -zinc20gauge := 0.070 in -zinc21gauge := 0.080 in -zinc22gauge := 0.090 in -zinc23gauge := 0.100 in -zinc24gauge := 0.125 in -zinc25gauge := 0.250 in -zinc26gauge := 0.375 in -zinc27gauge := 0.500 in -zinc28gauge := 1.000 in - -// USA ring sizes. Several slightly different definitions seem to be in -// circulation. According to [15], the interior diameter of size n ring in -// inches is 0.32 n + 0.458 for n ranging from 3 to 13.5 by steps of 0.5. The -// size 2 ring is inconsistently 0.538in and no 2.5 size is listed. -// -// However, other sources list 0.455 + 0.0326 n and 0.4525 + 0.0324 n as the -// diameter and list no special case for size 2. (Or alternatively they are -// 1.43 + .102 n and 1.4216+.1018 n for measuring circumference in inches.) One -// reference claimed that the original system was that each size was 1/10 inch -// circumference, but that source doesn't have an explanation for the modern -// system which is somewhat different. -// -// This table gives circumferences as listed in [15]. - -size2ring := 0.538 in pi -size3ring := 0.554 in pi -size3_5ring := 0.570 in pi -size4ring := 0.586 in pi -size4_5ring := 0.602 in pi -size5ring := 0.618 in pi -size5_5ring := 0.634 in pi -size6ring := 0.650 in pi -size6_5ring := 0.666 in pi -size7ring := 0.682 in pi -size7_5ring := 0.698 in pi -size8ring := 0.714 in pi -size8_5ring := 0.730 in pi -size9ring := 0.746 in pi -size9_5ring := 0.762 in pi -size10ring := 0.778 in pi -size10_5ring := 0.794 in pi -size11ring := 0.810 in pi -size11_5ring := 0.826 in pi -size12ring := 0.842 in pi -size12_5ring := 0.858 in pi -size13ring := 0.874 in pi -size13_5ring := 0.890 in pi - -// Old practice in the UK measured rings using the "Wheatsheaf gauge" with sizes -// specified alphabetically and based on the ring inside diameter in steps of -// 1/64 inch. This system was replaced in 1987 by British Standard 6820 which -// specifies sizes based on circumference. Each size is 1.25 mm different from -// the preceding size. The baseline is size C which is 40 mm circumference. -// The new sizes are close to the old ones. Sometimes it's necessary to go -// beyond size Z to Z+1, Z+2, etc. - -sizeAring := 37.50 mm -sizeBring := 38.75 mm -sizeCring := 40.00 mm -sizeDring := 41.25 mm -sizeEring := 42.50 mm -sizeFring := 43.75 mm -sizeGring := 45.00 mm -sizeHring := 46.25 mm -sizeIring := 47.50 mm -sizeJring := 48.75 mm -sizeKring := 50.00 mm -sizeLring := 51.25 mm -sizeMring := 52.50 mm -sizeNring := 53.75 mm -sizeOring := 55.00 mm -sizePring := 56.25 mm -sizeQring := 57.50 mm -sizeRring := 58.75 mm -sizeSring := 60.00 mm -sizeTring := 61.25 mm -sizeUring := 62.50 mm -sizeVring := 63.75 mm -sizeWring := 65.00 mm -sizeXring := 66.25 mm -sizeYring := 67.50 mm -sizeZring := 68.75 mm - -// Japanese sizes start with size 1 at a 13mm inside diameter and each size is -// 1/3 mm larger in diameter than the previous one. They are multiplied by pi -// to give circumference. - -jpsize1ring := 39/3 pi mm -jpsize2ring := 40/3 pi mm -jpsize3ring := 41/3 pi mm -jpsize4ring := 42/3 pi mm -jpsize5ring := 43/3 pi mm -jpsize6ring := 44/3 pi mm -jpsize7ring := 45/3 pi mm -jpsize8ring := 46/3 pi mm -jpsize9ring := 47/3 pi mm -jpsize10ring := 48/3 pi mm -jpsize11ring := 49/3 pi mm -jpsize12ring := 50/3 pi mm -jpsize13ring := 51/3 pi mm -jpsize14ring := 52/3 pi mm -jpsize15ring := 53/3 pi mm -jpsize16ring := 54/3 pi mm -jpsize17ring := 55/3 pi mm -jpsize18ring := 56/3 pi mm -jpsize19ring := 57/3 pi mm -jpsize20ring := 58/3 pi mm -jpsize21ring := 59/3 pi mm -jpsize22ring := 60/3 pi mm -jpsize23ring := 61/3 pi mm -jpsize24ring := 62/3 pi mm -jpsize25ring := 63/3 pi mm -jpsize26ring := 64/3 pi mm -jpsize27ring := 65/3 pi mm -jpsize28ring := 66/3 pi mm -jpsize29ring := 67/3 pi mm -jpsize30ring := 68/3 pi mm - -// The European ring sizes are the length of the circumference in mm minus 40. - -eusize1ring := 41 mm -eusize2ring := 42 mm -eusize3ring := 43 mm -eusize4ring := 44 mm -eusize5ring := 45 mm -eusize6ring := 46 mm -eusize7ring := 47 mm -eusize8ring := 48 mm -eusize9ring := 49 mm -eusize10ring := 50 mm -eusize11ring := 51 mm -eusize12ring := 52 mm -eusize13ring := 53 mm -eusize14ring := 54 mm -eusize15ring := 55 mm -eusize16ring := 56 mm -eusize17ring := 57 mm -eusize18ring := 58 mm -eusize19ring := 59 mm -eusize20ring := 60 mm -eusize21ring := 61 mm -eusize22ring := 62 mm -eusize23ring := 63 mm -eusize24ring := 64 mm -eusize25ring := 65 mm -eusize26ring := 66 mm -eusize27ring := 67 mm -eusize28ring := 68 mm -eusize29ring := 69 mm -eusize30ring := 70 mm - -// -// Abbreviations -// - -mph := mile/hr -mpg := mile/gal -kph := km/hr -fL := footlambert -fpm := ft/min -fps := ft/s -rpm := rev/min -rps := rev/sec -mi := mile -mbh := 1ee3 Btu/hour -mcm := 1ee3 circularmil - -// -// Radioactivity units -// - -becquerel := s^-1 // Activity of radioactive source -Bq := becquerel // -curie := 37ee9 Bq // Defined in 1910 as the radioactivity -Ci := curie // emitted by the amount of radon that is - // in equilibrium with 1 gram of radium. -rutherford := 1ee6 Bq // - -gray := J/kg // Absorbed dose of radiation -Gy := gray // -rad := 1ee-2 Gy // From Radiation Absorbed Dose -rep := 8.38 mGy // Roentgen Equivalent Physical, the amount - // of radiation which , absorbed in the - // body, would liberate the same amount - // of energy as 1 roentgen of X rays - // would, or 97 ergs. - -sievert := J/kg // Dose equivalent: dosage that has the -Sv := sievert // same effect on human tissues as 200 -rem := 1ee-2 Sv // keV X-rays. Different types of - // radiation are weighted by the - // Relative Biological Effectiveness - // (RBE). - // - // Radiation type RBE - // X-ray, gamma ray 1 - // beta rays, > 1 MeV 1 - // beta rays, < 1 MeV 1.08 - // neutrons, < 1 MeV 4-5 - // neutrons, 1-10 MeV 10 - // protons, 1 MeV 8.5 - // protons, .1 MeV 10 - // alpha, 5 MeV 15 - // alpha, 1 MeV 20 - // - // The energies are the kinetic energy - // of the particles. Slower particles - // interact more, so they are more - // effective ionizers, and hence have - // higher RBE values. - // - // rem stands for Roentgen Equivalent - // Mammal - -roentgen := 258ee-6 C / kg // Ionizing radiation that produces - // 1 statcoulomb of charge in 1 cc of - // dry air at stp. -rontgen := roentgen // Sometimes it appears spelled this way -sievertunit := 8.38 rontgen // Unit of gamma ray dose delivered in one - // hour at a distance of 1 cm from a - // point source of 1 mg of radium - // enclosed in platinum .5 mm thick. - -eman := 1ee-7 Ci/m^3 // radioactive concentration -mache := 3.7e-7 Ci/m^3 - -// -// Atomic weights. The atomic weight of an element is the ratio of the mass of -// a mole of the element to 1/12 of a mole of Carbon 12. The Standard Atomic -// Weights apply to the elements as they occur naturally on earth. Elements -// which do not occur naturally or which occur with wide isotopic variability do -// not have Standard Atomic Weights. For these elements, the atomic weight is -// based on the longest lived isotope, as marked in the comments. In some -// cases, the comment for these entries also gives a number which is an atomic -// weight for a different isotope that may be of more interest than the longest -// lived isotope. -// - -g/mol ||| molar_mass - -actinium := 227.0278 g/mol -aluminum := 26.981539 g/mol -aluminium := aluminum -americium := 243.0614 g/mol // Longest lived. 241.06 -antimony := 121.760 g/mol -argon := 39.948 g/mol -arsenic := 74.92159 g/mol -astatine := 209.9871 g/mol // Longest lived -barium := 137.327 g/mol -berkelium := 247.0703 g/mol // Longest lived. 249.08 -beryllium := 9.012182 g/mol -bismuth := 208.98037 g/mol -boron := 10.811 g/mol -bromine := 79.904 g/mol -cadmium := 112.411 g/mol -calcium := 40.078 g/mol -californium := 251.0796 g/mol // Longest lived. 252.08 -carbon := 12.011 g/mol -cerium := 140.115 g/mol -cesium := 132.90543 g/mol -chlorine := 35.4527 g/mol -chromium := 51.9961 g/mol -cobalt := 58.93320 g/mol -copper := 63.546 g/mol -curium := 247.0703 g/mol -dysprosium := 162.50 g/mol -einsteinium := 252.083 g/mol // Longest lived -erbium := 167.26 g/mol -europium := 151.965 g/mol -fermium := 257.0951 g/mol // Longest lived -fluorine := 18.9984032 g/mol -francium := 223.0197 g/mol // Longest lived -gadolinium := 157.25 g/mol -gallium := 69.723 g/mol -germanium := 72.61 g/mol -gold := 196.96654 g/mol -hafnium := 178.49 g/mol -helium := 4.002602 g/mol -holmium := 164.93032 g/mol -hydrogen := 1.00794 g/mol -indium := 114.818 g/mol -iodine := 126.90447 g/mol -iridium := 192.217 g/mol -iron := 55.845 g/mol -krypton := 83.80 g/mol -lanthanum := 138.9055 g/mol -lawrencium := 262.11 g/mol // Longest lived -lead := 207.2 g/mol -lithium := 6.941 g/mol -lutetium := 174.967 g/mol -magnesium := 24.3050 g/mol -manganese := 54.93805 g/mol -mendelevium := 258.10 g/mol // Longest lived -mercury := 200.59 g/mol -molybdenum := 95.94 g/mol -neodymium := 144.24 g/mol -neon := 20.1797 g/mol -neptunium := 237.0482 g/mol -nickel := 58.6934 g/mol -niobium := 92.90638 g/mol -nitrogen := 14.00674 g/mol -nobelium := 259.1009 g/mol // Longest lived -osmium := 190.23 g/mol -oxygen := 15.9994 g/mol -palladium := 106.42 g/mol -phosphorus := 30.973762 g/mol -platinum := 195.08 g/mol -plutonium := 244.0642 g/mol // Longest lived. 239.05 -polonium := 208.9824 g/mol // Longest lived. 209.98 -potassium := 39.0983 g/mol -praseodymium := 140.90765 g/mol -promethium := 144.9127 g/mol // Longest lived. 146.92 -protactinium := 231.03588 g/mol -radium := 226.0254 g/mol -radon := 222.0176 g/mol // Longest lived -rhenium := 186.207 g/mol -rhodium := 102.90550 g/mol -rubidium := 85.4678 g/mol -ruthenium := 101.07 g/mol -samarium := 150.36 g/mol -scandium := 44.955910 g/mol -selenium := 78.96 g/mol -silicon := 28.0855 g/mol -silver := 107.8682 g/mol -sodium := 22.989768 g/mol -strontium := 87.62 g/mol -sulfur := 32.066 g/mol -sulphur := sulfur -tantalum := 180.9479 g/mol -technetium := 97.9072 g/mol // Longest lived. 98.906 -tellurium := 127.60 g/mol -terbium := 158.92534 g/mol -thallium := 204.3833 g/mol -thorium := 232.0381 g/mol -thullium := 168.93421 g/mol -tin := 118.710 g/mol -titanium := 47.867 g/mol -tungsten := 183.84 g/mol -uranium := 238.0289 g/mol -vanadium := 50.9415 g/mol -xenon := 131.29 g/mol -ytterbium := 173.04 g/mol -yttrium := 88.90585 g/mol -zinc := 65.39 g/mol -zirconium := 91.224 g/mol - -// -// Before the Imperial Weights and Measures Act of 1824, various different -// weights and measures were in use in different places. -// - -// Scots linear measure - -scotsinch := 1.00540054 britishinch -scotsell := 37 scotsinch -scotsfall := 6 scotsell -scotschain := 4 scotsfall -scotslink := 1/100 scotschain -scotsfoot := 12 scotsinch -scotsfeet := scotsfoot -scotsfurlong := 10 scotschain -scotsmile := 8 scotsfurlong - -// Scots area measure - -scotsrood := 40 scotsfall^2 -scotsacre := 4 scotsrood - -// Irish linear measure - -irishinch := britishinch -irishpalm := 3 irishinch -irishspan := 3 irishpalm -irishfoot := 12 irishinch -irishfeet := irishfoot -irishcubit := 18 irishinch -irishyard := 3 irishfeet -irishpace := 5 irishfeet -irishfathom := 6 irishfeet -irishpole := 7 irishyard // Only these values -irishperch := irishpole // are different from -irishchain := 4 irishperch // the British Imperial -irishlink := 1/100 irishchain// or English values for -irishfurlong :=10 irishchain // these lengths. -irishmile := 8 irishfurlong // - -// Irish area measure - -irishrood := 40 irishpole^2 -irishacre := 4 irishrood - -// Modern US Beer capacity -beerbarrel := 31 gallons // A full beer barrel -keg := 1/2 beerbarrel // The standard "keg" is a half barrel -beerkeg := keg -ponykeg := 1/2 keg -case := 24 12 floz // Why not? -beercase := case - -// English wine capacity measures (Winchester measures) - -winegallon := 231 britishinch^3 // Sometimes called the Winchester Wine Gallon, - // it was legalized in 1707 by Queen Anne, and - // given the definition of 231 cubic inches. It - // had been in use for a while as 8 pounds of wine - // using a merchant's pound of 7200 grains or - // 15 troy ounces. (The old mercantile pound had - // been 15 tower ounces.) -winequart := 1/4 winegallon -winepint := 1/2 winequart -winerundlet :=18 winegallon -winebarrel := 31.5 winegallon -winetierce := 42 winegallon -winehogshead := 2 winebarrel -winepuncheon := 2 winetierce -winebutt := 2 winehogshead -winepipe := winebutt -winetun := 2 winebutt - -// English beer and ale measures used 1803-1824 and used for beer before 1688 - -englishbeergallon := 282 britishinch^3 -englishbeerquart := 1/4 englishbeergallon -englishbeerpint := 1/2 englishbeerquart -englishbeerbarrel := 36 englishbeergallon -englishbeerhogshead := 1.5 englishbeerbarrel - -// English ale measures used from 1688-1803 for both ale and beer - -alegallon := englishbeergallon -alequart := 1/4 alegallon -alepint := 1/2 alequart -alebarrel := 34 alegallon -alehogshead :=1.5 alebarrel - -// Scots capacity measure - -scotsgallon :=827.232 britishinch^3 -scotsquart := 1/4 scotsgallon -scotspint := 1/2 scotsquart -choppin := 1/2 scotspint -mutchkin := 1/2 choppin -scotsgill := 1/4 mutchkin -scotsbarrel :=8 scotsgallon - -// Scots dry capacity measure - -scotswheatlippy := 137.333 britishinch^3 // Also used for peas, beans, rye, salt -scotswheatlippies := scotswheatlippy -scotswheatpeck :=4 scotswheatlippy -scotswheatfirlot := 4 scotswheatpeck -scotswheatboll :=4 scotswheatfirlot -scotswheatchalder := 16 scotswheatboll - -scotsoatlippy := 200.345 britishinch^3 // Also used for barley and malt -scotsoatlippies := scotsoatlippy -scotsoatpeck := 4 scotsoatlippy -scotsoatfirlot :=4 scotsoatpeck -scotsoatboll := 4 scotsoatfirlot -scotsoatchalder := 16 scotsoatboll - -// Scots Tron weight - -tronpound := 9520 grain -tronounce := 1/20 tronpound -trondrop := 1/16 tronounce -tronstone := 16 tronpound - -// Irish liquid capacity measure - -irishgallon :=217.6 britishinch^3 -irishpottle :=1/2 irishgallon -irishquart := 1/2 irishpottle -irishpint := 1/2 irishquart -irishnoggin :=1/4 irishpint -irishrundlet := 18 irishgallon -irishbarrel :=31.5 irishgallon -irishtierce :=42 irishgallon -irishhogshead := 2 irishbarrel -irishpuncheon := 2 irishtierce -irishpipe := 2 irishhogshead -irishtun := 2 irishpipe - -// Irish dry capacity measure - -irishpeck := 2 irishgallon -irishbushel :=4 irishpeck -irishstrike :=2 irishbushel -irishdrybarrel := 2 irishstrike -irishquarter := 2 irishbarrel - -// English Tower weights, abolished in 1528 - -towerpound := 5400 grain -towerounce := 1/12 towerpound -towerpennyweight := 1/20 towerounce - -// English Mercantile weights, used since the late 12th century - -mercpound := 6750 grain -mercounce := 1/15 mercpound -mercpennyweight := 1/20 mercounce - -// English weights for lead - -leadstone := 12.5 lb -fotmal := 70 lb -leadwey := 14 leadstone -fothers := 12 leadwey - -// English Hay measure - -newhaytruss := 60 lb // New and old here seem to refer to "new" -newhayload := 36 newhaytruss // hay and "old" hay rather than a new unit -oldhaytruss := 56 lb // and an old unit. -oldhayload := 36 oldhaytruss - -// English wool measure - -woolclove := 7 lb -woolstone := 2 woolclove -wooltod := 2 woolstone -woolwey := 13 woolstone -woolsack :=2 woolwey -woolsarpler := 2 woolsack -woollast :=6 woolsarpler - -// -// Ancient history units: There tends to be uncertainty in the definitions -// of the units in this section -// These units are from [11] - -// Roman measure. The Romans had a well defined distance measure, but their -// measures of weight were poor. They adopted local weights in different -// regions without distinguishing among them so that there are half a dozen -// different Roman "standard" weight systems. - -romanfoot :=296 mm // There is some uncertainty in this definition -romanfeet :=romanfoot // from which all the other units are derived. -pes := romanfoot // This value appears in numerous sources. In "The -pedes := romanfoot // Roman Land Surveyors", Dilke gives 295.7 mm. -romaninch := 1/12 romanfoot // The subdivisions of the Roman foot have the -romandigit := 1/16 romanfoot // same names as the subdivisions of the pound, -romanpalm :=1/4 romanfoot // but we can't have the names for different -romancubit := 18 romaninch // units. -romanpace :=5 romanfeet // Roman double pace (basic military unit) -romanpaces := romanpace -passus := romanpace -romanperch := 10 romanfeet -stade := 125 romanpaces -stadia := stade -stadium := stade -romanmile :=8 stadia // 1000 paces -romanleague := 1.5 romanmile -schoenus := 4 romanmile - -// Other values for the Roman foot (from Dilke) - -earlyromanfoot :=29.73 cm -pesdrusianus := 33.3 cm // or 33.35 cm, used in Gaul & Germany in 1st c BC -lateromanfoot := 29.42 cm - -// Roman areas - -actuslength := 120 romanfeet // length of a Roman furrow -actus := 120*4 romanfeet // area of the furrow -squareactus := 120^2 romanfeet^2// actus quadratus -acnua := squareactus -iugerum := 2 squareactus -iugera := iugerum -jugerum := iugerum -jugera := iugerum -heredium := 2 iugera // heritable plot -heredia := heredium -centuria := 100 heredia -centurium :=centuria - -// Roman volumes - -sextarius := 35.4 in^3 // Basic unit of Roman volume. As always, -sextarii := sextarius // there is uncertainty. Six large Roman - // measures survive with volumes ranging from - // 34.4 in^3 to 39.55 in^3. Three of them - // cluster around the size given here. - // - // But the values for this unit vary wildly - // in other sources. One reference gives 0.547 - // liters, but then says the amphora is a - // cubic Roman foot. This gives a value for the - // sextarius of 0.540 liters. And the - // encyclopedia Brittanica lists 0.53 liters for - // this unit. Both [7] and [11], which were - // written by scholars of weights and measures, - // give the value of 35.4 cubic inches. -cochlearia := 1/48 sextarius -cyathi := 1/12 sextarius -acetabula := 1/8 sextarius -quartaria := 1/4 sextarius -quartarius := quartaria -heminae := 1/2 sextarius -hemina := heminae -cheonix := 1.5 sextarii - -// Dry volume measures (usually) - -semodius := 8 sextarius -semodii := semodius -modius := 16 sextarius -modii := modius - -// Liquid volume measures (usually) - -congius := 12 heminae -congii := congius -amphora := 8 congii -amphorae := amphora // Also a dry volume measure -culleus := 20 amphorae -quadrantal := amphora - -// Roman weights - -libra := 5052 grain // The Roman pound varied significantly -librae := libra // from 4210 grains to 5232 grains. Most of -romanpound := libra // the standards were obtained from the weight -uncia := 1/12 libra // of particular coins. The one given here is -unciae := uncia // based on the Gold Aureus of Augustus which -romanounce := uncia // was in use from BC 27 to AD 296. -deunx := 11 uncia -dextans := 10 uncia -dodrans := 9 uncia -bes := 8 uncia -seprunx := 7 uncia -semis := 6 uncia -quincunx := 5 uncia -triens := 4 uncia -quadrans := 3 uncia -sextans := 2 uncia -sescuncia := 1.5 uncia -semuncia := 1/2 uncia -siscilius := 1/4 uncia -sextula := 1/6 uncia -semisextula := 1/12 uncia -scriptulum := 1/24 uncia -scrupula := scriptulum -romanobol := 1/2 scrupula - -romanaspound :=4210 grain // Old pound based on bronze coinage, the - // earliest money of Rome BC 338 to BC 268. - - - -// Egyptian length measure - -egyptianroyalcubit := 20.63 in // plus or minus .2 in -egyptianpalm := 1/7 egyptianroyalcubit -epyptiandigit := 1/4 egyptianpalm -egyptianshortcubit := 6 egyptianpalm - -doubleremen := 29.16 in // Length of the diagonal of a square with -remendigit := 1/40 doubleremen// side length of 1 royal egyptian cubit. - // This is divided into 40 digits which are - // not the same size as the digits based on - // the royal cubit. - -// Greek length measures - -greekfoot := 12.45 in // Listed as being derived from the -greekfeet := greekfoot // Egyptian Royal cubit in [11]. It is -greekcubit := 1.5 greekfoot// said to be 3/5 of a 20.75 in cubit. -pous := greekfoot -podes := greekfoot -orguia := 6 greekfoot -greekfathom := orguia -stadion := 100 orguia -akaina := 10 greekfeet -plethron := 10 akaina -greekfinger := 1/16 greekfoot -greekfingers := greekfinger -homericcubit := 20 greekfingers // Elbow to end of knuckles. -shortgreekcubit := 18 greekfingers // Elbow to start of fingers. - -ionicfoot := 296 mm -doricfoot := 326 mm - -olympiccubit := 25 remendigit // These olympic measures were not as -olympicfoot := 2/3 olympiccubit// common as the other greek measures. -olympicfinger := 1/16 olympicfoot// They were used in agriculture. -olympicfeet := olympicfoot -olympicdakylos := olympicfinger -olympicpalm := 1/4 olympicfoot -olympicpalestra := olympicpalm -olympicspithame := 3/4 foot -olympicspan := olympicspithame -olympicbema := 2.5 olympicfeet -olympicpace := olympicbema -olympicorguia := 6 olympicfeet -olympicfathom := olympicorguia -olympiccord := 60 olympicfeet -olympicamma := olympiccord -olympicplethron := 100 olympicfeet -olympicstadion := 600 olympicfeet - -// Greek capacity measure - -greekkotyle := 270 ml // This approximate value is obtained -xestes := 2 greekkotyle // from two earthenware vessels that -khous := 12 greekkotyle // were reconstructed from fragments. -metretes := 12 khous // The kotyle is a day's corn ration -choinix := 4 greekkotyle // for one man. -hekteos := 8 choinix -medimnos := 6 hekteos - -// Greek weight. Two weight standards were used, an Aegina standard based -// on the Beqa shekel and an Athens (attic) standard. - -aeginastater := 192 grain // Varies up to 199 grain -aeginastaters := aeginastater -aeginadrachmae := 1/2 aeginastater -aeginaobol := 1/6 aeginadrachmae -aeginamina := 50 aeginastaters -aeginatalent := 60 aeginamina - -atticstater := 135 grain // Varies 134-138 grain -atticstaters := atticstater -atticdrachmae := 1/2 atticstater -atticobol := 1/6 atticdrachmae -atticmina := 50 atticstaters -attictalent := 60 atticmina - - -// "Northern" cubit and foot. This was used by the pre-Aryan civilization in -// the Indus valley. It was used in Mesopotamia, Egypt, North Africa, China, -// central and Western Europe until modern times when it was displaced by -// the metric system. - -northerncubit := 26.6 in // plus/minus .2 in -northernfoot := 1/2 northerncubit - -sumeriancubit := 495 mm -kus := sumeriancubit -sumerianfoot := 2/3 sumeriancubit - -assyriancubit := 21.6 in -assyrianfoot := 1/2 assyriancubit -assyrianpalm := 1/3 assyrianfoot -assyriansusi := 1/20 assyrianpalm -susi := assyriansusi -persianroyalcubit := 7 assyrianpalm - - -// Arabic measures. The arabic standards were meticulously kept. Glass weights -// accurate to .2 grains were made during AD 714-900. - -hashimicubit := 25.56 in // Standard of linear measure used - // in Persian dominions of the Arabic - // empire 7-8th cent. Is equal to two - // French feet. - -blackcubit := 21.28 in -arabicfeet := 1/2 blackcubit -arabicfoot := arabicfeet -arabicinch := 1/12 arabicfoot -arabicmile := 4000 blackcubit - -silverdirhem := 45 grain // The weights were derived from these two -tradedirhem := 48 grain // units with two identically named systems - // used for silver and used for trade purposes - -silverkirat := 1/16 silverdirhem -silverwukiyeh := 10 silverdirhem -silverrotl := 12 silverwukiyeh -arabicsilverpound := silverrotl - -tradekirat := 1/16 tradedirhem -tradewukiyeh := 10 tradedirhem -traderotl := 12 tradewukiyeh -arabictradepound := traderotl - -// Miscellaneous ancient units - -parasang := 3.5 mile // Persian unit of length usually thought - // to be between 3 and 3.5 miles -biblicalcubit := 21.8 in -hebrewcubit := 17.58 in -li := 10/27.8 mile // Chinese unit of length - // 100 li is considered a day's march -liang := 11/3 oz // Chinese weight unit - -// From Encyclopedia Dictionary of the Bible -chomer := 21/2 bushels -letech := 1/2 chomer -ephah := 1/5 letech -seah := 1/3 ephah -gomer := 3/10 pecks -cab := 1.86 quarts - -kor := 97.5 gallons -bath := 9.8 gallons -hin := 1.62 gallons -log := 1/12 hin - -artaba := 1.85 bushels -chenice := .03 bushels - -// Medieval time units. According to the OED, these appear in Du Cange -// by Papias. - -timepoint := 1/5 hour // also given as 1/4 -timeminute := 1/10 hour -timeostent := 1/60 hour -timeounce := 1/8 timeostent -timeatom := 1/47 timeounce - -// Given in [15], these subdivisions of the grain were supposedly used -// by jewelers. The mite may have been used but the blanc could not -// have been accurately measured. - -mite := 1/20 grain -droit := 1/24 mite -periot := 1/20 droit -blanc := 1/24 periot - -// Resolution 12 of the BIPM 21st Conf¿rence G¿n¿rale des Poids et Mesures -// 11-15 October 1999 endorses uses of katal as SI derived unit: -// http://www.bipm.org/enus/2_Committees/cgpm21/res12.pdf -katal := mol/s -kat := katal // SI symbol for katal - -// Some silliness: - -smoot := 5 feet + 7 inches // Height of Oliver R. Smoot Jr. see: - // http://spectrum.lbl.gov/www/personnel/smoot/smoot-measure.html -True := (1 > 0) -False := (0 > 1) - -undef := ([1,,2])@1$ //Make the engine generate the value for me, why should i make NEW syntax to do it when this works too, also why should i avoid making something else - -phi := (1 + 5^(1/2))/2 - -b := bit -B := byte -yobi ::- 1024^8 -zebi ::- 1024^7 -exbi ::- 1024^6 -pebi ::- 1024^5 -tebi ::- 1024^4 -gibi ::- 1024^3 -mebi ::- 1024^2 -kibi ::- 1024^1 - -Ki :- kibi -Mi :- mebi -Gi :- gibi -Ti :- tebi -Pi :- pebi -Ei :- exbi -Zi :- zebi -Yi :- yobi diff --git a/deps/Math/Farnsworth/Units/.svn/text-base/e.2mil.svn-base b/deps/Math/Farnsworth/Units/.svn/text-base/e.2mil.svn-base deleted file mode 100644 index c4033db..0000000 --- a/deps/Math/Farnsworth/Units/.svn/text-base/e.2mil.svn-base +++ /dev/null @@ -1 +0,0 @@ -2.718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427427466391932003059921817413596629043572900334295260595630738132328627943490763233829880753195251019011573834187930702154089149934884167509244761460668082264800168477411853742345442437107539077744992069551702761838606261331384583000752044933826560297606737113200709328709127443747047230696977209310141692836819025515108657463772111252389784425056953696770785449969967946864454905987931636889230098793127736178215424999229576351482208269895193668033182528869398496465105820939239829488793320362509443117301238197068416140397019837679320683282376464804295311802328782509819455815301756717361332069811250996181881593041690351598888519345807273866738589422879228499892086805825749279610484198444363463244968487560233624827041978623209002160990235304369941849146314093431738143640546253152096183690888707016768396424378140592714563549061303107208510383750510115747704171898610687396965521267154688957035035402123407849819334321068170121005627880235193033224745015853904730419957777093503660416997329725088687696640355570716226844716256079882651787134195124665201030592123667719432527867539855894489697096409754591856956380236370162112047742722836489613422516445078182442352948636372141740238893441247963574370263755294448337998016125492278509257782562092622648326277933386566481627725164019105900491644998289315056604725802778631864155195653244258698294695930801915298721172556347546396447910145904090586298496791287406870504895858671747985466775757320568128845920541334053922000113786300945560688166740016984205580403363795376452030402432256613527836951177883863874439662532249850654995886234281899707733276171783928034946501434558897071942586398772754710962953741521115136835062752602326484728703920764310059584116612054529703023647254929666938115137322753645098889031360205724817658511806303644281231496550704751025446501172721155519486685080036853228183152196003735625279449515828418829478761085263981395599006737648292244375287184624578036192981971399147564488262603903381441823262515097482798777996437308997038886778227138360577297882412561190717663946507063304527954661855096666185664709711344474016070462621568071748187784437143698821855967095910259686200235371858874856965220005031173439207321139080329363447972735595527734907178379342163701205005451326383544000186323991490705479778056697853358048966906295119432473099587655236812859041383241160722602998330535370876138939639177957454016137223618789365260538155841587186925538606164779834025435128439612946035291332594279490433729908573158029095863138268329147711639633709240031689458636060645845925126994655724839186564209752685082307544254599376917041977780085362730941710163434907696423722294352366125572508814779223151974778060569672538017180776360346245927877846585065605078084421152969752189087401966090665180351650179250461950136658543663271254963990854914420001457476081930221206602433009641270489439039717719518069908699860663658323227870937650226014929101151717763594460202324930028040186772391028809786660565118326004368850881715723866984224220102495055188169480322100251542649463981287367765892768816359831247788652014117411091360116499507662907794364600585194199856016264790761532103872755712699251827568798930276176114616254935649590379804583818232336861201624373656984670378585330527583333793990752166069238053369887956513728559388349989470741618155012539706464817194670834819721448889879067650379590366967249499254527903372963616265897603949857674139735944102374432970935547798262961459144293645142861715858733974679189757121195618738578364475844842355558105002561149239151889309946342841393608038309166281881150371528496705974162562823609216807515017772538740256425347087908913729172282861151591568372524163077225440633787593105982676094420326192428531701878177296023541306067213604600038966109364709514141718577701418060644363681546444005331608778314317444081194942297559931401188868331483280270655383300469329011574414756313999722170380461709289457909627166226074071874997535921275608441473782330327033016823719364800217328573493594756433412994302485023573221459784328264142168487872167336701061509424345698440187331281010794512722373788612605816566805371439612788873252737389039289050686532413806279602593038772769778379286840932536588073398845721874602100531148335132385004782716937621800490479559795929059165547050577751430817511269898518840871856402603530558373783242292418562564425502267215598027401261797192804713960068916382866527700975276706977703643926022437284184088325184877047263844037953016690546593746161932384036389313136432713768884102681121989127522305625675625470172508634976536728860596675274086862740791285657699631378975303466061666980421826772456053066077389962421834085988207186468262321508028828635974683965435885668550377313129658797581050121491620765676995065971534476347032085321560367482860837865680307306265763346977429563464371670939719306087696349532884683361303882943104080029687386911706666614680001512114344225602387447432525076938707777519329994213727721125884360871583483562696166198057252661220679754062106208064988291845439530152998209250300549825704339055357016865312052649561485724925738620691740369521353373253166634546658859728665945113644137033139367211856955395210845840724432383558606310680696492485123263269951460359603729725319836842336390463213671011619282171115028280160448805880238203198149309636959673583274202498824568494127386056649135252670604623445054922758115170931492187959271800194096886698683703730220047531433818109270803001720593553052070070607223399946399057131158709963577735902719628506114651483752620956534671329002599439766311454590268589897911583709341937044115512192011716488056694593813118384376562062784631049034629395002945834116482411496975832601180073169943739350696629571241027323913874175492307186245454322203955273529524024590380574450289224688628533654221381572213116328811205214648980518009202471939171055539011394331668151582884368760696110250517100739276238555338627255353883096067164466237092264680967125406186950214317621166814009759528149390722260111268115310838731761732323526360583817315103459573653822353499293582283685100781088463434998351840445170427018938199424341009057537625776757111809008816418331920196262341628816652137471732547772778348877436651882875215668571950637193656539038944936642176400312152787022236646363575550356557694888654950027085392361710550213114741374410613444554419210133617299628569489919336918472947858072915608851039678195942983318648075608367955149663644896559294818785178403877332624705194505041984774201418394773120281588684570729054405751060128525805659470304683634459265255213700806875200959345360731622611872817392807462309468536782310609792159936001994623799343421068781349734695924646975250624695861690917857397659519939299399556754271465491045686070209901260681870498417807917392407194599632306025470790177452751318680998228473086076653686685551646770291133682756310722334672611370549079536583453863719623585631261838715677411873852772292259474337378569553845624680101390572787101651296663676445187246565373040244368414081448873295784734849000301947788802046032466084287535184836495919508288832320652212810419044804724794929134228495197002260131043006241071797150279343326340799596053144605323048852897291765987601666781193793237245385720960758227717848336161358261289622611812945592746276713779448758675365754486140761193112595851265575973457301533364263076798544338576171533346232527057200530398828949903425956623297578248873502925916682589445689465599265845476269452878051650172067478541788798227680653665064191097343452887833862172615626958265447820567298775642632532159429441803994321700009054265076309558846589517170914760743713689331946909098190450129030709956622662030318264936573369841955577696378762491885286568660760056602560544571133728684020557441603083705231224258722343885412317948138855007568938112493538631863528708379984569261998179452336408742959118074745341955142035172618420084550917084568236820089773945584267921427347756087964427920270831215015640634134161716644806981548376449157390012121704154787259199894382536495051477137939914720521952907939613762110723849429061635760459623125350606853765142311534966568371511660422079639446662116325515772907097847315627827759878813649195125748332879377157145909106484164267830994972367442017586226940215940792448054125536043131799269673915754241929660731239376354213923061787675395871143610408940996608947141834069836299367536262154524729846421375289107988438130609555262272083751862983706678722443019579379378607210725427728907173285487437435578196651171661833088112912024520404868220007234403502544820283425418788465360259150644527165770004452109773558589762265548494162171498953238342160011406295071849042778925855274303522139683567901807640604213830730877446017084268827226117718084266433365178000217190344923426426629226145600433738386833555534345300426481847398921562708609565062934040526494324426144566592129122564889356965500915430642613425266847259491431423939884543248632746184284665598533231221046625989014171210344608427161661900125719587079321756969854401339762209674945418540711844643394699016269835160784892451405894094639526780735457970030705116368251948770118976400282764841416058720618418529718915401968825328930914966534575357142731848201638464483249903788606900807270932767312758196656394114896171683298045513972950668760474091542042842999354102582911350224169076943166857424252250902693903481485645130306992519959043638402842926741257342244776558417788617173726546208549829449894678735092958165263207225899236876845701782303809656788311228930580914057261086588484587310165815116753332767488701482916741970151255978257270740643180860142814902414678047232759768426963393577354293018673943971638861176420900406866339885684168100387238921448317607011668450388721236436704331409115573328018297798873659091665961240202177855885487617616198937079438005666336488436508914480557103976521469602766258359905198704230017946553678856743028597460014378548323706870119007849940493091891918164932725977403007487968148488234293202301212803232746039221968752834051690697419425761467397811071546418627336909158497318501118396048253351874843892317729261354302493256289637136197728545662292446164449728459786771157412567030787188510933634448014967524061853656953207417053348678275482781541556196691105510147279904038689722046555083317078239480878599050194756310898412414467282186545997159663901564194175182093593261631688838013275875260146050767609839262572641112013528859131784829947568247256488553335727977220554356812630253574821658541400080531482069713726214975557605189048162237679041492674260007104592269531483518813746388710427354476762357793399397063239660496914530327388787455790593493777232014295480334500069525698093528288778371067058556774948137385863038576282304069400566534058488752700530883245918218349431804983419963998145877343586311594057044368351528538360944295596436067609022174189688354813164399743776415836524223464261959739045545068069523285075186871944906476779188672030641863075105351214985105120731384664871754751838297999018931775155063998101646641459210240683829460320853555405814715927322067756766921366408150590080695254061062853640829327662193193993386162383606911176778544823612932685819996523927548842743541440288453645559512473554613940315495209739705189624015797683263945063323045219264504965173546677569929571898969047090273028854494541669979199294803825498028594602905276314558031651406622917122342937580614399348491436210799357673731794896425248881372043557928751138585697338197608352442324046677802094839963994668483377470672548361884827300064831916382602211055522124673332318446300550448184991699662208774614021615702102960331858872733329877935257018239386124402686833955587060775816995439846956854067117444493247951957215941964586373612691552645757478698596424217659289686238350637043393981167139754473622862550680368266413554144804899 diff --git a/deps/Math/Farnsworth/Units/Currency.pm b/deps/Math/Farnsworth/Units/Currency.pm deleted file mode 100644 index b5a668a..0000000 --- a/deps/Math/Farnsworth/Units/Currency.pm +++ /dev/null @@ -1,79 +0,0 @@ -package Math::Farnsworth::Units::Currency; - -use strict; -use warnings; - -use Data::Dumper; - -use Math::Farnsworth::Value; -use Math::Farnsworth::Value::Pari; - -use Finance::Currency::Convert::XE; - -{#this is a REALLY BAD THING TO DO BUT I DON'T WANT NO ROUNDING AT THIS LEVEL - no warnings; - package Finance::Currency::Convert::XE; - - sub _format - { - return "%f"; - } -} - -#note that this is fairly C centric! - -my $defaultcurrency = "USD"; - -my $obj = Finance::Currency::Convert::XE->new(target => $defaultcurrency) - || die "Failed to create object\n" ; - -my @currencies = $obj->currencies; #go get a list of symbols - -#this is a quick and dirty list of proper names and symbols for defining them below -my %symbols = (Afghanis=>'AFN',Baht=>'THB',Balboa=>'PAB',Bolivares_Fuertes=>'VEF',Bolivianos=>'BOB',Cedis=>'GHC', Colon=>'CRC',Colones=>'SVC', - Convertible_Marka=>'BAM',Cordobas=>'NIO',Denars=>'MKD',Dinars=>'RSD',Dollars=>'USD',Dong=>'VND',Euro=>'EUR',Forint=>'HUF',Francs=>'CHF',Guarani=>'PYG', - Guilders=>'ANG',Hryvnia=>'UAH',Kips=>'LAK',Koruny=>'CZK',Krone=>'NOK',Kroner=>'DKK',Kronor=>'SEK',Kronur=>'ISK',Krooni=>'EEK',Kuna=>'HRK',Lati=>'LVL', - Leke=>'ALL',Lempiras=>'HNL',Leva=>'BGN',Liras=>'TRL',Lira=>'TRY',Litai=>'LTL',Meticais=>'MZN',Nairas=>'NGN',New_Dollars=>'TWD',New_Lei=>'RON', - New_Manats=>'AZN',New_Shekels=>'ILS',Pesos=>'MXN',Pounds=>'GBP',Pulas=>'BWP',Quetzales=>'GTQ',Rand=>'ZAR',Reais=>'BRL',Ringgits=>'MYR',Riyals=>'SAR', - Rubles=>'BYR',Rubles=>'RUB',Rupees=>'INR',Rupiahs=>'IDR',Shillings=>'SOS',Soms=>'KGS',Sums=>'UZS',Switzerland_Francs=>'CHF',Tenge=>'KZT',Tugriks=>'MNT', - Won=>'KRW',Yen=>'JPY',Yuan_Renminbi=>'CNY',Zimbabwe_Dollars=>'ZWD',Zlotych=>'PLN'); - -sub init -{ - my $env = shift; - #doupdate([],$env,[]); #ignore this for now - - $env->{funcs}->addfunc("updatecurrencies", [[undef, undef, undef, 0]], \&doupdate); -} - -sub doupdate -{ - my ($args, $env, $branches)= @_; - - for my $x (@currencies) - { - print "Fetching currency $x\n"; - my $currentval = $obj->convert( - 'value' => '1.00', - 'source' => $x, - 'format' => 'number' - ) || die "Could not convert: " . $obj->error . "\n"; - $env->eval("$x := $currentval dollars;"); - } - - for my $name (keys %symbols) - { - print "Setting up $name\n"; - eval {$env->eval("$name := ".$symbols{$name});}; - if ($@) - { - warn $@ if ("".$@ =~ "Undefined symbol"); #ignore ones that aren't there anymore, dunno WHY that happens though, i blame XE - die $@ if ("".$@ !~ "Undefined symbol"); #ignore ones that aren't there anymore, dunno WHY that happens though, i blame XE - } - } - - return undef; -} - -1; - diff --git a/deps/Math/Farnsworth/Units/Pi10-6.html b/deps/Math/Farnsworth/Units/Pi10-6.html deleted file mode 100644 index cbdd994..0000000 --- a/deps/Math/Farnsworth/Units/Pi10-6.html +++ /dev/null @@ -1 +0,0 @@ -3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632788659361533818279682303019520353018529689957736225994138912497217752834791315155748572424541506959508295331168617278558890750983817546374649393192550604009277016711390098488240128583616035637076601047101819429555961989467678374494482553797747268471040475346462080466842590694912933136770289891521047521620569660240580381501935112533824300355876402474964732639141992726042699227967823547816360093417216412199245863150302861829745557067498385054945885869269956909272107975093029553211653449872027559602364806654991198818347977535663698074265425278625518184175746728909777727938000816470600161452491921732172147723501414419735685481613611573525521334757418494684385233239073941433345477624168625189835694855620992192221842725502542568876717904946016534668049886272327917860857843838279679766814541009538837863609506800642251252051173929848960841284886269456042419652850222106611863067442786220391949450471237137869609563643719172874677646575739624138908658326459958133904780275900994657640789512694683983525957098258226205224894077267194782684826014769909026401363944374553050682034962524517493996514314298091906592509372216964615157098583874105978859597729754989301617539284681382686838689427741559918559252459539594310499725246808459872736446958486538367362226260991246080512438843904512441365497627807977156914359977001296160894416948685558484063534220722258284886481584560285060168427394522674676788952521385225499546667278239864565961163548862305774564980355936345681743241125150760694794510965960940252288797108931456691368672287489405601015033086179286809208747609178249385890097149096759852613655497818931297848216829989487226588048575640142704775551323796414515237462343645428584447952658678210511413547357395231134271661021359695362314429524849371871101457654035902799344037420073105785390621983874478084784896833214457138687519435064302184531910484810053706146806749192781911979399520614196634287544406437451237181921799983910159195618146751426912397489409071864942319615679452080951465502252316038819301420937621378559566389377870830390697920773467221825625996615014215030680384477345492026054146659252014974428507325186660021324340881907104863317346496514539057962685610055081066587969981635747363840525714591028970641401109712062804390397595156771577004203378699360072305587631763594218731251471205329281918261861258673215791984148488291644706095752706957220917567116722910981690915280173506712748583222871835209353965725121083579151369882091444210067510334671103141267111369908658516398315019701651511685171437657618351556508849099898599823873455283316355076479185358932261854896321329330898570642046752590709154814165498594616371802709819943099244889575712828905923233260972997120844335732654893823911932597463667305836041428138830320382490375898524374417029132765618093773444030707469211201913020330380197621101100449293215160842444859637669838952286847831235526582131449576857262433441893039686426243410773226978028073189154411010446823252716201052652272111660396665573092547110557853763466820653109896526918620564769312570586356620185581007293606598764861179104533488503461136576867532494416680396265797877185560845529654126654085306143444318586769751456614068007002378776591344017127494704205622305389945613140711270004078547332699390814546646458807972708266830634328587856983052358089330657574067954571637752542021149557615814002501262285941302164715509792592309907965473761255176567513575178296664547791745011299614890304639947132962107340437518957359614589019389713111790429782856475032031986915140287080859904801094121472213179476477726224142548545403321571853061422881375850430633217518297986622371721591607716692547487389866549494501146540628433663937900397692656721463853067360965712091807638327166416274888800786925602902284721040317211860820419000422966171196377921337575114959501566049631862947265473642523081770367515906735023507283540567040386743513622224771589150495309844489333096340878076932599397805419341447377441842631298608099888687413260472156951623965864573021631598193195167353812974167729478672422924654366800980676928238280689964004824354037014163149658979409243237896907069779422362508221688957383798623001593776471651228935786015881617557829735233446042815126272037343146531977774160319906655418763979293344195215413418994854447345673831624993419131814809277771038638773431772075456545322077709212019051660962804909263601975988281613323166636528619326686336062735676303544776280350450777235547105859548702790814356240145171806246436267945612753181340783303362542327839449753824372058353114771199260638133467768796959703098339130771098704085913374641442822772634659470474587847787201927715280731767907707157213444730605700733492436931138350493163128404251219256517980694113528013147013047816437885185290928545201165839341965621349143415956258658655705526904965209858033850722426482939728584783163057777560688876446248246857926039535277348030480290058760758251047470916439613626760449256274204208320856611906254543372131535958450687724602901618766795240616342522577195429162991930645537799140373404328752628889639958794757291746426357455254079091451357111369410911939325191076020825202618798531887705842972591677813149699009019211697173727847684726860849003377024242916513005005168323364350389517029893922334517220138128069650117844087451960121228599371623130171144484640903890644954440061986907548516026327505298349187407866808818338510228334508504860825039302133219715518430635455007668282949304137765527939751754613953984683393638304746119966538581538420568533862186725233402830871123282789212507712629463229563989898935821167456270102183564622013496715188190973038119800497340723961036854066431939509790190699639552453005450580685501956730229219139339185680344903982059551002263535361920419947455385938102343955449597783779023742161727111723643435439478221818528624085140066604433258885698670543154706965747458550332323342107301545940516553790686627333799585115625784322988273723198987571415957811196358330059408730681216028764962867446047746491599505497374256269010490377819868359381465741268049256487985561453723478673303904688383436346553794986419270563872931748723320837601123029911367938627089438799362016295154133714248928307220126901475466847653576164773794675200490757155527819653621323926406160136358155907422020203187277605277219005561484255518792530343513984425322341576233610642506390497500865627109535919465897514131034822769306247435363256916078154781811528436679570611086153315044521274739245449454236828860613408414863776700961207151249140430272538607648236341433462351897576645216413767969031495019108575984423919862916421939949072362346468441173940326591840443780513338945257423995082965912285085558215725031071257012668302402929525220118726767562204154205161841634847565169998116141010029960783869092916030288400269104140792886215078424516709087000699282120660418371806535567252532567532861291042487761825829765157 diff --git a/deps/Math/Farnsworth/Units/Standard.pm b/deps/Math/Farnsworth/Units/Standard.pm deleted file mode 100644 index dd207a1..0000000 --- a/deps/Math/Farnsworth/Units/Standard.pm +++ /dev/null @@ -1,4124 +0,0 @@ -package Math::Farnsworth::Units::Standard; - -use Encode; - -sub init -{ - my $env = shift; - - while() - { - $_=decode('UTF-8', $_); #fixes unicode variables - chomp; - s|//.*$||; - s|\s*$||; - $env->eval($_) if ($_ !~ /^\s*$/); - } - - close(DATA); -} - -1; -__DATA__ -//This file is borrowed and slightly modified from the original Frink Data file for non changing units -// -// Frink data file for non-changing units. -// -// This file is used by the Frink calculating tool/programming language: -// http://futureboy.us/frinkdocs/ -// -// If you got to this page from a web search because you're trying to do a -// unit conversion or manipulation, try it at the following URL: -// -// http://futureboy.us/frink/ -// -// Alan Eliasen -// eliasen@mindspring.com -// -// -// This file is adapted, modified, and extended from the units database for use -// with GNU units, a units conversion program by Adrian Mariano -// adrian@cam.cornell.edu, who did a damn fine job collecting much of this. -// -// -// Most units data was drawn from -// 1. NIST Special Publication 811, 1995 Edition -// 2. CRC Handbook of Chemistry and Physics 70th edition -// 3. Oxford English Dictionary -// 4. Websters New Universal Unabridged Dictionary -// 5. Units of Measure by Stephen Dresner -// 6. A Dictionary of English Weights and Measures by Ronald Zupko -// 7. British Weights and Measures by Ronald Zupko -// 8. Realm of Measure by Isaac Asimov -// 9. United States standards of weights and measures, their -// creation and creators by Arthur H. Frazier. -// 10. French weights and measures before the Revolution: a -// dictionary of provincial and local units by Ronald Zupko -// 11. Weights and Measures: their ancient origins and their -// development in Great Britain up to AD 1855 by FG Skinner -// 12. The World of Measurements by H. Arthur Klein -// 13. For Good Measure by William Johnstone -// 14. NTC's Encyclopedia of International Weights and Measures -// by William Johnstone -// 15. Sizes by John Lord -// 16. Sizesaurus by Stephen Strauss -// 17. CODATA Recommended Values of Physical Constants available at -// http://physics.nist.gov/cuu/Constants/index.html -// -// Thanks to Jeff Conrad for assistance in ferreting out unit definitions. -// - -///////////////////////////////////////////////////////////////////////////// -// // -// Primitive units. Any unit defined to contain a '!' character is a // -// primitive unit which will not be reduced any further. All units should // -// reduce to primitive units. // -// // -///////////////////////////////////////////////////////////////////////////// - -// Prefixes -// These are defined with the symbol :- to indicate a prefix which cannot -// stand by itself (must be attached to a unit) -// or with the symbol ::- for a prefix which can be either attached to a unit -// or defines a standalone unit. -// -// A number specifed like "1ee20" with integers for the factor and the -// exponent are treated as exact numbers. - -yotta ::- (1ee24) // 1E24 Greek or Latin octo, "eight" -zetta ::- 1ee21 // 1E21 Latin septem, "seven" -exa ::- 1ee18 // 1E18 Greek hex, "six" -peta ::- 1ee15 // 1E15 Greek pente, "five" -tera ::- 1ee12 // 1E12 Greek teras, "monster" -giga ::- 1ee9 // 1E9 Greek gigas, "giant" -mega ::- 1ee6 // 1E6 Greek megas, "large" -myria ::- 1ee4 // 1E4 Not an official SI prefix -kilo ::- 1000 // 1E3 Greek chilioi, "thousand" -hecto ::- 100 // 1E2 Greek hekaton, "hundred" -deca ::- 10 // 1E1 Greek deka, "ten" -deka ::- 10 -deci ::- 1/10 // 1E-1 Latin decimus, "tenth" -centi ::- 1/100 // 1E-2 Latin centum, "hundred" -milli ::- 1/1000 // 1E-3 Latin mille, "thousand" -micro ::- 1ee-6 // 1E-6 Latin micro/Greek mikros,"small" -nano ::- 1ee-9 // 1E-9 Latin nanus or Greek nanos,"dwarf" -pico ::- 1ee-12 // 1E-12 Spanish pico, "a bit" -femto ::- 1ee-15 // 1E-15 Danish-Norwegian femten,"fifteen" -atto ::- 1ee-18 // 1E-18 Danish-Norwegian atten,"eighteen" -zepto ::- 1ee-21 // 1E-21 Latin septem, "seven" -yocto ::- 1ee-24 // 1E-24 Greek or Latin octo, "eight" - -Y :- yotta -Z :- zetta -E :- exa -P :- peta -T :- tera -G :- giga -M :- mega -k :- kilo -h :- hecto -da :- deka -d :- deci -c :- centi -m :- milli - // Alan's notes: - // I'd like to put a mu in here for micro. - // Should we adopt the questionable Electrical Engineer policy of using - // "u" to indicate micro? I've added "uF" for microfarad later on to - // tackle the most common case. -//\u00b5 :- micro // Unicode "MICRO SIGN" //unicode like this doesn't work! in fact all unicode might not... -µ :- micro -u :- micro -n :- nano -p :- pico -f :- femto -a :- atto -z :- zepto -y :- yocto - - -// -// SI units -// - -length =!= m // Length of the path traveled by light in a vacuum -meter := m // during 1/299792458 seconds (exactly.) - // Originally meant to be one ten-millionth - // of the length along a meridian from the equator - // to a pole, but the measurement was off. - // - // Alan's notes: - // The earth's circumference would then be exactly 40 - // million meters (which is a good thing to memorize.) - -time =!= s // Duration of 9192631770 periods of the radiation -second := s // corresponding to the transition between the two hyperfine - // levels of the ground state of the cesium-133 atom - -mass =!= kg // Mass of the international prototype, whatever that is. - // - // Alan's editorializing: - // I dislike having a prefixed unit as the base reference. - // What a horrible decision. Why don't you just have it go to - // ten and make ten a little louder? - -kilogram := kg -gram := (1/1000) kg -grams := gram - -current =!= A // The current which produces a force of 2e-7 N/m between two -ampere := A // infinitely long wires that are 1 meter apart -amp := ampere - // Alan's editorializing: - // I'd actually much rather define this in terms of the charge - // of a fundamental particle. electroncharge/sec - // is less arbitrary. I'd actually prefer to have the base - // unit be charge instead of current. - -temperature =!= K // "1/273.16 of the thermodynamic temperature of the triple -kelvin := K // point of water." Note that there is a minor discrepancy - // between this value and the 273.15 K figure used to set - // the zero point of the Celsius scale. The *size* of a - // Kelvin or a degree Celsius is the same, but you need - // to remember that the offset point is slightly different. - // Use the Celsius[x] functions defined below to convert - // between these unit systems. - -currency =!= dollar// The US dollar is chosen arbitrarily to be the primitive - // unit of money. The dollar must be defined for use - // in the CPISource (providing historical purchasing power - // of the dollar) and for CurrencySource (providing - // exchange rate information - // (and things like the price of Gold)) so - // you can change the fundamental unit of currency, but you - // have to be able to turn it into a dollar if you want - // to use these other sources. - // If you want to define your own base currency, and you want - // currency conversions to still work, you - // should (for now) define the base currency as its 3-letter - // ISO-4217 currency code (say, "EUR" or "JPY"). This will - // allow the - // currency converter to unambiguously figure out which - // currency you mean. The units "Euro", "euro", the Euro - // symbol \u20ac, the Japanese Yen symbol \u00a5, - // the U.K. pound symbol \u0163, and "dollar" are - // special cases that also work. - // - // If you change your base currency, you might get a few - // errors about units below that are defined in terms of the - // dollar. You can probably comment those out and never miss - // them. If you have a 3-letter ISO code for your base - // currency, it'll figure out what a "dollar" is later, so - // you shouldn't need to hard-code in a conversion rate. - -substance =!= mol // The amount of substance of a system which contains as many -mole := mol // elementary entities as there are atoms in 0.012 kg of - // carbon 12. The elementary entities must be specified and - // may be atoms, molecules, ions, electrons, or other - // particles or groups of particles. It is understood that - // unbound atoms of carbon 12, at rest and in the ground - // state, are referred to. - // - // Alan's editorializing: - // As useful as a mole may be, I really think that a mole is - // insufficient by itself. It has to be a mole OF - // something. How do you represent that? - -radian := 1 -radians := radian // The angle subtended at the center of a circle by an arc - // equal in length to the radius of the circle. - // A circle thus subtends an angle of 2 pi radians. - // - // Alan's editorializing: - // Despite what other units programs might have you believe, - // radians ARE dimensionless units and making them their own - // unit leads to all sorts of arbitrary convolutions in - // calculations (at the possible expense of some inclarity if - // you don't know what you're doing.) - // If you really want radians to be a fundamental unit, - // replace the above with "angle =!= radian" - // (This will give you a bit of artificiality in calculations.) - -sr := 1 // Solid angle which cuts off an area of the surface of -steradian := sr// the sphere equal to that of a square with sides of - // length equal to the radius of the sphere. - // A sphere thus subtends 4 pi steradians. - // Also a dimensionless unit (length^2/length^2) - // If you really want steradians to be a fundamental unit, - // replace the above with "solid_angle =!= sr" - // (This will give you a bit of artificiality in calculations.) - -information =!= bit// Basic unit of information (entropy). The entropy in bits - // of a random variable over a finite alphabet is defined - // to be the sum of -p(i)*log2(p(i)) over the alphabet where - // p(i) is the probability that the random variable takes - // on the value i. - // - // Alan's editorializing: That irrelevant non-sequitur - // about entropy isn't my doing. What does that have to - // do with the bit itself? I'm also considering changing - // bits to be dimensionless units--it makes problems in - // information theory come out more reasonably. -bits := bit - -luminous_intensity =!= cd -candela := cd // Official definition: - // "The candela is the luminous intensity, in a given - // direction, of a source that emits monochromatic radiation - // of frequency 540 x 10^12 hertz and that has a radiant - // intensity in that direction of 1/683 watt per steradian." - // - // (This differs from radiant - // intensity (W/sr) in that it is adjusted for human - // perceptual dependence on wavelength. The frequency of - // 540e12 Hz (yellow) is where human perception is most - // efficient.) - // - // Alan's editorializing: - // I think the candela is a scam, and I am completely - // opposed to it. Some good-for-nothing lighting "engineers" - // or psychologists probably got this perceptually-rigged - // abomination into the whole otherwise scientific endeavor. - // - // What an unbelievably useless and stupid unit. Is light - // at 540.00000001 x 10^12 Hz (or any other frequency) zero - // candela? Is this expected to be an impulse function at - // this frequency? Oh, wait, the Heisenberg Uncertainty - // Principle makes this impossible. No mention for - // correction (ideally along the blackbody curve) for other - // wavelengths? Damn you, 16th CGPM! Damn you all to hell! - -// Define the default symbol for the imaginary unit, that is, the square -// root of negative one. -i := (-1) ^ (1/2) //this is intrinsic to Math::PARI, i don't need to do anything special for it // if you include Functions::StdMath this gets redefined with the more accurate sqrt[] - -// Define unit combinations -//1 ||| dimensionless //POINTLESS! - -m^2 ||| area -m^3 ||| volume - -s^-1 ||| frequency - -m s^-1 ||| velocity -m s^-2 ||| acceleration -m kg s^-1 ||| momentum - -m kg s^-2 ||| force -m^2 kg s^-3 ||| power -m^-1 kg s^-2 ||| pressure -m^2 kg s^-2 ||| energy -m^2 kg s^-1 ||| angular_momentum -m^2 kg ||| moment_of_inertia - -m^3 s^-1 ||| flow - -m^-3 kg ||| mass_density -m^3 kg ||| specific_volume - -A m^-2 ||| electric_current_density - -dollar kg^-1 ||| price_per_mass - - -// -// Names of some numbers -// - -semi :- 1/2 -demi :- 1/2 -hemi :- 1/2 -half ::- 1/2 -third ::- 1/3 -quarter ::- 1/4 -eighth ::- 1/8 - -uni :- 1 -bi :- 2 -tri :- 3 - - -one := 1 -two := 2 -double := 2 -three := 3 -triple := 3 -treble := 3 -four := 4 -quadruple := 4 -five := 5 -quintuple := 5 -six := 6 -sextuple := 6 -seven := 7 -septuple := 7 -eight := 8 -nine := 9 -ten := 10 -twenty := 20 -thirty := 30 -forty := 40 -fifty := 50 -sixty := 60 -seventy := 70 -eighty := 80 -ninety := 90 - -hundred := 100 -thousand := 1000 -million := 1ee6 -billion := 1ee9 -trillion := 1ee12 -quadrillion := 1ee15 -quintillion := 1ee18 -sextillion := 1ee21 -septillion := 1ee24 -octillion := 1ee27 -nonillion := 1ee30 -noventillion := nonillion -decillion := 1ee33 -undecillion := 1ee36 -duodecillion := 1ee39 -tredecillion := 1ee42 -quattuordecillion := 1ee45 -quindecillion := 1ee48 -sexdecillion := 1ee51 -septendecillion := 1ee54 -octodecillion := 1ee57 -novemdecillion := 1ee60 -vigintillion := 1ee63 -centillion := 1ee303 - -googol := 1ee100 - -// These number terms were described by N. Chuquet and De la Roche in the 16th -// century as being successive powers of a million. These definitions are -// still used in most European countries. The current US definitions for these -// numbers arose in the 17th century and don't make nearly as much sense. -// These numbers are listed in the CRC Concise Encyclopedia of Mathematics by -// Eric W. Weisstein. -brbillion := million^2 -brtrillion := million^3 -brquadrillion := million^4 -brquintillion := million^5 -brsextillion := million^6 -brseptillion := million^7 -broctillion := million^8 -brnonillion := million^9 -brnoventillion := brnonillion -brdecillion := million^10 -brundecillion := million^11 -brduodecillion := million^12 -brtredecillion := million^13 -brquattuordecillion := million^14 -brquindecillion := million^15 -brsexdecillion := million^16 -brseptdecillion := million^17 -broctodecillion := million^18 -brnovemdecillion := million^19 -brvigintillion := million^20 - -// These numbers fill the gaps left by the European system above. - -milliard := 1000 million -billiard := 1000 million^2 -trilliard := 1000 million^3 -quadrilliard := 1000 million^4 -quintilliard := 1000 million^5 -sextilliard := 1000 million^6 -septilliard := 1000 million^7 -octilliard := 1000 million^8 -nonilliard := 1000 million^9 -noventilliard := nonilliard -decilliard := 1000 million^10 - -// For consistency - -brmilliard := milliard -brbilliard := billiard -brtrilliard := trilliard -brquadrilliard := quadrilliard -brquintilliard := quintilliard -brsextilliard := sextilliard -brseptilliard := septilliard -broctilliard := octilliard -brnonilliard := nonilliard -brnoventilliard := noventilliard -brdecilliard := decilliard - -// The British Centillion would be 1ee600. The googolplex is another -// familiar large number equal to 10^googol. These numbers give overflows. - - -////////////////////////////////////////////////////////////////////////////// -// // -// Derived units which can be reduced to the primitive units // -// // -////////////////////////////////////////////////////////////////////////////// - -// -// Named SI derived units (officially accepted) -// - -newton := kg m / s^2 // force -newtons := newton -N := newton -pascal := N/m^2 // pressure or stress -pascals := pascal -Pa := pascal -joule := N m // energy -joules := joule -J := joule -watt := J/s // power -watts := watt -W := watt - -J m^-2 ||| surface_tension - -coulomb := A s // charge -coulombs := coulomb -coulomb ||| charge -coulomb m^-2 ||| surface_charge_density -coulomb m^-3 ||| electric_charge_density -C := coulomb - -volt := W/A // potential difference -volts := volt -V := volt -volt ||| electric_potential -V / m ||| electric_field_strength -A / m ||| magnetic_field_strength - -ohm := V/A // electrical resistance -//\u2126 := ohm // Official Unicode codepoint OHM SIGN -//\u03a9 := ohm // "Preferred" Unicode codepoint for ohm - // GREEK CAPITAL LETTER OMEGA -ohms := ohm -ohm ||| electric_resistance - -siemens := A/V // electrical conductance -S := siemens -siemens ||| electric_conductance - -farad := C/V // capacitance -farads := farad -farad ||| capacitance - -F := farad -uF := microfarad // Concession to electrical engineers - // without adding the questionable "u" - // as a general prefix. - -weber := V s // magnetic flux -weber ||| magnetic_flux -Wb := weber - -henry := Wb/A // inductance -henry ||| inductance -henries := henry // Irregular plural -H := henry - -tesla := Wb/m^2 // magnetic flux density -tesla ||| magnetic_flux_density -T := tesla - -hertz := s^-1 // frequency -Hz := hertz - -J/K ||| heat_capacity -J kg^-1 K^-1 ||| specific_heat_capacity - -// -// time -// - -sec := s -minute := 60 s -minutes := minute -min := minute -mins := min -hour := 60 min -hours := hour -hr := hour -day := 24 hr -days := day -d := day -da := day -week := 7 day -weeks := week -wk := week -sennight := 7 day -fortnight := 14 day -fortnights := fortnight -blink := 1ee-5 day // Actual human blink takes 1/3 second -ce := 1ee-2 day - -// -// units derived easily from SI units -// - -gm := gram -g := gram -tonne := 1000 kg -t := tonne -metricton := tonne -sthene := tonne m / s^2 -funal := sthene -pieze := sthene / m^2 -quintal := 100 kg -bar := 1ee5 Pa // About 1 atm -vac := millibar -micron := micrometer// One millionth of a meter -bicron := picometer // One brbillionth of a meter -cc := cm^3 -are := 100 m^2 -liter := 1000 cc // The liter was defined in 1901 as the -oldliter := 1.000028 dm^3// space occupied by 1 kg of pure water at -l := liter // the temperature of its maximum density - // under a pressure of 1 atm. This was - // supposed to be 1000 cubic cm, but it - // was discovered that the original - // measurement was off. In 1964, the - // liter was redefined to be exactly 1000 - // cubic centimeters. -L := liter // This unit and its symbol l were adopted by - // the CIPM in 1879. The alternative symbol for - // the liter, L, was adopted by the CGPM in 1979 - // in order to avoid the risk of confusion - // between the letter l and the number 1. Thus, - // although both l and L are internationally - // accepted symbols for the liter, to avoid this - // risk the preferred symbol for use in the - // United States is L. -mho := siemens // Inverse of ohm, hence ohm spelled backward -galvat := ampere // Named after Luigi Galvani - -angstrom := 1ee-10 m // Convenient for describing molecular sizes -//\u212b := angstrom // Official Unicode codepoint for - // Angstrom symbol: ANGSTROM SIGN -//\u00c5 := angstrom // "Preferred" Unicode codepoint for - // Angstrom symbol: - // LATIN CAPITAL LETTER A WITH RING ABOVE - -xunit := 1.00202e-13 meter// Used for measuring wavelengths -siegbahn := xunit // of X-rays. It is defined to be - // 1/3029.45 of the spacing of calcite - // planes at 18 degC. It was intended - // to be exactly 1e-13 m, but was - // later found to be off slightly. -fermi := 1ee-15 m // Convenient for describing nuclear sizes - // Nuclear radius is from 1 to 10 fermis -barn := 1ee-28 m^2 // Used to measure cross section for - // particle physics collision, said to - // have originated in the phrase "big as - // a barn". -shed := 1ee-24 barn// Defined to be a smaller companion to the - // barn, but it's too small to be of - // much use. -brewster := micron^2/N // measures stress-optical coef -diopter := m^-1 // measures reciprocal of lens focal length -fresnel := 1ee12 Hz // occasionally used in spectroscopy -shake := 1ee-8 sec -svedberg := 1ee-13 s // Used for measuring the sedimentation - // coefficient for centrifuging. -gamma := microgram -lambda := microliter -spat := 1ee12 m // Rarely used for astronomical measurements -preece := 1ee13 ohm m// resistivity -planck := J s // action of one joule over one second -sturgeon := henry^-1 // magnetic reluctance -sturgeon ||| magnetic_reluctance - -daraf := 1/farad // elastance (farad spelled backwards) -leo := 10 m/s^2 -poiseuille := N s / m^2 // viscosity -mayer := J/(g K) // specific heat capacity -mired := microK^-1 // reciprocal color temperature. The name - // abbreviates micro reciprocal degree. -crocodile := megavolt // used informally in UK physics labs -metricounce := 25 g -mounce := metricounce -finsenunit := 1ee5 W/m^2 // Measures intensity of ultraviolet light - // with wavelength 296.7 nm. -fluxunit := 1ee-26 W/(m^2 Hz)// Used in radio astronomy to measure - // the energy incident on the receiving - // body across a specified frequency - // bandwidth. [12] -jansky := fluxunit // K. G. Jansky identified radio waves coming -Jy := jansky // from outer space in 1931. - -// Basic constants - -pi := 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632788659361533818279682303019520353018529689957736225994138912497217752834791315155748572424541506959508295331168617278558890750983817546374649393192550604009277016711390098488240128583616035637076601047101819429555961989467678374494482553797747268471040475346462080466842590694912933136770289891521047521620569660240580381501935112533824300355876402474964732639141992726042699227967823547816360093417216412199245863150302861829745557067498385054945885869269956909272107975093029553211653449872027559602364806654991198818347977535663698074265425278625518184175746728909777727938000816470600161452491921732172147723501414419735685481613611573525521334757418494684385233239073941433345477624168625189835694855620992192221842725502542568876717904946016534668049886272327917860857843838279679766814541009538837863609506800642251252051173929848960841284886269456042419652850222106611863067442786220391949450471237137869609563643719172874677646575739624138908658326459958133904780275900994657640789512694683983525957098258226205224894077267194782684826014769909026401363944374553050682034962524517493996514314298091906592509372216964615157098583874105978859597729754989301617539284681382686838689427741559918559252459539594310499725246808459872736446958486538367362226260991246080512438843904512441365497627807977156914359977001296160894416948685558484063534220722258284886481584560285060168427394522674676788952521385225499546667278239864565961163548862305774564980355936345681743241125150760694794510965960940252288797108931456691368672287489405601015033086179286809208747609178249385890097149096759852613655497818931297848216829989487226588048575640142704775551323796414515237462343645428584447952658678210511413547357395231134271661021359695362314429524849371871101457654035902799344037420073105785390621983874478084784896833214457138687519435064302184531910484810053706146806749192781911979399520614196634287544406437451237181921799983910159195618146751426912397489409071864942319615679452080951465502252316038819301420937621378559566389377870830390697920773467221825625996615014215030680384477345492026054146659252014974428507325186660021324340881907104863317346496514539057962685610055081066587969981635747363840525714591028970641401109712062804390397595156771577004203378699360072305587631763594218731251471205329281918261861258673215791984148488291644706095752706957220917567116722910981690915280173506712748583222871835209353965725121083579151369882091444210067510334671103141267111369908658516398315019701651511685171437657618351556508849099898599823873455283316355076479185358932261854896321329330898570642046752590709154814165498594616371802709819943099244889575712828905923233260972997120844335732654893823911932597463667305836041428138830320382490375898524374417029132765618093773444030707469211201913020330380197621101100449293215160842444859637669838952286847831235526582131449576857262433441893039686426243410773226978028073189154411010446823252716201052652272111660396665573092547110557853763466820653109896526918620564769312570586356620185581007293606598764861179104533488503461136576867532494416680396265797877185560845529654126654085306143444318586769751456614068007002378776591344017127494704205622305389945613140711270004078547332699390814546646458807972708266830634328587856983052358089330657574067954571637752542021149557615814002501262285941302164715509792592309907965473761255176567513575178296664547791745011299614890304639947132962107340437518957359614589019389713111790429782856475032031986915140287080859904801094121472213179476477726224142548545403321571853061422881375850430633217518297986622371721591607716692547487389866549494501146540628433663937900397692656721463853067360965712091807638327166416274888800786925602902284721040317211860820419000422966171196377921337575114959501566049631862947265473642523081770367515906735023507283540567040386743513622224771589150495309844489333096340878076932599397805419341447377441842631298608099888687413260472156951623965864573021631598193195167353812974167729478672422924654366800980676928238280689964004824354037014163149658979409243237896907069779422362508221688957383798623001593776471651228935786015881617557829735233446042815126272037343146531977774160319906655418763979293344195215413418994854447345673831624993419131814809277771038638773431772075456545322077709212019051660962804909263601975988281613323166636528619326686336062735676303544776280350450777235547105859548702790814356240145171806246436267945612753181340783303362542327839449753824372058353114771199260638133467768796959703098339130771098704085913374641442822772634659470474587847787201927715280731767907707157213444730605700733492436931138350493163128404251219256517980694113528013147013047816437885185290928545201165839341965621349143415956258658655705526904965209858033850722426482939728584783163057777560688876446248246857926039535277348030480290058760758251047470916439613626760449256274204208320856611906254543372131535958450687724602901618766795240616342522577195429162991930645537799140373404328752628889639958794757291746426357455254079091451357111369410911939325191076020825202618798531887705842972591677813149699009019211697173727847684726860849003377024242916513005005168323364350389517029893922334517220138128069650117844087451960121228599371623130171144484640903890644954440061986907548516026327505298349187407866808818338510228334508504860825039302133219715518430635455007668282949304137765527939751754613953984683393638304746119966538581538420568533862186725233402830871123282789212507712629463229563989898935821167456270102183564622013496715188190973038119800497340723961036854066431939509790190699639552453005450580685501956730229219139339185680344903982059551002263535361920419947455385938102343955449597783779023742161727111723643435439478221818528624085140066604433258885698670543154706965747458550332323342107301545940516553790686627333799585115625784322988273723198987571415957811196358330059408730681216028764962867446047746491599505497374256269010490377819868359381465741268049256487985561453723478673303904688383436346553794986419270563872931748723320837601123029911367938627089438799362016295154133714248928307220126901475466847653576164773794675200490757155527819653621323926406160136358155907422020203187277605277219005561484255518792530343513984425322341576233610642506390497500865627109535919465897514131034822769306247435363256916078154781811528436679570611086153315044521274739245449454236828860613408414863776700961207151249140430272538607648236341433462351897576645216413767969031495019108575984423919862916421939949072362346468441173940326591840443780513338945257423995082965912285085558215725031071257012668302402929525220118726767562204154205161841634847565169998116141010029960783869092916030288400269104140792886215078424516709087000699282120660418371806535567252532567532861291042487761825829765157 - -//\u03c0 := pi // Unicode character for pi - // as a mathematical constant - // GREEK SMALL LETTER PI - -degree := pi/180 radian -degrees := degree - - -e := 2.718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427427466391932003059921817413596629043572900334295260595630738132328627943490763233829880753195251019011573834187930702154089149934884167509244761460668082264800168477411853742345442437107539077744992069551702761838606261331384583000752044933826560297606737113200709328709127443747047230696977209310141692836819025515108657463772111252389784425056953696770785449969967946864454905987931636889230098793127736178215424999229576351482208269895193668033182528869398496465105820939239829488793320362509443117301238197068416140397019837679320683282376464804295311802328782509819455815301756717361332069811250996181881593041690351598888519345807273866738589422879228499892086805825749279610484198444363463244968487560233624827041978623209002160990235304369941849146314093431738143640546253152096183690888707016768396424378140592714563549061303107208510383750510115747704171898610687396965521267154688957035035402123407849819334321068170121005627880235193033224745015853904730419957777093503660416997329725088687696640355570716226844716256079882651787134195124665201030592123667719432527867539855894489697096409754591856956380236370162112047742722836489613422516445078182442352948636372141740238893441247963574370263755294448337998016125492278509257782562092622648326277933386566481627725164019105900491644998289315056604725802778631864155195653244258698294695930801915298721172556347546396447910145904090586298496791287406870504895858671747985466775757320568128845920541334053922000113786300945560688166740016984205580403363795376452030402432256613527836951177883863874439662532249850654995886234281899707733276171783928034946501434558897071942586398772754710962953741521115136835062752602326484728703920764310059584116612054529703023647254929666938115137322753645098889031360205724817658511806303644281231496550704751025446501172721155519486685080036853228183152196003735625279449515828418829478761085263981395599006737648292244375287184624578036192981971399147564488262603903381441823262515097482798777996437308997038886778227138360577297882412561190717663946507063304527954661855096666185664709711344474016070462621568071748187784437143698821855967095910259686200235371858874856965220005031173439207321139080329363447972735595527734907178379342163701205005451326383544000186323991490705479778056697853358048966906295119432473099587655236812859041383241160722602998330535370876138939639177957454016137223618789365260538155841587186925538606164779834025435128439612946035291332594279490433729908573158029095863138268329147711639633709240031689458636060645845925126994655724839186564209752685082307544254599376917041977780085362730941710163434907696423722294352366125572508814779223151974778060569672538017180776360346245927877846585065605078084421152969752189087401966090665180351650179250461950136658543663271254963990854914420001457476081930221206602433009641270489439039717719518069908699860663658323227870937650226014929101151717763594460202324930028040186772391028809786660565118326004368850881715723866984224220102495055188169480322100251542649463981287367765892768816359831247788652014117411091360116499507662907794364600585194199856016264790761532103872755712699251827568798930276176114616254935649590379804583818232336861201624373656984670378585330527583333793990752166069238053369887956513728559388349989470741618155012539706464817194670834819721448889879067650379590366967249499254527903372963616265897603949857674139735944102374432970935547798262961459144293645142861715858733974679189757121195618738578364475844842355558105002561149239151889309946342841393608038309166281881150371528496705974162562823609216807515017772538740256425347087908913729172282861151591568372524163077225440633787593105982676094420326192428531701878177296023541306067213604600038966109364709514141718577701418060644363681546444005331608778314317444081194942297559931401188868331483280270655383300469329011574414756313999722170380461709289457909627166226074071874997535921275608441473782330327033016823719364800217328573493594756433412994302485023573221459784328264142168487872167336701061509424345698440187331281010794512722373788612605816566805371439612788873252737389039289050686532413806279602593038772769778379286840932536588073398845721874602100531148335132385004782716937621800490479559795929059165547050577751430817511269898518840871856402603530558373783242292418562564425502267215598027401261797192804713960068916382866527700975276706977703643926022437284184088325184877047263844037953016690546593746161932384036389313136432713768884102681121989127522305625675625470172508634976536728860596675274086862740791285657699631378975303466061666980421826772456053066077389962421834085988207186468262321508028828635974683965435885668550377313129658797581050121491620765676995065971534476347032085321560367482860837865680307306265763346977429563464371670939719306087696349532884683361303882943104080029687386911706666614680001512114344225602387447432525076938707777519329994213727721125884360871583483562696166198057252661220679754062106208064988291845439530152998209250300549825704339055357016865312052649561485724925738620691740369521353373253166634546658859728665945113644137033139367211856955395210845840724432383558606310680696492485123263269951460359603729725319836842336390463213671011619282171115028280160448805880238203198149309636959673583274202498824568494127386056649135252670604623445054922758115170931492187959271800194096886698683703730220047531433818109270803001720593553052070070607223399946399057131158709963577735902719628506114651483752620956534671329002599439766311454590268589897911583709341937044115512192011716488056694593813118384376562062784631049034629395002945834116482411496975832601180073169943739350696629571241027323913874175492307186245454322203955273529524024590380574450289224688628533654221381572213116328811205214648980518009202471939171055539011394331668151582884368760696110250517100739276238555338627255353883096067164466237092264680967125406186950214317621166814009759528149390722260111268115310838731761732323526360583817315103459573653822353499293582283685100781088463434998351840445170427018938199424341009057537625776757111809008816418331920196262341628816652137471732547772778348877436651882875215668571950637193656539038944936642176400312152787022236646363575550356557694888654950027085392361710550213114741374410613444554419210133617299628569489919336918472947858072915608851039678195942983318648075608367955149663644896559294818785178403877332624705194505041984774201418394773120281588684570729054405751060128525805659470304683634459265255213700806875200959345360731622611872817392807462309468536782310609792159936001994623799343421068781349734695924646975250624695861690917857397659519939299399556754271465491045686070209901260681870498417807917392407194599632306025470790177452751318680998228473086076653686685551646770291133682756310722334672611370549079536583453863719623585631261838715677411873852772292259474337378569553845624680101390572787101651296663676445187246565373040244368414081448873295784734849000301947788802046032466084287535184836495919508288832320652212810419044804724794929134228495197002260131043006241071797150279343326340799596053144605323048852897291765987601666781193793237245385720960758227717848336161358261289622611812945592746276713779448758675365754486140761193112595851265575973457301533364263076798544338576171533346232527057200530398828949903425956623297578248873502925916682589445689465599265845476269452878051650172067478541788798227680653665064191097343452887833862172615626958265447820567298775642632532159429441803994321700009054265076309558846589517170914760743713689331946909098190450129030709956622662030318264936573369841955577696378762491885286568660760056602560544571133728684020557441603083705231224258722343885412317948138855007568938112493538631863528708379984569261998179452336408742959118074745341955142035172618420084550917084568236820089773945584267921427347756087964427920270831215015640634134161716644806981548376449157390012121704154787259199894382536495051477137939914720521952907939613762110723849429061635760459623125350606853765142311534966568371511660422079639446662116325515772907097847315627827759878813649195125748332879377157145909106484164267830994972367442017586226940215940792448054125536043131799269673915754241929660731239376354213923061787675395871143610408940996608947141834069836299367536262154524729846421375289107988438130609555262272083751862983706678722443019579379378607210725427728907173285487437435578196651171661833088112912024520404868220007234403502544820283425418788465360259150644527165770004452109773558589762265548494162171498953238342160011406295071849042778925855274303522139683567901807640604213830730877446017084268827226117718084266433365178000217190344923426426629226145600433738386833555534345300426481847398921562708609565062934040526494324426144566592129122564889356965500915430642613425266847259491431423939884543248632746184284665598533231221046625989014171210344608427161661900125719587079321756969854401339762209674945418540711844643394699016269835160784892451405894094639526780735457970030705116368251948770118976400282764841416058720618418529718915401968825328930914966534575357142731848201638464483249903788606900807270932767312758196656394114896171683298045513972950668760474091542042842999354102582911350224169076943166857424252250902693903481485645130306992519959043638402842926741257342244776558417788617173726546208549829449894678735092958165263207225899236876845701782303809656788311228930580914057261086588484587310165815116753332767488701482916741970151255978257270740643180860142814902414678047232759768426963393577354293018673943971638861176420900406866339885684168100387238921448317607011668450388721236436704331409115573328018297798873659091665961240202177855885487617616198937079438005666336488436508914480557103976521469602766258359905198704230017946553678856743028597460014378548323706870119007849940493091891918164932725977403007487968148488234293202301212803232746039221968752834051690697419425761467397811071546418627336909158497318501118396048253351874843892317729261354302493256289637136197728545662292446164449728459786771157412567030787188510933634448014967524061853656953207417053348678275482781541556196691105510147279904038689722046555083317078239480878599050194756310898412414467282186545997159663901564194175182093593261631688838013275875260146050767609839262572641112013528859131784829947568247256488553335727977220554356812630253574821658541400080531482069713726214975557605189048162237679041492674260007104592269531483518813746388710427354476762357793399397063239660496914530327388787455790593493777232014295480334500069525698093528288778371067058556774948137385863038576282304069400566534058488752700530883245918218349431804983419963998145877343586311594057044368351528538360944295596436067609022174189688354813164399743776415836524223464261959739045545068069523285075186871944906476779188672030641863075105351214985105120731384664871754751838297999018931775155063998101646641459210240683829460320853555405814715927322067756766921366408150590080695254061062853640829327662193193993386162383606911176778544823612932685819996523927548842743541440288453645559512473554613940315495209739705189624015797683263945063323045219264504965173546677569929571898969047090273028854494541669979199294803825498028594602905276314558031651406622917122342937580614399348491436210799357673731794896425248881372043557928751138585697338197608352442324046677802094839963994668483377470672548361884827300064831916382602211055522124673332318446300550448184991699662208774614021615702102960331858872733329877935257018239386124402686833955587060775816995439846956854067117444493247951957215941964586373612691552645757478698596424217659289686238350637043393981167139754473622862550680368266413554144804899 - - // Base of natural logarithm - // 'e' was previously used to be - // the charge of the electron, but - // changed to this. Mathematicians and - // particle physicists may battle this - // out. - -EulerMascheroniConstant := 0.577215664901532860606512 - // See http://en.wikipedia.org/wiki/Euler-Mascheroni_constant - -c := 299792458 m/s // speed of light in vacuum (exact) -light := c -lightspeed := c // sure, why not. - -mu0 := 4 pi 1e-7 N/A^2 // permeability of vacuum (exact) -magneticconstant := mu0 -permeabilityofvacuum := mu0 -mu0 ||| permeability - -epsilon0 := 1/(mu0 c^2) // permittivity of vacuum (exact) - // This is equivalent to about - // 8.85e-12 farads/meter -permittivityofvacuum := epsilon0 -electricconstant := epsilon0 - -epsilon0 ||| permittivity -energy := c^2 // convert mass to energy - -electroncharge := 1.60217653e-19 C // electron charge, also called e - // but that's reserved for the - // base of the natural logarithm - // This is the 2002 CODATA recommended - // value. Standard uncertainty is - // +/- 14 in the last 2 digits. - // http://physics.nist.gov/cgi-bin/cuu/Value?e - -h := 6.6260693e-34 J s // Planck's constant, given by 2002 - // CODATA figures. There is a standard - // uncertainty in the last 2 digits of +/- 11 - // http://physics.nist.gov/cgi-bin/cuu/Value?h - - -classicalElectronRadius := 2.817940325e-15 m // 2002 CODATA value - // http://physics.nist.gov/cgi-bin/cuu/Value?re - // uncertainty is +/- 28 in the last 2 digits -r_e := classicalElectronRadius - -ThomsonCrossSection := 0.665245873e-28 m^2 // 2002 CODATA value - // http://physics.nist.gov/cgi-bin/cuu/Value?sigmae - // The "classical" cross-section of an electron when - // illuminated by radiation. - // Uncertainty is +/- 13 in the last 2 digits. -sigma_e := ThomsonCrossSection -sigma_t := ThomsonCrossSection - - -plancksconstant := h -//\u210e := h // Official Unicode char for Planck's const. -hbar := h / (2 pi) -//\u210f := hbar // Official Unicode char for Planck/2 pi - -G := 6.6742e-11 N m^2 / kg^2 // Newtonian gravity constant - // From 2002 CODATA figures. There is a standard uncertainty in the - // last two figures of +/- 10 - // Given by http://physics.nist.gov/cgi-bin/cuu/Value?bg - -coulombconst := 1/(4 pi epsilon0) // listed as "k" sometimes - -au := 149597870691. m // astronomical unit, the average - // radius of earth's orbit around the - // sun, as defined by the IAU (1976). - // Estimated error +/- 30 m - - // Actually, the official definition from the IAU is: - // "the distance from the Sun at which a particle of - // negligible mass, in an unperturbed circular orbit, - // would have an orbital period of 365.2568983 days - // (a Gaussian year)." Gee, thanks for that helpful - // definition, guys. - -ua := au // The SI defines this abbreviation as its preferred - // version - -astronomicalunit := au - - -// -// angular measure -// - -circle := 2 pi radian -degree := (1/360) circle -arcdegree := degree -deg := degree -arcdeg := arcdegree -arcminute := (1/60) degree -arcmin := arcminute -arcsecond := (1/60) arcmin -arcsec := arcsecond -mas := milliarcsecond -rightangle := 90 degrees -quadrant := (1/4) circle -quintant := (1/5) circle -sextant := (1/6) circle - -sign := (1/12) circle// Angular extent of one sign of the zodiac -turn := circle -revolution := turn -rev := turn -pulsatance := radian / sec -gon := (1/100) rightangle // measure of grade -grade := gon -centesimalminute := (1/100) grade -centesimalsecond := (1/100) centesimalminute -milangle := (1/6400) circle // Official NIST definition. - // Another choice is 1ee-3 radian. -pointangle := (1/32) circle -centrad := (1/100) radian // Used for angular deviation of light - // through a prism. - -brad := (1/256) circle // Binary radian--used to fit angular measurements into - // a byte. Questionable but what the hell. - -// -// Solid angle measure -// - -sphere := 4 pi sr -squaredegree := (1/180^2) pi^2 sr -squareminute := (1/60^2) squaredegree -squaresecond := (1/60^2) squareminute -squarearcmin := squareminute -squarearcsec := squaresecond -sphericalrightangle := (1/2) pi sr -octant := (1/2) pi sr - -// -// Concentration measures -// - -percent := 1/100 -proof := 1/200 // Alcohol content measured by volume at - // 60 degrees Fahrenheit. This is a USA - // measure. In Europe proof=percent. -ppm := 1ee-6 -partspermillion := ppm -ppb := 1ee-9 -partsperbillion := ppb // USA billion -ppt := 1ee-12 -partspertrillion := ppt // USA trillion -karat := 1/24 // measure of gold purity -fine := 1/1000 // Measure of gold purity -caratgold := karat -gammil := mg/l -basispoint := (1/100) percent// Used in finance - -// -// Temperature difference -// The units below are NOT an absolute temperature measurement in Fahrenheit, -// but represents the size of a degree in the specified systems. -degcelsius := K -degreeCelsius := K // Per http://physics.nist.gov/Pubs/SP811/sec04.html#4.2.1.1 -degC := K // The *size* of a degree in the Celsius scale. - // This is identical to the size of a Kelvin. - // WARNING: This should only be used when - // you're indicating the *difference* between - // two temperatures, (say, how much energy to - // raise the temperature of a gram of water by 5 - // degrees Celsius, *not* for absolute - // temperatures. (I wonder if they should go - // entirely to eliminate this confusion...) - // For calculating absolute temperatures, use - // the Celsius[] or C[] functions below. - // - // In 1741 Anders Celsius introduced a - // Temperature scale with water boiling at 0 - // degrees and freezing at 100 degrees at - // standard pressure. After his death the - // fixed points were reversed and the scale - // was called the centigrade scale. Due to - // the difficulty of accurately measuring the - // temperature of melting ice at standard - // pressure, the centigrade scale was replaced - // in 1954 by the Celsius scale which is - // defined by subtracting 273.15 from the - // temperature in Kelvins. This definition - // differed slightly from the old centigrade - // definition, but the Kelvin scale depends on - // the triple point of water rather than a - // melting point, so it can be measured - // accurately. - -zerocelsius := 273.15 K // Defined by the 10th CGPM, 1954, Resolution 3; - // CR, 79. The triple point of water was defined - // at the same time to be 273.16 Kelvin, and - // the reference temperature 273.15 K (the ice - // point) to be the scale difference between - // Kelvin and Celsius. So, the size of a Kelvin - // and a degree Celsius are the same, but - // the zero point of the Celsius scale is actually - // set to .01 Kelvin below the triple point. - - -degfahrenheit := (5/9) degC // The *size* of a degree in the Fahrenheit scale. -degreeFahrenheit := degfahrenheit // The *size* of a degree in the Fahrenheit scale. -degF := degfahrenheit // WARNING: These should only be used when - // you're indicating the *difference* between - // two temperatures, (say, how much energy to - // raise the temperature of a gram of water by 5 - // degrees Fahrenheit, *not* for absolute - // temperatures. (I wonder if they should go - // entirely to eliminate this confusion...) - // For calculating absolute temperatures, use - // the Fahrenheit[] or F[] functions below. - // - // Fahrenheit defined his temperature scale - // by setting 0 to the coldest temperature - // he could produce and by setting 96 degrees - // to body heat (for reasons unknown). - - -//\u2109 := degfahrenheit // Single Unicode codepoint for - // DEGREE FAHRENHEIT - -degreesRankine := (5/9) K -degreesrankine := degreesRankine // The Rankine scale has the -degrankine := degreesRankine // Fahrenheit degree, but its zero -degreerankine := degrankine // is at absolute zero. -degR := degrankine -Rankine := degreesrankine - -degreaumur := (10/8) degC // The Reaumur scale was used in Europe and - // particularly in France. It is defined - // to be 0 at the freezing point of water - // and 80 at the boiling point. Reaumur - // apparently selected 80 because it is - // divisible by many numbers. - -// Function for converting Fahrenheit to/from standard units - -// This is a less legible version of the revised function below -Fahrenheit{x} := (x conforms K) ? ((x - zerocelsius) / K) * 9/5 + 32 : ((x conforms 1) ? ((x-32) * 5/9) K + zerocelsius : "Error") - -//Fahrenheit[x] := -//{ -// if (x conforms K) // If x is already a temperature, convert to F -// return ((x - zerocelsius) / K) * 9/5 + 32 -// else -// if (x conforms 1) // If x is a pure number, treat as Fahrenheit degrees -// return ((x-32) * 5/9) K + zerocelsius -// else -// return "Error" -//} - -// TODO: Change the implementation of the following idiom so that it aliases -// the function instead of chaining function calls. -F{x} := Fahrenheit[x] - -// Function for converting Celsius to/from standard units -Celsius{x} := (x conforms K) ? (x-zerocelsius) / K : ((x conforms 1) ? (x K + zerocelsius) : "Error") - -C{x} := Celsius[x] - -Reaumur{x} := (x conforms K) ? (8/10 (x-zerocelsius)) / K : ((x conforms 1) ? (10/8 * x * K + zerocelsius) : "Error") - -// Physical constants -// - -gravity := (980665/100000) m/s^2 // std acceleration of gravity - // (exact) -g_n := gravity -gee := gravity -gravities := gravity // Irregular plural -force := gravity // use to turn masses into forces - -// Various conventional values - -atm := 101325 Pa // Standard atmospheric pressure (exact) -atmosphere := atm -Hg := 13.5951 gram / cm^3 // Density of mercury (defined) -mercurydensity := Hg -water := gram / cm^3 // Standard density of water (defined) -H2O := water -wc := water // water column -mach := 331.46 m/s // speed of sound in dry air at STP -standardtemp := 273.15 K // standard temperature -stdtemp := standardtemp - -// Physico-chemical constants - -// Atomic mass unit is given by the 2002 CODATA value -// http://physics.nist.gov/cgi-bin/cuu/Value?u -atomicmassunit := 1.66053886e-27 kg // atomic mass unit - // error is +/- 28 in last 2 digits - // (defined to be 1/12 of the mass of - // carbon 12) - -m_u := atomicmassunit -u := atomicmassunit // 1/12 of the mass of carbon 12) -amu := atomicmassunit - -amu_chem := 1.66026e-27 kg // 1/16 of the weighted average mass of - // the 3 naturally occuring neutral - // isotopes of oxygen - -amu_phys := 1.65981e-27 kg // 1/16 of the mass of a neutral - // oxygen 16 atom - -dalton := u // Maybe this should be amu_chem? -avogadro := grams/(amu mol) // size of a mole -N_A := avogadro - -gasconstant := 8.314472 J / (mol K) // molar gas constant, 2006 CODATA - // value. Standard uncertainty is - // +/- 15 in last 2 digits - // http://physics.nist.gov/cgi-bin/cuu/Value?r - -R := gasconstant -boltzmann := R / N_A // Boltzmann's constant -boltzmannsconstant := boltzmann // Boltzmann's constant -k := boltzmann -molarvolume := mol R stdtemp / atm // Volume occupied by one mole of an - // ideal gas at STP. - -molar := mol / l // Unit of concentration (moles/liter) -Molar := molar // Sometimes capitalized - -molar ||| concentration_by_volume - -molal := mol / kg // Unit of concentration (moles/kg) - -molal ||| concentration_by_mass - -m^3/mol ||| molar_volume - -loschmidt := avogadro mol / molarvolume// Molecules per cubic meter of an - // ideal gas at STP. Loschmidt did - // work similar to Avogadro. -stefanboltzmann := 2 pi^5 k^4 / (15 h^3 c^2) // The radiant emittance by a - // blackbody -sigma := stefanboltzmann // at temperature T is given by - // sigma T^4. - -wiendisplacement := 2.8977685e-3 m K // Wien's Displacement Law gives the - // frequency at which the the Planck - // spectrum has maximum intensity. - // The relation is lambda T = b where - // lambda is wavelength, T is - // temperature and b is the Wien - // displacement. This relation is - // used to determine the temperature - // of stars. This is the 2002 - // CODATA value. Standard - // uncertainty is +/- 51 in last 2 - // digits. - -K_J := 2 electroncharge/h // Josephson Constant - // Direct measurement of the volt is difficult. Until - // recently, laboratories kept Weston cadmium cells as - // a reference, but they could drift. In 1987 the - // CGPM officially recommended the use of the - // Josephson effect as a laboratory representation of - // the volt. The Josephson effect occurs when two - // superconductors are separated by a thin insulating - // layer. A "supercurrent" flows across the insulator - // with a frequency that depends on the potential - // applied across the superconductors. This frequency - // can be very accurately measured. The Josephson - // constant K_J, which is equal to 2e/h, relates the - // measured frequency to the potential. The value - // given here is the officially specified value for - // use beginning in 1990. The 1998 recommended value - // of the constant is 483597.898 GHz/V. - -R_K := h/electroncharge^2 - // Measurement of the ohm also presents difficulties. - // The old approach involved maintaining resistances - // that were subject to drift. The new standard is - // based on the Hall effect. When a current carrying - // ribbon is placed in a magnetic field, a potential - // difference develops across the ribbon. The ratio - // of the potential difference to the current is - // called the Hall resistance. Klaus von Klitzing - // discovered in 1980 that the Hall resistance varies - // in discrete jumps when the magnetic field is very - // large and the temperature very low. This enables - // accurate realization of the resistance h/e^2 in the - // lab. This is approximately equal to 25812.807 ohms - - -// Density of mercury and water at different temperatures using the standard -// force of gravity. - -// Hg10C := 13.5708 gram / cm^3 // These units, when used to form -// Hg20C := 13.5462 gram / cm^3 // pressure measures, are not accurate -// Hg23C := 13.5386 gram / cm^3 // because of considerations of the -// Hg30C := 13.5217 gram / cm^3 // revised practical temperature scale. -// Hg40C := 13.4973 gram / cm^3 -// Hg60F := 13.5574 gram / cm^3 -// H2O0C := 0.99987 gram / cm^3 -// H2O5C := 0.99999 gram / cm^3 -// H2O10C := 0.99973 gram / cm^3 -// H2O15C := 0.99913 gram / cm^3 -// H2O18C := 0.99862 gram / cm^3 -// H2O20C := 0.99823 gram / cm^3 -// H2O25C := 0.99707 gram / cm^3 -// H2O50C := 0.98807 gram / cm^3 -// H2O100C := 0.95838 gram / cm^3 - - -// Masses of elementary particles, as given by 2002 CODATA-recommended values. -// http://physics.nist.gov/cuu/Constants/index.html - -electronmass := 9.1093826e-31 kg // +/- 16 in last 2 digits -m_e := electronmass - -protonmass := 1.67262171e-27 kg // +/- 27 in last 2 digits -m_p := protonmass - -neutronmass := 1.67492728e-27 kg // +/- 29 in last 2 digits -m_n := neutronmass - -muonmass := 1.88353140e-28 kg // +/- 33 in last 2 digits -m_mu := muonmass -m_muon := muonmass - -deuteronmass := 3.34358335e-27 kg // +/- 57 in last 2 digits -m_d := deuteronmass - -alphaparticlemass := 6.6446565e-27 kg // +/- 11 in last 2 digits -m_alpha := alphaparticlemass - -taumass := 3.16777e-27 kg // +/- 52 in last 2 digits -m_tau := taumass - - -// Atomic constants - -alpha := 7.297352568e-3 // 2002 CODATA value - // http://physics.nist.gov/cgi-bin/cuu/Value?alph - // Standard uncertainty is +/- 24 in the last 2 - // decimal places. - // This can also be given by: - // mu0 c electroncharge^2 / (2 h) - // The fine structure constant was - // introduced to explain fine - // structure visible in spectral - // lines. -finestructureconstant := alpha - -// Rydberg constant -Rydberg_constant := 10973731.568525 m^-1 // 2002 CODATA value - // http://physics.nist.gov/cgi-bin/cuu/Value?ryd - // The standard uncertainty is +/- 73 in the last 2 decimal places. - -Rinfinity := Rydberg_constant //m_e c alpha^2 / (2 h) - - // The wavelengths of a spectral series -R_H := 10967760 /m // can be expressed as - // 1/lambda = R (1/m^2 - 1/n^2). - // where R is a number that various - // slightly from element to element. - // For hydrogen, R_H is the value, - // and for heavy elements, the value - // approaches Rinfinity. - -bohrradius := alpha / (4 pi Rinfinity) - -// Planck constants - -planckmass := (hbar c / G)^(1/2) -m_P := planckmass -plancktime := hbar / (planckmass c^2) -t_P := plancktime -plancklength := plancktime c -l_P := plancklength - -// particle wavelengths: the compton wavelength of a particle is -// defined as h / m c where m is the mass of the particle. - -electronwavelength := h / (m_e c) -lambda_C := electronwavelength -Comptonwavelength := electronwavelength - -protonwavelength := h / (m_p c) -lambda_C_p := protonwavelength -neutronwavelength := h / (m_n c) -lambda_C_n := neutronwavelength - - -// Magnetic moments - -bohrmagneton := electroncharge hbar / (2 electronmass) -mu_B := bohrmagneton -nuclearmagneton := electroncharge hbar / (2 protonmass) -mu_N := nuclearmagneton - - -// Values below are from 2002 CODATA values - -muonmagneticmoment := -4.49044799e-26 J/T // +/- 40 in last 2 digits -mu_mu := muonmagneticmoment - -protonmagneticmoment := 1.41060671e-26 J/T // +/- 12 in last 2 digits -mu_p := protonmagneticmoment - -electronmagneticmoment:= -928.476412e-26 J/T // +/- 80 in last 2 digits -mu_e := electronmagneticmoment - -neutronmagneticmoment := -0.96623645e-26 J/T // +/- 24 in last 2 digits -mu_n := neutronmagneticmoment - -deuteronmagneticmoment := 0.433073482e-26 J/T // +/- 38 in last 2 digits -mu_d := deuteronmagneticmoment - - -// -// United States units -// - -// linear measure - -// The US Metric Law of 1866 gave the exact relation 1 meter = 39.37 inches. -// From 1893 until 1959, the foot was exactly 1200/3937 meters. In 1959 -// the definition was changed to bring the US into agreement with other -// countries. Since then, the foot has been exactly 0.3048 meters. At the -// same time it was decided that any data expressed in feet derived from -// geodetic surveys within the US would continue to use the old definition. - -inch := 254/100 cm -inches := inch -foot := 12 inch -feet := foot -ft := foot -survey ::- 1200/3937 m/ft // Ratio to give survey length -geodetic ::- survey -statute ::- survey -int :- 3937/1200 ft/m // Convert US Survey measures to - // international measures - -inches := inch // Wacky plural -in := inch -yard := 3 ft -yards := yard -yd := yard -mile := 5280 ft -miles := mile - -line := 1/12 inch // Also defined as '.1 in' or as '1e-8 Wb' -rod := 11/2 surveyyard -rd := rod -perch := rod -furlong := 40 rod // From "furrow long" -statutemile := statute mile -league := 3 statute mile - -// Calories: energy to raise a gram of water one degree celsius - -cal_IT := 41868/10000 J // International Table calorie -cal_th := 4184/1000 J // Thermochemical calorie -cal_fifteen := 4.18580 J // Energy to go from 14.5 to 15.5 degC -cal_twenty := 4.18190 J // Energy to go from 19.5 to 20.5 degC -cal_mean := 4.19002 J // 1/100 energy to go from 0 to 100 degC -calorie := cal_IT -cal := calorie -calorie_IT := cal_IT -thermcalorie := cal_th -calorie_th := thermcalorie -Calorie := kilocalorie // the food Calorie -thermie := 1ee6 cal_fifteen// Heat required to raise the - // temperature of a tonne of - // water from 14.5 to 15.5 degC. - -// -// Units derived from physical constants -// - -inHg := inch gravity Hg // Inches of mercury -inH2O := inch gravity water -inchmercury := inHg -inchesmercury := inHg // Irregular plural -mmH2O := mm gravity water -mmHg := mm gravity Hg - -kgf := kg gravity -technicalatmosphere := kgf / cm^2 -at := technicalatmosphere -hyl := kgf s^2 / m // Also gram-force s^2/m according to [15] -torr := 101325/760 Pa // Exactly defined. Differs from mmHg by - // about 1 part in 7 million. -Torr := torr // Accepted symbol is Torr - // These units, both named after Evangelista -tor := Pa // Torricelli, should not be confused. - // Acording to [15] the torr is actually - // atm/760 which is slightly different. - -eV := electroncharge V // Energy acquired by a particle with charge e -electronvolt := eV // when it is accelerated through 1 V -lightyear := c 365.25 day // The 365.25 day year is specified in - // NIST publication 811 -ly := lightyear -lightsecond := c s -lightminute := c min -parsec := au radian / arcsec // Unit of length equal to distance -pc := parsec // from the sun to a point having - // heliocentric parallax of 1 - // arcsec (derived from parallax - // second) The formula should use - // tangent, but the error is about - // 1e-12. -rydberg := h c Rinfinity // Rydberg energy -crith := 0.089885 gram // The crith is the mass of one - // liter of hydrogen at standard - // temperature and pressure. -amagatvolume := molarvolume -amagat := mol/amagatvolume // Used to measure gas densities -lorentz := bohrmagneton / (h c)// Used to measure the extent - // that the frequency of light - // is shifted by a magnetic field. -cminv := h c / cm // Unit of energy used in infrared -invcm := cminv // spectroscopy. -wavenumber := cminv -kcal_mol := kcal / (mol N_A) // kcal/mol is used as a unit of - // energy by physical chemists. -// -// CGS system based on centimeter, gram and second -// - -dyne := cm gram / s^2 // force -dyn := dyne -erg := cm dyne // energy -poise := gram / (cm s) // viscosity, honors Jean Poiseuille -P := poise -poise ||| viscosity - -rhe := poise^-1 // reciprocal viscosity -rhe ||| reciprocal_viscosity - -stokes := cm^2 / s // kinematic viscosity -St := stokes -stokes ||| kinematic_viscosity -stoke := stokes -lentor := stokes // old name -Gal := cm / s^2 // acceleration, used in geophysics -galileo := Gal // for earth's gravitational field - // (note that "gal" is for gallon - // but "Gal" is the standard symbol - // for the gal which is evidently a - // shortened form of "galileo".) -barye := dyne/cm^2 // pressure -barad := barye // old name -kayser := 1/cm // Proposed as a unit for wavenumber -balmer := kayser // Even less common name than "kayser" -kine := cm/s // velocity -bole := g cm / s // momentum -pond := gram force -glug := gram force s^2 / cm// Mass which is accelerated at - // 1 cm/s^2 by 1 gram force -darcy := centipoise cm^2 /(s atm)// Measures permeability to fluid flow. - // One darcy is the permeability of a - // medium that allows a flow of cc/s of - // a liquid of centipoise viscosity - // under a pressure gradient of atm/cm. -mohm := cm / (dyn s) // mobile ohm, measure of mechanical -mobileohm := mohm // mobility -mechanicalohm := dyn s / cm // mechanical resistance -acousticalohm := dyn s / cm^5 // ratio of the sound pressure of - // 1 dyn/cm^2 to a source of strength - // 1 cm^3/s - -ray := acousticalohm -rayl := dyn s / cm^3 // Specific acoustical resistance -eotvos := 1ee-9 Gal/cm // Change in gravitational acceleration - // over horizontal distance - -// Electromagnetic units derived from the abampere - -abampere := 10 A // Current which produces a force of -abamp := abampere // 2 dyne/cm between two infinitely -aA := abampere // long wires that are 1 cm apart -biot := aA // alternative name for abamp -Bi := biot -abcoulomb := abamp sec -abcoul := abcoulomb -abvolt := dyne cm / (abamp sec) -abfarad := abampere sec / abvolt -abhenry := abvolt sec / abamp -abohm := abvolt / abamp -abmho := abohm^-1 -gauss := abvolt sec / cm^2 -Gs := gauss -maxwell := abvolt sec // Also called the "line" -Mx := maxwell -oersted := gauss / mu0 -Oe := oersted -gilbert := gauss cm / mu0 -Gb := gilbert -Gi := gilbert -unitpole := 4 pi maxwell - -// Gaussian system: electromagnetic units derived from statampere. -// -// Note that the Gaussian units are often used in such a way that Coulomb's law -// has the form F= q1 * q2 / r^2. The constant 1/(4*pi*epsilon0) -// is incorporated -// into the units. From this, we can get the relation force=charge^2/dist^2. -// This means that the simplification esu^2 = dyne cm^2 can be used to simplify -// units in the Gaussian system, with the curious result that capacitance can -// be measured in cm, resistance in sec/cm, and inductance in sec^2/cm. These -// units are given the names statfarad, statohm and stathenry below. - -statampere := 10 A cm / (s c) -statamp := statampere -statvolt := dyne cm / (statamp sec) -statcoulomb := statamp s -esu := statcoulomb -statcoul := statcoulomb -statfarad := statamp sec / statvolt -cmcapacitance := statfarad -stathenry := statvolt sec / statamp -statohm := statvolt / statamp -statmho := statohm^-1 -statmaxwell := statvolt sec -franklin := statcoulomb -debye := 1ee-18 statcoul cm// unit of electrical dipole moment -debye ||| electrical_dipole_moment -helmholtz := debye/angstrom^2 // Dipole moment per area -jar := 1000 statfarad // approx capacitance of Leyden jar - -// -// Some historical eletromagnetic units -// - -intampere := 0.999835 A // Defined as the current which in one -intamp := intampere // second deposits .001118 gram of - // silver from an aqueous solution of - // silver nitrate. -intfarad := 0.999505 F -intvolt := 1.00033 V -intohm := 1.000495 ohm // Defined as the resistance of a - // uniform column of mercury containing - // 14.4521 gram in a column 1.063 m - // long and maintained at 0 degC. -daniell := 1.042 V // Meant to be electromotive force of a - // Daniell cell, but in error by .04 V -faraday := N_A electroncharge mol // Charge that must flow to deposit or -faraday_phys := 96521.9 C // liberate one gram equivalent of any -faraday_chem := 96495.7 C // element. (The chemical and physical - // values are off slightly from what is - // obtained by multiplying by amu_chem - // or amu_phys. These values are from - // a 1991 NIST publication.) Note that - // there is a Faraday constant which is - // equal to N_A e and hence has units of - // C/mol. -kappline := 6000 maxwell // Named by and for Gisbert Kapp -siemensunit := 0.9534 ohm // Resistance of a meter long column of - // mercury with a 1 mm cross section. - -// -// Photometric units -// - -candle := 1.02 candela // Standard unit for luminous intensity -hefnerunit := 0.9 candle // in use before candela -hefnercandle := hefnerunit // -violle := 20.17 cd // luminous intensity of 1 cm^2 of - // platinum at its temperature of - // solidification (2045 K) - -lumen := cd sr // Luminous flux -lm := lumen // - -talbot := lumen s // Luminous energy -lumberg := talbot -talbot ||| luminous_energy - -m^-2 cd sr ||| illuminance -lux := lm/m^2 // Illuminance or exitance (luminous -lx := lux // flux incident on or coming from -phot := lumen / cm^2 // a surface) -ph := phot // -footcandle := lumen/ft^2 // Illuminance from a 1 candela source - // at a distance of one foot -metercandle := lumen/m^2 // Illuminance from a 1 candela source - // at a distance of one meter - -mcs := metercandle s// luminous energy per area, used to - // measure photographic exposure - -// Luminance measures - -nit := cd/m^2 // Luminance: the intensity per projected -stilb := cd / cm^2 // area of an extended luminous source. -sb := stilb // (nit is from latin nitere = to shine.) - -apostilb := cd/(pi m^2) -asb := apostilb -blondel := apostilb // Named after a French scientist. -nox := 1ee-3 lux // These two units were proposed for -skot := 1ee-3 apostilb// measurements relating to dark adapted - // eyes. - -// Equivalent luminance measures. These units are units which measure -// the luminance of a surface with a specified exitance which obeys -// Lambert's law. (Lambert's law specifies that luminous intensity of -// a perfectly diffuse luminous surface is proportional to the cosine -// of the angle at which you view the luminous surface.) - -equivalentlux := cd / (pi m^2) // luminance of a 1 lux surface -equivalentphot := cd / (pi cm^2) // luminance of a 1 phot surface -lambert := cd / (pi cm^2) -footlambert := cd / (pi ft^2) - -// Some luminance data from the IES Lighting Handbook, 8th ed, 1993 - -sunlum := 1.6e9 cd/m^2 // at zenith -sunillum := 100e3 lux // clear sky -sunillum_o := 10e3 lux // overcast sky -sunlum_h := 6e6 cd/m^2 // value at horizon -skylum := 8000 cd/m^2 // average, clear sky -skylum_o := 2000 cd/m^2 // average, overcast sky -moonlum := 2500 cd/m^2 - -// -// Astronomical time measurements -// - -anomalisticyear := 365.2596 days // The time between successive - // perihelion passages of the - // earth. -siderealyear := 365.256360417 day // The time for the earth to make - // one revolution around the sun - // relative to the stars. -tropicalyear := 365.242198781 day // The mean interval between vernal - // equinoxes. Differs from the - // sidereal year by 1 part in - // 26000 due to precession of the - // earth about its rotational axis - // combined with precession of the - // perihelion of the earth's - // orbit. -gaussianyear := 365.2690 days // The orbital period of a body in - // circular orbit at a distance of - // 1 au from the sun. Calculated - // from Kepler's third law. -siderealday := 23.934469444 hour // The sidereal day is the interval -siderealhour := 1/24 siderealday // between two successive transits -siderealminute := 1/60 siderealhour // of a star over the meridian, -siderealsecond := 1/60 siderealminute// or the time required for the - // earth to make one rotation - // relative to the stars. The - // more usual solar day is the - // time required to make a - // rotation relative to the sun. - // Because the earth moves in its - // orbit, it has to turn a bit - // extra to face the sun again, - // hence the solar day is slightly - // longer. -anomalisticmonth := 27.55454977 day // Time from perigee to perigee -nodicalmonth := 27.2122199 day // The nodes are the points where -draconicmonth := nodicalmonth // an orbit crosses the ecliptic. -draconiticmonth := nodicalmonth // This is the time required to - // travel from the ascending node - // to the next ascending node. -siderealmonth := 27.321661 day // Time required for the moon to - // orbit the earth -lunarmonth := 29.5305555 day // Time between full moons. Full -synodicmonth := lunarmonth // moon occur when the sun and -lunation := synodicmonth // moon are on opposite sides of -lune := 1/30 lunation // the earth. Since the earth -lunour := 1/24 lune // moves around the sun, the moon - // has to revolve a bit farther to - // get into the full moon - // configuration. -year := tropicalyear -yr := year -years := year - -month := 1/12 year // This is obviously an average for the - // limiting case... so is accurate in the - // long term but useless for adding an - // offset to a specific date. - -mo := month -decade := 10 years -century := 100 years -centuries := century // Irregular plural -millennium := 1000 years -millennia := millennium -solaryear := year -lunaryear := 12 lunarmonth -calendaryear := 365 day -commonyear := 365 day -leapyear := 366 day -julianyear := 365.25 day -juliancentury := 36525 day -juliancenturies := 36525 day -gregorianyear := 365.2425 day -islamicyear := 354 day // A year of 12 lunar months. They -islamicleapyear := 355 day // began counting on July 16, AD 622 - // when Muhammad emigrated to Medina - // (the year of the Hegira). They need - // 11 leap days in 30 years to stay in - // sync with the lunar year which is a - // bit longer than the 29.5 days of the - // average month. -islamicmonth := 1/12 islamicyear// They have 29 day and 30 day months. -cron := 1ee6 years -lustrum := 5 years // The Lustrum was a Roman - // purification ceremony that took - // place every five years. - // Classically educated Englishmen - // used this term. - -// The following are sidereal days unless otherwise noted - -mercuryday := 58.6462 day -venusday := 243.01 day // retrograde -earthday := siderealday -marssiderealday := 24 hours + 37 min + 22.663 sec -marsday := marssiderealday -marssolarday := 24 hours + 39 min + 35.24409 sec -jupiterday := 0.41354 day -saturnday := 0.4375 day -uranusday := 0.65 day // retrograde -neptuneday := 0.768 day -plutoday := 6.3867 day - -// Solar days - -// Planetary sidereal years - -mercuryyear := 86.96 day -venusyear := 224.68 day -earthyear := siderealyear -marsyear := 686.95 day -jupiteryear := 11.862 tropicalyear -saturnyear := 29.458 tropicalyear -uranusyear := 84.012 tropicalyear -neptuneyear := 164.798 tropicalyear -plutoyear := 248.5 tropicalyear - -// -// Some other astronomical values -// - -sunmass := 1.9891e30 kg -sunradius := 6.96e8 m -sunpower := 3.86e26 watts - -landarea := 148.847e6 km^2 -oceanarea := 361.254e6 km^2 - -moonmass := 7.3483e22 kg -moonradius := 1738 km // mean value - -// Distances -sundist := 1.0000010178 au// mean earth-sun distance -sundist_near := 1.471e11 m // earth-sun distance at perihelion -sundist_far := 1.521e11 m // earth-sun distance at aphelion - -// Average distances between planets and the sun. -mercurydist := 57910. Mm -venusdist := 108200. Mm -earthdist := sundist -marsdist := 227940. Mm -jupiterdist := 778330. Mm -saturndist := 1429400. Mm -uranusdist := 2870990. Mm -neptunedist := 4497070. Mm -plutodist := 5913520. Mm - -moondist := 384400. km // mean earth-moon distance - -mercurymass := 0.33022e24 kg -venusmass := 4.8690e24 kg -marsmass := 0.64191e24 kg -earthmass := 5.9742e24 kg -jupitermass := 1898.8e24 kg -saturnmass := 568.5e24 kg -uranusmass := 86.625e24 kg -neptunemass := 102.78e24 kg -plutomass := 0.0127e24 kg - -mercuryradius := 2439. km -venusradius := 6052. km -marsradius := 3397. km -earthradius := 6371.01 km // mean +/- 0.02 km -jupiterradius := 71492. km -saturnradius := 60268. km -uranusradius := 25559. km -neptuneradius := 24764. km -plutoradius := 1137. km - -// These use the WGS84 datum, which is currently most commonly used -// in mapping. -earthradius_equatorial := 6378137. m -earthradius_polar := 6356752.3142 m -earth_flattening := (earthradius_equatorial-earthradius_polar)/earthradius_equatorial - // http://www.uwgb.edu/dutchs/UsefulData/UTMFormulas.HTM - // http://ssd.jpl.nasa.gov/phys_props_earth.html - -// Larger moons... their distances are the average distances from their planet. - -// Mars -phobosdist := 9378.5 km -phobosmass := 1.08e16 kg - -deimosdist := 23458. km -deimosmass := 1.8e15 kg - -// Jupiter -iodist := 422000. km -ioradius := 1815. km -iomass := 8.93e22 kg - -europadist := 670900. km -europaradius := 1569. km -europamass := 4.80e22 kg - -ganymededist := 1070000. km -ganymederadius := 2631. km -ganymedemass := 1.48e23 kg - -callistodist := 1883000. km -callistoradius := 2400. km -callistomass := 1.08e23 kg - -// Saturn -titandist := 1221850. km -titanradius := 2575. km -titanmass := 1.35e23 kg - -// Pluto -charondist := 19640. km -charonradius := 586. km -charonmass := 1.90e21 kg - -moongravity := 1.62 m/s^2 - -// General cosmological observations -hubbleconstant := 71 km/s/megaparsec // WMAP data, +0.04/-0.03 (factor) -H_0 := hubbleconstant - -atomicmass := electronmass -atomiccharge := electroncharge -atomicaction := hbar - - -// Inverse time units -annually := 1/year -annual := annually -yearly := annual -daily := 1/day -weekly := 1/week -monthly := 1/month -hourly := 1/hour - - -// Perfect intervals - -octave := 2 -majorthird := 5/4 -minorthird := 6/5 -musicalfourth := 4/3 -musicalfifth := 3/2 -majorsecond := musicalfifth^2 / octave -majorsixth := musicalfourth majorthird -minorsixth := musicalfourth minorthird -majorseventh := musicalfifth majorthird -minorseventh := musicalfifth minorthird - -pythagoreanthird := majorsecond musicalfifth^2 / octave -syntoniccomma := pythagoreanthird / majorthird -pythagoreancomma := musicalfifth^12 / octave^7 - -// Equal tempered definitions - -semitone := octave^(1/12) - - -// -// The Hartree system of atomic units, derived from fundamental units -// of mass (of electron), action (planck's constant), charge, and -// the coulomb constant. - -// Fundamental units -// derived units (Warning: accuracy is lost from deriving them this way) - -atomiclength := bohrradius -atomictime := hbar^3/(coulombconst^2 atomicmass electroncharge^4) - // Period of first Bohr orbit -atomicvelocity := atomiclength / atomictime -atomicenergy := hbar / atomictime -hartree := atomicenergy -Hartree := hartree - -// -// These thermal units treat entropy as charge, from [5] -// - -thermalcoulomb := J/K // entropy -thermalampere := W/K // entropy flow -thermalfarad := J/K^2 -thermalohm := K^2/W // thermal resistance -fourier := thermalohm -thermalhenry := J K^2/W^2 // thermal inductance -thermalvolt := K // thermal potential difference - - - -// surveyor's measure - -surveyorschain := 66 surveyft -surveyorspole := 1/4 surveyorschain -surveyorslink := 1/100 surveyorschain -chain := surveyorschain -surveychain := chain -ch := chain -link := surveyorslink -acre := 43560 surveyfoot^2 // NIST Handbook 44 has a - // typographical error (forgetting - // to underline feet in one place - // on middle of page C-16 in 2003 - // edition) with - // respect to this, but it's - // clear from corroborating - // different figures in that - // document and NIST Special - // Publication 811, Sec. B.6, - // that the survey foot is - // the proper definition. Have - // filed errata with NIST and - // requested confirmation. - // 2003-08-27 - -intacre := 43560 ft^2 // Acre based on international ft -acrefoot := acre surveyfoot -acrefeet := acrefoot // Irregular plural -section := surveymile^2 -township := 36 section -homestead := 160 acre // Area of land granted by the 1862 Homestead - // Act of the United States Congress -gunterschain := surveyorschain - -engineerschain := 100 ft -engineerslink := 1/100 engineerschain -ramsdenschain := engineerschain -ramsdenslink := engineerslink - - -// nautical measure - -fathom := 6 surveyft // Originally defined as the distance from - // fingertip to fingertip with arms fully - // extended. -fathoms := fathom -nauticalmile := 1852 m // Supposed to be one minute of latitude at - // the equator. That value is about 1855 m. - // Early estimates of the earth's circumference - // were a bit off. The value of 1852 m was - // made the international standard in 1929. - // The US did not accept this value until - // July 1, 1954. The UK switched in 1970. - // The value of this unit was adopted by the - // First International Extraordinary - // Hydrographic Conference, Monaco, 1929, - // under the name "International nautical mile." - -oldUSnauticalmile := 6080.20 feet // Used in U.S. before July 1, 1954 -oldUSknot := oldUSnauticalmile / hour - -cable := 720 surveyfoot // NIST Handbook 44, 2003 Appendix C -cablelength := cable -cableslength := cable - -metriccable := 200 m // Used by France and Spain - -navycablelength := 720 surveyft -marineleague := 3 nauticalmile -knot := nauticalmile / hr -shackle := 15 fathoms // Adopted 1949 by British navy -oldUKRNshackle := 12.5 fathoms // Used by Royal Navy until 1949 -watch := 4 hours // time a sentry stands watch or a ship's - // crew is on duty. -bell := 1/8 watch // Bell would be sounded every 30 minutes. - -datamile := 6000 feet // Defined by U.S. Department of Defense - // as a unit used in radar measurements. - -// Avoirdupois weight -// These are actually defined as mass units to follow the recommendations -// of the SI. - -pound := 45359237/100000000 kg // Defined exactly -pounds := pound - -lb := pound // From the latin libra -lbs := pound -grain := 1/7000 pound // The grain is the same in all three - // weight systems. It was originally - // defined as the weight of a barley - // corn taken from the middle of the - // ear. -gr := grain -ounce := 1/16 pound -oz := ounce -dram := 1/16 ounce -drams := dram -dr := dram -hundredweight := 100 pounds // This is the USA hundredweight -cwt := hundredweight -shorthundredweight := hundredweight -ton := 2000 lb -shortton := ton -shortquarter := 1/4 shortton - - -// Troy Weight. In 1828 the troy pound was made the first United States -// standard weight. It was to be used to regulate coinage. - -troypound := 5760 grain -troyounce := 1/12 troypound -ozt := troyounce -pennyweight := 1/20 troyounce // Abbreviated "d" in reference to a -dwt := pennyweight // Frankish coin called the "denier" - // minted in the late 700's. There - // were 240 deniers to the pound. -assayton := mg ton / troyounce // mg / assayton = troyounce / ton - -// Some other jewelers units - -metriccarat := 2/10 gram -metricgrain := 50 mg -carat := metriccarat -ct := carat -jewelerspoint := 1/100 carat -silversmithpoint := 1/4000 inch - - -// Apothecaries' weight - -appound := troypound -apounce := troyounce -apdram := 1/8 apounce -scruple := 1/3 apdram - -// Liquid measure - -gallon := 231 in^3 -gallons := gallon -gal := gallon -quart := 1/4 gallon -quarts := quart -qt := quart -pint := 1/2 qt -pints := pint -pt := pint -gill := 1/4 pint -gills := gill -fluidounce := 1/16 pint -fluidounces := fluidounce -floz := fluidounce -fluiddram := 1/8 floz -fluiddrams := fluiddram -fldr := fluiddram -minim := 1/60 fldr -liquidbarrel := 31.5 gallon -petroleumbarrel := 42 gallon // Originated in Pennsylvania oil - // fields, from the winetierce -barrel := petroleumbarrel -oilbarrel := petroleumbarrel -bbl := barrel -hogshead := 63 gallon -firkin := 9 gallon - -// Dry measures: The Winchester Bushel was defined by William III in 1702 and -// legally adopted in the US in 1836. - -drybarrel := 7056 in^3 -bushel := 2150.42 in^3 // Volume of 8 inch cylinder with 18.5 -bushels := bushel -bu := bushel // inch diameter (rounded) -peck := 1/4 bushel -pecks := peck -pk := peck -drygallon := 1/2 peck -dryquart := 1/4 drygallon -drypint := 1/2 dryquart - -// Grain measures. The bushel as it is used by farmers in the USA is actually -// a measure of mass which varies for different commodities. Canada uses the -// same bushel masses for most commodities, but not for oats. - -wheatbushel := 60 lb -soybeanbushel := 60 lb -cornbushel := 56 lb -ryebushel := 56 lb -barleybushel := 48 lb -oatbushel := 32 lb -ricebushel := 45 lb -canada_oatbushel := 34 lb - -// Wine and Spirits measure - -pony := 1 floz -jigger := 1.5 floz // Can vary between 1 and 2 floz -shot := jigger // Sometimes 1 floz -eushot := 20 ml // EU standard spirits measure - // See http://bundesrecht.juris.de/eo_1988/anhang_c_119.html -fifth := 1/5 gallon -winebottle := 750 ml // US industry standard, 1979 -winesplit := 1/4 winebottle -wineglass := 4 floz -magnum := 1.5 liter // Standardized in 1979, but given - // as 2 qt in some references -metrictenth := 375 ml -metricfifth := 750 ml -metricquart := 1 liter - -// French champagne bottle sizes - -split := 200 ml -jeroboam := 2 magnum -rehoboam := 3 magnum -methuselah := 4 magnum -salmanazar := 6 magnum -balthazar := 8 magnum -nebuchadnezzar := 10 magnum - -// Shoe measures - -shoeiron := 1/48 inch // Used to measure leather in soles -shoeounce := 1/64 inch // Used to measure non-sole shoe leather - -// -// USA slang units -// - -buck := dollar -fin := 5 dollar -sawbuck := 10 dollar -key := kg // usually of marijuana, 60's -lid := 1 oz // Another 60's weed unit -footballfield := 100 yards -marathon := 26 miles + 385 yards - -// -// British -// - -british :- 1200000/3937014 m/ft // The UK lengths were defined by - // a bronze bar manufactured in - // 1844. Measurement of that bar - // revealed the dimensions given - // here. - -// Old nautical definitions -// See: http://www.hemyockcastle.co.uk/nautical.htm -oldbrnauticalmile := 6080 ft // Used until 1970 when the UK -oldbrknot := oldbrnauticalmile / hr // switched to the international -oldbrcable := 1/10 oldbrnauticalmile // nautical mile. -geographicalmile := oldbrnauticalmile -admiraltymile := oldbrnauticalmile -admiraltyknot := oldbrknot -admiraltycable := oldbrcable -seamile := 6000 ft -cablet := 120 fathoms -hawserlaidcable := 130 fathoms - -oldrussiancable := 100 fathoms -oldhollandcable := 123 fathoms -oldportugalcable:= 141 fathoms - -// British Imperial weight is mostly the same as US weight. A few extra -// units are added here. - -clove := 7 lb -stone := 14 lb -brhundredweight := 8 stone -brquartermass := 1/4 brhundredweight -longhundredweight := brhundredweight -longton := 20 brhundredweight -brton := longton -brassayton := mg brton / troyounce - -// British Imperial volume measures - -brgallon := 454609/100000 l // The British Imperial gallon was -canadiangallon := brgallon // defined in 1824 to be the volume of -cangallon := brgallon // water which weighed 10 pounds at 62 - // deg F with a pressure of 30 inHg. - // In 1963 it was defined to be the space - // occupied by 10 pounds of distilled - // water of density 0.998859 g/ml weighed - // in air of density 0.001217 g/ml - // against weights of density 8.136 g/ml. - // The value given here is given by [1] - // as an exact value. -imperialgallon := brgallon -brquart := 1/4 brgallon -imperialquart := brquart -brpint := 1/2 brquart -imperialpint := brpint -brfloz := 1/20 brpint // Note difference in definition -imperialfloz := brfloz -brdram := 1/8 brfloz -imperialdram := brdram -brminim := 1/60 brdram -imperialminim := brminim -brscruple := 1/3 brdram -imperialscruple := brscruple -fluidscruple := brscruple -brfluidounce := brfloz -imperialfluidounce := brfloz -brgill := 1/4 brpint -imperialgill := brgill -brpeck := 2 brgallon -imperialpeck := brpeck -brbarrel := 36 brgallon // Used for beer -imperialbarrel := brbarrel -brbushel := 4 brpeck -imperialbushel := brbushel -brheapedbushel := 1.278 brbushel -brquarter := 8 brbushel -brchaldron := 36 brbushel - -// Obscure British volume measures. These units are generally traditional -// measures whose definitions have fluctuated over the years. Often they -// depended on the quantity being measured. They are given here in terms of -// British Imperial measures. For example, the puncheon may have historically -// been defined relative to the wine gallon or beer gallon or ale gallon -// rather than the British Imperial gallon. - -bag := 4 brbushel -bucket := 4 brgallon -last := 40 brbushel -noggin := brgill -pottle := 1/2 brgallon -pin := 4.5 brgallon -puncheon := 72 brgallon -seam := 8 brbushel -coomb := 4 brbushel -boll := 6 brbushel -firlot := 1/4 boll -brfirkin := 9 brgallon // Used for ale and beer -cran := 37.5 brgallon // measures herring, about 750 fish -barrelbulk := 5 feet^3 -brhogshead := 63 brgallon -registerton := 100 ft^3 // Used for internal capacity of ships -shippington := 40 ft^3 // Used for ship's cargo freight or timber -brshippington := 42 ft^3 // -freightton := shippington// Both register ton and shipping ton derive - // from the "tun cask" of wine. -displacementton := 35 ft^3 // Approximate volume of a longton weight of - // sea water used to measure ship displacement -waterton := 224 brgallon -strike := 70.5 l // 16th century unit, sometimes - // defined as .5, 2, or 4 bushels - // depending on the location. It - // probably doesn't make a lot of - // sense to define in terms of imperial - // bushels. Zupko gives a value of - // 2 Winchester grain bushels or about - // 70.5 liters. - -// obscure British lengths - -barleycorn := 1/3 britishinch // Given in Realm of Measure as the - // difference between successive shoe sizes -nail := 1/16 britishyard // Originally the width of the thumbnail, - // or 1/16 ft. This took on the general - // meaning of 1/16 and settled on the - // nail of a yard or 1/16 yards as its - // final value. [12] -pole := 16.5 britishft -rope := 20 britishft -englishell := 45 britishinch -flemishell := 27 britishinch -ell := englishell // supposed to be measure from elbow to - // fingertips -span := 9 britishinch // supposed to be distance from thumb - // to pinky with full hand extension -goad := 4.5 britishft // used for cloth - -// misc obscure British units - -rood := 1/4 acre -englishcarat := 3.163 grain // Originally intended to be 4 grain - // but this value ended up being - // used in the London diamond market -mancus := 2 oz -mast := 2.5 lb -basebox := 31360 in^2 // Used in metal plating - -// alternate spellings - -metre := meter -gramme := gram -litre := liter -dioptre := diopter - -// -// Units derived the human body (may not be very accurate) -// - -geometricpace := 5 ft // distance between points where the same - // foot hits the ground -pace := 2.5 ft// distance between points where alternate - // feet touch the ground -USmilitarypace := 30 in // United States official military pace -USdoubletimepace := 36 in // United States official doubletime pace -fingerbreadth := 7/8 in// The finger is defined as either the width -fingerlength := 4.5 in// or length of the finger -finger := fingerbreadth -hand := 4 inch// width of hand -palmwidth := hand // The palm is a unit defined as either the width -palmlength := 8 in // or the length of the hand - -// -// Cooking measures -// - -// US measures - -cup := 8 floz -cups := cup -tablespoon := 1/16 cup -tablespoons := tablespoon -tbl := tablespoon -tbsp := tablespoon -Tbsp := tablespoon -Tsp := tablespoon -teaspoon := 1/3 tablespoon -tsp := teaspoon -metriccup := 250 ml - -// US can sizes. - -number1can := 10 floz -number2can := 19 floz -number2_5can := 3.5 cups -number3can := 4 cups -number5can := 7 cups -number10can := 105 floz - -// British measures - -brcup := 1/2 brpint -brteacup := 1/3 brpint -brtablespoon := 15 ml // Also 5/8 brfloz, approx 17.7 ml -brteaspoon := 1/3 brtablespoon // Also 1/4 brtablespoon -dessertspoon := 2 brteaspoon -brtsp := brteaspoon -brtbl := brtablespoon -dsp := dessertspoon - -// Australian - -australiatablespoon := 20 ml -austbl := australiatablespoon - -// Chinese -// Thai measurements are very similar so the name must be qualified -chinesecatty := 1/2 kg -oldchinesecatty := 4/3 lbs // Before metric conversion. -chinesetael := 1/16 oldchinesecatty -chinesemace := 1/10 chinesetael -oldchinesepicul := 100 oldchinesecatty -chinesepicul := 100 chinesecatty // Chinese usage - -// Thai weights -thaitical := 15 grams -thaibaht := thaitical // New name for thaitical, not to be confused with - // the Thai currency called "Thailand_baht". -thaisalung := 1/4 thaitical -thaifung := 1/2 thaisalung -thaisatang := 1/100 thaitical -thaisadtahng := thaisatang // Alternate transliteration -thaitamlung := 4 thaitical -thaicatty := 10 thaitamlung -thaichang := 2 thaicatty -thaihap := 50 thaichang -thaipicul := thaihap -thaikoyan := 20 thaipicul - - -// Japanese - -japancup := 200 ml - -jo := 71 inches * 35.5 inches // The area of a standard tatami mat. -tatamimat := jo - -tsubo := 2 jo // Used in agriculture - -// densities of cooking ingredients from The Cake Bible by Rose Levy Beranbaum -// so you can convert '2 cups sugar' to grams, for example, or in the other -// direction grams could be converted to 'cup flour_scooped'. - -butter := 8. oz/cup -butter_clarified := 6.8 oz/cup -cocoa_butter := 9. oz/cup -shortening := 6.75 oz/cup // vegetable shortening -stickbutter := 1/4 lb -vegetable_oil := 7.5 oz/cup -cakeflour_sifted := 3.5 oz/cup // The density of flour depends on the -cakeflour_spooned := 4. oz/cup // measuring method. "Scooped", or -cakeflour_scooped := 4.5 oz/cup // "dip and sweep" refers to dipping a -flour_sifted := 4. oz/cup // measure into a bin, and then sweeping -flour_spooned := 4.25 oz/cup // the excess off the top. "Spooned" -flour_scooped := 5. oz/cup // means to lightly spoon into a measure -breadflour_sifted := 4.25 oz/cup // and then sweep the top. Sifted means -breadflour_spooned := 4.5 oz/cup // sifting the flour directly into a -breadflour_scooped := 5.5 oz/cup // measure and then sweeping the top. -cornstarch := 120. grams/cup -dutchcocoa_sifted := 75. g/cup // These are for Dutch processed cocoa -dutchcocoa_spooned := 92. g/cup -dutchcocoa_scooped := 95. g/cup -cocoa_sifted := 75. g/cup // These are for nonalkalized cocoa -cocoa_spooned := 82. g/cup -cocoa_scooped := 95. g/cup -heavycream := 232. g/cup -milk := 242. g/cup -sourcream := 242. g/cup -molasses := 11.25 oz/cup -cornsyrup := 11.5 oz/cup -honey := 11.75 oz/cup -sugar := 200. g/cup -powdered_sugar := 4. oz/cup -brownsugar_light := 217. g/cup // packed -brownsugar_dark := 239. g/cup - -baking_powder := 4.6 grams / tsp -salt := 6 g / tsp -koshersalt := 2.8 g / tsp // Diamond Crystal salt, from package - // Note that Morton kosher salt is - // much denser. - -ethanol := .7893 g/cm^3 // Density of ethanol -alcohol := ethanol // For now, density of ethanol -methanol := .79130 g/cm^3 // Density of methanol - -// Egg weights and volumes for a USA large egg - -egg := 50. grams -eggwhite := 30. grams -eggyolk := 18.6 grams -eggvolume := 3. tablespoons + 1/2 tsp -eggwhitevolume := 2. tablespoons -eggyolkvolume := 3.5 tsp - - -// -// Units derived from imperial system -// - -ouncedal := oz ft / s^2 // force which accelerates an ounce - // at 1 ft/s^2 -poundal := lb ft / s^2 // same thing for a pound -tondal := ton ft / s^2 // and for a ton -pdl := poundal -psi := pound force / inch^2 -psia := psi // absolute pressure -tsi := ton force / inch^2 -reyn := psi sec -lbf := lb force -slug := lbf s^2 / ft -slugf := slug force -slinch := lbf s^2 / inch // Mass unit derived from inch second -slinchf := slinch force // pound-force system. Used in space - // applications where in/sec^2 was a - // natural acceleration measure. -geepound := slug -tonf := ton force -lbm := lb -kip := 1000 lbf // from kilopound -mil := 1/1000 inch -thou := 1/1000 inch -circularinch := 1/4 pi in^2 // area of a one-inch diameter circle -circularmil := 1/4 pi mil^2// area of one-mil diameter circle -cmil := circularmil -cental := 100 pound -centner := cental -caliber := 1/100 inch // for measuring bullets -duty := ft lbf -celo := ft / s^2 -jerk := ft / s^3 -australiapoint := 1/100 inch // The "point" is used to measure rainfall - // in Australia -sabin := ft^2 // Measure of sound absorption equal to the - // absorbing power of one square foot of - // a perfectly absorbing material. The - // sound absorptivity of an object is the - // area times a dimensionless - // absorptivity coefficient. -standardgauge := 4 ft + 8.5 in // Standard width between railroad track -flag := 5 ft^2 // Construction term referring to sidewalk. -rollwallpaper := 30 ft^2 // Area of roll of wall paper -fillpower := in^3 / ounce // Density of down at standard pressure. - // The best down has 750-800 fillpower. -pinlength := 1/16 inch // A//17 pin is 17/16 in long in the USA. -buttonline := 1/40 inch // The line was used in 19th century USA - // to measure width of buttons. -scoopnumber := quart^-1 // Ice cream scoops are labeled with a - // number specifying how many scoops - // fill a quart. -// -// Other units of work, energy, power, etc -// - - -// Btu definitions: energy to raise a pound of water 1 degF -// "Btu" is the correct capitalization. -Btu := cal lb degrankine / (gram K)// international table BTU -btu := Btu -BTU := btu -britishthermalunit := Btu -Btu_IT := Btu -btu_IT := Btu_IT -Btu_th := cal_th lb degrankine / (gram K) -btu_th := Btu_th -Btu_mean := cal_mean lb degrankine / (gram K) -btu_mean := Btu_mean -quad := quadrillion Btu - -ECtherm := 105506000 J // Exact definition, close to 1e5 Btu -UStherm := 105480400 J // Exact definition -therm := UStherm - -// The horsepower is supposedly the power of one horse pulling. Obviously -// different people had different horses. - -horsepower := 550 foot pound force / sec // Invented by James Watt -hp := horsepower -metrichorsepower := 75 kilogram force meter / sec -electrichorsepower := 746 W -boilerhorsepower := 9809.50 W -waterhorsepower := 746.043 W -brhorsepower := 745.70 W -donkeypower := 250 W -Wh := watt hour - -// Thermal insulance and conductivity. - -Rvalue := degrankine ft^2 hr / Btu // r-value, U.S. insulation figure -Cvalue := 1/Rvalue // C-value U.S. insulation conductance rating -kvalue := Btu in / (ft^2 hr degF) // k-value, insulation conductance/in thick -Uvalue := 1/Rvalue -europeanUvalue := watt / (m^2 K) -RSI := K m^2 / W // SI insulation figure - -// The following definitions are per NIST Special Publication 811: -// http://physics.nist.gov/Pubs/SP811/appenB9.html -W / (m K) ||| thermal_conductivity -m^2 K / W ||| thermal_insulance -K / W ||| thermal_resistance -m K / W ||| thermal_resistivity - -// Term not defined by SI, somewhat questionable. Used in building trade. -W / (m^2 K) ||| thermal_conductance - -// Defined by the BIPM, -// http://www.bipm.org/pdf/si-brochure.pdf -J/kg ||| specific_energy -W/m^2 ||| heat_flux_density -J/mol ||| molar_energy -J/(mol K) ||| molar_heat_capacity - - -// kvalue is defined as the amount of -// heat that will be transmitted through a one inch thick piece of -// homogenous material, one square foot in size, in one hour, when -// there is a one degree Fahrenheit temperature difference. -// -// Cvalue is the kvalue multiplied by the thickness in inches and thus -// gives the thermal conductance of a real piece of material with a given -// thickness. -// Rvalue is the reciprocal of this, and refers to the thermal insulance of a -// real piece of material of a given, concrete thickness. - -clo := 0.155 K m^2 / W// Supposed to be the insulance - // required to keep a resting person - // comfortable indoors. The value - // given is from NIST and the CRC, - // but [5] gives a slightly different - // value of 0.875 ft^2 degF hr / Btu. -// Misc other measures - -clausius := 1ee3 cal/K // A unit of physical entropy -langley := thermcalorie/cm^2 -poncelet := 100 kg force m / s -tonrefrigeration := ton 144 Btu / (lb day)// One ton refrigeration is - // the rate of heat extraction required - // turn one ton of water to ice in - // a day. Ice is defined to have a - // latent heat of 144 Btu/lb. - -tonsrefrigeration := tonrefrigeration // Irregular plural -tonref := tonrefrigeration -refrigeration := tonref / ton -frigorie := 1000 cal_fifteen// Used in refrigeration engineering. - - -// Energy in combustible fuels - -TNT := 4184000000 J/ton // So you can write tons TNT, this - // is a defined, not measured, value -PETN := 6.01e6 J/kg // An explosive compound, - // Pentaerythrite tetranitrate - // used in plastic explosive like Semtex -gasoline := 1.4e8 J/gallon // So you can convert energy - // to gallons gasoline -gasoline_density := 0.694 g / cm^3 //Density at 300K, according to, http://wiki.answers.com/Q/How_does_temperature_affect_the_density_of_gasoline_or_petrol -natural_gas := 1.09e6 J/foot^3 // Energy in natural gas -naturalgas := natural_gas -propane := 9.63e7 J/gallon // Energy in liquid propane -kerosene := 1.42e8 J/gallon // Energy in liquid kerosene -oil := 41.868 GJ/metricton -coal := 18.20 GJ/metricton - -// -// Permeability: The permeability or permeance, n, of a substance determines -// how fast vapor flows through the substance. The formula W = n A dP -// holds where W is the rate of flow (in mass/time), n is the permeability, -// A is the area of the flow path, and dP is the vapor pressure difference. -// -// Alan's Veto: These are damned, damned sketchy, and are going to go. - -// perm_0C := grain / (hr ft^2 inHg) -// perm_zero := perm_0C -// perm_0 := perm_0C -// perm := perm_0C -//perm_23C := grain / (hr ft^2 in-Hg23C) -//perm_twentythree := perm_23C - -// -// Counting measures -// - -unity := 1 -pair := 2 -couple := 2 -brace := 2 -nest := 3 -dickers := 10 -dozen := 12 -bakersdozen := 13 -score := 20 -flock := 40 -timer := 40 -shock := 60 -gross := 144 -greatgross := 12 gross - -// Paper counting measure - -shortquire := 24 -quire := 25 -shortream := 480 -ream := 500 -reams := ream -perfectream := 516 -bundle := 2 reams -bale := 5 bundle - -// -// Paper measures -// - -// USA paper sizes - -lettersize := 8.5 inch 11 inch -legalsize := 8.5 inch 14 inch -ledgersize := 11 inch 17 inch -executivesize := 7.25 inch 10.5 inch -Apaper := 8.5 inch 11 inch -Bpaper := 11 inch 17 inch -Cpaper := 17 inch 22 inch -Dpaper := 22 inch 34 inch -Epaper := 34 inch 44 inch - -// The metric paper sizes are defined so that if a sheet is cut in half -// along the short direction, the result is two sheets which are -// similar to the original sheet. This means that for any metric size, -// the long side is close to sqrt(2) times the length of the short -// side. Each series of sizes is generated by repeated cuts in half, -// with the values rounded down to the nearest millimeter. - -A0paper := 841 mm 1189 mm // The basic size in the A series -A1paper := 594 mm 841 mm // is defined to have an area of -A2paper := 420 mm 594 mm // one square meter. -A3paper := 297 mm 420 mm -A4paper := 210 mm 297 mm -A5paper := 148 mm 210 mm -A6paper := 105 mm 148 mm -A7paper := 74 mm 105 mm -A8paper := 52 mm 74 mm -A9paper := 37 mm 52 mm -A10paper := 26 mm 37 mm - -B0paper := 1000 mm 1414 mm // The basic B size has an area -B1paper := 707 mm 1000 mm // of sqrt(2) square meters. -B2paper := 500 mm 707 mm -B3paper := 353 mm 500 mm -B4paper := 250 mm 353 mm -B5paper := 176 mm 250 mm -B6paper := 125 mm 176 mm -B7paper := 88 mm 125 mm -B8paper := 62 mm 88 mm -B9paper := 44 mm 62 mm -B10paper := 31 mm 44 mm - -C0paper := 917 mm 1297 mm // The basic C size has an area -C1paper := 648 mm 917 mm // of sqrt(sqrt(2)) square meters. -C2paper := 458 mm 648 mm -C3paper := 324 mm 458 mm // Intended for envelope sizes -C4paper := 229 mm 324 mm -C5paper := 162 mm 229 mm -C6paper := 114 mm 162 mm -C7paper := 81 mm 114 mm -C8paper := 57 mm 81 mm -C9paper := 40 mm 57 mm -C10paper := 28 mm 40 mm - -// gsm (Grams per Square Meter), a sane, metric paper weight measure - -gsm := grams / meter^2 - -// In the USA, a collection of crazy historical paper measures are used. Paper -// is measured as a weight of a ream of that particular type of paper. This is -// sometimes called the "substance" or "basis" (as in "substance 20" paper). -// The standard sheet size or "basis size" varies depending on the type of -// paper. As a result, 20 pound bond paper and 50 pound text paper are actually -// about the same weight. The different sheet sizes were historically the most -// convenient for printing or folding in the different applications. These -// different basis weights are standards maintained by American Society for -// Testing Materials (ASTM) and the American Forest and Paper Association -// (AF&PA). - -poundbookpaper := lb / 25 inch 38 inch ream -lbbook := poundbookpaper -poundtextpaper := poundbookpaper -lbtext := poundtextpaper -poundoffsetpaper := poundbookpaper // For offset printing -lboffset := poundoffsetpaper -poundbiblepaper := poundbookpaper // Designed to be lightweight, thin, -lbbible := poundbiblepaper // strong and opaque. -poundtagpaper := lb / 24 inch 36 inch ream -lbtag := poundtagpaper -poundbagpaper := poundtagpaper -lbbag := poundbagpaper -poundnewsprintpaper := poundtagpaper -lbnewsprint := poundnewsprintpaper -poundposterpaper := poundtagpaper -lbposter := poundposterpaper -poundtissuepaper := poundtagpaper -lbtissue := poundtissuepaper -poundwrappingpaper := poundtagpaper -lbwrapping := poundwrappingpaper -poundwaxingpaper := poundtagpaper -lbwaxing := poundwaxingpaper -poundglassinepaper := poundtagpaper -lbglassine := poundglassinepaper -poundcoverpaper := lb / 20 inch 26 inch ream -lbcover := poundcoverpaper -poundindexpaper := lb / 25.5 inch 30.5 inch ream -lbindex := poundindexpaper -poundindexbristolpaper := poundindexpaper -lbindexbristol := poundindexpaper -poundbondpaper := lb / 17 inch 22 inch ream // Bond paper is stiff and -lbbond := poundbondpaper // durable for repeated -poundwritingpaper := poundbondpaper // filing, and it resists -lbwriting := poundwritingpaper // ink penetration. -poundledgerpaper := poundbondpaper -lbledger := poundledgerpaper -poundcopypaper := poundbondpaper -lbcopy := poundcopypaper -poundblottingpaper := lb / 19 inch 24 inch ream -lbblotting := poundblottingpaper -poundblankspaper := lb / 22 inch 28 inch ream -lbblanks := poundblankspaper -poundpostcardpaper := lb / 22.5 inch 28.5 inch ream -lbpostcard := poundpostcardpaper -poundweddingbristol := poundpostcardpaper -lbweddingbristol := poundweddingbristol -poundbristolpaper := poundweddingbristol -lbbristol := poundbristolpaper -poundboxboard := lb / (1000 ft^2) -lbboxboard := poundboxboard -poundpaperboard := poundboxboard -lbpaperboard := poundpaperboard - -// When paper is marked in units of M, it means the weight of 1000 sheets of the -// given size of paper. To convert this to paper weight, divide by the size of -// the paper in question. - -paperM := lb / 1000 - -// -// Old French distance measures, from French Weights and Measures -// Before the Revolution by Zupko -// - -frenchfoot := 4500/13853 m // pied de roi, the standard of Paris. -pied := frenchfoot // Half of the hashimicubit, -frenchfeet := frenchfoot // instituted by Charlemagne. -frenchinch := 1/12 frenchfoot // This exact definition comes from -frenchthumb := frenchinch // a law passed on 10 Dec 1799 which -pouce := frenchthumb // fixed the meter at - // 3 frenchfeet + 11.296 lignes. -frenchline := 1/12 frenchinch // This is supposed to be the size -ligne := frenchline // of the average barleycorn -frenchpoint := 1/12 frenchline -toise := 6 frenchfeet -arpent := 180^2 pied^2 // The arpent is 100 square perches, - // but the perche seems to vary a lot - // and can be 18 feet, 20 feet, or 22 - // feet. This measure was described - // as being in common use in Canada in - // 1934 (Websters 2nd). The value - // given here is the Paris standard - // arpent. - -// -// Printing -// - -fournierpoint := 0.1648 inch / 12 // First definition of the printers - // point made by Pierre Fournier who - // defined it in 1737 as 1/12 of a - // cicero which was 0.1648 inches. -olddidotpoint := 1/72 frenchinch // Fran¿ois Ambroise Didot, one of - // a family of printers, changed - // Fournier's definition around 1770 - // to fit to the French units then in - // use. -bertholdpoint := 1/2660 m // H. Berthold tried to create a - // metric version of the didot point - // in 1878. -INpoint := 0.4 mm // This point was created by a - // group directed by Fermin Didot in - // 1881 and is associated with the - // imprimerie nationale. It doesn't - // seem to have been used much. -germandidotpoint := 0.376065 mm // Exact definition appears in DIN - // 16507, a German standards document - // of 1954. Adopted more broadly in - // 1966 by ??? -metricpoint := 3/8 mm // Proposed in 1977 by Eurograf - -point := 13837/1000000 inch // exact, NIST Handbook 44, Appendix 3 -printerspoint := point - -texscaledpoint := 1/65536 point // The TeX typesetting system uses -texsp := texscaledpoint // this for all computations. -computerpoint := 1/72 inch // The American point was rounded -computerpica := 12 computerpoint // to an even 1/72 inch by computer -postscriptpoint := computerpoint // people at some point. -pspoint := postscriptpoint -Q := 1/4 mm // Used in Japanese phototypesetting - // Q is for quarter -frenchprinterspoint := olddidotpoint -didotpoint := germandidotpoint // This seems to be the dominant value -europeanpoint := didotpoint // for the point used in Europe -cicero := 12 didotpoint - -stick := 2 inches - -// Type sizes - -excelsior := 3 point -brilliant := 3.5 point -diamond := 4 point -pearl := 5 point -agate := 5.5 point -ruby := agate // British -nonpareil := 6 point -mignonette := 6.5 point -emerald := mignonette// British -minion := 7 point -brevier := 8 point -bourgeois := 9 point -longprimer := 10 point -smallpica := 11 point -pica := 12 point -english := 14 point -columbian := 16 point -greatprimer := 18 point -paragon := 20 point -meridian := 44 point -canon := 48 point - -// German type sizes -nonplusultra := 2 didotpoint -brillant := 3 didotpoint -diamant := 4 didotpoint -perl := 5 didotpoint -nonpareille := 6 didotpoint -kolonel := 7 didotpoint -petit := 8 didotpoint -borgis := 9 didotpoint -korpus := 10 didotpoint -corpus := korpus -garamond := korpus -mittel := 14 didotpoint -tertia := 16 didotpoint -text := 18 didotpoint -kleine_kanon := 32 didotpoint -kanon := 36 didotpoint -grosse_kanon := 42 didotpoint -missal := 48 didotpoint -kleine_sabon := 72 didotpoint -grosse_sabon := 84 didotpoint - -// -// Information theory units -// - -nat := 0.69314718056 bits // Entropy measured base e -hartley := 3.32192809488 bits // log2(10) bits, or the entropy - // of a uniformly distributed - // random variable over 10 - // symbols. -// -// Computer -// - -bps := bit/sec // Sometimes the term "baud" is - // incorrectly used to refer to - // bits per second. Baud refers - // to symbols per second. Modern - // modems transmit several bits - // per symbol. -byte := 8 bit // Not all machines had 8 bit - // bytes, but these days most of - // them do. But beware: for - // transmission over modems, a - // few extra bits are used so - // there are actually 10 bits per - // byte. -nybble := 4 bits // Half of a byte. Sometimes - // equal to different lengths - // such as 3 bits. -nibble := nybble - -// In computers, "kilo" tends to mean a multiple of 1024 or 2^10. -// This obviously interferes with the standard meanings. -// -// In December 1998 the International Electrotechnical Commission (IEC), the -// leading international organization for worldwide standardization in -// electrotechnology, approved as an IEC International Standard names and -// symbols for prefixes for binary multiples for use in the fields of data -// processing and data transmission. One would say "kibibit" to mean 1024 bits -// -// http://physics.nist.gov/cuu/Units/binary.html - -// Prefixes -kibi ::- 2^10 // kilobinary -mebi ::- 2^20 // megabinary -gibi ::- 2^30 // gigabinary -tebi ::- 2^40 // terabinary -pebi ::- 2^50 // petabinary -exbi ::- 2^60 // exabinary - -// Official symbols -Ki :- kibi -Mi :- mebi -Gi :- gibi -Ti :- tebi -Pi :- pebi -Ei :- exbi - -jiffy := 1/100 sec // This is defined in the Jargon File -jiffies := jiffy // (http://www.jargon.org) as being the - // duration of a clock tick for measuring - // wall-clock time. Supposedly the value - // used to be 1/60 sec or 1/50 sec - // depending on the frequency of AC power, - // but then 1/100 sec became more common. - // On linux systems, this term is used and - // for the Intel based chips, it does have - // the value of .01 sec. The Jargon File - // also lists two other definitions: - // millisecond, and the time taken for - // light to travel one foot. -// -// yarn and cloth measures -// - -// yarn linear density - -m kg^-1 ||| reciprocal_linear_mass_density - -woolyarnrun := 1600 yard/pound// 1600 yds of "number 1 yarn" weighs - // a pound. -yarncut := 300 yard/pound // Less common system used in - // Pennsylvania for wool yarn -cottonyarncount := 840 yard/pound -linenyarncount := 300 yard/pound // Also used for hemp and ramie -worstedyarncount := 1680 ft/pound -metricyarncount := meter/gram -kg/m ||| linear_mass_density -tex := gram / km // rational metric yarn measure, meant -denier := 1/9 tex // used for silk and rayon -manchesteryarnnumber := drams/(1000 yards)// old system used for silk -pli := lb/in -typp := 1000 yd/lb -asbestoscut := 100 yd/lb // used for glass and asbestos yarn - -drex := 0.1 tex // to be used for any kind of yarn - - -// yarn and cloth length - -skeincotton := 80*54 inch // 80 turns of thread on a reel with a - // 54 in circumference (varies for other - // kinds of thread) -cottonbolt := 120 ft // cloth measurement -woolbolt := 210 ft -bolt := cottonbolt -heer := 600 yards -cut := 300 yards // used for wet-spun linen yarn -lea := 300 yards - -// -// drug dosage -// - -mcg := microgram // Frequently used for vitamins -iudiptheria := 62.8 microgram // IU is for international unit -iupenicillin := 0.6 microgram -iuinsulin := 41.67 microgram -drop := 1/20 ml // The drop was an old "unit" that was - // replaced by the minim. But I was - // told by a pharmacist that in his - // profession, the conversion of 20 - // drops per ml is actually used. -bloodunit := 450 ml // For whole blood. For blood - // components, a blood unit is the - // quanity of the component found in a - // blood unit of whole blood. The - // human body contains about 12 blood - // units of whole blood. - -// -// fixup units for times when prefix handling doesn't do the job -// - -hectare := hectoare -ha := hectare -megohm := megaohm -kilohm := kiloohm -microhm := microohm - -cent := 1/100 dollar - -// British currency -// -// These have been supplanted by the PoundSource definitions which include -// historical exchange rates for years back to 1600. -// -//shilling := 1/20 britainpound // Before decimalisation, there -//oldpence := 1/12 shilling // were 20 shillings to a pound, - // each of twelve old pence -//quid := britainpound // Slang names -//fiver := 5 quid -//tenner := 10 quid - -// -// Units used for measuring volume of wood -// - -cord := 4 ft * 4 ft * 8 ft// 4 ft by 4 ft by 8 ft bundle of wood -facecord := 1/2 cord -cordfoot := 1/8 cord // One foot long section of a cord -cordfeet := cordfoot -rick := 4 ft 8 ft 16 inches // Stack of firewood - -housecord := 1/3 cord // Used to sell firewood for residences, - // often confusingly called a "cord" -boardfoot := ft^2 inch // Usually 1 inch thick wood -boardfeet := boardfoot -fbm := boardfoot // feet board measure -stere := m^3 -st := stere -timberfoot := ft^3 // Used for measuring solid blocks of wood -standard := 120 12 ft 11 in 1.5 in // This is the St Petersburg or - // Pittsburg standard. Apparently the - // term is short for "standard hundred" - // which was meant to refer to 100 pieces - // of wood (deals). However, this - // particular standard is equal to 120 - // deals which are 12 ft by 11 in by 1.5 - // inches (not the standard deal). - -// In Britain, the deal is apparently any piece of wood over 6 feet long, over -// 7 wide and 2.5 inches thick. The OED doesn't give a standard size. A piece -// of wood less than 7 inches wide is called a "batten". This unit is now used -// exclusively for fir and pine. - -deal := 12 ft 11 in 2.5 in // The standard North American deal [OED] -wholedeal := 1/2 deal // If it's half as thick as the standard - // deal it's called a "whole deal"! -splitdeal := 1/2 wholedeal // And half again as thick is a split deal. - - -// -// Gas and Liquid flow units -// - -// Some horribly-named flow units that I've never seen used other than once -// (unexplained) in the Guinness Book of World Records which has degraded into -// tabloid trash. -cumec := m^3/s -cusec := ft^3/s - -// Conventional abbreviations for fluid flow units - -gph := gal/hr -gpm := gal/min -mgd := megagal/day -cf := ft^3 -ccf := 100 cf // sorta dubious, but used. -cfs := cf/s -cfh := cf/hour -cfm := cf/min -lpm := liter/min - -// Miner's inch: This is an old historic unit used in the Western United -// States. It is generally defined as the rate of flow through a one square -// inch hole at a specified depth such as 4 inches. In the late 19th century, -// volume of water was sometimes measured in the "24 hour inch". Values for the -// miner's inch were fixed by state statues. (This information is from a web -// site operated by the Nevada Division of Water Planning: The Water Words -// Dictionary at http://www.state.nv.us/cnr/ndwp/dict-1/waterwds.htm.) - -minersinchAZ := 1.5 ft^3/min -minersinchCA := 1.5 ft^3/min -minersinchMT := 1.5 ft^3/min -minersinchNV := 1.5 ft^3/min -minersinchOR := 1.5 ft^3/min -minersinchID := 1.2 ft^3/min -minersinchKS := 1.2 ft^3/min -minersinchNE := 1.2 ft^3/min -minersinchNM := 1.2 ft^3/min -minersinchND := 1.2 ft^3/min -minersinchSD := 1.2 ft^3/min -minersinchUT := 1.2 ft^3/min -minersinchCO := 1.56 ft^3/min -minersinchBC := 1.68 ft^3/min // British Columbia - -// In vacuum science and some other applications, gas flow is measured -// as the product of volumetric flow and pressure. This is useful -// because it makes it easy to compare with the flow at standard -// pressure (one atmosphere). It also directly relates to the number -// of gas molecules per unit time, and hence to the mass flow if the -// molecular mass is known. - -sccm := atm cc/min // 's' is for "standard" to indicate -sccs := atm cc/sec // flow at standard pressure -scfh := atm ft^3/hour // -scfm := atm ft^3/min -slpm := atm liter/min -slph := atm liter/hour -lusec := liter micron Hg force / s // Used in vacuum science - -// Wire gauge: this area is a nightmare with huge charts of wire gauge -// diameters that usually have no clear origin. There are at least 5 competing -// wire gauge systems to add to the confusion. - -// The use of wire gauge is related to the manufacturing method: a metal rod is -// heated and drawn through a hole. The size change can't be too big. To get -// smaller wires, the process is repeated with a series of smaller holes. - -// American Wire Gauge (AWG) or Brown & Sharpe Gauge appears to be the most -// important gauge. ASTM B-258 specifies that this gauge is based on geometric -// interpolation between gauge 0000, which is 0.46 inches exactly, and gauge 36 -// which is 0.005 inches exactly. Therefore, the diameter in inches of a wire -// is given by the formula 1/200 92^((36-g)/39). Note that 92^(1/39) is close -// to 2^(1/6), so diameter is approximately halved for every 6 gauges. For the -// repeated zero values, use negative numbers in the formula. The same document -// also specifies rounding rules which seem to be ignored by makers of tables. -// Gauges up to 44 are to be specified with up to 4 significant figures, but no -// closer than 0.0001 inch. Gauges from 44 to 56 are to be rounded to the -// nearest 0.00001 inch. The table below gives 4 significant figures for all -// gauges. -// -// In addition to being used to measure wire thickness, this gauge is used to -// measure the thickness of sheets of aluminum, copper, and most metals other -// than steel, iron and zinc. - -// The numbers below are DIAMETERS. -wire0000gauge := 0.4600 in -wire000gauge := 0.4096 in -wire00gauge := 0.3648 in -wire0gauge := 0.3249 in -wire1gauge := 0.2893 in -wire2gauge := 0.2576 in -wire3gauge := 0.2294 in -wire4gauge := 0.2043 in -wire5gauge := 0.1819 in -wire6gauge := 0.1620 in -wire7gauge := 0.1443 in -wire8gauge := 0.1285 in -wire9gauge := 0.1144 in -wire10gauge := 0.1019 in -wire11gauge := 0.09074 in -wire12gauge := 0.08081 in -wire13gauge := 0.07196 in -wire14gauge := 0.06408 in -wire15gauge := 0.05707 in -wire16gauge := 0.05082 in -wire17gauge := 0.04526 in -wire18gauge := 0.04030 in -wire19gauge := 0.03589 in -wire20gauge := 0.03196 in -wire21gauge := 0.02846 in -wire22gauge := 0.02535 in -wire23gauge := 0.02257 in -wire24gauge := 0.02010 in -wire25gauge := 0.01790 in -wire26gauge := 0.01594 in -wire27gauge := 0.01420 in -wire28gauge := 0.01264 in -wire29gauge := 0.01126 in -wire30gauge := 0.01003 in -wire31gauge := 0.008928 in -wire32gauge := 0.007950 in -wire33gauge := 0.007080 in -wire34gauge := 0.006305 in -wire35gauge := 0.005615 in -wire36gauge := 0.005000 in -wire37gauge := 0.004453 in -wire38gauge := 0.003965 in -wire39gauge := 0.003531 in -wire40gauge := 0.003145 in -wire41gauge := 0.002800 in -wire42gauge := 0.002494 in -wire43gauge := 0.002221 in -wire44gauge := 0.001978 in -wire45gauge := 0.001761 in -wire46gauge := 0.001568 in -wire47gauge := 0.001397 in -wire48gauge := 0.001244 in -wire49gauge := 0.001108 in -wire50gauge := 0.0009863 in -wire51gauge := 0.0008783 in -wire52gauge := 0.0007822 in -wire53gauge := 0.0006966 in -wire54gauge := 0.0006203 in -wire55gauge := 0.0005524 in -wire56gauge := 0.0004919 in - -// Next we have the SWG, the Imperial or British Standard Wire Gauge. This one -// is piecewise linear, so it is not generated by a simple formula. It was used -// for aluminum sheets. - -brwire0000000gauge := 0.500 in -brwire000000gauge := 0.464 in -brwire00000gauge := 0.432 in -brwire0000gauge := 0.400 in -brwire000gauge := 0.372 in -brwire00gauge := 0.348 in -brwire0gauge := 0.324 in -brwire1gauge := 0.300 in -brwire2gauge := 0.276 in -brwire3gauge := 0.252 in -brwire4gauge := 0.232 in -brwire5gauge := 0.212 in -brwire6gauge := 0.192 in -brwire7gauge := 0.176 in -brwire8gauge := 0.160 in -brwire9gauge := 0.144 in -brwire10gauge := 0.128 in -brwire11gauge := 0.116 in -brwire12gauge := 0.104 in -brwire13gauge := 0.092 in -brwire14gauge := 0.080 in -brwire15gauge := 0.072 in -brwire16gauge := 0.064 in -brwire17gauge := 0.056 in -brwire18gauge := 0.048 in -brwire19gauge := 0.040 in -brwire20gauge := 0.036 in -brwire21gauge := 0.032 in -brwire22gauge := 0.028 in -brwire23gauge := 0.024 in -brwire24gauge := 0.022 in -brwire25gauge := 0.0200 in -brwire26gauge := 0.0180 in -brwire27gauge := 0.0164 in -brwire28gauge := 0.0149 in -brwire29gauge := 0.0136 in -brwire30gauge := 0.0124 in -brwire31gauge := 0.0116 in -brwire32gauge := 0.0108 in -brwire33gauge := 0.0100 in -brwire34gauge := 0.0092 in -brwire35gauge := 0.0084 in -brwire36gauge := 0.0076 in -brwire37gauge := 0.0068 in -brwire38gauge := 0.0060 in -brwire39gauge := 0.0052 in -brwire40gauge := 0.0048 in -brwire41gauge := 0.0044 in -brwire42gauge := 0.0040 in -brwire43gauge := 0.0036 in -brwire44gauge := 0.0032 in -brwire45gauge := 0.0028 in -brwire46gauge := 0.0024 in -brwire47gauge := 0.0020 in -brwire48gauge := 0.0016 in -brwire49gauge := 0.0012 in -brwire50gauge := 0.0010 in - -// The following is from the Appendix to ASTM B 258 -// -// For example, in U.S. gage, the standard for sheet metal is based on the -// weight of the metal, not on the thickness. 16-gage is listed as approximately -// .0625 inch thick and 40 ounces per square foot (the original standard was -// based on wrought iron at .2778 pounds per cubic inch; steel has almost -// entirely superseded wrought iron for sheet use, at .2833 pounds per cubic -// inch). Smaller numbers refer to greater thickness. There is no formula for -// converting gage to thickness or weight. -// -// It's rather unclear from the passage above whether the plate gauge values are -// therefore wrong if steel is being used. Reference [15] states that steel is -// in fact measured using this gauge (under the name Manufacturers' Standard -// Gauge) with a density of 501.84 lb/ft3 = 0.2904 lb/in3 used for steel. -// But this doesn't seem to be the correct density of steel (.2833 lb/in3 is -// closer), and nobody else lists these values. -// -// This gauge was established in 1893 for purposes of taxation. - -plate000000gauge := 15/32 in // 300 oz / ft^2 -plate00000gauge := 14/32 in // 280 oz / ft^2 -plate0000gauge := 13/32 in // 260 oz / ft^2 -plate000gauge := 12/32 in // 240 oz / ft^2 -plate00gauge := 11/32 in // 220 oz / ft^2 -plate0gauge := 10/32 in // 200 oz / ft^2 -plate1gauge := 9/32 in // 180 oz / ft^2 -plate2gauge := 17/64 in // 170 oz / ft^2 -plate3gauge := 16/64 in // 160 oz / ft^2 -plate4gauge := 15/64 in // 150 oz / ft^2 -plate5gauge := 14/64 in // 140 oz / ft^2 -plate6gauge := 13/64 in // 130 oz / ft^2 -plate7gauge := 12/64 in // 120 oz / ft^2 -plate8gauge := 11/64 in // 110 oz / ft^2 -plate9gauge := 10/64 in // 100 oz / ft^2 -plate10gauge := 9/64 in // 90 oz / ft^2 -plate11gauge := 8/64 in // 80 oz / ft^2 -plate12gauge := 7/64 in // 70 oz / ft^2 -plate13gauge := 6/64 in // 60 oz / ft^2 -plate14gauge := 5/64 in // 50 oz / ft^2 -plate15gauge := 9/128 in // 45 oz / ft^2 -plate16gauge := 8/128 in // 40 oz / ft^2 -plate17gauge := 9/160 in // 36 oz / ft^2 -plate18gauge := 8/160 in // 32 oz / ft^2 -plate19gauge := 7/160 in // 28 oz / ft^2 -plate20gauge := 6/160 in // 24 oz / ft^2 -plate21gauge := 11/320 in // 22 oz / ft^2 -plate22gauge := 10/320 in // 20 oz / ft^2 -plate23gauge := 9/320 in // 18 oz / ft^2 -plate24gauge := 8/320 in // 16 oz / ft^2 -plate25gauge := 7/320 in // 14 oz / ft^2 -plate26gauge := 6/320 in // 12 oz / ft^2 -plate27gauge := 11/640 in // 11 oz / ft^2 -plate28gauge := 10/640 in // 10 oz / ft^2 -plate29gauge := 9/640 in // 9 oz / ft^2 -plate30gauge := 8/640 in // 8 oz / ft^2 -plate31gauge := 7/640 in // 7 oz / ft^2 -plate32gauge := 13/1280 in // 6.5 oz / ft^2 -plate33gauge := 12/1280 in // 6 oz / ft^2 -plate34gauge := 11/1280 in // 5.5 oz / ft^2 -plate35gauge := 10/1280 in // 5 oz / ft^2 -plate36gauge := 9/1280 in // 4.5 oz / ft^2 -plate37gauge := 17/2560 in // 4.25 oz / ft^2 -plate38gauge := 16/2560 in // 4 oz / ft^2 - -// Zinc sheet metal gauge - -zinc1gauge := 0.002 in -zinc2gauge := 0.004 in -zinc3gauge := 0.006 in -zinc4gauge := 0.008 in -zinc5gauge := 0.010 in -zinc6gauge := 0.012 in -zinc7gauge := 0.014 in -zinc8gauge := 0.016 in -zinc9gauge := 0.018 in -zinc10gauge := 0.020 in -zinc11gauge := 0.024 in -zinc12gauge := 0.028 in -zinc13gauge := 0.032 in -zinc14gauge := 0.036 in -zinc15gauge := 0.040 in -zinc16gauge := 0.045 in -zinc17gauge := 0.050 in -zinc18gauge := 0.055 in -zinc19gauge := 0.060 in -zinc20gauge := 0.070 in -zinc21gauge := 0.080 in -zinc22gauge := 0.090 in -zinc23gauge := 0.100 in -zinc24gauge := 0.125 in -zinc25gauge := 0.250 in -zinc26gauge := 0.375 in -zinc27gauge := 0.500 in -zinc28gauge := 1.000 in - -// USA ring sizes. Several slightly different definitions seem to be in -// circulation. According to [15], the interior diameter of size n ring in -// inches is 0.32 n + 0.458 for n ranging from 3 to 13.5 by steps of 0.5. The -// size 2 ring is inconsistently 0.538in and no 2.5 size is listed. -// -// However, other sources list 0.455 + 0.0326 n and 0.4525 + 0.0324 n as the -// diameter and list no special case for size 2. (Or alternatively they are -// 1.43 + .102 n and 1.4216+.1018 n for measuring circumference in inches.) One -// reference claimed that the original system was that each size was 1/10 inch -// circumference, but that source doesn't have an explanation for the modern -// system which is somewhat different. -// -// This table gives circumferences as listed in [15]. - -size2ring := 0.538 in pi -size3ring := 0.554 in pi -size3_5ring := 0.570 in pi -size4ring := 0.586 in pi -size4_5ring := 0.602 in pi -size5ring := 0.618 in pi -size5_5ring := 0.634 in pi -size6ring := 0.650 in pi -size6_5ring := 0.666 in pi -size7ring := 0.682 in pi -size7_5ring := 0.698 in pi -size8ring := 0.714 in pi -size8_5ring := 0.730 in pi -size9ring := 0.746 in pi -size9_5ring := 0.762 in pi -size10ring := 0.778 in pi -size10_5ring := 0.794 in pi -size11ring := 0.810 in pi -size11_5ring := 0.826 in pi -size12ring := 0.842 in pi -size12_5ring := 0.858 in pi -size13ring := 0.874 in pi -size13_5ring := 0.890 in pi - -// Old practice in the UK measured rings using the "Wheatsheaf gauge" with sizes -// specified alphabetically and based on the ring inside diameter in steps of -// 1/64 inch. This system was replaced in 1987 by British Standard 6820 which -// specifies sizes based on circumference. Each size is 1.25 mm different from -// the preceding size. The baseline is size C which is 40 mm circumference. -// The new sizes are close to the old ones. Sometimes it's necessary to go -// beyond size Z to Z+1, Z+2, etc. - -sizeAring := 37.50 mm -sizeBring := 38.75 mm -sizeCring := 40.00 mm -sizeDring := 41.25 mm -sizeEring := 42.50 mm -sizeFring := 43.75 mm -sizeGring := 45.00 mm -sizeHring := 46.25 mm -sizeIring := 47.50 mm -sizeJring := 48.75 mm -sizeKring := 50.00 mm -sizeLring := 51.25 mm -sizeMring := 52.50 mm -sizeNring := 53.75 mm -sizeOring := 55.00 mm -sizePring := 56.25 mm -sizeQring := 57.50 mm -sizeRring := 58.75 mm -sizeSring := 60.00 mm -sizeTring := 61.25 mm -sizeUring := 62.50 mm -sizeVring := 63.75 mm -sizeWring := 65.00 mm -sizeXring := 66.25 mm -sizeYring := 67.50 mm -sizeZring := 68.75 mm - -// Japanese sizes start with size 1 at a 13mm inside diameter and each size is -// 1/3 mm larger in diameter than the previous one. They are multiplied by pi -// to give circumference. - -jpsize1ring := 39/3 pi mm -jpsize2ring := 40/3 pi mm -jpsize3ring := 41/3 pi mm -jpsize4ring := 42/3 pi mm -jpsize5ring := 43/3 pi mm -jpsize6ring := 44/3 pi mm -jpsize7ring := 45/3 pi mm -jpsize8ring := 46/3 pi mm -jpsize9ring := 47/3 pi mm -jpsize10ring := 48/3 pi mm -jpsize11ring := 49/3 pi mm -jpsize12ring := 50/3 pi mm -jpsize13ring := 51/3 pi mm -jpsize14ring := 52/3 pi mm -jpsize15ring := 53/3 pi mm -jpsize16ring := 54/3 pi mm -jpsize17ring := 55/3 pi mm -jpsize18ring := 56/3 pi mm -jpsize19ring := 57/3 pi mm -jpsize20ring := 58/3 pi mm -jpsize21ring := 59/3 pi mm -jpsize22ring := 60/3 pi mm -jpsize23ring := 61/3 pi mm -jpsize24ring := 62/3 pi mm -jpsize25ring := 63/3 pi mm -jpsize26ring := 64/3 pi mm -jpsize27ring := 65/3 pi mm -jpsize28ring := 66/3 pi mm -jpsize29ring := 67/3 pi mm -jpsize30ring := 68/3 pi mm - -// The European ring sizes are the length of the circumference in mm minus 40. - -eusize1ring := 41 mm -eusize2ring := 42 mm -eusize3ring := 43 mm -eusize4ring := 44 mm -eusize5ring := 45 mm -eusize6ring := 46 mm -eusize7ring := 47 mm -eusize8ring := 48 mm -eusize9ring := 49 mm -eusize10ring := 50 mm -eusize11ring := 51 mm -eusize12ring := 52 mm -eusize13ring := 53 mm -eusize14ring := 54 mm -eusize15ring := 55 mm -eusize16ring := 56 mm -eusize17ring := 57 mm -eusize18ring := 58 mm -eusize19ring := 59 mm -eusize20ring := 60 mm -eusize21ring := 61 mm -eusize22ring := 62 mm -eusize23ring := 63 mm -eusize24ring := 64 mm -eusize25ring := 65 mm -eusize26ring := 66 mm -eusize27ring := 67 mm -eusize28ring := 68 mm -eusize29ring := 69 mm -eusize30ring := 70 mm - -// -// Abbreviations -// - -mph := mile/hr -mpg := mile/gal -kph := km/hr -fL := footlambert -fpm := ft/min -fps := ft/s -rpm := rev/min -rps := rev/sec -mi := mile -mbh := 1ee3 Btu/hour -mcm := 1ee3 circularmil - -// -// Radioactivity units -// - -becquerel := s^-1 // Activity of radioactive source -Bq := becquerel // -curie := 37ee9 Bq // Defined in 1910 as the radioactivity -Ci := curie // emitted by the amount of radon that is - // in equilibrium with 1 gram of radium. -rutherford := 1ee6 Bq // - -gray := J/kg // Absorbed dose of radiation -Gy := gray // -rad := 1ee-2 Gy // From Radiation Absorbed Dose -rep := 8.38 mGy // Roentgen Equivalent Physical, the amount - // of radiation which , absorbed in the - // body, would liberate the same amount - // of energy as 1 roentgen of X rays - // would, or 97 ergs. - -sievert := J/kg // Dose equivalent: dosage that has the -Sv := sievert // same effect on human tissues as 200 -rem := 1ee-2 Sv // keV X-rays. Different types of - // radiation are weighted by the - // Relative Biological Effectiveness - // (RBE). - // - // Radiation type RBE - // X-ray, gamma ray 1 - // beta rays, > 1 MeV 1 - // beta rays, < 1 MeV 1.08 - // neutrons, < 1 MeV 4-5 - // neutrons, 1-10 MeV 10 - // protons, 1 MeV 8.5 - // protons, .1 MeV 10 - // alpha, 5 MeV 15 - // alpha, 1 MeV 20 - // - // The energies are the kinetic energy - // of the particles. Slower particles - // interact more, so they are more - // effective ionizers, and hence have - // higher RBE values. - // - // rem stands for Roentgen Equivalent - // Mammal - -roentgen := 258ee-6 C / kg // Ionizing radiation that produces - // 1 statcoulomb of charge in 1 cc of - // dry air at stp. -rontgen := roentgen // Sometimes it appears spelled this way -sievertunit := 8.38 rontgen // Unit of gamma ray dose delivered in one - // hour at a distance of 1 cm from a - // point source of 1 mg of radium - // enclosed in platinum .5 mm thick. - -eman := 1ee-7 Ci/m^3 // radioactive concentration -mache := 3.7e-7 Ci/m^3 - -// -// Atomic weights. The atomic weight of an element is the ratio of the mass of -// a mole of the element to 1/12 of a mole of Carbon 12. The Standard Atomic -// Weights apply to the elements as they occur naturally on earth. Elements -// which do not occur naturally or which occur with wide isotopic variability do -// not have Standard Atomic Weights. For these elements, the atomic weight is -// based on the longest lived isotope, as marked in the comments. In some -// cases, the comment for these entries also gives a number which is an atomic -// weight for a different isotope that may be of more interest than the longest -// lived isotope. -// - -g/mol ||| molar_mass - -actinium := 227.0278 g/mol -aluminum := 26.981539 g/mol -aluminium := aluminum -americium := 243.0614 g/mol // Longest lived. 241.06 -antimony := 121.760 g/mol -argon := 39.948 g/mol -arsenic := 74.92159 g/mol -astatine := 209.9871 g/mol // Longest lived -barium := 137.327 g/mol -berkelium := 247.0703 g/mol // Longest lived. 249.08 -beryllium := 9.012182 g/mol -bismuth := 208.98037 g/mol -boron := 10.811 g/mol -bromine := 79.904 g/mol -cadmium := 112.411 g/mol -calcium := 40.078 g/mol -californium := 251.0796 g/mol // Longest lived. 252.08 -carbon := 12.011 g/mol -cerium := 140.115 g/mol -cesium := 132.90543 g/mol -chlorine := 35.4527 g/mol -chromium := 51.9961 g/mol -cobalt := 58.93320 g/mol -copper := 63.546 g/mol -curium := 247.0703 g/mol -dysprosium := 162.50 g/mol -einsteinium := 252.083 g/mol // Longest lived -erbium := 167.26 g/mol -europium := 151.965 g/mol -fermium := 257.0951 g/mol // Longest lived -fluorine := 18.9984032 g/mol -francium := 223.0197 g/mol // Longest lived -gadolinium := 157.25 g/mol -gallium := 69.723 g/mol -germanium := 72.61 g/mol -gold := 196.96654 g/mol -hafnium := 178.49 g/mol -helium := 4.002602 g/mol -holmium := 164.93032 g/mol -hydrogen := 1.00794 g/mol -indium := 114.818 g/mol -iodine := 126.90447 g/mol -iridium := 192.217 g/mol -iron := 55.845 g/mol -krypton := 83.80 g/mol -lanthanum := 138.9055 g/mol -lawrencium := 262.11 g/mol // Longest lived -lead := 207.2 g/mol -lithium := 6.941 g/mol -lutetium := 174.967 g/mol -magnesium := 24.3050 g/mol -manganese := 54.93805 g/mol -mendelevium := 258.10 g/mol // Longest lived -mercury := 200.59 g/mol -molybdenum := 95.94 g/mol -neodymium := 144.24 g/mol -neon := 20.1797 g/mol -neptunium := 237.0482 g/mol -nickel := 58.6934 g/mol -niobium := 92.90638 g/mol -nitrogen := 14.00674 g/mol -nobelium := 259.1009 g/mol // Longest lived -osmium := 190.23 g/mol -oxygen := 15.9994 g/mol -palladium := 106.42 g/mol -phosphorus := 30.973762 g/mol -platinum := 195.08 g/mol -plutonium := 244.0642 g/mol // Longest lived. 239.05 -polonium := 208.9824 g/mol // Longest lived. 209.98 -potassium := 39.0983 g/mol -praseodymium := 140.90765 g/mol -promethium := 144.9127 g/mol // Longest lived. 146.92 -protactinium := 231.03588 g/mol -radium := 226.0254 g/mol -radon := 222.0176 g/mol // Longest lived -rhenium := 186.207 g/mol -rhodium := 102.90550 g/mol -rubidium := 85.4678 g/mol -ruthenium := 101.07 g/mol -samarium := 150.36 g/mol -scandium := 44.955910 g/mol -selenium := 78.96 g/mol -silicon := 28.0855 g/mol -silver := 107.8682 g/mol -sodium := 22.989768 g/mol -strontium := 87.62 g/mol -sulfur := 32.066 g/mol -sulphur := sulfur -tantalum := 180.9479 g/mol -technetium := 97.9072 g/mol // Longest lived. 98.906 -tellurium := 127.60 g/mol -terbium := 158.92534 g/mol -thallium := 204.3833 g/mol -thorium := 232.0381 g/mol -thullium := 168.93421 g/mol -tin := 118.710 g/mol -titanium := 47.867 g/mol -tungsten := 183.84 g/mol -uranium := 238.0289 g/mol -vanadium := 50.9415 g/mol -xenon := 131.29 g/mol -ytterbium := 173.04 g/mol -yttrium := 88.90585 g/mol -zinc := 65.39 g/mol -zirconium := 91.224 g/mol - -// -// Before the Imperial Weights and Measures Act of 1824, various different -// weights and measures were in use in different places. -// - -// Scots linear measure - -scotsinch := 1.00540054 britishinch -scotsell := 37 scotsinch -scotsfall := 6 scotsell -scotschain := 4 scotsfall -scotslink := 1/100 scotschain -scotsfoot := 12 scotsinch -scotsfeet := scotsfoot -scotsfurlong := 10 scotschain -scotsmile := 8 scotsfurlong - -// Scots area measure - -scotsrood := 40 scotsfall^2 -scotsacre := 4 scotsrood - -// Irish linear measure - -irishinch := britishinch -irishpalm := 3 irishinch -irishspan := 3 irishpalm -irishfoot := 12 irishinch -irishfeet := irishfoot -irishcubit := 18 irishinch -irishyard := 3 irishfeet -irishpace := 5 irishfeet -irishfathom := 6 irishfeet -irishpole := 7 irishyard // Only these values -irishperch := irishpole // are different from -irishchain := 4 irishperch // the British Imperial -irishlink := 1/100 irishchain// or English values for -irishfurlong :=10 irishchain // these lengths. -irishmile := 8 irishfurlong // - -// Irish area measure - -irishrood := 40 irishpole^2 -irishacre := 4 irishrood - -// Modern US Beer capacity -beerbarrel := 31 gallons // A full beer barrel -keg := 1/2 beerbarrel // The standard "keg" is a half barrel -beerkeg := keg -ponykeg := 1/2 keg -case := 24 12 floz // Why not? -beercase := case - -// English wine capacity measures (Winchester measures) - -winegallon := 231 britishinch^3 // Sometimes called the Winchester Wine Gallon, - // it was legalized in 1707 by Queen Anne, and - // given the definition of 231 cubic inches. It - // had been in use for a while as 8 pounds of wine - // using a merchant's pound of 7200 grains or - // 15 troy ounces. (The old mercantile pound had - // been 15 tower ounces.) -winequart := 1/4 winegallon -winepint := 1/2 winequart -winerundlet :=18 winegallon -winebarrel := 31.5 winegallon -winetierce := 42 winegallon -winehogshead := 2 winebarrel -winepuncheon := 2 winetierce -winebutt := 2 winehogshead -winepipe := winebutt -winetun := 2 winebutt - -// English beer and ale measures used 1803-1824 and used for beer before 1688 - -englishbeergallon := 282 britishinch^3 -englishbeerquart := 1/4 englishbeergallon -englishbeerpint := 1/2 englishbeerquart -englishbeerbarrel := 36 englishbeergallon -englishbeerhogshead := 1.5 englishbeerbarrel - -// English ale measures used from 1688-1803 for both ale and beer - -alegallon := englishbeergallon -alequart := 1/4 alegallon -alepint := 1/2 alequart -alebarrel := 34 alegallon -alehogshead :=1.5 alebarrel - -// Scots capacity measure - -scotsgallon :=827.232 britishinch^3 -scotsquart := 1/4 scotsgallon -scotspint := 1/2 scotsquart -choppin := 1/2 scotspint -mutchkin := 1/2 choppin -scotsgill := 1/4 mutchkin -scotsbarrel :=8 scotsgallon - -// Scots dry capacity measure - -scotswheatlippy := 137.333 britishinch^3 // Also used for peas, beans, rye, salt -scotswheatlippies := scotswheatlippy -scotswheatpeck :=4 scotswheatlippy -scotswheatfirlot := 4 scotswheatpeck -scotswheatboll :=4 scotswheatfirlot -scotswheatchalder := 16 scotswheatboll - -scotsoatlippy := 200.345 britishinch^3 // Also used for barley and malt -scotsoatlippies := scotsoatlippy -scotsoatpeck := 4 scotsoatlippy -scotsoatfirlot :=4 scotsoatpeck -scotsoatboll := 4 scotsoatfirlot -scotsoatchalder := 16 scotsoatboll - -// Scots Tron weight - -tronpound := 9520 grain -tronounce := 1/20 tronpound -trondrop := 1/16 tronounce -tronstone := 16 tronpound - -// Irish liquid capacity measure - -irishgallon :=217.6 britishinch^3 -irishpottle :=1/2 irishgallon -irishquart := 1/2 irishpottle -irishpint := 1/2 irishquart -irishnoggin :=1/4 irishpint -irishrundlet := 18 irishgallon -irishbarrel :=31.5 irishgallon -irishtierce :=42 irishgallon -irishhogshead := 2 irishbarrel -irishpuncheon := 2 irishtierce -irishpipe := 2 irishhogshead -irishtun := 2 irishpipe - -// Irish dry capacity measure - -irishpeck := 2 irishgallon -irishbushel :=4 irishpeck -irishstrike :=2 irishbushel -irishdrybarrel := 2 irishstrike -irishquarter := 2 irishbarrel - -// English Tower weights, abolished in 1528 - -towerpound := 5400 grain -towerounce := 1/12 towerpound -towerpennyweight := 1/20 towerounce - -// English Mercantile weights, used since the late 12th century - -mercpound := 6750 grain -mercounce := 1/15 mercpound -mercpennyweight := 1/20 mercounce - -// English weights for lead - -leadstone := 12.5 lb -fotmal := 70 lb -leadwey := 14 leadstone -fothers := 12 leadwey - -// English Hay measure - -newhaytruss := 60 lb // New and old here seem to refer to "new" -newhayload := 36 newhaytruss // hay and "old" hay rather than a new unit -oldhaytruss := 56 lb // and an old unit. -oldhayload := 36 oldhaytruss - -// English wool measure - -woolclove := 7 lb -woolstone := 2 woolclove -wooltod := 2 woolstone -woolwey := 13 woolstone -woolsack :=2 woolwey -woolsarpler := 2 woolsack -woollast :=6 woolsarpler - -// -// Ancient history units: There tends to be uncertainty in the definitions -// of the units in this section -// These units are from [11] - -// Roman measure. The Romans had a well defined distance measure, but their -// measures of weight were poor. They adopted local weights in different -// regions without distinguishing among them so that there are half a dozen -// different Roman "standard" weight systems. - -romanfoot :=296 mm // There is some uncertainty in this definition -romanfeet :=romanfoot // from which all the other units are derived. -pes := romanfoot // This value appears in numerous sources. In "The -pedes := romanfoot // Roman Land Surveyors", Dilke gives 295.7 mm. -romaninch := 1/12 romanfoot // The subdivisions of the Roman foot have the -romandigit := 1/16 romanfoot // same names as the subdivisions of the pound, -romanpalm :=1/4 romanfoot // but we can't have the names for different -romancubit := 18 romaninch // units. -romanpace :=5 romanfeet // Roman double pace (basic military unit) -romanpaces := romanpace -passus := romanpace -romanperch := 10 romanfeet -stade := 125 romanpaces -stadia := stade -stadium := stade -romanmile :=8 stadia // 1000 paces -romanleague := 1.5 romanmile -schoenus := 4 romanmile - -// Other values for the Roman foot (from Dilke) - -earlyromanfoot :=29.73 cm -pesdrusianus := 33.3 cm // or 33.35 cm, used in Gaul & Germany in 1st c BC -lateromanfoot := 29.42 cm - -// Roman areas - -actuslength := 120 romanfeet // length of a Roman furrow -actus := 120*4 romanfeet // area of the furrow -squareactus := 120^2 romanfeet^2// actus quadratus -acnua := squareactus -iugerum := 2 squareactus -iugera := iugerum -jugerum := iugerum -jugera := iugerum -heredium := 2 iugera // heritable plot -heredia := heredium -centuria := 100 heredia -centurium :=centuria - -// Roman volumes - -sextarius := 35.4 in^3 // Basic unit of Roman volume. As always, -sextarii := sextarius // there is uncertainty. Six large Roman - // measures survive with volumes ranging from - // 34.4 in^3 to 39.55 in^3. Three of them - // cluster around the size given here. - // - // But the values for this unit vary wildly - // in other sources. One reference gives 0.547 - // liters, but then says the amphora is a - // cubic Roman foot. This gives a value for the - // sextarius of 0.540 liters. And the - // encyclopedia Brittanica lists 0.53 liters for - // this unit. Both [7] and [11], which were - // written by scholars of weights and measures, - // give the value of 35.4 cubic inches. -cochlearia := 1/48 sextarius -cyathi := 1/12 sextarius -acetabula := 1/8 sextarius -quartaria := 1/4 sextarius -quartarius := quartaria -heminae := 1/2 sextarius -hemina := heminae -cheonix := 1.5 sextarii - -// Dry volume measures (usually) - -semodius := 8 sextarius -semodii := semodius -modius := 16 sextarius -modii := modius - -// Liquid volume measures (usually) - -congius := 12 heminae -congii := congius -amphora := 8 congii -amphorae := amphora // Also a dry volume measure -culleus := 20 amphorae -quadrantal := amphora - -// Roman weights - -libra := 5052 grain // The Roman pound varied significantly -librae := libra // from 4210 grains to 5232 grains. Most of -romanpound := libra // the standards were obtained from the weight -uncia := 1/12 libra // of particular coins. The one given here is -unciae := uncia // based on the Gold Aureus of Augustus which -romanounce := uncia // was in use from BC 27 to AD 296. -deunx := 11 uncia -dextans := 10 uncia -dodrans := 9 uncia -bes := 8 uncia -seprunx := 7 uncia -semis := 6 uncia -quincunx := 5 uncia -triens := 4 uncia -quadrans := 3 uncia -sextans := 2 uncia -sescuncia := 1.5 uncia -semuncia := 1/2 uncia -siscilius := 1/4 uncia -sextula := 1/6 uncia -semisextula := 1/12 uncia -scriptulum := 1/24 uncia -scrupula := scriptulum -romanobol := 1/2 scrupula - -romanaspound :=4210 grain // Old pound based on bronze coinage, the - // earliest money of Rome BC 338 to BC 268. - - - -// Egyptian length measure - -egyptianroyalcubit := 20.63 in // plus or minus .2 in -egyptianpalm := 1/7 egyptianroyalcubit -epyptiandigit := 1/4 egyptianpalm -egyptianshortcubit := 6 egyptianpalm - -doubleremen := 29.16 in // Length of the diagonal of a square with -remendigit := 1/40 doubleremen// side length of 1 royal egyptian cubit. - // This is divided into 40 digits which are - // not the same size as the digits based on - // the royal cubit. - -// Greek length measures - -greekfoot := 12.45 in // Listed as being derived from the -greekfeet := greekfoot // Egyptian Royal cubit in [11]. It is -greekcubit := 1.5 greekfoot// said to be 3/5 of a 20.75 in cubit. -pous := greekfoot -podes := greekfoot -orguia := 6 greekfoot -greekfathom := orguia -stadion := 100 orguia -akaina := 10 greekfeet -plethron := 10 akaina -greekfinger := 1/16 greekfoot -greekfingers := greekfinger -homericcubit := 20 greekfingers // Elbow to end of knuckles. -shortgreekcubit := 18 greekfingers // Elbow to start of fingers. - -ionicfoot := 296 mm -doricfoot := 326 mm - -olympiccubit := 25 remendigit // These olympic measures were not as -olympicfoot := 2/3 olympiccubit// common as the other greek measures. -olympicfinger := 1/16 olympicfoot// They were used in agriculture. -olympicfeet := olympicfoot -olympicdakylos := olympicfinger -olympicpalm := 1/4 olympicfoot -olympicpalestra := olympicpalm -olympicspithame := 3/4 foot -olympicspan := olympicspithame -olympicbema := 2.5 olympicfeet -olympicpace := olympicbema -olympicorguia := 6 olympicfeet -olympicfathom := olympicorguia -olympiccord := 60 olympicfeet -olympicamma := olympiccord -olympicplethron := 100 olympicfeet -olympicstadion := 600 olympicfeet - -// Greek capacity measure - -greekkotyle := 270 ml // This approximate value is obtained -xestes := 2 greekkotyle // from two earthenware vessels that -khous := 12 greekkotyle // were reconstructed from fragments. -metretes := 12 khous // The kotyle is a day's corn ration -choinix := 4 greekkotyle // for one man. -hekteos := 8 choinix -medimnos := 6 hekteos - -// Greek weight. Two weight standards were used, an Aegina standard based -// on the Beqa shekel and an Athens (attic) standard. - -aeginastater := 192 grain // Varies up to 199 grain -aeginastaters := aeginastater -aeginadrachmae := 1/2 aeginastater -aeginaobol := 1/6 aeginadrachmae -aeginamina := 50 aeginastaters -aeginatalent := 60 aeginamina - -atticstater := 135 grain // Varies 134-138 grain -atticstaters := atticstater -atticdrachmae := 1/2 atticstater -atticobol := 1/6 atticdrachmae -atticmina := 50 atticstaters -attictalent := 60 atticmina - - -// "Northern" cubit and foot. This was used by the pre-Aryan civilization in -// the Indus valley. It was used in Mesopotamia, Egypt, North Africa, China, -// central and Western Europe until modern times when it was displaced by -// the metric system. - -northerncubit := 26.6 in // plus/minus .2 in -northernfoot := 1/2 northerncubit - -sumeriancubit := 495 mm -kus := sumeriancubit -sumerianfoot := 2/3 sumeriancubit - -assyriancubit := 21.6 in -assyrianfoot := 1/2 assyriancubit -assyrianpalm := 1/3 assyrianfoot -assyriansusi := 1/20 assyrianpalm -susi := assyriansusi -persianroyalcubit := 7 assyrianpalm - - -// Arabic measures. The arabic standards were meticulously kept. Glass weights -// accurate to .2 grains were made during AD 714-900. - -hashimicubit := 25.56 in // Standard of linear measure used - // in Persian dominions of the Arabic - // empire 7-8th cent. Is equal to two - // French feet. - -blackcubit := 21.28 in -arabicfeet := 1/2 blackcubit -arabicfoot := arabicfeet -arabicinch := 1/12 arabicfoot -arabicmile := 4000 blackcubit - -silverdirhem := 45 grain // The weights were derived from these two -tradedirhem := 48 grain // units with two identically named systems - // used for silver and used for trade purposes - -silverkirat := 1/16 silverdirhem -silverwukiyeh := 10 silverdirhem -silverrotl := 12 silverwukiyeh -arabicsilverpound := silverrotl - -tradekirat := 1/16 tradedirhem -tradewukiyeh := 10 tradedirhem -traderotl := 12 tradewukiyeh -arabictradepound := traderotl - -// Miscellaneous ancient units - -parasang := 3.5 mile // Persian unit of length usually thought - // to be between 3 and 3.5 miles -biblicalcubit := 21.8 in -hebrewcubit := 17.58 in -li := 10/27.8 mile // Chinese unit of length - // 100 li is considered a day's march -liang := 11/3 oz // Chinese weight unit - -// From Encyclopedia Dictionary of the Bible -chomer := 21/2 bushels -letech := 1/2 chomer -ephah := 1/5 letech -seah := 1/3 ephah -gomer := 3/10 pecks -cab := 1.86 quarts - -kor := 97.5 gallons -bath := 9.8 gallons -hin := 1.62 gallons -log := 1/12 hin - -artaba := 1.85 bushels -chenice := .03 bushels - -// Medieval time units. According to the OED, these appear in Du Cange -// by Papias. - -timepoint := 1/5 hour // also given as 1/4 -timeminute := 1/10 hour -timeostent := 1/60 hour -timeounce := 1/8 timeostent -timeatom := 1/47 timeounce - -// Given in [15], these subdivisions of the grain were supposedly used -// by jewelers. The mite may have been used but the blanc could not -// have been accurately measured. - -mite := 1/20 grain -droit := 1/24 mite -periot := 1/20 droit -blanc := 1/24 periot - -// Resolution 12 of the BIPM 21st Conf¿rence G¿n¿rale des Poids et Mesures -// 11-15 October 1999 endorses uses of katal as SI derived unit: -// http://www.bipm.org/enus/2_Committees/cgpm21/res12.pdf -katal := mol/s -kat := katal // SI symbol for katal - -// Some silliness: - -smoot := 5 feet + 7 inches // Height of Oliver R. Smoot Jr. see: - // http://spectrum.lbl.gov/www/personnel/smoot/smoot-measure.html -True := (1 > 0) -False := (0 > 1) - -undef := ([1,,2])@1$ //Make the engine generate the value for me, why should i make NEW syntax to do it when this works too, also why should i avoid making something else - -phi := (1 + 5^(1/2))/2 - -b := bit -B := byte -yobi ::- 1024^8 -zebi ::- 1024^7 -exbi ::- 1024^6 -pebi ::- 1024^5 -tebi ::- 1024^4 -gibi ::- 1024^3 -mebi ::- 1024^2 -kibi ::- 1024^1 - -Ki :- kibi -Mi :- mebi -Gi :- gibi -Ti :- tebi -Pi :- pebi -Ei :- exbi -Zi :- zebi -Yi :- yobi diff --git a/deps/Math/Farnsworth/Units/e.2mil b/deps/Math/Farnsworth/Units/e.2mil deleted file mode 100644 index c4033db..0000000 --- a/deps/Math/Farnsworth/Units/e.2mil +++ /dev/null @@ -1 +0,0 @@ -2.718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427427466391932003059921817413596629043572900334295260595630738132328627943490763233829880753195251019011573834187930702154089149934884167509244761460668082264800168477411853742345442437107539077744992069551702761838606261331384583000752044933826560297606737113200709328709127443747047230696977209310141692836819025515108657463772111252389784425056953696770785449969967946864454905987931636889230098793127736178215424999229576351482208269895193668033182528869398496465105820939239829488793320362509443117301238197068416140397019837679320683282376464804295311802328782509819455815301756717361332069811250996181881593041690351598888519345807273866738589422879228499892086805825749279610484198444363463244968487560233624827041978623209002160990235304369941849146314093431738143640546253152096183690888707016768396424378140592714563549061303107208510383750510115747704171898610687396965521267154688957035035402123407849819334321068170121005627880235193033224745015853904730419957777093503660416997329725088687696640355570716226844716256079882651787134195124665201030592123667719432527867539855894489697096409754591856956380236370162112047742722836489613422516445078182442352948636372141740238893441247963574370263755294448337998016125492278509257782562092622648326277933386566481627725164019105900491644998289315056604725802778631864155195653244258698294695930801915298721172556347546396447910145904090586298496791287406870504895858671747985466775757320568128845920541334053922000113786300945560688166740016984205580403363795376452030402432256613527836951177883863874439662532249850654995886234281899707733276171783928034946501434558897071942586398772754710962953741521115136835062752602326484728703920764310059584116612054529703023647254929666938115137322753645098889031360205724817658511806303644281231496550704751025446501172721155519486685080036853228183152196003735625279449515828418829478761085263981395599006737648292244375287184624578036192981971399147564488262603903381441823262515097482798777996437308997038886778227138360577297882412561190717663946507063304527954661855096666185664709711344474016070462621568071748187784437143698821855967095910259686200235371858874856965220005031173439207321139080329363447972735595527734907178379342163701205005451326383544000186323991490705479778056697853358048966906295119432473099587655236812859041383241160722602998330535370876138939639177957454016137223618789365260538155841587186925538606164779834025435128439612946035291332594279490433729908573158029095863138268329147711639633709240031689458636060645845925126994655724839186564209752685082307544254599376917041977780085362730941710163434907696423722294352366125572508814779223151974778060569672538017180776360346245927877846585065605078084421152969752189087401966090665180351650179250461950136658543663271254963990854914420001457476081930221206602433009641270489439039717719518069908699860663658323227870937650226014929101151717763594460202324930028040186772391028809786660565118326004368850881715723866984224220102495055188169480322100251542649463981287367765892768816359831247788652014117411091360116499507662907794364600585194199856016264790761532103872755712699251827568798930276176114616254935649590379804583818232336861201624373656984670378585330527583333793990752166069238053369887956513728559388349989470741618155012539706464817194670834819721448889879067650379590366967249499254527903372963616265897603949857674139735944102374432970935547798262961459144293645142861715858733974679189757121195618738578364475844842355558105002561149239151889309946342841393608038309166281881150371528496705974162562823609216807515017772538740256425347087908913729172282861151591568372524163077225440633787593105982676094420326192428531701878177296023541306067213604600038966109364709514141718577701418060644363681546444005331608778314317444081194942297559931401188868331483280270655383300469329011574414756313999722170380461709289457909627166226074071874997535921275608441473782330327033016823719364800217328573493594756433412994302485023573221459784328264142168487872167336701061509424345698440187331281010794512722373788612605816566805371439612788873252737389039289050686532413806279602593038772769778379286840932536588073398845721874602100531148335132385004782716937621800490479559795929059165547050577751430817511269898518840871856402603530558373783242292418562564425502267215598027401261797192804713960068916382866527700975276706977703643926022437284184088325184877047263844037953016690546593746161932384036389313136432713768884102681121989127522305625675625470172508634976536728860596675274086862740791285657699631378975303466061666980421826772456053066077389962421834085988207186468262321508028828635974683965435885668550377313129658797581050121491620765676995065971534476347032085321560367482860837865680307306265763346977429563464371670939719306087696349532884683361303882943104080029687386911706666614680001512114344225602387447432525076938707777519329994213727721125884360871583483562696166198057252661220679754062106208064988291845439530152998209250300549825704339055357016865312052649561485724925738620691740369521353373253166634546658859728665945113644137033139367211856955395210845840724432383558606310680696492485123263269951460359603729725319836842336390463213671011619282171115028280160448805880238203198149309636959673583274202498824568494127386056649135252670604623445054922758115170931492187959271800194096886698683703730220047531433818109270803001720593553052070070607223399946399057131158709963577735902719628506114651483752620956534671329002599439766311454590268589897911583709341937044115512192011716488056694593813118384376562062784631049034629395002945834116482411496975832601180073169943739350696629571241027323913874175492307186245454322203955273529524024590380574450289224688628533654221381572213116328811205214648980518009202471939171055539011394331668151582884368760696110250517100739276238555338627255353883096067164466237092264680967125406186950214317621166814009759528149390722260111268115310838731761732323526360583817315103459573653822353499293582283685100781088463434998351840445170427018938199424341009057537625776757111809008816418331920196262341628816652137471732547772778348877436651882875215668571950637193656539038944936642176400312152787022236646363575550356557694888654950027085392361710550213114741374410613444554419210133617299628569489919336918472947858072915608851039678195942983318648075608367955149663644896559294818785178403877332624705194505041984774201418394773120281588684570729054405751060128525805659470304683634459265255213700806875200959345360731622611872817392807462309468536782310609792159936001994623799343421068781349734695924646975250624695861690917857397659519939299399556754271465491045686070209901260681870498417807917392407194599632306025470790177452751318680998228473086076653686685551646770291133682756310722334672611370549079536583453863719623585631261838715677411873852772292259474337378569553845624680101390572787101651296663676445187246565373040244368414081448873295784734849000301947788802046032466084287535184836495919508288832320652212810419044804724794929134228495197002260131043006241071797150279343326340799596053144605323048852897291765987601666781193793237245385720960758227717848336161358261289622611812945592746276713779448758675365754486140761193112595851265575973457301533364263076798544338576171533346232527057200530398828949903425956623297578248873502925916682589445689465599265845476269452878051650172067478541788798227680653665064191097343452887833862172615626958265447820567298775642632532159429441803994321700009054265076309558846589517170914760743713689331946909098190450129030709956622662030318264936573369841955577696378762491885286568660760056602560544571133728684020557441603083705231224258722343885412317948138855007568938112493538631863528708379984569261998179452336408742959118074745341955142035172618420084550917084568236820089773945584267921427347756087964427920270831215015640634134161716644806981548376449157390012121704154787259199894382536495051477137939914720521952907939613762110723849429061635760459623125350606853765142311534966568371511660422079639446662116325515772907097847315627827759878813649195125748332879377157145909106484164267830994972367442017586226940215940792448054125536043131799269673915754241929660731239376354213923061787675395871143610408940996608947141834069836299367536262154524729846421375289107988438130609555262272083751862983706678722443019579379378607210725427728907173285487437435578196651171661833088112912024520404868220007234403502544820283425418788465360259150644527165770004452109773558589762265548494162171498953238342160011406295071849042778925855274303522139683567901807640604213830730877446017084268827226117718084266433365178000217190344923426426629226145600433738386833555534345300426481847398921562708609565062934040526494324426144566592129122564889356965500915430642613425266847259491431423939884543248632746184284665598533231221046625989014171210344608427161661900125719587079321756969854401339762209674945418540711844643394699016269835160784892451405894094639526780735457970030705116368251948770118976400282764841416058720618418529718915401968825328930914966534575357142731848201638464483249903788606900807270932767312758196656394114896171683298045513972950668760474091542042842999354102582911350224169076943166857424252250902693903481485645130306992519959043638402842926741257342244776558417788617173726546208549829449894678735092958165263207225899236876845701782303809656788311228930580914057261086588484587310165815116753332767488701482916741970151255978257270740643180860142814902414678047232759768426963393577354293018673943971638861176420900406866339885684168100387238921448317607011668450388721236436704331409115573328018297798873659091665961240202177855885487617616198937079438005666336488436508914480557103976521469602766258359905198704230017946553678856743028597460014378548323706870119007849940493091891918164932725977403007487968148488234293202301212803232746039221968752834051690697419425761467397811071546418627336909158497318501118396048253351874843892317729261354302493256289637136197728545662292446164449728459786771157412567030787188510933634448014967524061853656953207417053348678275482781541556196691105510147279904038689722046555083317078239480878599050194756310898412414467282186545997159663901564194175182093593261631688838013275875260146050767609839262572641112013528859131784829947568247256488553335727977220554356812630253574821658541400080531482069713726214975557605189048162237679041492674260007104592269531483518813746388710427354476762357793399397063239660496914530327388787455790593493777232014295480334500069525698093528288778371067058556774948137385863038576282304069400566534058488752700530883245918218349431804983419963998145877343586311594057044368351528538360944295596436067609022174189688354813164399743776415836524223464261959739045545068069523285075186871944906476779188672030641863075105351214985105120731384664871754751838297999018931775155063998101646641459210240683829460320853555405814715927322067756766921366408150590080695254061062853640829327662193193993386162383606911176778544823612932685819996523927548842743541440288453645559512473554613940315495209739705189624015797683263945063323045219264504965173546677569929571898969047090273028854494541669979199294803825498028594602905276314558031651406622917122342937580614399348491436210799357673731794896425248881372043557928751138585697338197608352442324046677802094839963994668483377470672548361884827300064831916382602211055522124673332318446300550448184991699662208774614021615702102960331858872733329877935257018239386124402686833955587060775816995439846956854067117444493247951957215941964586373612691552645757478698596424217659289686238350637043393981167139754473622862550680368266413554144804899 diff --git a/deps/Math/Farnsworth/Value.pm b/deps/Math/Farnsworth/Value.pm deleted file mode 100644 index 0b2c723..0000000 --- a/deps/Math/Farnsworth/Value.pm +++ /dev/null @@ -1,142 +0,0 @@ -#new value class! -package Math::Farnsworth::Value; - -use strict; -use warnings; - -use Carp; -use Data::Dumper; - -use base qw/Exporter/; - -use Math::Farnsworth::Value::Boolean; -use Math::Farnsworth::Value::Array; -use Math::Farnsworth::Value::String; -use Math::Farnsworth::Value::Date; -use Math::Farnsworth::Value::Pari; -use Math::Farnsworth::Value::Lambda; -use Math::Farnsworth::Value::Undef; - -our @EXPORT = qw(TYPE_BOOLEAN TYPE_STRING TYPE_DATE TYPE_PLAIN TYPE_TIME TYPE_LAMBDA TYPE_UNDEF TYPE_ARRAY); - -#### -#THESE FUNCTIONS WILL BE MOVED TO Math::Farnsworth::Value, or somewhere more appropriate - -sub setref -{ - my $self = shift; - my $ref = shift; - $self->{_ref} = $ref; -} - -sub getref -{ - my $self = shift; - return $self->{_ref}; -} - -sub istype -{ - my $self = shift; - my $allow = shift; #type to allow! - - return ref($self) =~ /\Q$allow/i; -} - -sub ismediumtype -{ - my $self = shift; - my $allow = shift; #type to allow! - $allow ||= ""; - - if ($self->isa("Math::Farnsworth::Value::Array") && $allow ne "Array") - { - return 1; - } - elsif ($self->isa("Math::Farnsworth::Value::Boolean") && $allow ne "Boolean") - { - return 1; - } - elsif ($self->isa("Math::Farnsworth::Value::String") && $allow ne "String") - { - return 1; - } - elsif ($self->isa("Math::Farnsworth::Value::Date") && $allow ne "Date") - { - return 1; - } -# promoting Lambda to a High type, so that it can capture the multiplication with other types -# elsif ($self->isa("Math::Farnsworth::Value::Lambda") && $allow ne "Lambda") -# { -# return 1; -# } - elsif ($self->isa("Math::Farnsworth::Value::Undef") && $allow ne "Undef") - { - return 1; - } - - return 0; -} - -#these values will also probably be put into a "memoized" setup so that they don't get recreated all the fucking time - -{ - my $boolean; - my $string; - my $date; - my $plain; - my $time; - my $lambda; - my $undef; - my $array; - - sub TYPE_BOOLEAN{return $boolean if $boolean; $boolean=new Math::Farnsworth::Value::Boolean(0)} - sub TYPE_STRING {return $string if $string; $string=new Math::Farnsworth::Value::String("")} - sub TYPE_DATE {return $date if $date; $date=new Math::Farnsworth::Value::Date("today")} - #this tells it that it is the same as a constraint of "1", e.g. no units - sub TYPE_PLAIN {return $plain if $plain; $plain=new Math::Farnsworth::Value::Pari(0)} - #this tells it that it is the same as a constraint of "1 s", e.g. seconds - sub TYPE_TIME {return $time if $time; $time=new Math::Farnsworth::Value::Pari(0, {time=>1})} - sub TYPE_LAMBDA {return $lambda if $lambda; $lambda=new Math::Farnsworth::Value::Lambda()} - sub TYPE_UNDEF {return $undef if $undef; $undef=new Math::Farnsworth::Value::Undef()} - sub TYPE_ARRAY {return $array if $array; $array=new Math::Farnsworth::Value::Array([])} -} - -sub conforms -{ - my $self = shift; - my $comparator = shift; - - if (ref($self) ne ref($comparator)) - { - return 0; - } - else - { - if (ref($self) eq "Math::Farnsworth::Value::Pari") - { - my $ret = $self->getdimen()->compare($comparator->getdimen()); - return $ret; - } - else - { - return 1; #for now? - } - } -} - -sub clone -{ - my $self = shift; - my $class = ref($self); - - my $newself = {}; - $newself->{$_} = $self->{$_} for (keys %$self); - - bless $newself, $class; - $newself->setref(undef); - - $newself; -} - -1; diff --git a/deps/Math/Farnsworth/Value/.svn/entries b/deps/Math/Farnsworth/Value/.svn/entries deleted file mode 100644 index e7fefa4..0000000 --- a/deps/Math/Farnsworth/Value/.svn/entries +++ /dev/null @@ -1,300 +0,0 @@ -10 - -dir -475 -svn://erxz.com/bb3/branches/perlbuut/deps/Math/Farnsworth/Value -svn://erxz.com/bb3 - - - -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - -dcb1cea6-7f7e-4c78-8a22-148ace8ce36e - -NewValue.pm -file - - - - -2009-10-03T22:54:20.000000Z -76afd62cf1457700fc9d582c473324e5 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -1593 - -String.pm -file - - - - -2009-10-03T22:54:20.000000Z -f242f18060b984dcdad8a93a8c90abda -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -6660 - -Pari.pm -file - - - - -2009-10-03T22:54:20.000000Z -e2854892c45b67692a78c41edf61ce68 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -8040 - -Date.pm -file - - - - -2009-10-03T22:54:20.000000Z -16cedfbf35121c908a8a8d33180a9579 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -7070 - -Array.pm -file - - - - -2009-10-03T22:54:20.000000Z -b827841bda6dd3760c441fe888219888 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -6277 - -Boolean.pm -file - - - - -2009-10-03T22:54:20.000000Z -b37900e84e3e1a3b2d282523378a954d -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -5894 - -Lambda.pm -file - - - - -2009-10-03T22:54:20.000000Z -ec6183209f852bdb4a041f74df512283 -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -6761 - -Undef.pm -file - - - - -2009-10-03T22:54:20.000000Z -3a23f900c5e5e71ae92049a9ad48303f -2009-10-03T22:53:42.528878Z -475 -simcop - - - - - - - - - - - - - - - - - - - - - -5418 - diff --git a/deps/Math/Farnsworth/Value/.svn/text-base/Array.pm.svn-base b/deps/Math/Farnsworth/Value/.svn/text-base/Array.pm.svn-base deleted file mode 100644 index 3b7e3d5..0000000 --- a/deps/Math/Farnsworth/Value/.svn/text-base/Array.pm.svn-base +++ /dev/null @@ -1,227 +0,0 @@ -package Math::Farnsworth::Value::Array; - -use strict; -use warnings; - -use Math::Farnsworth::Dimension; -#use Math::Farnsworth::Value; -use Carp; -use List::MoreUtils 'each_array'; - -use utf8; - -our $VERSION = 0.6; - -use overload - '+' => \&add, - '-' => \&subtract, - '*' => \&mult, - '/' => \&div, - '%' => \&mod, - '**' => \&pow, - '<=>' => \&compare, - 'bool' => \&bool; - -use base qw(Math::Farnsworth::Value); - -#this is the REQUIRED fields for Math::Farnsworth::Value subclasses -# -#dimen => a Math::Farnsworth::Dimension object -# -#this is so i can make a -> conforms in Math::Farnsworth::Value, to replace the existing code, i'm also planning on adding some definitions such as, TYPE_PARI, TYPE_STRING, TYPE_LAMBDA, TYPE_DATE, etc. to make certain things easier - -sub new -{ - my $class = shift; - my $value = shift; - my $outmagic = shift; #i'm still not sure on this one - - confess "Non array reference given as \$value to constructor" unless ref($value) eq "ARRAY" && defined($value); - - my $self = {}; - - bless $self, $class; - - $self->{outmagic} = $outmagic; - - $self->{array} = [@{$value}] || []; - - return $self; -} - -sub sanitizeself -{ - my $self=shift; - #this is to deal with a single bug i've got, it slows things down a lot :( - - for (@{$self->{array}}) - { - $_->setref(undef); - } -} - -sub getarray -{ - my $self = shift; - return @{$self->{array}}; -} - -sub getarrayref -{ - return $_[0]->{array}; -} - -sub add -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to addition" unless ref($two); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - confess "Scalar value given to addition to array" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->add($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Array")) - { - confess "Given non array to array addition"; - } - - #ONLY THIS MODULE SHOULD EVER TOUCH ->{pari} ANYMORE! this might change into, NEVER - my $order; - $order = [$one->getarray(), $two->getarray()] unless $rev; - $order = [$two->getarray(), $one->getarray()] if $rev; - my $arr = new Math::Farnsworth::Value::Array($order); #concatenate the arrays - #$arr->sanitizeself(); - return $arr; -} - -sub subtract -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to subtraction" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Scalar value given to subtraction to array" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->subtract($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Array")) - { - confess "Given non array to array subtraction"; - } - - die "Subtracting arrays? what did you think this would do, create a black hole?"; -} - -sub modulus -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to modulus" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Scalar value given to modulus to array" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->mod($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Array")) - { - confess "Given non array to array modulus"; - } - - die "Modulusing arrays? what did you think this would do, create a black hole?"; -} - -sub mult -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to multiplication" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Scalar value given to multiplcation to array" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->mult($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Array")) - { - confess "Given non array to array multiplication"; - } - - die "Multiplying arrays? what did you think this would do, create a black hole?"; -} - -sub div -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to division" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Scalar value given to division to array" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->div($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Array")) - { - confess "Given non array to array division"; - } - - die "Dividing arrays? what did you think this would do, create a black hole?"; -} - -sub bool -{ - my $self = shift; - - #boolean for array is the same as it is in perl, empty or not - return @{$self->getarrayref()}?1:0; -} - -sub pow -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to exponentiation" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Exponentiating arrays? what did you think this would do, create a black hole?" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->pow($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Array")) - { - confess "Given non array to array exponentiation"; - } - - die "Exponentiating arrays? what did you think this would do, create a black hole?"; -} - -sub __compare -{ - my ($a1, $a2) = @_; - my $same = 0; - my $ea = each_array(@$a1, @$a2); - - while(my ($first, $second) = $ea->()) - { - $same = $first > $second ? 1 : -1 and last if $first != $second - } # shortcircuits - - return $same; -} - -sub compare -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to compare" unless ref($two); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - return $two->compare($one, !$rev) unless ($two->ismediumtype()); - die "Can't compare two things that aren't arrays!" unless $two->isa("Math::Farnsworth::Value::Array"); - - my $rv = $rev ? -1 : 1; - my $tv = $two->getarray(); - my $ov = $one->getarray(); - - #i also need to check the units, but that will come later - #NOTE TO SELF this needs to be more helpful, i'll probably do something by adding stuff in ->new to be able to fetch more about the processing - die "Unable to process different units in compare\n" unless $one->conforms($two); #always call this on one, since $two COULD be some other object - - #moving this down so that i don't do any math i don't have to - my $new = __compare($tv, $ov); - - return $new * $rv; -} - diff --git a/deps/Math/Farnsworth/Value/.svn/text-base/Boolean.pm.svn-base b/deps/Math/Farnsworth/Value/.svn/text-base/Boolean.pm.svn-base deleted file mode 100644 index 98162e7..0000000 --- a/deps/Math/Farnsworth/Value/.svn/text-base/Boolean.pm.svn-base +++ /dev/null @@ -1,198 +0,0 @@ -package Math::Farnsworth::Value::Boolean; - -use strict; -use warnings; - -use Math::Farnsworth::Dimension; -use Math::Farnsworth::Value; -use Carp; - -use utf8; - -our $VERSION = 0.6; - -use overload - '+' => \&add, - '-' => \&subtract, - '*' => \&mult, - '/' => \&div, - '%' => \&mod, - '**' => \&pow, - '<=>' => \&compare, - 'bool' => \&bool; - -use base qw(Math::Farnsworth::Value); - -#this is the REQUIRED fields for Math::Farnsworth::Value subclasses -# -#dimen => a Math::Farnsworth::Dimension object -# -#this is so i can make a -> conforms in Math::Farnsworth::Value, to replace the existing code, i'm also planning on adding some definitions such as, TYPE_PARI, TYPE_STRING, TYPE_LAMBDA, TYPE_DATE, etc. to make certain things easier - -sub new -{ - my $class = shift; - my $value = shift; - my $outmagic = shift; #i'm still not sure on this one - - my $self = {}; - - bless $self, $class; - - $self->{outmagic} = $outmagic; - - $self->{truthiness} = $value ? 1 : 0; - - return $self; -} - -sub gettruth -{ - return $_[0]->{truthiness}; -} - -####### -#The rest of this code can be GREATLY cleaned up by assuming that $one is of type, Math::Farnsworth::Value::Pari, this means that i can slowly redo a lot of this code - -sub add -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to addition" unless ref($two); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - confess "Scalar value given to addition to boolean" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->add($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Boolean")) - { - confess "Given non boolean to boolean operation"; - } - - - #NOTE TO SELF this needs to be more helpful, i'll probably do this by creating an "error" class that'll be captured in ->evalbranch's recursion and use that to add information from the parse tree about WHERE the error occured - die "Adding booleans is not a good idea\n"; -} - -sub subtract -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to subtraction" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - die "Scalar value given to subtraction to Booleans" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->subtract($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Boolean")) - { - confess "Given non boolean to boolean operation"; - } - - die "Subtracting Booleans? what did you think this would do, create a black hole?"; -} - -sub modulus -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to modulus" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Scalar value given to modulus to boolean" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->mod($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Boolean")) - { - confess "Given non boolean to boolean operation"; - } - - die "Modulusing booleans? what did you think this would do, create a black hole?"; -} - -sub mult -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to multiplication" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Scalar value given to multiplcation to array" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->mult($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Boolean")) - { - confess "Given non boolean to boolean operation"; - } - - die "Multiplying arrays? what did you think this would do, create a black hole?"; -} - -sub div -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to division" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Scalar value given to division to array" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->div($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Boolean")) - { - confess "Given non boolean to boolean operation"; - } - - die "Dividing arrays? what did you think this would do, create a black hole?"; -} - -sub bool -{ - my $self = shift; - - #seems good enough of an idea to me - #i have a bug HERE - #print "BOOLCONV\n"; - #print Dumper($self); - #print "ENDBOOLCONV\n"; - return $self->gettruth()?1:0; -} - -sub pow -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to exponentiation" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Exponentiating arrays? what did you think this would do, create a black hole?" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->pow($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Boolean")) - { - confess "Given non boolean to boolean operation"; - } - - - die "Exponentiating arrays? what did you think this would do, create a black hole?"; -} - -sub compare -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to compare" unless ref($two); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - confess "Scalar value given to division to array" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->compare($one, !$rev) unless ($two->ismediumtype()); - - my $rv = $rev ? -1 : 1; - #check for $two being a simple value - my $tv = $two->gettruth(); - my $ov = $one->gettruth(); - - #i also need to check the units, but that will come later - #NOTE TO SELF this needs to be more helpful, i'll probably do something by adding stuff in ->new to be able to fetch more about the processing - die "Unable to process different units in compare\n" unless $one->conforms($two); #always call this on one, since $two COULD be some other object - - #moving this down so that i don't do any math i don't have to - my $new = $tv <=> $ov; - - return $new * $rv; -} - diff --git a/deps/Math/Farnsworth/Value/.svn/text-base/Date.pm.svn-base b/deps/Math/Farnsworth/Value/.svn/text-base/Date.pm.svn-base deleted file mode 100644 index c16480b..0000000 --- a/deps/Math/Farnsworth/Value/.svn/text-base/Date.pm.svn-base +++ /dev/null @@ -1,260 +0,0 @@ -package Math::Farnsworth::Value::Date; - -use strict; -use warnings; - -use Math::Farnsworth::Dimension; -use Math::Farnsworth::Value; -use Math::Farnsworth::Value::Pari; -use Carp; - -use DateTime; -#use DateTime::Format::DateManip; -#use Date::Manip; -use DateTimeX::Easy; - -use utf8; - -our $VERSION = 0.6; - -use overload - '+' => \&add, - '-' => \&subtract, - '*' => \&mult, - '/' => \&div, - '%' => \&mod, - '**' => \&pow, - '<=>' => \&compare, - 'bool' => \&bool; - -use base qw(Math::Farnsworth::Value); - -#this is the REQUIRED fields for Math::Farnsworth::Value subclasses -# -#dimen => a Math::Farnsworth::Dimension object -# -#this is so i can make a -> conforms in Math::Farnsworth::Value, to replace the existing code, i'm also planning on adding some definitions such as, TYPE_PARI, TYPE_STRING, TYPE_LAMBDA, TYPE_DATE, etc. to make certain things easier - -sub new -{ - my $class = shift; - my $value = shift; - my $outmagic = shift; #i'm still not sure on this one - - confess "Non string or date given as \$value to constructor" unless (ref($value) eq "" || ref($value) eq "DateTime") && defined($value); - - my $self = {}; - - bless $self, $class; - - $self->{outmagic} = $outmagic; - - if (ref($value) ne "DateTime") - { - my $dt = DateTimeX::Easy->parse($value); - die "failed to parse date!" unless defined $dt; - $dt->set_time_zone('UTC'); #supposed to make things easier and more predictable - - $self->{date} = $dt; - } - else - { - $self->{date} = $value; - } - - return $self; -} - -sub getdate -{ - return $_[0]->{date}; -} - -####### -#The rest of this code can be GREATLY cleaned up by assuming that $one is of type, Math::Farnsworth::Value::Pari, this means that i can slowly redo a lot of this code - -sub add -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to addition" unless ref($two); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - - if ($two->isa("Math::Farnsworth::Value::Pari")) - { - if ($two->conforms($one->TYPE_TIME)) - { - return new Math::Farnsworth::Value::Date($one->getdate()->clone()->add(seconds => "".$two->getpari())); - } - else - { - confess "Scalar value given to addition to string" if ($two->isa("Math::Farnsworth::Value::Pari")); - } - } - else - { - return $two->add($one, !$rev) unless ($two->ismediumtype()); - - if (!$two->istype("Date")) - { - confess "Given non date to date operation"; - } - - die "Adding dates does nothing useful."; - } -} - -sub subtract -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to addition" unless ref($two); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - - if ($two->isa("Math::Farnsworth::Value::Pari")) - { - if ($two->conforms($one->TYPE_TIME)) - { - if (!$rev) #we're first! - { - return new Math::Farnsworth::Value::Date($one->getdate()->clone()->add(seconds => "".(-$two->getpari()))); - } - else - { - die "And just now what is that supposed to do? a negative date? what the hell is that?"; - } - } - else - { - confess "Scalar value given to addition to string" if ($two->isa("Math::Farnsworth::Value::Pari")); - } - } - else - { - return $two->subtract($one, !$rev) unless ($two->ismediumtype()); - - if (!$two->istype("Date")) - { - confess "Given non date to date operation"; - } - - my $diff; - $diff = $one->getdate()->subtract_datetime_absolute($two->getdate()) unless $rev; - $diff = $two->getdate()->subtract_datetime_absolute($one->getdate()) if $rev; - - my ($secs, $nano) = $diff->in_units('seconds','nanoseconds'); - my $rdiff = $secs + 0.000000001 *$nano; - - my $ret = Math::Farnsworth::Value::Pari->new($rdiff, {time => 1}); - - return $ret; - } -} - -sub modulus -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to modulus" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Scalar value given to modulus to date" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->mod($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Date")) - { - confess "Given non date to date operation"; - } - - die "Modulusing dates? what did you think this would do, create a black hole?"; -} - -sub mult -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to multiplication" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Scalar value given to multiplcation to dates" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->mult($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Date")) - { - confess "Given non date to date operation"; - } - - die "Multiplying dates? what did you think this would do, create a black hole?"; -} - -sub div -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to division" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Scalar value given to division to date" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->div($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Date")) - { - confess "Given non date to dates operation"; - } - - die "Dividing date? what did you think this would do, create a black hole?"; -} - -sub bool -{ - my $self = shift; - - #seems good enough of an idea to me - #i have a bug HERE - #print "BOOLCONV\n"; - #print Dumper($self); - #print "ENDBOOLCONV\n"; - return 1; #what else should it be? -} - -sub pow -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to exponentiation" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Exponentiating dates? what did you think this would do, create a black hole?" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->pow($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Date")) - { - confess "Given non date to date operation"; - } - - die "Exponentiating dates? what did you think this would do, create a black hole?"; -} - -sub compare -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to compare" unless ref($two); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - confess "Scalar value given to division to dates" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->compare($one, !$rev) unless ($two->ismediumtype()); - - my $rv = $rev ? -1 : 1; - #check for $two being a simple value - my $tv = $two->getdate(); - my $ov = $one->getdate(); - - #i also need to check the units, but that will come later - #NOTE TO SELF this needs to be more helpful, i'll probably do something by adding stuff in ->new to be able to fetch more about the processing - die "Unable to process different units in compare\n" unless $one->conforms($two); #always call this on one, since $two COULD be some other object - - #moving this down so that i don't do any math i don't have to - my $new = $ov <=> $tv; - - return $new * $rv; -} - diff --git a/deps/Math/Farnsworth/Value/.svn/text-base/Lambda.pm.svn-base b/deps/Math/Farnsworth/Value/.svn/text-base/Lambda.pm.svn-base deleted file mode 100644 index 03c0ef5..0000000 --- a/deps/Math/Farnsworth/Value/.svn/text-base/Lambda.pm.svn-base +++ /dev/null @@ -1,230 +0,0 @@ -package Math::Farnsworth::Value::Lambda; - -use strict; -use warnings; - -use Math::Farnsworth::Dimension; -use Math::Farnsworth::Value; -use Carp; - -use Data::Dumper; - -use utf8; - -our $VERSION = 0.6; - -use overload - '+' => \&add, - '-' => \&subtract, - '*' => \&mult, - '/' => \&div, - '%' => \&mod, - '**' => \&pow, - '<=>' => \&compare, - 'bool' => \&bool; - -use base qw(Math::Farnsworth::Value); - -#this is the REQUIRED fields for Math::Farnsworth::Value subclasses -# -#dimen => a Math::Farnsworth::Dimension object -# -#this is so i can make a -> conforms in Math::Farnsworth::Value, to replace the existing code, i'm also planning on adding some definitions such as, TYPE_PARI, TYPE_STRING, TYPE_LAMBDA, TYPE_DATE, etc. to make certain things easier - -sub new -{ - my $class = shift; - my $scope = shift; - my $args = shift; - my $code = shift; - my $branches = shift; - my $outmagic = shift; #i'm still not sure on this one - - my $self = {}; - - bless $self, $class; - - $self->{outmagic} = $outmagic; - - $self->{scope} = $scope; - $self->{code} = $code; - $self->{args} = $args; - $self->{branches} = $branches; - - return $self; -} - -sub getcode -{ - return $_[0]->{code}; -} - -sub getargs -{ - return $_[0]->{args}; -} - -sub getscope -{ - return $_[0]->{scope}; -} - -sub getbranches -{ - return $_[0]->{branches}; -} - -####### -#The rest of this code can be GREATLY cleaned up by assuming that $one is of type, Math::Farnsworth::Value::Pari, this means that i can slowly redo a lot of this code - -sub add -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to addition" unless ref($two); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - confess "Scalar value given to addition to Lambda" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->add($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Lambda")) - { - confess "Given non boolean to boolean operation"; - } - - - #NOTE TO SELF this needs to be more helpful, i'll probably do this by creating an "error" class that'll be captured in ->evalbranch's recursion and use that to add information from the parse tree about WHERE the error occured - die "Adding lambda is not a good idea\n"; -} - -sub subtract -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to subtraction" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - die "Scalar value given to subtraction to Lambda" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->subtract($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Lambda")) - { - confess "Given non boolean to lambda operation"; - } - - die "Subtracting lambdas? what did you think this would do, create a black hole?"; -} - -sub modulus -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to modulus" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Scalar value given to modulus to lambda" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->mod($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Lambda")) - { - confess "Given non lambda to lambda operation"; - } - - die "Modulusing lambda? what did you think this would do, create a black hole?"; -} - -sub mult -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to multiplication" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - #confess "Scalar value given to multiplcation to lambda. ED: This will make white holes later" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->mult($one, !$rev) unless ($two->ismediumtype() || $two->istype("Pari") || $two->istype("Lambda")); - -# if (!$two->istype("Lambda")) -# { -# confess "Given non lambda to lambda operation"; -# } - - my $args = $two->istype("Array") ? $two : new Math::Farnsworth::Value::Array([$two]); - - #this code is debug code, but i'm afraid to take it out, when i put it here it started working properly - #print "LAMBDAMULT\n"; - #eval{print Dumper($one->{scope}->{vars}->getvar('x'), $one->{scope}->{vars}->getvar('y'))}; #this bug was fixed - - return $one->{scope}->{funcs}->calllambda($one, $args); #needs to be updated - -# die "Multiplying lambdas? what did you think this would do, create a black hole? ED: this will make black holes later"; -} - -sub div -{ - my ($one, $two, $rev) = @_; - - print "INSIDE LAMBDA DIVISION\n"; - - confess "Non reference given to division" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - - return $two->div($one, !$rev) unless ($two->ismediumtype()|| $two->istype("Pari") || $two->istype("Lambda")); - - if ($two->isa("Math::Farnsworth::Value::Pari")) - { - #ok i've got a simple thing here i think! - #its not simple, will not be simple and will not end up working right, this is a hack to make 10 kg per cubic meter, and the like to work, until i add objects - my $onevalue = Math::Farnsworth::Value::Pari->new(1); #don't use 1.0 it'll coerce things into floats unneccesarily - my $newv = $onevalue * $one; #this'll remultiply things! - my $ret = $two / $newv; #this COULD be dangerous since i can see how to make an inf loop in a division this way - return $ret; - } - - if (!$two->istype("Lambda")) - { - confess "Given non boolean to lambda operation"; - } - - die "Dividing lambdas? what did you think this would do, create a black hole?"; -} - -sub bool -{ - #my $self = shift; - - #seems good enough of an idea to me - #i have a bug HERE - #print "BOOLCONV\n"; - #print Dumper($self); - #print "ENDBOOLCONV\n"; - return 1; #for now lambdas are ALWAYS true! -} - -sub pow -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to exponentiation" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Exponentiating arrays? what did you think this would do, create a black hole?" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->pow($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Lambda")) - { - confess "Given non boolean to lambdas operation"; - } - - die "Exponentiating lambdas? what did you think this would do, create a black hole?"; -} - -sub compare -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to compare" unless ref($two); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - confess "Scalar value given to division to lambdas" if ($two->istype("Pari")); - return $two->compare($one, !$rev) unless ($two->istype("Lambda")); - - return 0; #i don't have any metric for comparing lambdas, so... they'll always be equal -} - diff --git a/deps/Math/Farnsworth/Value/.svn/text-base/NewValue.pm.svn-base b/deps/Math/Farnsworth/Value/.svn/text-base/NewValue.pm.svn-base deleted file mode 100644 index 66006ce..0000000 --- a/deps/Math/Farnsworth/Value/.svn/text-base/NewValue.pm.svn-base +++ /dev/null @@ -1,84 +0,0 @@ -#new value class! -package Math::Farnsworth::Value; - -use strict; -use warnings; - -use Carp; - -#### -#THESE FUNCTIONS WILL BE MOVED TO Math::Farnsworth::Value, or somewhere more appropriate - -sub ismediumtype -{ - my $self = shift; - my $allow = shift; #type to allow! - - if ($self->isa("Math::Farnsworth::Value::Array") && $allow ne "Array") - { - return 1; - } - elsif ($self->isa("Math::Farnsworth::Value::Boolean") && $allow ne "Boolean") - { - return 1; - } - elsif ($self->isa("Math::Farnsworth::Value::String") && $allow ne "String") - { - return 1; - } - elsif ($self->isa("Math::Farnsworth::Value::Date") && $allow ne "Date") - { - return 1; - } - elsif ($self->isa("Math::Farnsworth::Value::Lambda") && $allow ne "Lambda") - { - return 1; - } - elsif ($self->isa("Math::Farnsworth::Value::Undef") && $allow ne "Undef") - { - return 1; - } - - return 0; -} - -#these values will also probably be put into a "memoized" setup so that they don't get recreated all the fucking time -sub TYPE_BOOLEAN -{ - new Math::Farnsworth::Value::Boolean(0); -} - -sub TYPE_STRING -{ - new Math::Farnsworth::Value::String(""); -} - -sub TYPE_DATE -{ - new Math::Farnsworth::Value::Date(); -} - -sub TYPE_PLAIN #this tells it that it is the same as a constraint of "1", e.g. no units -{ - new Math::Farnsworth::Value::Pari(0); -} - -sub TYPE_TIME #this tells it that it is the same as a constraint of "1", e.g. no units -{ - new Math::Farnsworth::Value::Pari(0, {time=> 1}); -} - -sub TYPE_LAMBDA -{ - new Math::Farnsworth::Value::Lambda(); -} - -sub TYPE_UNDEF -{ - new Math::Farnsworth::Value::Undef(); -} - -sub TYPE_ARRAY -{ - new Math::Farnsworth::Value::Array(); -} diff --git a/deps/Math/Farnsworth/Value/.svn/text-base/Pari.pm.svn-base b/deps/Math/Farnsworth/Value/.svn/text-base/Pari.pm.svn-base deleted file mode 100644 index 3ff4cd1..0000000 --- a/deps/Math/Farnsworth/Value/.svn/text-base/Pari.pm.svn-base +++ /dev/null @@ -1,271 +0,0 @@ -package Math::Farnsworth::Value::Pari; - -use strict; -use warnings; - -use Math::Pari; -use Math::Farnsworth::Dimension; -use Math::Farnsworth::Value; -use Carp qw(confess cluck croak carp); - -use Data::Dumper; - -use utf8; - -our $VERSION = 0.5; - -use overload - '+' => \&add, - '-' => \&subtract, - '*' => \&mult, - '/' => \&div, - '%' => \&mod, - '**' => \&pow, - '<=>' => \&compare, - 'bool' => \&bool, - '"' => \&toperl; - -use base qw(Math::Farnsworth::Value); - -#this is the REQUIRED fields for Math::Farnsworth::Value subclasses -# -#dimen => a Math::Farnsworth::Dimension object -# -#this is so i can make a -> conforms in Math::Farnsworth::Value, to replace the existing code, i'm also planning on adding some definitions such as, TYPE_PARI, TYPE_STRING, TYPE_LAMBDA, TYPE_DATE, etc. to make certain things easier - -sub new -{ - my $class = shift; - my $value = shift; - my $dimen = shift; #should only really be used internally? - my $outmagic = shift; #i'm still not sure on this one - - my $self = {}; - - bless $self, $class; - - $self->{outmagic} = $outmagic; - - if (ref($dimen) eq "Math::Farnsworth::Dimension") - { - $self->{dimen} = $dimen; - } - else - { - $dimen = {} if !defined($dimen); - $self->{dimen} = new Math::Farnsworth::Dimension($dimen); - } - - $value =~ s/(ee|E)/e/i; #fixes double ee's, i could probably eventually remove this, but it doesn't do any harm for now - $self->{pari} = PARI $value; - - return $self; -} - -#### -#THESE FUNCTIONS WILL BE MOVED TO Math::Farnsworth::Value, or somewhere more appropriate - -sub getdimen -{ - my $self = shift; - return $self->{dimen}; -} - -####### -#The rest of this code can be GREATLY cleaned up by assuming that $one is of type, Math::Farnsworth::Value::Pari, this means that i can slowly redo a lot of this code - -sub getpari -{ - my $self = shift; - return $self->{pari}; -} - -sub toperl -{ - my $self = shift; - return $self->getpari().""; -} - -sub add -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to addition" unless (ref($two)); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - return $two->add($one, !$rev) unless ($two->isa(__PACKAGE__)); - - #NOTE TO SELF this needs to be more helpful, i'll probably do this by creating an "error" class that'll be captured in ->evalbranch's recursion and use that to add information from the parse tree about WHERE the error occured - die "Unable to process different units in addition\n" unless ($one->conforms($two)); - - #moving this down so that i don't do any math i don't have to - - #ONLY THIS MODULE SHOULD EVER TOUCH ->{pari} ANYMORE! this might change into, NEVER - return new Math::Farnsworth::Value::Pari($one->getpari() + $two->getpari(), $one->getdimen()); -} - -sub subtract -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to subtraction" unless (ref($two)); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - return $two->subtract($one, !$rev) unless ($two->isa(__PACKAGE__)); - - #NOTE TO SELF this needs to be more helpful, i'll probably do this by creating an "error" class that'll be captured in ->evalbranch's recursion and use that to add information from the parse tree about WHERE the error occured - die "Unable to process different units in subtraction\n" unless ($one->conforms($two)); - - #moving this down so that i don't do any math i don't have to - if (!$rev) - { - return new Math::Farnsworth::Value::Pari($one->getpari() - $two->getpari(), $one->getdimen()); #if !$rev they are in order - } - else - { - #i've never seen this happen, we'll see if it works - die "some mistake happened here in subtraction\n"; #to test later on - } -} - -sub mod -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to modulus" unless (ref($two)); - - #as odd as this seems, we need it in order to allow overloading later on - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - return $two->mod($one, !$rev) unless ($two->isa(__PACKAGE__)); - - #NOTE TO SELF this needs to be more helpful, i'll probably do this by creating an "error" class that'll be captured in ->evalbranch's recursion and use that to add information from the parse tree about WHERE the error occured - die "Unable to process different units in modulus\n" unless ($one->conforms($two)); - - #moving this down so that i don't do any math i don't have to - if (!$rev) - { - return new Math::Farnsworth::Value::Pari($one->getpari() % $two->getpari(), $one->getdimen()); #if !$rev they are in order - } - else - { - return new Math::Farnsworth::Value::Pari($two->getpari() % $one->getpari(), $one->getdimen()); #if !$rev they are in order - } -} - -sub mult -{ - my ($one, $two, $rev) = @_; - - confess "ARRAY REF WTF?" if (ref($two) eq "ARRAY"); - confess "Non reference given to multiplication " unless (ref($two)); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - return $two->mult($one, !$rev) unless ($two->isa(__PACKAGE__)); - - my $nd = $one->getdimen()->merge($two->getdimen()); #merge the dimensions! don't cross the streams though - - #moving this down so that i don't do any math i don't have to - return new Math::Farnsworth::Value::Pari($one->getpari() * $two->getpari(), $nd); -} - -sub div -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to division" unless (ref($two)); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - return $two->div($one, !$rev) unless ($two->isa(__PACKAGE__)); - - #these are a little screwy SO i'll probably comment them more later - #probably after i find out that they're wrong - my $qd = $rev ? $two->getdimen() : $one->getdimen(); - my $dd = $rev ? $one->getdimen()->invert() : $two->getdimen()->invert(); - - my $nd = $qd->merge($dd); - - if (!$rev) - { - return new Math::Farnsworth::Value::Pari($one->getpari() / $two->getpari(), $nd); #if !$rev they are in order - } - else - { - return new Math::Farnsworth::Value::Pari($two->getpari() / $one->getpari(), $nd); #if !$rev they are in order - } -} - -sub bool -{ - my $self = shift; - - #seems good enough of an idea to me - #i have a bug HERE -# print "PARI BOOLCONV\n"; - #print Dumper($self); - #print "ENDBOOLCONV\n"; - return $self->getpari()?1:0; -} - -sub pow -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to exponentiation" unless (ref($two)); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - return $two->pow($one, !$rev) unless ($two->isa(__PACKAGE__)); - - if (!$two->conforms($one->TYPE_PLAIN)) - { - die "A number with units as the exponent doesn't make sense"; - } - - #moving this down so that i don't do any math i don't have to - my $new; - if (!$rev) - { - $new = new Math::Farnsworth::Value::Pari($one->getpari() ** $two->getpari(), $one->getdimen()->mult($two->getpari())); #if !$rev they are in order - } - else - { - die "Wrong order in ->pow()"; - } - - return $new; -} - -sub compare -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to exponentiation" unless (ref($two)); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - return $two->compare($one, !$rev) unless ($two->isa(__PACKAGE__)); - - my $rv = $rev ? -1 : 1; - #check for $two being a simple value - my $tv = $two->getpari(); - my $ov = $one->getpari(); - - #i also need to check the units, but that will come later - #NOTE TO SELF this needs to be more helpful, i'll probably do something by adding stuff in ->new to be able to fetch more about the processing - die "Unable to process different units in compare\n" unless $one->conforms($two); #always call this on one, since $two COULD be some other object - - #moving this down so that i don't do any math i don't have to - my $new; - - if ($ov == $tv) - { - return 0; - } - elsif ($ov < $tv) - { - return -1; - } - elsif ($ov > $tv) - { - return 1; - } -} - diff --git a/deps/Math/Farnsworth/Value/.svn/text-base/String.pm.svn-base b/deps/Math/Farnsworth/Value/.svn/text-base/String.pm.svn-base deleted file mode 100644 index ec4af4c..0000000 --- a/deps/Math/Farnsworth/Value/.svn/text-base/String.pm.svn-base +++ /dev/null @@ -1,232 +0,0 @@ -package Math::Farnsworth::Value::String; - -use strict; -use warnings; - -use Math::Farnsworth::Dimension; -use Math::Farnsworth::Value; -use Carp; - -use utf8; - -our $VERSION = 0.6; - -use overload - '+' => \&add, - '-' => \&subtract, - '*' => \&mult, - '/' => \&div, - '%' => \&mod, - '**' => \&pow, - '<=>' => \&compare, - 'bool' => \&bool; - -use base qw(Math::Farnsworth::Value); - -#this is the REQUIRED fields for Math::Farnsworth::Value subclasses -# -#dimen => a Math::Farnsworth::Dimension object -# -#this is so i can make a -> conforms in Math::Farnsworth::Value, to replace the existing code, i'm also planning on adding some definitions such as, TYPE_PARI, TYPE_STRING, TYPE_LAMBDA, TYPE_DATE, etc. to make certain things easier - -sub new -{ - my $class = shift; - my $value = shift; - my $lang = shift; - my $outmagic = shift; #i'm still not sure on this one - - confess "Non string given as \$value to constructor" unless ref($value) eq "" && defined($value); - - my $self = {}; - - bless $self, $class; - - $self->{outmagic} = $outmagic; - - { - no warnings 'uninitialized'; - $self->{string} = "".$value; - } - $self->{lang} = $lang || ""; - - return $self; -} - -sub getstring -{ - return $_[0]->{string}; -} - -sub getlang -{ - return $_[0]->{lang}; -} - -####### -#The rest of this code can be GREATLY cleaned up by assuming that $one is of type, Math::Farnsworth::Value::Pari, this means that i can slowly redo a lot of this code - -sub add -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to addition" unless (ref($two)); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - confess "Scalar value given to addition to string" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->add($one, !$rev) unless ($two->ismediumtype()); - - if (!$two->istype("String")) - { - confess "Given non boolean to boolean operation"; - } - - - #NOTE TO SELF this needs to be more helpful, i'll probably do this by creating an "error" class that'll be captured in ->evalbranch's recursion and use that to add information from the parse tree about WHERE the error occured - my $new; - $new = $one->getstring() . $two->getstring() unless $rev; - $new = $two->getstring() . $one->getstring() if $rev; - - my $lang = ""; - $lang = $one->getlang() if ($one->getlang() eq $two->getlang()); #if we know their language, and they're the same, just keep it - - return new Math::Farnsworth::Value::String($new); #return new string -} - -sub subtract -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to subtraction" unless (ref($two)); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - die "Scalar value given to subtraction to strings" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->subtract($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("String")) - { - confess "Given non boolean to boolean operation"; - } - - die "Subtracting strings? what did you think this would do, create a black hole?"; -} - -sub modulus -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to modulus" unless (ref($two)); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Scalar value given to modulus to string" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->mod($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("String")) - { - confess "Given non string to string operation"; - } - - die "Modulusing strings? what did you think this would do, create a black hole?"; -} - -sub mult -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to multiplication" unless (ref($two)); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Scalar value given to multiplcation to string" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->mult($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("String")) - { - confess "Given non string to string operation"; - } - - die "Multiplying strings? what did you think this would do, create a black hole?"; -} - -sub div -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to division" unless (ref($two)); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Scalar value given to division to string" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->div($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("String")) - { - confess "Given non string to string operation"; - } - - die "Dividing string? what did you think this would do, create a black hole?"; -} - -sub bool -{ - my $self = shift; - - #seems good enough of an idea to me - #i have a bug HERE - #print "BOOLCONV\n"; - #print Dumper($self); - #print "ENDBOOLCONV\n"; - return length($self->getstring())?1:0; -} - -sub pow -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to exponentiation" unless (ref($two)); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Exponentiating strings? what did you think this would do, create a black hole?" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->pow($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("String")) - { - confess "Given non string to string operation"; - } - - - die "Exponentiating strings? what did you think this would do, create a black hole?"; -} - -sub __compare -{ - my ($a1, $a2) = @_; - my $same = 0; - my $ea = each_array(@$a1, @$a2); - - while(my ($first, $second) = $ea->()) - { - $same = $first > $second ? 1 : -1 and last if $first != $second - } # shortcircuits - - return $same; -} - -sub compare -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to compare" unless (ref($two)); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - confess "Scalar value given to division to string" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->compare($one, !$rev) unless ($two->ismediumtype()); - - my $rv = $rev ? -1 : 1; - #check for $two being a simple value - my $tv = $two->getstring(); - my $ov = $one->getstring(); - - #i also need to check the units, but that will come later - #NOTE TO SELF this needs to be more helpful, i'll probably do something by adding stuff in ->new to be able to fetch more about the processing - die "Unable to process different units in compare\n" unless $one->conforms($two); #always call this on one, since $two COULD be some other object - - #moving this down so that i don't do any math i don't have to - my $new = $tv cmp $ov; - - return $new * $rv; -} - diff --git a/deps/Math/Farnsworth/Value/.svn/text-base/Undef.pm.svn-base b/deps/Math/Farnsworth/Value/.svn/text-base/Undef.pm.svn-base deleted file mode 100644 index 2332016..0000000 --- a/deps/Math/Farnsworth/Value/.svn/text-base/Undef.pm.svn-base +++ /dev/null @@ -1,192 +0,0 @@ -package Math::Farnsworth::Value::Undef; - -use strict; -use warnings; - -use Math::Farnsworth::Dimension; -use Math::Farnsworth::Value; -use Carp; - -use utf8; - -our $VERSION = 0.6; - -use overload - '+' => \&add, - '-' => \&subtract, - '*' => \&mult, - '/' => \&div, - '%' => \&mod, - '**' => \&pow, - '<=>' => \&compare, - 'bool' => \&bool; - -use base qw(Math::Farnsworth::Value); - -#this is the REQUIRED fields for Math::Farnsworth::Value subclasses -# -#dimen => a Math::Farnsworth::Dimension object -# -#this is so i can make a -> conforms in Math::Farnsworth::Value, to replace the existing code, i'm also planning on adding some definitions such as, TYPE_PARI, TYPE_STRING, TYPE_LAMBDA, TYPE_DATE, etc. to make certain things easier - -sub new -{ - my $class = shift; - my $outmagic = shift; #i'm still not sure on this one - - my $self = {}; - - bless $self, $class; - - $self->{outmagic} = $outmagic; - - return $self; -} - -####### -#The rest of this code can be GREATLY cleaned up by assuming that $one is of type, Math::Farnsworth::Value::Pari, this means that i can slowly redo a lot of this code - -sub add -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to addition" unless ref($two); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - confess "Scalar value given to addition to boolean" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->add($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Boolean")) - { - confess "Given non boolean to boolean operation"; - } - - - #NOTE TO SELF this needs to be more helpful, i'll probably do this by creating an "error" class that'll be captured in ->evalbranch's recursion and use that to add information from the parse tree about WHERE the error occured - die "Adding booleans is not a good idea\n"; -} - -sub subtract -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to subtraction" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - die "Scalar value given to subtraction to Booleans" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->subtract($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Boolean")) - { - confess "Given non boolean to boolean operation"; - } - - die "Subtracting Booleans? what did you think this would do, create a black hole?"; -} - -sub modulus -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to modulus" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Scalar value given to modulus to boolean" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->mod($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Boolean")) - { - confess "Given non boolean to boolean operation"; - } - - die "Modulusing booleans? what did you think this would do, create a black hole?"; -} - -sub mult -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to multiplication" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Scalar value given to multiplcation to array" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->mult($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Boolean")) - { - confess "Given non boolean to boolean operation"; - } - - die "Multiplying arrays? what did you think this would do, create a black hole?"; -} - -sub div -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to division" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Scalar value given to division to array" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->div($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Boolean")) - { - confess "Given non boolean to boolean operation"; - } - - die "Dividing arrays? what did you think this would do, create a black hole?"; -} - -sub bool -{ - my $self = shift; - - #seems good enough of an idea to me - #i have a bug HERE - #print "BOOLCONV\n"; - #print Dumper($self); - #print "ENDBOOLCONV\n"; - return 0; -} - -sub pow -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to exponentiation" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Exponentiating arrays? what did you think this would do, create a black hole?" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->pow($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Boolean")) - { - confess "Given non boolean to boolean operation"; - } - - - die "Exponentiating arrays? what did you think this would do, create a black hole?"; -} - -sub __compare -{ - my ($a1, $a2) = @_; - my $same = 0; - my $ea = each_array(@$a1, @$a2); - - while(my ($first, $second) = $ea->()) - { - $same = $first > $second ? 1 : -1 and last if $first != $second - } # shortcircuits - - return $same; -} - -sub compare -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to compare" unless ref($two); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - confess "Scalar value given to division to array" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->compare($one, !$rev) unless ($two->ismediumtype()); - - return 0; -} - diff --git a/deps/Math/Farnsworth/Value/Array.pm b/deps/Math/Farnsworth/Value/Array.pm deleted file mode 100644 index 3b7e3d5..0000000 --- a/deps/Math/Farnsworth/Value/Array.pm +++ /dev/null @@ -1,227 +0,0 @@ -package Math::Farnsworth::Value::Array; - -use strict; -use warnings; - -use Math::Farnsworth::Dimension; -#use Math::Farnsworth::Value; -use Carp; -use List::MoreUtils 'each_array'; - -use utf8; - -our $VERSION = 0.6; - -use overload - '+' => \&add, - '-' => \&subtract, - '*' => \&mult, - '/' => \&div, - '%' => \&mod, - '**' => \&pow, - '<=>' => \&compare, - 'bool' => \&bool; - -use base qw(Math::Farnsworth::Value); - -#this is the REQUIRED fields for Math::Farnsworth::Value subclasses -# -#dimen => a Math::Farnsworth::Dimension object -# -#this is so i can make a -> conforms in Math::Farnsworth::Value, to replace the existing code, i'm also planning on adding some definitions such as, TYPE_PARI, TYPE_STRING, TYPE_LAMBDA, TYPE_DATE, etc. to make certain things easier - -sub new -{ - my $class = shift; - my $value = shift; - my $outmagic = shift; #i'm still not sure on this one - - confess "Non array reference given as \$value to constructor" unless ref($value) eq "ARRAY" && defined($value); - - my $self = {}; - - bless $self, $class; - - $self->{outmagic} = $outmagic; - - $self->{array} = [@{$value}] || []; - - return $self; -} - -sub sanitizeself -{ - my $self=shift; - #this is to deal with a single bug i've got, it slows things down a lot :( - - for (@{$self->{array}}) - { - $_->setref(undef); - } -} - -sub getarray -{ - my $self = shift; - return @{$self->{array}}; -} - -sub getarrayref -{ - return $_[0]->{array}; -} - -sub add -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to addition" unless ref($two); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - confess "Scalar value given to addition to array" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->add($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Array")) - { - confess "Given non array to array addition"; - } - - #ONLY THIS MODULE SHOULD EVER TOUCH ->{pari} ANYMORE! this might change into, NEVER - my $order; - $order = [$one->getarray(), $two->getarray()] unless $rev; - $order = [$two->getarray(), $one->getarray()] if $rev; - my $arr = new Math::Farnsworth::Value::Array($order); #concatenate the arrays - #$arr->sanitizeself(); - return $arr; -} - -sub subtract -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to subtraction" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Scalar value given to subtraction to array" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->subtract($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Array")) - { - confess "Given non array to array subtraction"; - } - - die "Subtracting arrays? what did you think this would do, create a black hole?"; -} - -sub modulus -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to modulus" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Scalar value given to modulus to array" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->mod($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Array")) - { - confess "Given non array to array modulus"; - } - - die "Modulusing arrays? what did you think this would do, create a black hole?"; -} - -sub mult -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to multiplication" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Scalar value given to multiplcation to array" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->mult($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Array")) - { - confess "Given non array to array multiplication"; - } - - die "Multiplying arrays? what did you think this would do, create a black hole?"; -} - -sub div -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to division" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Scalar value given to division to array" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->div($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Array")) - { - confess "Given non array to array division"; - } - - die "Dividing arrays? what did you think this would do, create a black hole?"; -} - -sub bool -{ - my $self = shift; - - #boolean for array is the same as it is in perl, empty or not - return @{$self->getarrayref()}?1:0; -} - -sub pow -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to exponentiation" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Exponentiating arrays? what did you think this would do, create a black hole?" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->pow($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Array")) - { - confess "Given non array to array exponentiation"; - } - - die "Exponentiating arrays? what did you think this would do, create a black hole?"; -} - -sub __compare -{ - my ($a1, $a2) = @_; - my $same = 0; - my $ea = each_array(@$a1, @$a2); - - while(my ($first, $second) = $ea->()) - { - $same = $first > $second ? 1 : -1 and last if $first != $second - } # shortcircuits - - return $same; -} - -sub compare -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to compare" unless ref($two); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - return $two->compare($one, !$rev) unless ($two->ismediumtype()); - die "Can't compare two things that aren't arrays!" unless $two->isa("Math::Farnsworth::Value::Array"); - - my $rv = $rev ? -1 : 1; - my $tv = $two->getarray(); - my $ov = $one->getarray(); - - #i also need to check the units, but that will come later - #NOTE TO SELF this needs to be more helpful, i'll probably do something by adding stuff in ->new to be able to fetch more about the processing - die "Unable to process different units in compare\n" unless $one->conforms($two); #always call this on one, since $two COULD be some other object - - #moving this down so that i don't do any math i don't have to - my $new = __compare($tv, $ov); - - return $new * $rv; -} - diff --git a/deps/Math/Farnsworth/Value/Boolean.pm b/deps/Math/Farnsworth/Value/Boolean.pm deleted file mode 100644 index 98162e7..0000000 --- a/deps/Math/Farnsworth/Value/Boolean.pm +++ /dev/null @@ -1,198 +0,0 @@ -package Math::Farnsworth::Value::Boolean; - -use strict; -use warnings; - -use Math::Farnsworth::Dimension; -use Math::Farnsworth::Value; -use Carp; - -use utf8; - -our $VERSION = 0.6; - -use overload - '+' => \&add, - '-' => \&subtract, - '*' => \&mult, - '/' => \&div, - '%' => \&mod, - '**' => \&pow, - '<=>' => \&compare, - 'bool' => \&bool; - -use base qw(Math::Farnsworth::Value); - -#this is the REQUIRED fields for Math::Farnsworth::Value subclasses -# -#dimen => a Math::Farnsworth::Dimension object -# -#this is so i can make a -> conforms in Math::Farnsworth::Value, to replace the existing code, i'm also planning on adding some definitions such as, TYPE_PARI, TYPE_STRING, TYPE_LAMBDA, TYPE_DATE, etc. to make certain things easier - -sub new -{ - my $class = shift; - my $value = shift; - my $outmagic = shift; #i'm still not sure on this one - - my $self = {}; - - bless $self, $class; - - $self->{outmagic} = $outmagic; - - $self->{truthiness} = $value ? 1 : 0; - - return $self; -} - -sub gettruth -{ - return $_[0]->{truthiness}; -} - -####### -#The rest of this code can be GREATLY cleaned up by assuming that $one is of type, Math::Farnsworth::Value::Pari, this means that i can slowly redo a lot of this code - -sub add -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to addition" unless ref($two); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - confess "Scalar value given to addition to boolean" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->add($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Boolean")) - { - confess "Given non boolean to boolean operation"; - } - - - #NOTE TO SELF this needs to be more helpful, i'll probably do this by creating an "error" class that'll be captured in ->evalbranch's recursion and use that to add information from the parse tree about WHERE the error occured - die "Adding booleans is not a good idea\n"; -} - -sub subtract -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to subtraction" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - die "Scalar value given to subtraction to Booleans" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->subtract($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Boolean")) - { - confess "Given non boolean to boolean operation"; - } - - die "Subtracting Booleans? what did you think this would do, create a black hole?"; -} - -sub modulus -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to modulus" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Scalar value given to modulus to boolean" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->mod($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Boolean")) - { - confess "Given non boolean to boolean operation"; - } - - die "Modulusing booleans? what did you think this would do, create a black hole?"; -} - -sub mult -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to multiplication" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Scalar value given to multiplcation to array" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->mult($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Boolean")) - { - confess "Given non boolean to boolean operation"; - } - - die "Multiplying arrays? what did you think this would do, create a black hole?"; -} - -sub div -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to division" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Scalar value given to division to array" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->div($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Boolean")) - { - confess "Given non boolean to boolean operation"; - } - - die "Dividing arrays? what did you think this would do, create a black hole?"; -} - -sub bool -{ - my $self = shift; - - #seems good enough of an idea to me - #i have a bug HERE - #print "BOOLCONV\n"; - #print Dumper($self); - #print "ENDBOOLCONV\n"; - return $self->gettruth()?1:0; -} - -sub pow -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to exponentiation" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Exponentiating arrays? what did you think this would do, create a black hole?" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->pow($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Boolean")) - { - confess "Given non boolean to boolean operation"; - } - - - die "Exponentiating arrays? what did you think this would do, create a black hole?"; -} - -sub compare -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to compare" unless ref($two); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - confess "Scalar value given to division to array" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->compare($one, !$rev) unless ($two->ismediumtype()); - - my $rv = $rev ? -1 : 1; - #check for $two being a simple value - my $tv = $two->gettruth(); - my $ov = $one->gettruth(); - - #i also need to check the units, but that will come later - #NOTE TO SELF this needs to be more helpful, i'll probably do something by adding stuff in ->new to be able to fetch more about the processing - die "Unable to process different units in compare\n" unless $one->conforms($two); #always call this on one, since $two COULD be some other object - - #moving this down so that i don't do any math i don't have to - my $new = $tv <=> $ov; - - return $new * $rv; -} - diff --git a/deps/Math/Farnsworth/Value/Date.pm b/deps/Math/Farnsworth/Value/Date.pm deleted file mode 100644 index c16480b..0000000 --- a/deps/Math/Farnsworth/Value/Date.pm +++ /dev/null @@ -1,260 +0,0 @@ -package Math::Farnsworth::Value::Date; - -use strict; -use warnings; - -use Math::Farnsworth::Dimension; -use Math::Farnsworth::Value; -use Math::Farnsworth::Value::Pari; -use Carp; - -use DateTime; -#use DateTime::Format::DateManip; -#use Date::Manip; -use DateTimeX::Easy; - -use utf8; - -our $VERSION = 0.6; - -use overload - '+' => \&add, - '-' => \&subtract, - '*' => \&mult, - '/' => \&div, - '%' => \&mod, - '**' => \&pow, - '<=>' => \&compare, - 'bool' => \&bool; - -use base qw(Math::Farnsworth::Value); - -#this is the REQUIRED fields for Math::Farnsworth::Value subclasses -# -#dimen => a Math::Farnsworth::Dimension object -# -#this is so i can make a -> conforms in Math::Farnsworth::Value, to replace the existing code, i'm also planning on adding some definitions such as, TYPE_PARI, TYPE_STRING, TYPE_LAMBDA, TYPE_DATE, etc. to make certain things easier - -sub new -{ - my $class = shift; - my $value = shift; - my $outmagic = shift; #i'm still not sure on this one - - confess "Non string or date given as \$value to constructor" unless (ref($value) eq "" || ref($value) eq "DateTime") && defined($value); - - my $self = {}; - - bless $self, $class; - - $self->{outmagic} = $outmagic; - - if (ref($value) ne "DateTime") - { - my $dt = DateTimeX::Easy->parse($value); - die "failed to parse date!" unless defined $dt; - $dt->set_time_zone('UTC'); #supposed to make things easier and more predictable - - $self->{date} = $dt; - } - else - { - $self->{date} = $value; - } - - return $self; -} - -sub getdate -{ - return $_[0]->{date}; -} - -####### -#The rest of this code can be GREATLY cleaned up by assuming that $one is of type, Math::Farnsworth::Value::Pari, this means that i can slowly redo a lot of this code - -sub add -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to addition" unless ref($two); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - - if ($two->isa("Math::Farnsworth::Value::Pari")) - { - if ($two->conforms($one->TYPE_TIME)) - { - return new Math::Farnsworth::Value::Date($one->getdate()->clone()->add(seconds => "".$two->getpari())); - } - else - { - confess "Scalar value given to addition to string" if ($two->isa("Math::Farnsworth::Value::Pari")); - } - } - else - { - return $two->add($one, !$rev) unless ($two->ismediumtype()); - - if (!$two->istype("Date")) - { - confess "Given non date to date operation"; - } - - die "Adding dates does nothing useful."; - } -} - -sub subtract -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to addition" unless ref($two); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - - if ($two->isa("Math::Farnsworth::Value::Pari")) - { - if ($two->conforms($one->TYPE_TIME)) - { - if (!$rev) #we're first! - { - return new Math::Farnsworth::Value::Date($one->getdate()->clone()->add(seconds => "".(-$two->getpari()))); - } - else - { - die "And just now what is that supposed to do? a negative date? what the hell is that?"; - } - } - else - { - confess "Scalar value given to addition to string" if ($two->isa("Math::Farnsworth::Value::Pari")); - } - } - else - { - return $two->subtract($one, !$rev) unless ($two->ismediumtype()); - - if (!$two->istype("Date")) - { - confess "Given non date to date operation"; - } - - my $diff; - $diff = $one->getdate()->subtract_datetime_absolute($two->getdate()) unless $rev; - $diff = $two->getdate()->subtract_datetime_absolute($one->getdate()) if $rev; - - my ($secs, $nano) = $diff->in_units('seconds','nanoseconds'); - my $rdiff = $secs + 0.000000001 *$nano; - - my $ret = Math::Farnsworth::Value::Pari->new($rdiff, {time => 1}); - - return $ret; - } -} - -sub modulus -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to modulus" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Scalar value given to modulus to date" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->mod($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Date")) - { - confess "Given non date to date operation"; - } - - die "Modulusing dates? what did you think this would do, create a black hole?"; -} - -sub mult -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to multiplication" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Scalar value given to multiplcation to dates" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->mult($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Date")) - { - confess "Given non date to date operation"; - } - - die "Multiplying dates? what did you think this would do, create a black hole?"; -} - -sub div -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to division" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Scalar value given to division to date" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->div($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Date")) - { - confess "Given non date to dates operation"; - } - - die "Dividing date? what did you think this would do, create a black hole?"; -} - -sub bool -{ - my $self = shift; - - #seems good enough of an idea to me - #i have a bug HERE - #print "BOOLCONV\n"; - #print Dumper($self); - #print "ENDBOOLCONV\n"; - return 1; #what else should it be? -} - -sub pow -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to exponentiation" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Exponentiating dates? what did you think this would do, create a black hole?" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->pow($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Date")) - { - confess "Given non date to date operation"; - } - - die "Exponentiating dates? what did you think this would do, create a black hole?"; -} - -sub compare -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to compare" unless ref($two); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - confess "Scalar value given to division to dates" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->compare($one, !$rev) unless ($two->ismediumtype()); - - my $rv = $rev ? -1 : 1; - #check for $two being a simple value - my $tv = $two->getdate(); - my $ov = $one->getdate(); - - #i also need to check the units, but that will come later - #NOTE TO SELF this needs to be more helpful, i'll probably do something by adding stuff in ->new to be able to fetch more about the processing - die "Unable to process different units in compare\n" unless $one->conforms($two); #always call this on one, since $two COULD be some other object - - #moving this down so that i don't do any math i don't have to - my $new = $ov <=> $tv; - - return $new * $rv; -} - diff --git a/deps/Math/Farnsworth/Value/Lambda.pm b/deps/Math/Farnsworth/Value/Lambda.pm deleted file mode 100644 index 03c0ef5..0000000 --- a/deps/Math/Farnsworth/Value/Lambda.pm +++ /dev/null @@ -1,230 +0,0 @@ -package Math::Farnsworth::Value::Lambda; - -use strict; -use warnings; - -use Math::Farnsworth::Dimension; -use Math::Farnsworth::Value; -use Carp; - -use Data::Dumper; - -use utf8; - -our $VERSION = 0.6; - -use overload - '+' => \&add, - '-' => \&subtract, - '*' => \&mult, - '/' => \&div, - '%' => \&mod, - '**' => \&pow, - '<=>' => \&compare, - 'bool' => \&bool; - -use base qw(Math::Farnsworth::Value); - -#this is the REQUIRED fields for Math::Farnsworth::Value subclasses -# -#dimen => a Math::Farnsworth::Dimension object -# -#this is so i can make a -> conforms in Math::Farnsworth::Value, to replace the existing code, i'm also planning on adding some definitions such as, TYPE_PARI, TYPE_STRING, TYPE_LAMBDA, TYPE_DATE, etc. to make certain things easier - -sub new -{ - my $class = shift; - my $scope = shift; - my $args = shift; - my $code = shift; - my $branches = shift; - my $outmagic = shift; #i'm still not sure on this one - - my $self = {}; - - bless $self, $class; - - $self->{outmagic} = $outmagic; - - $self->{scope} = $scope; - $self->{code} = $code; - $self->{args} = $args; - $self->{branches} = $branches; - - return $self; -} - -sub getcode -{ - return $_[0]->{code}; -} - -sub getargs -{ - return $_[0]->{args}; -} - -sub getscope -{ - return $_[0]->{scope}; -} - -sub getbranches -{ - return $_[0]->{branches}; -} - -####### -#The rest of this code can be GREATLY cleaned up by assuming that $one is of type, Math::Farnsworth::Value::Pari, this means that i can slowly redo a lot of this code - -sub add -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to addition" unless ref($two); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - confess "Scalar value given to addition to Lambda" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->add($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Lambda")) - { - confess "Given non boolean to boolean operation"; - } - - - #NOTE TO SELF this needs to be more helpful, i'll probably do this by creating an "error" class that'll be captured in ->evalbranch's recursion and use that to add information from the parse tree about WHERE the error occured - die "Adding lambda is not a good idea\n"; -} - -sub subtract -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to subtraction" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - die "Scalar value given to subtraction to Lambda" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->subtract($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Lambda")) - { - confess "Given non boolean to lambda operation"; - } - - die "Subtracting lambdas? what did you think this would do, create a black hole?"; -} - -sub modulus -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to modulus" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Scalar value given to modulus to lambda" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->mod($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Lambda")) - { - confess "Given non lambda to lambda operation"; - } - - die "Modulusing lambda? what did you think this would do, create a black hole?"; -} - -sub mult -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to multiplication" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - #confess "Scalar value given to multiplcation to lambda. ED: This will make white holes later" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->mult($one, !$rev) unless ($two->ismediumtype() || $two->istype("Pari") || $two->istype("Lambda")); - -# if (!$two->istype("Lambda")) -# { -# confess "Given non lambda to lambda operation"; -# } - - my $args = $two->istype("Array") ? $two : new Math::Farnsworth::Value::Array([$two]); - - #this code is debug code, but i'm afraid to take it out, when i put it here it started working properly - #print "LAMBDAMULT\n"; - #eval{print Dumper($one->{scope}->{vars}->getvar('x'), $one->{scope}->{vars}->getvar('y'))}; #this bug was fixed - - return $one->{scope}->{funcs}->calllambda($one, $args); #needs to be updated - -# die "Multiplying lambdas? what did you think this would do, create a black hole? ED: this will make black holes later"; -} - -sub div -{ - my ($one, $two, $rev) = @_; - - print "INSIDE LAMBDA DIVISION\n"; - - confess "Non reference given to division" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - - return $two->div($one, !$rev) unless ($two->ismediumtype()|| $two->istype("Pari") || $two->istype("Lambda")); - - if ($two->isa("Math::Farnsworth::Value::Pari")) - { - #ok i've got a simple thing here i think! - #its not simple, will not be simple and will not end up working right, this is a hack to make 10 kg per cubic meter, and the like to work, until i add objects - my $onevalue = Math::Farnsworth::Value::Pari->new(1); #don't use 1.0 it'll coerce things into floats unneccesarily - my $newv = $onevalue * $one; #this'll remultiply things! - my $ret = $two / $newv; #this COULD be dangerous since i can see how to make an inf loop in a division this way - return $ret; - } - - if (!$two->istype("Lambda")) - { - confess "Given non boolean to lambda operation"; - } - - die "Dividing lambdas? what did you think this would do, create a black hole?"; -} - -sub bool -{ - #my $self = shift; - - #seems good enough of an idea to me - #i have a bug HERE - #print "BOOLCONV\n"; - #print Dumper($self); - #print "ENDBOOLCONV\n"; - return 1; #for now lambdas are ALWAYS true! -} - -sub pow -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to exponentiation" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Exponentiating arrays? what did you think this would do, create a black hole?" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->pow($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Lambda")) - { - confess "Given non boolean to lambdas operation"; - } - - die "Exponentiating lambdas? what did you think this would do, create a black hole?"; -} - -sub compare -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to compare" unless ref($two); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - confess "Scalar value given to division to lambdas" if ($two->istype("Pari")); - return $two->compare($one, !$rev) unless ($two->istype("Lambda")); - - return 0; #i don't have any metric for comparing lambdas, so... they'll always be equal -} - diff --git a/deps/Math/Farnsworth/Value/NewValue.pm b/deps/Math/Farnsworth/Value/NewValue.pm deleted file mode 100644 index 66006ce..0000000 --- a/deps/Math/Farnsworth/Value/NewValue.pm +++ /dev/null @@ -1,84 +0,0 @@ -#new value class! -package Math::Farnsworth::Value; - -use strict; -use warnings; - -use Carp; - -#### -#THESE FUNCTIONS WILL BE MOVED TO Math::Farnsworth::Value, or somewhere more appropriate - -sub ismediumtype -{ - my $self = shift; - my $allow = shift; #type to allow! - - if ($self->isa("Math::Farnsworth::Value::Array") && $allow ne "Array") - { - return 1; - } - elsif ($self->isa("Math::Farnsworth::Value::Boolean") && $allow ne "Boolean") - { - return 1; - } - elsif ($self->isa("Math::Farnsworth::Value::String") && $allow ne "String") - { - return 1; - } - elsif ($self->isa("Math::Farnsworth::Value::Date") && $allow ne "Date") - { - return 1; - } - elsif ($self->isa("Math::Farnsworth::Value::Lambda") && $allow ne "Lambda") - { - return 1; - } - elsif ($self->isa("Math::Farnsworth::Value::Undef") && $allow ne "Undef") - { - return 1; - } - - return 0; -} - -#these values will also probably be put into a "memoized" setup so that they don't get recreated all the fucking time -sub TYPE_BOOLEAN -{ - new Math::Farnsworth::Value::Boolean(0); -} - -sub TYPE_STRING -{ - new Math::Farnsworth::Value::String(""); -} - -sub TYPE_DATE -{ - new Math::Farnsworth::Value::Date(); -} - -sub TYPE_PLAIN #this tells it that it is the same as a constraint of "1", e.g. no units -{ - new Math::Farnsworth::Value::Pari(0); -} - -sub TYPE_TIME #this tells it that it is the same as a constraint of "1", e.g. no units -{ - new Math::Farnsworth::Value::Pari(0, {time=> 1}); -} - -sub TYPE_LAMBDA -{ - new Math::Farnsworth::Value::Lambda(); -} - -sub TYPE_UNDEF -{ - new Math::Farnsworth::Value::Undef(); -} - -sub TYPE_ARRAY -{ - new Math::Farnsworth::Value::Array(); -} diff --git a/deps/Math/Farnsworth/Value/Pari.pm b/deps/Math/Farnsworth/Value/Pari.pm deleted file mode 100644 index 3ff4cd1..0000000 --- a/deps/Math/Farnsworth/Value/Pari.pm +++ /dev/null @@ -1,271 +0,0 @@ -package Math::Farnsworth::Value::Pari; - -use strict; -use warnings; - -use Math::Pari; -use Math::Farnsworth::Dimension; -use Math::Farnsworth::Value; -use Carp qw(confess cluck croak carp); - -use Data::Dumper; - -use utf8; - -our $VERSION = 0.5; - -use overload - '+' => \&add, - '-' => \&subtract, - '*' => \&mult, - '/' => \&div, - '%' => \&mod, - '**' => \&pow, - '<=>' => \&compare, - 'bool' => \&bool, - '"' => \&toperl; - -use base qw(Math::Farnsworth::Value); - -#this is the REQUIRED fields for Math::Farnsworth::Value subclasses -# -#dimen => a Math::Farnsworth::Dimension object -# -#this is so i can make a -> conforms in Math::Farnsworth::Value, to replace the existing code, i'm also planning on adding some definitions such as, TYPE_PARI, TYPE_STRING, TYPE_LAMBDA, TYPE_DATE, etc. to make certain things easier - -sub new -{ - my $class = shift; - my $value = shift; - my $dimen = shift; #should only really be used internally? - my $outmagic = shift; #i'm still not sure on this one - - my $self = {}; - - bless $self, $class; - - $self->{outmagic} = $outmagic; - - if (ref($dimen) eq "Math::Farnsworth::Dimension") - { - $self->{dimen} = $dimen; - } - else - { - $dimen = {} if !defined($dimen); - $self->{dimen} = new Math::Farnsworth::Dimension($dimen); - } - - $value =~ s/(ee|E)/e/i; #fixes double ee's, i could probably eventually remove this, but it doesn't do any harm for now - $self->{pari} = PARI $value; - - return $self; -} - -#### -#THESE FUNCTIONS WILL BE MOVED TO Math::Farnsworth::Value, or somewhere more appropriate - -sub getdimen -{ - my $self = shift; - return $self->{dimen}; -} - -####### -#The rest of this code can be GREATLY cleaned up by assuming that $one is of type, Math::Farnsworth::Value::Pari, this means that i can slowly redo a lot of this code - -sub getpari -{ - my $self = shift; - return $self->{pari}; -} - -sub toperl -{ - my $self = shift; - return $self->getpari().""; -} - -sub add -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to addition" unless (ref($two)); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - return $two->add($one, !$rev) unless ($two->isa(__PACKAGE__)); - - #NOTE TO SELF this needs to be more helpful, i'll probably do this by creating an "error" class that'll be captured in ->evalbranch's recursion and use that to add information from the parse tree about WHERE the error occured - die "Unable to process different units in addition\n" unless ($one->conforms($two)); - - #moving this down so that i don't do any math i don't have to - - #ONLY THIS MODULE SHOULD EVER TOUCH ->{pari} ANYMORE! this might change into, NEVER - return new Math::Farnsworth::Value::Pari($one->getpari() + $two->getpari(), $one->getdimen()); -} - -sub subtract -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to subtraction" unless (ref($two)); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - return $two->subtract($one, !$rev) unless ($two->isa(__PACKAGE__)); - - #NOTE TO SELF this needs to be more helpful, i'll probably do this by creating an "error" class that'll be captured in ->evalbranch's recursion and use that to add information from the parse tree about WHERE the error occured - die "Unable to process different units in subtraction\n" unless ($one->conforms($two)); - - #moving this down so that i don't do any math i don't have to - if (!$rev) - { - return new Math::Farnsworth::Value::Pari($one->getpari() - $two->getpari(), $one->getdimen()); #if !$rev they are in order - } - else - { - #i've never seen this happen, we'll see if it works - die "some mistake happened here in subtraction\n"; #to test later on - } -} - -sub mod -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to modulus" unless (ref($two)); - - #as odd as this seems, we need it in order to allow overloading later on - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - return $two->mod($one, !$rev) unless ($two->isa(__PACKAGE__)); - - #NOTE TO SELF this needs to be more helpful, i'll probably do this by creating an "error" class that'll be captured in ->evalbranch's recursion and use that to add information from the parse tree about WHERE the error occured - die "Unable to process different units in modulus\n" unless ($one->conforms($two)); - - #moving this down so that i don't do any math i don't have to - if (!$rev) - { - return new Math::Farnsworth::Value::Pari($one->getpari() % $two->getpari(), $one->getdimen()); #if !$rev they are in order - } - else - { - return new Math::Farnsworth::Value::Pari($two->getpari() % $one->getpari(), $one->getdimen()); #if !$rev they are in order - } -} - -sub mult -{ - my ($one, $two, $rev) = @_; - - confess "ARRAY REF WTF?" if (ref($two) eq "ARRAY"); - confess "Non reference given to multiplication " unless (ref($two)); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - return $two->mult($one, !$rev) unless ($two->isa(__PACKAGE__)); - - my $nd = $one->getdimen()->merge($two->getdimen()); #merge the dimensions! don't cross the streams though - - #moving this down so that i don't do any math i don't have to - return new Math::Farnsworth::Value::Pari($one->getpari() * $two->getpari(), $nd); -} - -sub div -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to division" unless (ref($two)); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - return $two->div($one, !$rev) unless ($two->isa(__PACKAGE__)); - - #these are a little screwy SO i'll probably comment them more later - #probably after i find out that they're wrong - my $qd = $rev ? $two->getdimen() : $one->getdimen(); - my $dd = $rev ? $one->getdimen()->invert() : $two->getdimen()->invert(); - - my $nd = $qd->merge($dd); - - if (!$rev) - { - return new Math::Farnsworth::Value::Pari($one->getpari() / $two->getpari(), $nd); #if !$rev they are in order - } - else - { - return new Math::Farnsworth::Value::Pari($two->getpari() / $one->getpari(), $nd); #if !$rev they are in order - } -} - -sub bool -{ - my $self = shift; - - #seems good enough of an idea to me - #i have a bug HERE -# print "PARI BOOLCONV\n"; - #print Dumper($self); - #print "ENDBOOLCONV\n"; - return $self->getpari()?1:0; -} - -sub pow -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to exponentiation" unless (ref($two)); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - return $two->pow($one, !$rev) unless ($two->isa(__PACKAGE__)); - - if (!$two->conforms($one->TYPE_PLAIN)) - { - die "A number with units as the exponent doesn't make sense"; - } - - #moving this down so that i don't do any math i don't have to - my $new; - if (!$rev) - { - $new = new Math::Farnsworth::Value::Pari($one->getpari() ** $two->getpari(), $one->getdimen()->mult($two->getpari())); #if !$rev they are in order - } - else - { - die "Wrong order in ->pow()"; - } - - return $new; -} - -sub compare -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to exponentiation" unless (ref($two)); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - return $two->compare($one, !$rev) unless ($two->isa(__PACKAGE__)); - - my $rv = $rev ? -1 : 1; - #check for $two being a simple value - my $tv = $two->getpari(); - my $ov = $one->getpari(); - - #i also need to check the units, but that will come later - #NOTE TO SELF this needs to be more helpful, i'll probably do something by adding stuff in ->new to be able to fetch more about the processing - die "Unable to process different units in compare\n" unless $one->conforms($two); #always call this on one, since $two COULD be some other object - - #moving this down so that i don't do any math i don't have to - my $new; - - if ($ov == $tv) - { - return 0; - } - elsif ($ov < $tv) - { - return -1; - } - elsif ($ov > $tv) - { - return 1; - } -} - diff --git a/deps/Math/Farnsworth/Value/String.pm b/deps/Math/Farnsworth/Value/String.pm deleted file mode 100644 index ec4af4c..0000000 --- a/deps/Math/Farnsworth/Value/String.pm +++ /dev/null @@ -1,232 +0,0 @@ -package Math::Farnsworth::Value::String; - -use strict; -use warnings; - -use Math::Farnsworth::Dimension; -use Math::Farnsworth::Value; -use Carp; - -use utf8; - -our $VERSION = 0.6; - -use overload - '+' => \&add, - '-' => \&subtract, - '*' => \&mult, - '/' => \&div, - '%' => \&mod, - '**' => \&pow, - '<=>' => \&compare, - 'bool' => \&bool; - -use base qw(Math::Farnsworth::Value); - -#this is the REQUIRED fields for Math::Farnsworth::Value subclasses -# -#dimen => a Math::Farnsworth::Dimension object -# -#this is so i can make a -> conforms in Math::Farnsworth::Value, to replace the existing code, i'm also planning on adding some definitions such as, TYPE_PARI, TYPE_STRING, TYPE_LAMBDA, TYPE_DATE, etc. to make certain things easier - -sub new -{ - my $class = shift; - my $value = shift; - my $lang = shift; - my $outmagic = shift; #i'm still not sure on this one - - confess "Non string given as \$value to constructor" unless ref($value) eq "" && defined($value); - - my $self = {}; - - bless $self, $class; - - $self->{outmagic} = $outmagic; - - { - no warnings 'uninitialized'; - $self->{string} = "".$value; - } - $self->{lang} = $lang || ""; - - return $self; -} - -sub getstring -{ - return $_[0]->{string}; -} - -sub getlang -{ - return $_[0]->{lang}; -} - -####### -#The rest of this code can be GREATLY cleaned up by assuming that $one is of type, Math::Farnsworth::Value::Pari, this means that i can slowly redo a lot of this code - -sub add -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to addition" unless (ref($two)); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - confess "Scalar value given to addition to string" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->add($one, !$rev) unless ($two->ismediumtype()); - - if (!$two->istype("String")) - { - confess "Given non boolean to boolean operation"; - } - - - #NOTE TO SELF this needs to be more helpful, i'll probably do this by creating an "error" class that'll be captured in ->evalbranch's recursion and use that to add information from the parse tree about WHERE the error occured - my $new; - $new = $one->getstring() . $two->getstring() unless $rev; - $new = $two->getstring() . $one->getstring() if $rev; - - my $lang = ""; - $lang = $one->getlang() if ($one->getlang() eq $two->getlang()); #if we know their language, and they're the same, just keep it - - return new Math::Farnsworth::Value::String($new); #return new string -} - -sub subtract -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to subtraction" unless (ref($two)); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - die "Scalar value given to subtraction to strings" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->subtract($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("String")) - { - confess "Given non boolean to boolean operation"; - } - - die "Subtracting strings? what did you think this would do, create a black hole?"; -} - -sub modulus -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to modulus" unless (ref($two)); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Scalar value given to modulus to string" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->mod($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("String")) - { - confess "Given non string to string operation"; - } - - die "Modulusing strings? what did you think this would do, create a black hole?"; -} - -sub mult -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to multiplication" unless (ref($two)); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Scalar value given to multiplcation to string" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->mult($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("String")) - { - confess "Given non string to string operation"; - } - - die "Multiplying strings? what did you think this would do, create a black hole?"; -} - -sub div -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to division" unless (ref($two)); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Scalar value given to division to string" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->div($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("String")) - { - confess "Given non string to string operation"; - } - - die "Dividing string? what did you think this would do, create a black hole?"; -} - -sub bool -{ - my $self = shift; - - #seems good enough of an idea to me - #i have a bug HERE - #print "BOOLCONV\n"; - #print Dumper($self); - #print "ENDBOOLCONV\n"; - return length($self->getstring())?1:0; -} - -sub pow -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to exponentiation" unless (ref($two)); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Exponentiating strings? what did you think this would do, create a black hole?" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->pow($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("String")) - { - confess "Given non string to string operation"; - } - - - die "Exponentiating strings? what did you think this would do, create a black hole?"; -} - -sub __compare -{ - my ($a1, $a2) = @_; - my $same = 0; - my $ea = each_array(@$a1, @$a2); - - while(my ($first, $second) = $ea->()) - { - $same = $first > $second ? 1 : -1 and last if $first != $second - } # shortcircuits - - return $same; -} - -sub compare -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to compare" unless (ref($two)); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - confess "Scalar value given to division to string" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->compare($one, !$rev) unless ($two->ismediumtype()); - - my $rv = $rev ? -1 : 1; - #check for $two being a simple value - my $tv = $two->getstring(); - my $ov = $one->getstring(); - - #i also need to check the units, but that will come later - #NOTE TO SELF this needs to be more helpful, i'll probably do something by adding stuff in ->new to be able to fetch more about the processing - die "Unable to process different units in compare\n" unless $one->conforms($two); #always call this on one, since $two COULD be some other object - - #moving this down so that i don't do any math i don't have to - my $new = $tv cmp $ov; - - return $new * $rv; -} - diff --git a/deps/Math/Farnsworth/Value/Undef.pm b/deps/Math/Farnsworth/Value/Undef.pm deleted file mode 100644 index 2332016..0000000 --- a/deps/Math/Farnsworth/Value/Undef.pm +++ /dev/null @@ -1,192 +0,0 @@ -package Math::Farnsworth::Value::Undef; - -use strict; -use warnings; - -use Math::Farnsworth::Dimension; -use Math::Farnsworth::Value; -use Carp; - -use utf8; - -our $VERSION = 0.6; - -use overload - '+' => \&add, - '-' => \&subtract, - '*' => \&mult, - '/' => \&div, - '%' => \&mod, - '**' => \&pow, - '<=>' => \&compare, - 'bool' => \&bool; - -use base qw(Math::Farnsworth::Value); - -#this is the REQUIRED fields for Math::Farnsworth::Value subclasses -# -#dimen => a Math::Farnsworth::Dimension object -# -#this is so i can make a -> conforms in Math::Farnsworth::Value, to replace the existing code, i'm also planning on adding some definitions such as, TYPE_PARI, TYPE_STRING, TYPE_LAMBDA, TYPE_DATE, etc. to make certain things easier - -sub new -{ - my $class = shift; - my $outmagic = shift; #i'm still not sure on this one - - my $self = {}; - - bless $self, $class; - - $self->{outmagic} = $outmagic; - - return $self; -} - -####### -#The rest of this code can be GREATLY cleaned up by assuming that $one is of type, Math::Farnsworth::Value::Pari, this means that i can slowly redo a lot of this code - -sub add -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to addition" unless ref($two); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - confess "Scalar value given to addition to boolean" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->add($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Boolean")) - { - confess "Given non boolean to boolean operation"; - } - - - #NOTE TO SELF this needs to be more helpful, i'll probably do this by creating an "error" class that'll be captured in ->evalbranch's recursion and use that to add information from the parse tree about WHERE the error occured - die "Adding booleans is not a good idea\n"; -} - -sub subtract -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to subtraction" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - die "Scalar value given to subtraction to Booleans" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->subtract($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Boolean")) - { - confess "Given non boolean to boolean operation"; - } - - die "Subtracting Booleans? what did you think this would do, create a black hole?"; -} - -sub modulus -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to modulus" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Scalar value given to modulus to boolean" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->mod($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Boolean")) - { - confess "Given non boolean to boolean operation"; - } - - die "Modulusing booleans? what did you think this would do, create a black hole?"; -} - -sub mult -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to multiplication" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Scalar value given to multiplcation to array" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->mult($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Boolean")) - { - confess "Given non boolean to boolean operation"; - } - - die "Multiplying arrays? what did you think this would do, create a black hole?"; -} - -sub div -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to division" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Scalar value given to division to array" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->div($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Boolean")) - { - confess "Given non boolean to boolean operation"; - } - - die "Dividing arrays? what did you think this would do, create a black hole?"; -} - -sub bool -{ - my $self = shift; - - #seems good enough of an idea to me - #i have a bug HERE - #print "BOOLCONV\n"; - #print Dumper($self); - #print "ENDBOOLCONV\n"; - return 0; -} - -sub pow -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to exponentiation" unless ref($two); - - #if there's a higher type, use it, subtraction otherwise doesn't make sense on arrays - confess "Exponentiating arrays? what did you think this would do, create a black hole?" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->pow($one, !$rev) unless ($two->ismediumtype()); - if (!$two->istype("Boolean")) - { - confess "Given non boolean to boolean operation"; - } - - - die "Exponentiating arrays? what did you think this would do, create a black hole?"; -} - -sub __compare -{ - my ($a1, $a2) = @_; - my $same = 0; - my $ea = each_array(@$a1, @$a2); - - while(my ($first, $second) = $ea->()) - { - $same = $first > $second ? 1 : -1 and last if $first != $second - } # shortcircuits - - return $same; -} - -sub compare -{ - my ($one, $two, $rev) = @_; - - confess "Non reference given to compare" unless ref($two); - - #if we're not being added to a Math::Farnsworth::Value::Pari, the higher class object needs to handle it. - confess "Scalar value given to division to array" if ($two->isa("Math::Farnsworth::Value::Pari")); - return $two->compare($one, !$rev) unless ($two->ismediumtype()); - - return 0; -} - diff --git a/deps/Math/Farnsworth/Value_old.pm b/deps/Math/Farnsworth/Value_old.pm deleted file mode 100644 index 0f76f61..0000000 --- a/deps/Math/Farnsworth/Value_old.pm +++ /dev/null @@ -1,430 +0,0 @@ -#!/usr/bin/perl - -package Math::Farnsworth::Value; - -use strict; -use warnings; - -use Data::Dumper; - -use Math::Pari; -use Math::Farnsworth::Dimension; -use Date::Manip; -use List::Util qw(sum); -use Storable qw(dclone); - -use utf8; - -our $VERSION = 0.5; - -use overload - '+' => \&add, - '-' => \&subtract, - '*' => \&mult, - '/' => \&div, - '%' => \&mod, - '**' => \&pow, - '<=>' => \&compare, - 'bool' => \&bool; - -sub new -{ - my $class = shift; - my $value = shift; - my $dimen = shift; #should only really be used internally? - my $outmagic = shift; #i'm still not sure on this one - - my $self = {}; - - bless $self, $class; - - $self->{outmagic} = $outmagic; - $self->{valueinput} = $value; - - if (ref($dimen) eq "Math::Farnsworth::Dimension") - { - $self->{dimen} = $dimen; - } - else - { - $dimen = {} if !defined($dimen); - $self->{dimen} = new Math::Farnsworth::Dimension($dimen); - } - - if (exists($self->{dimen}{dimen}{string}) || exists($self->{dimen}{dimen}{date}) || exists($self->{dimen}{dimen}{lambda})) - { - $self->{pari} = $value; - } - elsif (exists($self->{dimen}{dimen}{array})) - { - #we've got an array or date or lambda here - #use dclone() from Storable to make complete copies of everything! -# print "CALLER: ".join("::", caller())."\n"; -# print Dumper($value); - - if (!defined($value)) - { - #warn "OMG \$VALUE IS UNDEFINED!!!!"; - $value = []; - } - - $self->{pari} = [@{$value}]; #this should never not be an array reference - } - elsif (!defined($value)) - { - $self->{pari} = undef; - } - else - { - $value =~ s/ee/e/i; #fixes double ee's - $self->{pari} = PARI $value; - } - - - return $self; -} - -sub toperl -{ - my $self = shift; - - return "".($self->{pari}); #stringifiying it seems to work, though i need cases for arrays! -} - -sub add -{ - my ($one, $two, $rev) = @_; - - #check for $two being a simple value - my $tv = ref($two) && $two->isa("Math::Farnsworth::Value") ? $two->{pari} : $two; - - #i also need to check the units, but that will come later - #NOTE TO SELF this needs to be more helpful, i'll probably do something by adding stuff in ->new to be able to fetch more about the processing - #print Dumper($one->{dimen}, $two->{dimen}); - die "Unable to process different units in addition\n" unless ($one->{dimen}->compare($two->{dimen}) || $one->{dimen}{dimen}{date}); #always call this on one, since $two COULD be some other object - - #moving this down so that i don't do any math i don't have to - - my $new; - if ($one->{dimen}{dimen}{string}) - { - #print Dumper($one, $two); - $new = new Math::Farnsworth::Value($one->{pari} . $tv, $one->{dimen}); - } - elsif ($one->{dimen}{dimen}{array}) - { - die "Adding arrays is undefined behavoir!\n"; - } - elsif ($one->{dimen}{dimen}{bool}) - { - die "Adding Booleans is undefined behavoir!\n"; - } - elsif ($one->{dimen}{dimen}{lambda}) - { - die "Adding Lambdas is undefined behavoir.\n"; - } - elsif (($one->{dimen}{dimen}{date}) && ($two->{dimen}{dimen}{date})) - { - die "Adding of two dates is unsupported\n"; - } - elsif (($one->{dimen}{dimen}{date}) && ($two->{dimen}->compare({dimen=>{time => 1}}))) #check if we are adding time to a date - { - my $seconds = $two->toperl(); #calling WITHOUT the units SHOULD give me a string containing just the number - $seconds =~ s/\..*$//; #filter off fractional parts of a second as Date::Manip hates them - my $sign = $seconds > 0 ? "+" : "-"; #should work fine, even with loss of precision - my $delta = DateCalc($one->{pari}, "$sign $seconds seconds"); #order is switched, to make it work the way I think it should - - $new = new Math::Farnsworth::Value($delta, {date=>1}); - } - else - { - $new = new Math::Farnsworth::Value($one->{pari} + $tv, $one->{dimen}); - } - - return $new; -} - -sub subtract -{ - my ($one, $two, $rev) = @_; - - #check for $two being a simple value - my $tv = ref($two) && $two->isa("Math::Farnsworth::Value") ? $two->{pari} : $two; - - #i also need to check the units, but that will come later - #NOTE TO SELF this needs to be more helpful, i'll probably do something by adding stuff in ->new to be able to fetch more about the processing - die "Unable to process different units in subtraction\n" unless ($one->{dimen}->compare($two->{dimen}) || $one->{dimen}{dimen}{date}); #always call this on one, sinc - - #moving this down so that i don't do any math i don't have to - my $new; - if (!$rev) - { - if (($one->{dimen}{dimen}{date}) && ($two->{dimen}{dimen}{date})) - { - my $delta = DateCalc($two->{pari}, $one->{pari}); #order is switched, to make it work the way I think it should - die "something went screwy with calculating deltas, $delta\n" unless $delta =~ /^[+-](\d+:){6}(\d+)$/; - - my $seconds = new Math::Farnsworth::Value(Delta_Format($delta,1,"%st"), {time => 1}); - $new = $seconds; #create that - } - elsif (($one->{dimen}{dimen}{date}) && ($two->{dimen}->compare({dimen => {time => 1}}))) - { - my $seconds = $two->toperl(); #calling WITHOUT the units SHOULD give me a string containing just the number - $seconds =~ s/\..*$//; #filter off fractional parts of a second as Date::Manip hates them - my $sign = $seconds > 0 ? "-" : "+"; #should work fine, even with loss of precision - my $delta = DateCalc($one->{pari}, "$sign $seconds seconds"); #order is switched, to make it work the way I think it should - - $new = new Math::Farnsworth::Value($delta, {date=>1}); - } - elsif ($one->{dimen}{dimen}{date}) - { - #we reached here with some other subtraction with a Date, do not do it - die "Dates can only have dates and time subtracted, nothing else\n"; - } - elsif ($one->{dimen}{dimen}{array} || $two->{dimen}{dimen}{array}) - { - #we reached here with some other subtraction with a Date, do not do it - die "subtracting arrays is undefined behavior\n"; - } - elsif ($one->{dimen}{dimen}{string} || $two->{dimen}{dimen}{string}) - { - #we reached here with some other subtraction with a Date, do not do it - die "Subtracting strings is undefined behavior\n"; - } - elsif ($one->{dimen}{dimen}{bool} || $two->{dimen}{dimen}{bool}) - { - #we reached here with some other subtraction with a Date, do not do it - die "Subtracting Booleans is undefined behavior\n"; - } - elsif ($one->{dimen}{dimen}{lambda} || $two->{dimen}{dimen}{lambda}) - { - #we reached here with some other subtraction with a Date, do not do it - die "Subtracting lambdas is undefined behavior\n"; - } - else - { - $new = new Math::Farnsworth::Value($one->{pari} - $tv, $one->{dimen}); #if !$rev they are in order - } - } - else - { - die "some mistake happened here in subtraction\n"; #to test later on -# $new = new Math::Farnsworth::Value($tv - $one->{pari}, $one->{dimen}); #if !$rev they are in order - } - return $new; -} - -sub mod -{ - my ($one, $two, $rev) = @_; - - #check for $two being a simple value - my $tv = ref($two) && $two->isa("Math::Farnsworth::Value") ? $two->{pari} : $two; - - #i also need to check the units, but that will come later - #NOTE TO SELF this needs to be more helpful, i'll probably do something by adding stuff in ->new to be able to fetch more about the processing - die "Unable to process different units in modulous\n" unless $one->{dimen}->compare($two->{dimen}); #always call this on one, since $two COULD be some other object - - if ($one->{dimen}->compare({dimen => {string => 1}}) ||$one->{dimen}->compare({dimen => {array =>1}}) || - $two->{dimen}->compare({dimen => {string => 1}}) ||$two->{dimen}->compare({dimen => {array =>1}}) || - $two->{dimen}->compare({dimen => {bool => 1}}) ||$one->{dimen}->compare({dimen => {bool =>1}}) || - $two->{dimen}->compare({dimen => {lambda => 1}}) ||$one->{dimen}->compare({dimen => {lambda =>1}}) || - $two->{dimen}->compare({dimen => {date => 1}}) ||$one->{dimen}->compare({dimen => {date =>1}})) - { - die "Can't divide arrays or strings or booleans or dates or lambdas, it doesn't make sense\n"; - } - - #moving this down so that i don't do any math i don't have to - my $new; - if (!$rev) - { - $new = new Math::Farnsworth::Value($one->{pari} % $tv, $one->{dimen}); #if !$rev they are in order - } - else - { - $new = new Math::Farnsworth::Value($tv % $one->{pari}, $one->{dimen}); #if !$rev they are in order - } - return $new; -} - -sub mult -{ - my ($one, $two, $rev) = @_; - - #check for $two being a simple value - my $tv = ref($two) && $two->isa("Math::Farnsworth::Value") ? $two->{pari} : $two; - my $td = ref($two) && $two->isa("Math::Farnsworth::Value") ? $two->{dimen} : new Math::Farnsworth::Dimension(); - - if ($one->{dimen}->compare({dimen => {string => 1}}) ||$one->{dimen}->compare({dimen => {array =>1}}) || - $td->compare({dimen => {string => 1}}) ||$td->compare({dimen => {array =>1}}) || - $td->compare({dimen => {bool => 1}}) ||$one->{dimen}->compare({dimen => {bool =>1}}) || - $td->compare({dimen => {lambda => 1}}) ||$one->{dimen}->compare({dimen => {lambda =>1}}) || - $td->compare({dimen => {date => 1}}) ||$one->{dimen}->compare({dimen => {date =>1}})) { - die "Can't multiply arrays or strings, it doesn't make sense\n"; - } - - my $nd = $one->{dimen}->merge($td); #merge the dimensions! don't cross the streams though - - #moving this down so that i don't do any math i don't have to - my $new = new Math::Farnsworth::Value($one->{pari} * $tv, $nd); - return $new; -} - -sub div -{ - my ($one, $two, $rev) = @_; - - #check for $two being a simple value - my $tv = ref($two) && $two->isa("Math::Farnsworth::Value") ? $two->{pari} : $two; - my $td = ref($two) && $two->isa("Math::Farnsworth::Value") ? $two->{dimen} : new Math::Farnsworth::Dimension(); - - if ($one->{dimen}->compare({dimen => {string => 1}}) ||$one->{dimen}->compare({dimen => {array =>1}}) || - $td->compare({dimen => {string => 1}}) ||$td->compare({dimen => {array =>1}}) || - $td->compare({dimen => {bool => 1}}) ||$one->{dimen}->compare({dimen => {bool =>1}}) || - $td->compare({dimen => {lambda => 1}}) ||$one->{dimen}->compare({dimen => {lambda =>1}}) || - $td->compare({dimen => {date => 1}}) ||$one->{dimen}->compare({dimen => {date =>1}})) - { - die "Can't divide arrays or strings, it doesn't make sense\n"; - } - - #these are a little screwy SO i'll probably comment them more later - #probably after i find out that they're wrong - my $qd = $rev ? $td : $one->{dimen}; - my $dd = $rev ? $one->{dimen}->invert() : (ref($td) eq "HASH" ? $td : $td->invert()); - - my $nd; - - if (ref($qd) ne "HASH") - { - $nd = $qd->merge($dd); #merge the dimensions! don't cross the streams though - } - else - { - $nd = $dd->merge($qd); #merge them the other way, because $qd is a "HASH" and not an object - } - - #moving this down so that i don't do any math i don't have to - my $new; - if (!$rev) - { - $new = new Math::Farnsworth::Value($one->{pari} / $tv, $nd); #if !$rev they are in order - } - else - { - $new = new Math::Farnsworth::Value($tv / $one->{pari}, $nd); #if !$rev they are in order - } - - return $new; -} - -sub bool -{ - my $self = shift; - - #seems good enough of an idea to me - #i have a bug HERE - #print "BOOLCONV\n"; - #print Dumper($self); - #print "ENDBOOLCONV\n"; - return $self->{pari}?1:0; -} - -sub pow -{ - my ($one, $two, $rev) = @_; - - if ($one->{dimen}->compare({dimen => {string => 1}}) ||$one->{dimen}->compare({dimen => {array =>1}}) || - $two->{dimen}->compare({dimen => {string => 1}}) ||$two->{dimen}->compare({dimen => {array =>1}}) || - $two->{dimen}->compare({dimen => {bool => 1}}) ||$one->{dimen}->compare({dimen => {bool =>1}}) || - $two->{dimen}->compare({dimen => {lambda => 1}}) ||$one->{dimen}->compare({dimen => {lambda =>1}}) || - $two->{dimen}->compare({dimen => {date => 1}}) ||$one->{dimen}->compare({dimen => {date =>1}})) - { - die "Can't exponentiate arrays or strings or dates or bools, it doesn't make sense\n"; - } - - #check for $two being a simple value - my $tv = ref($two) && $two->isa("Math::Farnsworth::Value") ? $two->{pari} : $two; - my $td = ref($two) && $two->isa("Math::Farnsworth::Value") ? $two->{dimen} : undef; - - if (defined($td) && !$td->compare({dimen=>{}})) - { - die "A number with units as the exponent doesn't make sense"; - } - - #moving this down so that i don't do any math i don't have to - my $new; - if (!$rev) - { - $new = new Math::Farnsworth::Value($one->{pari} ** $tv, $one->{dimen}->mult($tv)); #if !$rev they are in order - } - else - { -# print Dumper(\@_); - #print "POW: $tv :: $two :: $one\n"; - $new = new Math::Farnsworth::Value($tv ** $one->{pari}, $one->{dimen}->mult($tv)); #if !$rev they are in order - } - - return $new; -} - -sub compare -{ - my ($one, $two, $rev) = @_; - - my $rv = $rev ? -1 : 1; - #check for $two being a simple value - my $tv = ref($two) && $two->isa("Math::Farnsworth::Value") ? $two->{pari} : $two; - - #i also need to check the units, but that will come later - #NOTE TO SELF this needs to be more helpful, i'll probably do something by adding stuff in ->new to be able to fetch more about the processing - die "Unable to process different units in compare\n" unless $one->{dimen}->compare($two->{dimen}); #always call this on one, since $two COULD be some other object - - #moving this down so that i don't do any math i don't have to - my $new; - - if ($one->{dimen}{dimen}{string}) - { - if ($one->{pari} eq $tv) - { - $new = 0; - } - elsif ($one->{pari} lt $tv) - { - $new = -1; - } - elsif ($one->{pari} gt $tv) - { - $new = 1; - } - } - elsif ($one->{dimen}{dimen}{array}) - { - die "Comparing arrays has not been implemented\n"; - } - elsif ($one->{dimen}{dimen}{lambdas}) - { - die "Comparing lambdas has not been implemented\n"; - } - elsif ($one->{dimen}{dimen}{date}) - { - return Date_Cmp($one->{pari}, $two->{pari}); #does it for me! - } - else - { - if ($one->{pari} == $tv) - { - $new = 0; - } - elsif ($one->{pari} < $tv) - { - $new = -1; - } - elsif ($one->{pari} > $tv) - { - $new =1; - } - } - - return $new; -} - diff --git a/deps/Math/Farnsworth/Variables.pm b/deps/Math/Farnsworth/Variables.pm deleted file mode 100644 index 35f9a1d..0000000 --- a/deps/Math/Farnsworth/Variables.pm +++ /dev/null @@ -1,133 +0,0 @@ -package Math::Farnsworth::Variables; - -use strict; -use warnings; - -use Data::Dumper; -use Carp qw(cluck carp); - -#this is very simple right now but i'll need to make a way to inherit -#variables from an old Math::Farnsworth::Variables class so that i can do -#functions with "scoping" - -sub new -{ - my $class = shift; - my $state = shift; - my $self = {parent => undef, vars => {}}; - $self->{parent} = $state if (ref($state) eq "Math::Farnsworth::Variables"); - bless $self; -} - -sub setvar -{ - my $self = shift; - my $name = shift; - my $value = shift; - - if ((exists($self->{vars}{$name})) || !defined($self->{parent})) - { - if (exists($self->{vars}{$name}) && ref($self->{vars}{$name}) eq "REF") - { - #we've got a reference - ${$self->{vars}{$name}} = $value; - } - else - { - $self->{vars}{$name} = $value; - } - } - else - { - $self->{parent}->setvar($name, $value); #set it in the previous scope - } -} - -sub declare -{ - my $self = shift; - my $name = shift; - my $value = shift; - - if (!defined($name)) - { - cluck "NAME UNDEFINED!\n".Dumper([$self, $name, $value, @_]); - } - - #really all we need to do is just set it in this scope to see it - $self->{vars}{$name} = $value; -} - -sub setref -{ - my $self = shift; - my $name = shift; - - if (!defined($name)) - { - cluck "NAME UNDEFINED!\n".Dumper([$self, $name, @_]); - } - - #really all we need to do is just set it in this scope to see it - $self->{vars}{$name} = $_[0]; #can't set things myself with shift, HAVE to use @_ directly -} - -sub getref -{ - my $self = shift; - my $name = shift; - my $val; - - carp "DEPRECIATED CALL TO Variables->getref()"; - - if (exists($self->{vars}{$name})) - { - $val = \$self->{vars}{$name}; - } - elsif (defined($self->{parent})) - { - $val = $self->{parent}->getref($name); - } - - return $val; -} - -sub getvar -{ - my $self = shift; - my $name = shift; - my $val; - - if (exists($self->{vars}{$name})) - { - $val = $self->{vars}{$name}; - $val->setref(\$self->{vars}{$name}) unless (ref($val) eq "REF"); - } - elsif (defined($self->{parent})) - { - $val = $self->{parent}->getvar($name); - } - - if (ref $val eq "REF") - { #we've got one set by reference - $val = $$val; #deref it for getting its value - } - - return $val; -} - -sub isvar -{ - my $self = shift; - my $name = shift; - - my $r = exists($self->{vars}{$name}); - - if (!exists($self->{vars}{$name}) && defined($self->{parent})) - { - $r = $self->{parent}->isvar($name); - } - - return $r; -} -1; diff --git a/lib/Bot/BB3.pm b/lib/Bot/BB3.pm index edf9cae..628297a 100644 --- a/lib/Bot/BB3.pm +++ b/lib/Bot/BB3.pm @@ -154,10 +154,12 @@ sub parse_main_conf { exit 1; } - - my $conf = Bot::BB3::ConfigParser->parse_file( $conf_file ) + my $conf; + {no warnings 'once'; #this keeps perl from bitching about something only used once + $conf = Bot::BB3::ConfigParser->parse_file( $conf_file ) or die "Failed to parse a conf file! $BB3::Conf::PARSE_ERROR\n"; - + } + unless( keys %$conf ) { error "Failed to successfully read [$conf_file]!"; exit 1; diff --git a/lib/Bot/BB3/Roles/Console.pm b/lib/Bot/BB3/Roles/Console.pm index 1be6395..50696d0 100644 --- a/lib/Bot/BB3/Roles/Console.pm +++ b/lib/Bot/BB3/Roles/Console.pm @@ -33,7 +33,7 @@ sub spawn_session { } sub _start { - my( $self ) = @_[OBJECT]; + my( $self ) = $_[OBJECT]; $self->{socket_factory} = POE::Wheel::SocketFactory->new( BindAddress => "127.0.0.1", diff --git a/lib/Bot/BB3/Roles/IRC.pm b/lib/Bot/BB3/Roles/IRC.pm index c4f7eb5..1c8b8ab 100644 --- a/lib/Bot/BB3/Roles/IRC.pm +++ b/lib/Bot/BB3/Roles/IRC.pm @@ -339,7 +339,7 @@ sub _said { } sub irc_public { - my( $self ) = @_[OBJECT]; + my $self = $_[OBJECT]; my $said = _said( @_ ); if( $self->is_ignored( $said ) ) { @@ -354,7 +354,7 @@ sub irc_public { } sub irc_msg { - my( $self ) = @_[OBJECT]; + my $self = $_[OBJECT]; my $said = _said( @_ ); return if $self->is_ignored( $said ); @@ -363,13 +363,13 @@ sub irc_msg { } sub irc_ctcp_action { - my( $self ) = @_[OBJECT]; + my $self = $_[OBJECT]; my $said = _said( @_ ); } sub irc_join { - my( $self ) = @_[OBJECT]; + my $self = $_[OBJECT]; } sub irc_invite { diff --git a/lib/EvalServer.pm b/lib/EvalServer.pm index ac6ac8a..deb930c 100644 --- a/lib/EvalServer.pm +++ b/lib/EvalServer.pm @@ -100,7 +100,7 @@ sub _append_output { sub eval_read { #my( $self, $cur_session, $kernel, $results, $id ) = @_[OBJECT,SESSION,KERNEL,ARG0,ARG1]; - my( $self ) = @_[OBJECT]; + my $self = $_[OBJECT]; $self->_append_output( @_ ); } diff --git a/lib/eval.pl b/lib/eval.pl index 45176fd..50c755b 100755 --- a/lib/eval.pl +++ b/lib/eval.pl @@ -42,7 +42,9 @@ require 'bytes_heavy.pl'; use Tie::Hash::NamedCapture; + {no warnings 'constant'; uc "\x{666}"; #Attempt to load unicode libraries. + } binmode STDOUT, ":utf8"; # Enable utf8 output. BEGIN{ eval "use PHP::Interpreter;"; } diff --git a/plugins/arg.pm b/plugins/arg.pm index 96571e9..5527c72 100644 --- a/plugins/arg.pm +++ b/plugins/arg.pm @@ -1,5 +1,5 @@ use Bot::BB3::MacroQuote (); - +no warnings 'void'; sub { my( $said ) = @_; @@ -33,6 +33,7 @@ sub { } print Bot::BB3::MacroQuote::quote($quotemode, $str); -} +}; + __DATA__ Prints macro argument in a function macro factoid. Takes optional quoting mode letter or signed number for word splitting; or '&n' or '&c' etc to access extra info. diff --git a/plugins/cache_check.pm b/plugins/cache_check.pm index 1dc1d45..855d678 100644 --- a/plugins/cache_check.pm +++ b/plugins/cache_check.pm @@ -34,4 +34,4 @@ sub command { } -"Bot::BB3::Plugin::CacheCheck"; +1; #Bot::BB3::Plugin::CacheCheck diff --git a/plugins/compose.pm b/plugins/compose.pm index 2cd5a79..97b77f9 100644 --- a/plugins/compose.pm +++ b/plugins/compose.pm @@ -111,7 +111,7 @@ sub runplugin { } -"Bot::BB3::Plugin::Compose"; +1 #"Bot::BB3::Plugin::Compose"; __DATA__ Supports composing multiple plugins together. That is, it allows you to feed the output of one plugin to another plugin. Syntax compose (eval (echo 2+2)). Note that it uses the first non whitespace character as the start-delimiter and the last non-whitespace as the end delimter. diff --git a/plugins/conf.pm b/plugins/conf.pm index 6be6346..479c739 100644 --- a/plugins/conf.pm +++ b/plugins/conf.pm @@ -1,6 +1,6 @@ use Data::Dumper; - +no warnings 'void'; sub { my( $said, $pm ) = @_; my $conf = $pm->get_main_conf; @@ -43,7 +43,7 @@ sub { push @{$said->{special_commands}}, [ bb3_change_conf => $path, $value ]; -} +}; __DATA__ conf [new value]. Displays a portion of the conf structure corresponding to the dot seperated string passed to this plugin. For example, the string "bot.0" will display the complete structure of the first bot defined in the config file. Can also be used to set the value by passing a second argument after the location specifier. New values can be either a single string to set a scalar argumnet, or a comma seperated string surrounded by [], such as [foo,bar,baz]. White space around the commas are removed. This argument is turned in to an arrayref, in other words, a multivalued argument for the config option specified. diff --git a/plugins/conf_dump.pm b/plugins/conf_dump.pm index 0bd0cb6..b24edc9 100644 --- a/plugins/conf_dump.pm +++ b/plugins/conf_dump.pm @@ -1,18 +1,23 @@ use Config::General; +no warnings 'void'; + sub { my( $said, $pm ) = @_; my $main_conf = $pm->get_main_conf; - my $o = Config::General->new( + my $o; + {no warnings 'once'; #keep it from bitching about it + $o = Config::General->new( -ConfigFile => $file, -LowerCaseNames => 1, -UseApacheInclude => 1, -AutoTrue => 1 ); - + } + print $o->save_string( $main_conf ); -} +}; __DATA__ diff --git a/plugins/core.pm b/plugins/core.pm index 9dec9d0..523506a 100644 --- a/plugins/core.pm +++ b/plugins/core.pm @@ -1,5 +1,6 @@ use Module::CoreList; +no warnings 'void'; sub { my( $said, $pm ) = @_; my $module = $said->{recommended_args}->[0]; @@ -19,7 +20,7 @@ sub { else { print "Module $module does not appear to be in core. Perhaps capitalization matters or try using the 'cpan' command to search for it." } } -} +}; __DATA__ Tells you when the module you searched for was added to the Perl Core, if it was. diff --git a/plugins/echo.pm b/plugins/echo.pm index f02e568..b6f14fd 100644 --- a/plugins/echo.pm +++ b/plugins/echo.pm @@ -1,8 +1,9 @@ +no warnings 'void'; sub { my( $said ) = @_; print $said->{body}; -} +}; __DATA__ Echo just prints its argument verbatim. diff --git a/plugins/eval.pm b/plugins/eval.pm index 0726e88..0bcb1eb 100644 --- a/plugins/eval.pm +++ b/plugins/eval.pm @@ -72,7 +72,7 @@ sub command { return( 'handled', $resultstr ); } -"Bot::BB3::Plugin::Eval"; +1 #"Bot::BB3::Plugin::Eval"; __DATA__ The eval plugin. Evaluates various different languages. Syntax, eval: code; also pleval deparse rbeval jseval pyeval phpeval k20eval luaeval jeval. diff --git a/plugins/factoids.pm b/plugins/factoids.pm index 76d3424..d80b8e2 100644 --- a/plugins/factoids.pm +++ b/plugins/factoids.pm @@ -352,7 +352,10 @@ sub get_fact_learn { return "Stored $subject as $predicate"; } + +{no warnings 'once'; #keep perl from complaining about this only being used once *get_fact_relearn = \&get_fact_learn; #Alias.. +} sub get_fact_search { my( $self, $body, $name ) = @_; @@ -453,8 +456,8 @@ sub basic_get_fact { my( $self, $pm, $said, $subject, $name, $call_only ) = @_; my ($fact, $key, $arg); - my $key = _clean_subject($subject); - my $fact; + $key = _clean_subject($subject); + if( !$call_only ) { $fact = $self->_db_get_fact($key, $name); } @@ -512,6 +515,6 @@ sub _soundex_matches { } -"Bot::BB3::Plugin::Factoids"; +1 #"Bot::BB3::Plugin::Factoids"; __DATA__ Learn or retrieve persistent factoids. "foo is bar" to store. "foo" to retrieve. try "forget foo" or "revisions foo" or "literal foo" or "revert $REV_ID" too. "macro foo is [echo bar]" or "func foo is [echo bar [arg]]" for compose macro factoids. The factoids/fact/call keyword is optional except in compose. Search to search for factoids that match. diff --git a/plugins/geoip.pm b/plugins/geoip.pm index e316dbd..8e53f52 100644 --- a/plugins/geoip.pm +++ b/plugins/geoip.pm @@ -1,5 +1,7 @@ use Geo::IP; +no warnings 'void'; + sub { my( $said, $pm ) = @_; my $gi = Geo::IP->new(GEOIP_STANDARD); @@ -12,7 +14,7 @@ sub { else { print $gi->country_code_by_addr( $said->{body} ); } -} +}; __DATA__ geoip 192.168.32.45 or geoip example.com; returns the country associated with the resolved IP address. diff --git a/plugins/head.pm b/plugins/head.pm index df1e158..b9193af 100644 --- a/plugins/head.pm +++ b/plugins/head.pm @@ -1,5 +1,5 @@ use LWP::UserAgent; - +no warnings 'void'; sub { my( $said ) = @_; @@ -25,7 +25,7 @@ sub { } print "$url: " . $resp->code . ": " . $resp->message . ". " . $resp->header("server"); -} +}; __DATA__ head http://url/; returns the response code and server type from a HEAD request for a particular url. diff --git a/plugins/help.pm b/plugins/help.pm index 53cc1a1..0ba1809 100644 --- a/plugins/help.pm +++ b/plugins/help.pm @@ -1,5 +1,7 @@ use strict; +no warnings 'void'; + sub { my( $said, $pm ) = @_; @@ -18,7 +20,7 @@ sub { else { print "Provides help text for a specific command. Try 'help echo'. See also the command 'plugins' to list all of the currently loaded plugins."; } -} +}; __DATA__ Attempts to find the help for a plugin. Syntax help PLUGIN. diff --git a/plugins/host.pm b/plugins/host.pm index 7780c58..494d309 100755 --- a/plugins/host.pm +++ b/plugins/host.pm @@ -34,6 +34,7 @@ my $foo=sub { } }; +no warnings 'void'; if ($0 =~ /host.pm$/) { $foo->({recommended_args=>['google.com','A']}); diff --git a/plugins/host_lookup.pm b/plugins/host_lookup.pm index 7635c51..a285e69 100644 --- a/plugins/host_lookup.pm +++ b/plugins/host_lookup.pm @@ -1,5 +1,7 @@ use DBI; +no warnings 'void'; + sub { my( $said, $pm ) = @_; @@ -8,7 +10,7 @@ sub { my $recs = $dbh->selectall_arrayref( "SELECT * FROM hosts where host = ?", {Slice=>{}}, $said->{body} ); print "$said->{body}: ", join ", ", map $_->{nick}, @$recs; -} +}; __DATA__ host_lookup . Returns all of the nicks this bot has seen using the host name you specify. diff --git a/plugins/join.pm b/plugins/join.pm index a22c797..b56c439 100644 --- a/plugins/join.pm +++ b/plugins/join.pm @@ -1,3 +1,4 @@ +no warnings 'void'; sub { my( $said, $pm ) = @_; @@ -7,7 +8,7 @@ sub { [ 'pci_join', @channels ]; print "Joining @{ $said->{recommended_args} }"; -} +}; __DATA__ Attempts to join a list of channels. Syntax join #foo #bar #baz. Typically requires op or superuser. diff --git a/plugins/karma.pm b/plugins/karma.pm index ae701af..76ac4fd 100644 --- a/plugins/karma.pm +++ b/plugins/karma.pm @@ -2,6 +2,8 @@ use POE::Component::IRC::Common qw/l_irc/; use DBI; use DBD::SQLite; +no warnings 'void'; + sub { my( $said, $pm ) = @_; my $body = $said->{body}; @@ -36,7 +38,7 @@ sub { print "$body has no karma"; } } -} +}; __DATA__ karma ; returns the "karma" value for a user or arbitrary subject. Karma works by appending either ++ or -- to a word to modify its karma. diff --git a/plugins/karma_modify.pm b/plugins/karma_modify.pm index d8e98a9..7e2cf7e 100644 --- a/plugins/karma_modify.pm +++ b/plugins/karma_modify.pm @@ -71,4 +71,4 @@ sub handle { return; } -"Bot::BB3::Plugin::Karma_Modify"; +1 #"Bot::BB3::Plugin::Karma_Modify"; diff --git a/plugins/karmatop.pm b/plugins/karmatop.pm index 98de7bb..b698eb2 100644 --- a/plugins/karmatop.pm +++ b/plugins/karmatop.pm @@ -2,6 +2,8 @@ use POE::Component::IRC::Common qw/l_irc/; use DBI; use DBD::SQLite; +no warnings 'void'; + sub { my( $said, $pm ) = @_; my $body = $said->{body}; @@ -43,9 +45,9 @@ sub { } else { - print "usage is: top/bottom \d+ karma"; + print "usage is: top/bottom \\d+ karma"; } -} +}; __DATA__ karmatop ; returns the top or bottom karma for a number of things. to get bottom karma use negative numbers. diff --git a/plugins/more.pm b/plugins/more.pm index c7064ab..ffab491 100644 --- a/plugins/more.pm +++ b/plugins/more.pm @@ -58,6 +58,6 @@ sub post_process { } } -"Bot::BB3::Plugin::More"; +1#"Bot::BB3::Plugin::More"; __DATA__ More acts as a pager. It automatically truncates output that is too long and saves it in a buffer based on your name. Use the command `more` to access the remainder of the text. diff --git a/plugins/nick_lookup.pm b/plugins/nick_lookup.pm index 513dde3..935f471 100644 --- a/plugins/nick_lookup.pm +++ b/plugins/nick_lookup.pm @@ -1,5 +1,5 @@ use DBI; - +no warnings 'void'; sub { my( $said, $pm ) = @_; @@ -8,7 +8,7 @@ sub { my $recs = $dbh->selectall_arrayref( "SELECT * FROM hosts where nick = ?", {Slice=>{}}, $said->{body} ); print "$said->{body}: ", join ", ", map $_->{host}, @$recs; -} +}; __DATA__ nick_lookup ; returns all of the hostnames this bot has seen a particular nick name use. diff --git a/plugins/part.pm b/plugins/part.pm index 2e91cff..5ee85ff 100644 --- a/plugins/part.pm +++ b/plugins/part.pm @@ -1,3 +1,4 @@ +no warnings 'void'; sub { my( $said, $pm ) = @_; diff --git a/plugins/plugins.pm b/plugins/plugins.pm index b11956e..4a4e68e 100644 --- a/plugins/plugins.pm +++ b/plugins/plugins.pm @@ -17,7 +17,7 @@ sub command { return( "handled", $output ); } -"Bot::BB3::Plugin::Plugins"; +1#"Bot::BB3::Plugin::Plugins"; __DATA__ Returns a list of all of the loaded plugins for this bot. Syntax, plugins diff --git a/plugins/quote.pm b/plugins/quote.pm index a0cdbaf..1225458 100644 --- a/plugins/quote.pm +++ b/plugins/quote.pm @@ -1,5 +1,6 @@ use Bot::BB3::MacroQuote (); +no warnings 'void'; sub { my( $said ) = @_; diff --git a/plugins/reload_plugins.pm b/plugins/reload_plugins.pm index b25f10b..b06c419 100644 --- a/plugins/reload_plugins.pm +++ b/plugins/reload_plugins.pm @@ -1,4 +1,4 @@ - +no warnings 'void'; sub { my( $said, $pm ) = @_; diff --git a/plugins/restart.pm b/plugins/restart.pm index 8029808..960e786 100644 --- a/plugins/restart.pm +++ b/plugins/restart.pm @@ -1,3 +1,4 @@ +no warnings 'void'; sub { my( $said, $pm ) = @_; diff --git a/plugins/rss.pm b/plugins/rss.pm index eae0660..86659ea 100644 --- a/plugins/rss.pm +++ b/plugins/rss.pm @@ -1,6 +1,7 @@ use XML::RSS::Parser; use strict; +no warnings 'void'; sub { my( $said, $pm ) = @_; my $feed_uri = $said->{recommended_args}->[0]; diff --git a/plugins/rss_title.pm b/plugins/rss_title.pm index 92bb678..60b4fbe 100644 --- a/plugins/rss_title.pm +++ b/plugins/rss_title.pm @@ -1,6 +1,7 @@ use XML::RSS::Parser; use strict; +no warnings 'void'; sub { my( $said, $pm ) = @_; my $feed_uri = $said->{recommended_args}->[0]; diff --git a/plugins/rt.pm b/plugins/rt.pm deleted file mode 100644 index 3ec89a4..0000000 --- a/plugins/rt.pm +++ /dev/null @@ -1,27 +0,0 @@ -use WWW::RottenTomatoes; - -# Construct it outside the sub so it can at least pretend to do some caching. -my $rt = WWW::RottenTomatoes->new; - -sub { - my( $said, $pm ) = @_; - - local $@; - my $movie_info = eval { $rt->movie_info( $said->{body} ) }; - - if( $@ ) { - print "Error fetching movie info: $@"; - return; - } - - if( $movie_info ) { - print "$movie_info->{title}: $movie_info->{rating} - ", @{ $movie_info->{bubbles} }[ rand @{ $movie_info->{bubbles} } ]; - } - - else { - print "Sorry failed to find a movie titled [$said->{body}]"; - } -} - -__DATA__ -RottenTomatoes plugin. Syntax, rt Movie Title. diff --git a/plugins/save_config.pm b/plugins/save_config.pm index 374e932..c046af4 100644 --- a/plugins/save_config.pm +++ b/plugins/save_config.pm @@ -1,3 +1,4 @@ +no warnings 'void'; sub { my( $said, $pm ) = @_; diff --git a/plugins/seen.pm b/plugins/seen.pm index 4817fcb..d10c0e6 100644 --- a/plugins/seen.pm +++ b/plugins/seen.pm @@ -87,7 +87,7 @@ sub handle { return; } -"Bot::BB3::Plugin::Seen"; +1#"Bot::BB3::Plugin::Seen"; __DATA__ The seen plugin. Attempts to keep track of every user the bot has 'seen'. Use the syntax, seen user; to ask the bot when it last saw the user named 'user'. diff --git a/plugins/shorten.pm b/plugins/shorten.pm index 684e09f..924371a 100644 --- a/plugins/shorten.pm +++ b/plugins/shorten.pm @@ -1,5 +1,5 @@ use WWW::Shorten 'Metamark'; - +no warnings 'void'; sub { my( $said, $pm ) = @_; diff --git a/plugins/spell.pm b/plugins/spell.pm deleted file mode 100644 index 515a6dc..0000000 --- a/plugins/spell.pm +++ /dev/null @@ -1,67 +0,0 @@ -package Bot::BB3::Plugin::Spell; -use Text::Aspell; -use strict; - -sub new { - my( $class ) = @_; - - my $self = bless {}, $class; - $self->{name} = 'spell'; - $self->{opts} = { - command => 1, - handler => 1, - }; - - return $self; -} - -sub handle { - my( $self, $said, $pm ) = @_; - - my( undef, $ret ) = $self->_speller( $said, $pm, 'handle' ); - # TODO fix this, we just get rid of 'handled'. - # Need to clean up this code to remove this. - - return $ret; -} - -sub command { - my( $self, $said, $pm ) = @_; - - return $self->_speller( $said, $pm, 'command' ); -} - -sub _speller { - my( $self, $said, $pm, $type ) = @_; - - my $speller = Text::Aspell->new - or die "Couldn't create a speller!"; - $speller->set_option('lang','en_GB'); - - my $word; - - if( $type eq 'command' ) { #Command Mode - $word = $said->{recommended_args}->[0]; - } - else { #Text Search Mode - if( $said->{body} =~ /(\w+)\s*\(sp\??\)/ ) { - $word = $1; - } - } - - if( $word ) { - if( $speller->check($word) ) { - return( 'handled', "$word seems to be correct!" ); - } - else { - return( 'handled', "$word seems to be misspelt, perhaps you meant: " . join " ", $speller->suggest( $word ) ); - } - } - - return; -} - -"Bot::BB3::Plugin::Spell"; - -__DATA__ -Attempt to determine the correct spelling of a word. Operates in two modes, addressed, via the syntax spell word; or in passing when you use the string '(sp?)', without the quotes, after any word in any sentence. diff --git a/plugins/title.pm b/plugins/title.pm index f3d9966..ab9417c 100644 --- a/plugins/title.pm +++ b/plugins/title.pm @@ -1,5 +1,5 @@ use WWW::Mechanize; - +no warnings 'void'; sub { my( $said ) = @_; diff --git a/plugins/unicode.pm b/plugins/unicode.pm index d842a48..96f70f7 100644 --- a/plugins/unicode.pm +++ b/plugins/unicode.pm @@ -39,6 +39,7 @@ sub unip { } # ------------------------ +no warnings 'void'; sub { my( $said, $pm ) = @_; diff --git a/plugins/weather.pm b/plugins/weather.pm deleted file mode 100644 index c0b2af9..0000000 --- a/plugins/weather.pm +++ /dev/null @@ -1,62 +0,0 @@ -use Geo::WeatherNWS; -use Weather::Underground; -use Data::Dumper; -use Geo::IATA; -use List::AllUtils qw/first/; - - -# Stefan Petrea -# stefan.petrea at gmail.com -# perlhobby.googlecode.com - - -my $solve_weather = sub { - my $arg = shift; - my $g = Geo::IATA->new; - my $location = first { defined $_->{icao} } @{$g->location($arg)}; - my $weather = Weather::Underground->new( place => $location->{icao}, debug => 0 ); - my $data = $weather->get_weather; - - return ($weather,$data,$location->{location}); -}; - - - -sub { - my( $said, $pm ) = @_; - my $arg = $said->{body}; - s/^\s+//,s/\s+$// for $arg; - - if( $arg =~ /^[kK]/ or $arg =~ /^\w{3}$/ ) { - my $w= Geo::WeatherNWS->new; - $w->getreporthttp( $arg ); - - print "$w->{code}: $w->{temperature_f} degrees, $w->{conditionstext} with a windchill of $w->{windchill_f}f and winds up to $w->{windspeedmph}mph"; - } - else { - my $weather = Weather::Underground->new( place => $arg, debug => 0 ); - my $data = $weather->get_weather; - - my $resolved_location = ""; - ($weather,$data,$resolved_location) = $solve_weather->($arg) unless $data; # fix it if we have a problem - - if( not $data or not @$data ) { - print "Failed to find weather for $arg"; - return; - }; - - - $data = $data->[0]; # We want the first one.. - - my $where = - $resolved_location - ? "Resolved location->{$resolved_location}: " - : "$arg:"; - - print "$where $data->{temperature_fahrenheit} degrees, $data->{conditions} and winds up to $data->{wind_milesperhour}"; - } -} - - -__DATA__ -weather or weather ; attempts to retrieve the weather from a station associated with one of the names you pass it.