democracy 0.0.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of democracy might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/LIBERTY +310 -0
- data/README +310 -0
- data/README2 +14 -0
- data/READ_THIS_TO_CHANGE_THINGS +310 -0
- data/Resume.pdf +0 -0
- data/Ruby Installer.exe +0 -0
- data/VERSION_NUMBER +1 -0
- data/WE_NEEDNT_BE_ENSLAVED +310 -0
- data/_.html +460 -0
- data/__index.html +11 -0
- data/a.html +21 -0
- data/ac +73 -0
- data/all_code.cpp +280 -0
- data/all_code.js +30 -0
- data/app_topics +93 -0
- data/background.jpg +0 -0
- data/better_string +26 -0
- data/bin/abs +0 -0
- data/bin/ac +34 -0
- data/bin/add +0 -0
- data/bin/append +14 -0
- data/bin/args +0 -0
- data/bin/autorequire +85 -0
- data/bin/big_num +155 -0
- data/bin/black +0 -0
- data/bin/blue +0 -0
- data/bin/bold +0 -0
- data/bin/c_repl +76 -0
- data/bin/close +3 -0
- data/bin/copy +0 -0
- data/bin/count +0 -0
- data/bin/cpy +0 -0
- data/bin/cyan +0 -0
- data/bin/democracyinstall.exe +0 -0
- data/bin/div +0 -0
- data/bin/down_all_links +50 -0
- data/bin/dump +0 -0
- data/bin/email +127 -0
- data/bin/emerald-browser +0 -0
- data/bin/emoji +176 -0
- data/bin/executable +1 -0
- data/bin/exp +0 -0
- data/bin/files +0 -0
- data/bin/floor +0 -0
- data/bin/foreach +49 -0
- data/bin/g+ +557 -0
- data/bin/get_all_links +11 -0
- data/bin/github +55 -0
- data/bin/green +0 -0
- data/bin/gsearch +159 -0
- data/bin/gsub +0 -0
- data/bin/gsub_in_place +0 -0
- data/bin/last_nth +0 -0
- data/bin/lines +0 -0
- data/bin/magenta +0 -0
- data/bin/mkfile +47 -0
- data/bin/mul +0 -0
- data/bin/nth +0 -0
- data/bin/open +0 -0
- data/bin/play +0 -0
- data/bin/prepend +14 -0
- data/bin/processes +3 -0
- data/bin/qt_download +21 -0
- data/bin/record +121 -0
- data/bin/red +0 -0
- data/bin/replace_in_place +0 -0
- data/bin/replace_not_in_place +0 -0
- data/bin/selectlines +0 -0
- data/bin/sort_in_place +0 -0
- data/bin/splitfiles +16 -0
- data/bin/squeeze +17 -0
- data/bin/string +161 -0
- data/bin/strip_extensions +13 -0
- data/bin/sub +0 -0
- data/bin/t +63 -0
- data/bin/tracefile +555 -0
- data/bin/underline +0 -0
- data/bin/undump +0 -0
- data/bin/viu +0 -0
- data/bin/white +0 -0
- data/bin/yellow +0 -0
- data/bin/youtube_video +45 -0
- data/bin/youtube_video2 +45 -0
- data/code.js +28490 -0
- data/crystal-gobject/.git/HEAD +1 -0
- data/crystal-gobject/.git/config +11 -0
- data/crystal-gobject/.git/description +1 -0
- data/crystal-gobject/.git/hooks/applypatch-msg.sample +15 -0
- data/crystal-gobject/.git/hooks/commit-msg.sample +24 -0
- data/crystal-gobject/.git/hooks/fsmonitor-watchman.sample +109 -0
- data/crystal-gobject/.git/hooks/post-update.sample +8 -0
- data/crystal-gobject/.git/hooks/pre-applypatch.sample +14 -0
- data/crystal-gobject/.git/hooks/pre-commit.sample +49 -0
- data/crystal-gobject/.git/hooks/pre-merge-commit.sample +13 -0
- data/crystal-gobject/.git/hooks/pre-push.sample +53 -0
- data/crystal-gobject/.git/hooks/pre-rebase.sample +169 -0
- data/crystal-gobject/.git/hooks/pre-receive.sample +24 -0
- data/crystal-gobject/.git/hooks/prepare-commit-msg.sample +42 -0
- data/crystal-gobject/.git/hooks/update.sample +128 -0
- data/crystal-gobject/.git/index +0 -0
- data/crystal-gobject/.git/info/exclude +6 -0
- data/crystal-gobject/.git/logs/HEAD +1 -0
- data/crystal-gobject/.git/logs/refs/heads/main +1 -0
- data/crystal-gobject/.git/logs/refs/remotes/origin/HEAD +1 -0
- data/crystal-gobject/.git/objects/pack/pack-c21cfd88c6eef3076f2c2aebb658b750e87e10b6.idx +0 -0
- data/crystal-gobject/.git/objects/pack/pack-c21cfd88c6eef3076f2c2aebb658b750e87e10b6.pack +0 -0
- data/crystal-gobject/.git/packed-refs +15 -0
- data/crystal-gobject/.git/refs/heads/main +1 -0
- data/crystal-gobject/.git/refs/remotes/origin/HEAD +1 -0
- data/crystal-gobject/.github/workflows/ci.yml +22 -0
- data/crystal-gobject/.gitignore +14 -0
- data/crystal-gobject/LICENSE +27 -0
- data/crystal-gobject/README.md +143 -0
- data/crystal-gobject/samples/base_class_container.cr +15 -0
- data/crystal-gobject/samples/connect_after.cr +35 -0
- data/crystal-gobject/samples/crout/crout.cr +59 -0
- data/crystal-gobject/samples/e +0 -0
- data/crystal-gobject/samples/gdk_window.cr +36 -0
- data/crystal-gobject/samples/glist.cr +16 -0
- data/crystal-gobject/samples/greeter.cr +34 -0
- data/crystal-gobject/samples/greeter.glade +91 -0
- data/crystal-gobject/samples/gtk_accel_group.cr +13 -0
- data/crystal-gobject/samples/gtk_application.cr +12 -0
- data/crystal-gobject/samples/gtk_boxes.cr +44 -0
- data/crystal-gobject/samples/gtk_css_styling/css_window.cr +37 -0
- data/crystal-gobject/samples/gtk_css_styling/css_window.css +3 -0
- data/crystal-gobject/samples/gtk_css_styling/css_window.glade +104 -0
- data/crystal-gobject/samples/gtk_editable.cr +14 -0
- data/crystal-gobject/samples/gtk_entry.cr +10 -0
- data/crystal-gobject/samples/gtk_hello_world.cr +13 -0
- data/crystal-gobject/samples/gtk_menu_and_actions.cr +69 -0
- data/crystal-gobject/samples/gtk_message_dialog.cr +9 -0
- data/crystal-gobject/samples/gtk_subclasses.cr +30 -0
- data/crystal-gobject/samples/gtk_tree_view.cr +30 -0
- data/crystal-gobject/samples/gtk_tree_view.glade +44 -0
- data/crystal-gobject/samples/hello +0 -0
- data/crystal-gobject/samples/libgdk-3.a +0 -0
- data/crystal-gobject/samples/libgdk_pixbuf-2.0.a +0 -0
- data/crystal-gobject/samples/libgtk-3.a +0 -0
- data/crystal-gobject/samples/timeout.cr +34 -0
- data/crystal-gobject/script/ci.sh +17 -0
- data/crystal-gobject/script/release.sh +31 -0
- data/crystal-gobject/script/run_with_timeout.cr +14 -0
- data/crystal-gobject/script/test +7 -0
- data/crystal-gobject/shard.yml +16 -0
- data/crystal-gobject/spec/basic_spec.cr +46 -0
- data/crystal-gobject/spec/libsample/Makefile +28 -0
- data/crystal-gobject/spec/libsample/test-subject.c +107 -0
- data/crystal-gobject/spec/libsample/test-subject.h +65 -0
- data/crystal-gobject/spec/spec_helper.cr +5 -0
- data/crystal-gobject/src/atk/atk.cr +2 -0
- data/crystal-gobject/src/closure_data_manager.cr +62 -0
- data/crystal-gobject/src/crout.cr +601 -0
- data/crystal-gobject/src/g_i_repository/dumper.cr +116 -0
- data/crystal-gobject/src/g_i_repository/g_i_repository.cr +46 -0
- data/crystal-gobject/src/g_i_repository/info/arg_info.cr +157 -0
- data/crystal-gobject/src/g_i_repository/info/base_info.cr +169 -0
- data/crystal-gobject/src/g_i_repository/info/callable_info.cr +266 -0
- data/crystal-gobject/src/g_i_repository/info/callback_info.cr +54 -0
- data/crystal-gobject/src/g_i_repository/info/constant_info.cr +115 -0
- data/crystal-gobject/src/g_i_repository/info/enum_info.cr +88 -0
- data/crystal-gobject/src/g_i_repository/info/field_info.cr +97 -0
- data/crystal-gobject/src/g_i_repository/info/function_info.cr +237 -0
- data/crystal-gobject/src/g_i_repository/info/interface_info.cr +97 -0
- data/crystal-gobject/src/g_i_repository/info/object_info.cr +170 -0
- data/crystal-gobject/src/g_i_repository/info/property_info.cr +93 -0
- data/crystal-gobject/src/g_i_repository/info/registered_type_info.cr +62 -0
- data/crystal-gobject/src/g_i_repository/info/signal_info.cr +119 -0
- data/crystal-gobject/src/g_i_repository/info/struct_info.cr +139 -0
- data/crystal-gobject/src/g_i_repository/info/type_info.cr +326 -0
- data/crystal-gobject/src/g_i_repository/info/union_info.cr +136 -0
- data/crystal-gobject/src/g_i_repository/info/v_func_info.cr +33 -0
- data/crystal-gobject/src/g_i_repository/info/value_info.cr +62 -0
- data/crystal-gobject/src/g_i_repository/repository.cr +68 -0
- data/crystal-gobject/src/g_i_repository/wrapper_generator.cr +103 -0
- data/crystal-gobject/src/g_lib/error.cr +34 -0
- data/crystal-gobject/src/g_lib/g_lib.cr +81 -0
- data/crystal-gobject/src/g_lib/list_iterator.cr +81 -0
- data/crystal-gobject/src/g_lib/s_list_iterator.cr +54 -0
- data/crystal-gobject/src/g_object/closure.cr +40 -0
- data/crystal-gobject/src/g_object/g_object.cr +7 -0
- data/crystal-gobject/src/g_object/module_functions.cr +38 -0
- data/crystal-gobject/src/g_object/object.cr +104 -0
- data/crystal-gobject/src/g_object/type.cr +68 -0
- data/crystal-gobject/src/g_object/value.cr +308 -0
- data/crystal-gobject/src/gdk/event.cr +34 -0
- data/crystal-gobject/src/gdk/gdk.cr +35 -0
- data/crystal-gobject/src/generated/g_i_repository/argument.cr +130 -0
- data/crystal-gobject/src/generated/g_i_repository/array_type.cr +34 -0
- data/crystal-gobject/src/generated/g_i_repository/attribute_iter.cr +65 -0
- data/crystal-gobject/src/generated/g_i_repository/base_info.cr +134 -0
- data/crystal-gobject/src/generated/g_i_repository/direction.cr +33 -0
- data/crystal-gobject/src/generated/g_i_repository/field_info_flags.cr +34 -0
- data/crystal-gobject/src/generated/g_i_repository/function_info_flags.cr +38 -0
- data/crystal-gobject/src/generated/g_i_repository/g_i_repository.cr +7 -0
- data/crystal-gobject/src/generated/g_i_repository/info_type.cr +50 -0
- data/crystal-gobject/src/generated/g_i_repository/module_functions.cr +816 -0
- data/crystal-gobject/src/generated/g_i_repository/repository.cr +214 -0
- data/crystal-gobject/src/generated/g_i_repository/repository_class.cr +55 -0
- data/crystal-gobject/src/generated/g_i_repository/repository_error.cr +34 -0
- data/crystal-gobject/src/generated/g_i_repository/repository_load_flags.cr +33 -0
- data/crystal-gobject/src/generated/g_i_repository/repository_private.cr +46 -0
- data/crystal-gobject/src/generated/g_i_repository/scope_type.cr +34 -0
- data/crystal-gobject/src/generated/g_i_repository/transfer.cr +33 -0
- data/crystal-gobject/src/generated/g_i_repository/type_tag.cr +52 -0
- data/crystal-gobject/src/generated/g_i_repository/typelib.cr +61 -0
- data/crystal-gobject/src/generated/g_i_repository/unresolved_info.cr +45 -0
- data/crystal-gobject/src/generated/g_i_repository/v_func_info_flags.cr +36 -0
- data/crystal-gobject/src/generated/g_object/param_flags.cr +44 -0
- data/crystal-gobject/src/generated/g_object/signal_flags.cr +42 -0
- data/crystal-gobject/src/generated/lib_g_i_repository.cr +302 -0
- data/crystal-gobject/src/generated/lib_g_lib.cr +2261 -0
- data/crystal-gobject/src/generated/lib_g_object.cr +874 -0
- data/crystal-gobject/src/generator/build_namespace.cr +22 -0
- data/crystal-gobject/src/generator/doc.cr +259 -0
- data/crystal-gobject/src/generator/dump.cr +55 -0
- data/crystal-gobject/src/generator/generator.cr +22 -0
- data/crystal-gobject/src/generator/namespace.cr +192 -0
- data/crystal-gobject/src/generator/stage2.cr +113 -0
- data/crystal-gobject/src/generator/stage3.cr +3 -0
- data/crystal-gobject/src/gio/gio.cr +4 -0
- data/crystal-gobject/src/gobject.cr +54 -0
- data/crystal-gobject/src/gtk/autorun.cr +16 -0
- data/crystal-gobject/src/gtk/gtk.cr +61 -0
- data/crystal-gobject/src/notify/notification.cr +158 -0
- data/crystal-gobject/src/notify/notify.cr +4 -0
- data/crystal-gobject/src/pointer_iterator.cr +49 -0
- data/crystal-gobject/src/wrapped_type.cr +53 -0
- data/democracy.gemspec +14 -0
- data/dictate +183 -0
- data/emerald-browser/.qmake.stash +23 -0
- data/emerald-browser/Makefile +469 -0
- data/emerald-browser/OUT +90 -0
- data/emerald-browser/a.out +0 -0
- data/emerald-browser/empty +0 -0
- data/emerald-browser/empty.c +1 -0
- data/emerald-browser/open +0 -0
- data/emerald-browser/open.c +57 -0
- data/emerald-browser/qmake.pro +23 -0
- data/emerald-browser/src/OUT +438 -0
- data/emerald-browser/src/a.cpp +303 -0
- data/emerald-browser/src/a.out +0 -0
- data/emerald-browser/src/ss.h +12 -0
- data/emerald-browser/src/t/fullscreennotification.cpp +98 -0
- data/emerald-browser/src/t/fullscreennotification.h +72 -0
- data/emerald-browser/src/t/fullscreenwindow.cpp +99 -0
- data/emerald-browser/src/t/fullscreenwindow.h +76 -0
- data/emerald-browser/src/t/main.cpp +64 -0
- data/emerald-browser/src/t/mainwindow.cpp +83 -0
- data/emerald-browser/src/t/mainwindow.h +75 -0
- data/emerald-browser/test/a.cpp +2 -0
- data/f +0 -0
- data/faster_googler +31 -0
- data/favicon.ico +0 -0
- data/foo +80 -0
- data/foo.c +39 -0
- data/foo.cpp +36 -0
- data/foo.js +25 -0
- data/free_icons/site/bulb +0 -0
- data/free_icons/site/chess +0 -0
- data/free_icons/site/compiz.svg +463 -0
- data/free_icons/site/cursor.svg +1 -0
- data/free_icons/site/dock +0 -0
- data/free_icons/site/gnu +0 -0
- data/free_icons/site/info.svg +200 -0
- data/free_icons/site/iphone.svg +222 -0
- data/free_icons/site/laptop +0 -0
- data/free_icons/site/magic.svg +856 -0
- data/free_icons/site/man +0 -0
- data/free_icons/site/mint +0 -0
- data/free_icons/site/mouse +0 -0
- data/free_icons/site/paint.svg +2640 -0
- data/free_icons/site/present +0 -0
- data/free_icons/site/python +0 -0
- data/free_icons/site/reality +0 -0
- data/free_icons/site/ruby +0 -0
- data/free_icons/site/skeptic +0 -0
- data/free_icons/site/terminal +0 -0
- data/free_icons/site/video.svg +358 -0
- data/free_icons/site/warning +0 -0
- data/free_icons/site/wikipedia.svg +553 -0
- data/free_icons/site/write.svg +287 -0
- data/g +0 -0
- data/graphical_help.c +6 -0
- data/gregory_coreutils/DOC +14 -0
- data/gregory_coreutils/build/Makefile +12 -0
- data/gregory_coreutils/build/code +1 -0
- data/gregory_coreutils/build/functions +465 -0
- data/gregory_coreutils/build/make +93 -0
- data/gregory_coreutils/build/mk +74 -0
- data/gregory_coreutils/build/regex +2 -0
- data/gregory_coreutils/build/ruby_functions +0 -0
- data/gregory_coreutils/utilities/abs +0 -0
- data/gregory_coreutils/utilities/add +0 -0
- data/gregory_coreutils/utilities/args +0 -0
- data/gregory_coreutils/utilities/black +0 -0
- data/gregory_coreutils/utilities/blue +0 -0
- data/gregory_coreutils/utilities/bold +0 -0
- data/gregory_coreutils/utilities/copy +0 -0
- data/gregory_coreutils/utilities/count +0 -0
- data/gregory_coreutils/utilities/cpy +0 -0
- data/gregory_coreutils/utilities/cyan +0 -0
- data/gregory_coreutils/utilities/div +0 -0
- data/gregory_coreutils/utilities/dump +0 -0
- data/gregory_coreutils/utilities/exp +0 -0
- data/gregory_coreutils/utilities/files +0 -0
- data/gregory_coreutils/utilities/floor +0 -0
- data/gregory_coreutils/utilities/green +0 -0
- data/gregory_coreutils/utilities/gsub +0 -0
- data/gregory_coreutils/utilities/gsub_in_place +0 -0
- data/gregory_coreutils/utilities/last_nth +0 -0
- data/gregory_coreutils/utilities/lines +0 -0
- data/gregory_coreutils/utilities/magenta +0 -0
- data/gregory_coreutils/utilities/mul +0 -0
- data/gregory_coreutils/utilities/nth +0 -0
- data/gregory_coreutils/utilities/red +0 -0
- data/gregory_coreutils/utilities/replace_in_place +0 -0
- data/gregory_coreutils/utilities/replace_not_in_place +0 -0
- data/gregory_coreutils/utilities/selectlines +0 -0
- data/gregory_coreutils/utilities/sort_in_place +0 -0
- data/gregory_coreutils/utilities/sub +0 -0
- data/gregory_coreutils/utilities/underline +0 -0
- data/gregory_coreutils/utilities/undump +0 -0
- data/gregory_coreutils/utilities/white +0 -0
- data/gregory_coreutils/utilities/yellow +0 -0
- data/gtk +3 -0
- data/html_file +0 -0
- data/html_file.html +92 -0
- data/i +181 -0
- data/index.html +38 -0
- data/index2.html +344 -0
- data/inspect.rb +209 -0
- data/lib/README +310 -0
- data/lib/__index.html +11 -0
- data/lib/because.rb +41 -0
- data/lib/code.js +28490 -0
- data/lib/compile +5 -0
- data/lib/conjunction.rb +49 -0
- data/lib/evidence.rb +45 -0
- data/lib/graphical_help +90 -0
- data/lib/however.rb +42 -0
- data/lib/index.html +49 -0
- data/lib/index2.html +344 -0
- data/lib/inputreceiver.rb +135 -0
- data/lib/item.rb +77 -0
- data/lib/itemlist.rb +50 -0
- data/lib/negative.rb +43 -0
- data/lib/neutral.rb +43 -0
- data/lib/outputter.rb +60 -0
- data/lib/p.rb +71 -0
- data/lib/positive.rb +41 -0
- data/lib/script.js +423 -0
- data/lib/string__.rb +110 -0
- data/lib/sub/file +5 -0
- data/man/foo.rb +6 -0
- data/man/gtk.html +1 -0
- data/man/out +7288 -0
- data/more/ac.desktop +12 -0
- data/more/res +1 -0
- data/more/web-speech-api/.git/HEAD +1 -0
- data/more/web-speech-api/.git/config +11 -0
- data/more/web-speech-api/.git/description +1 -0
- data/more/web-speech-api/.git/hooks/applypatch-msg.sample +15 -0
- data/more/web-speech-api/.git/hooks/commit-msg.sample +24 -0
- data/more/web-speech-api/.git/hooks/fsmonitor-watchman.sample +109 -0
- data/more/web-speech-api/.git/hooks/post-update.sample +8 -0
- data/more/web-speech-api/.git/hooks/pre-applypatch.sample +14 -0
- data/more/web-speech-api/.git/hooks/pre-commit.sample +49 -0
- data/more/web-speech-api/.git/hooks/pre-merge-commit.sample +13 -0
- data/more/web-speech-api/.git/hooks/pre-push.sample +53 -0
- data/more/web-speech-api/.git/hooks/pre-rebase.sample +169 -0
- data/more/web-speech-api/.git/hooks/pre-receive.sample +24 -0
- data/more/web-speech-api/.git/hooks/prepare-commit-msg.sample +42 -0
- data/more/web-speech-api/.git/hooks/update.sample +128 -0
- data/more/web-speech-api/.git/index +0 -0
- data/more/web-speech-api/.git/info/exclude +6 -0
- data/more/web-speech-api/.git/logs/HEAD +1 -0
- data/more/web-speech-api/.git/logs/refs/heads/master +1 -0
- data/more/web-speech-api/.git/logs/refs/remotes/origin/HEAD +1 -0
- data/more/web-speech-api/.git/objects/pack/pack-4d2adae000c513b287d53e24937e9e836954f901.idx +0 -0
- data/more/web-speech-api/.git/objects/pack/pack-4d2adae000c513b287d53e24937e9e836954f901.pack +0 -0
- data/more/web-speech-api/.git/packed-refs +2 -0
- data/more/web-speech-api/.git/refs/heads/master +1 -0
- data/more/web-speech-api/.git/refs/remotes/origin/HEAD +1 -0
- data/more/web-speech-api/CODE_OF_CONDUCT.md +15 -0
- data/more/web-speech-api/LICENSE +116 -0
- data/more/web-speech-api/README.md +23 -0
- data/more/web-speech-api/index.html +25 -0
- data/more/web-speech-api/phrase-matcher/index.html +30 -0
- data/more/web-speech-api/phrase-matcher/script.js +124 -0
- data/more/web-speech-api/phrase-matcher/style.css +54 -0
- data/more/web-speech-api/speak-easy-synthesis/img/ws128.png +0 -0
- data/more/web-speech-api/speak-easy-synthesis/img/ws512.png +0 -0
- data/more/web-speech-api/speak-easy-synthesis/index.html +43 -0
- data/more/web-speech-api/speak-easy-synthesis/manifest.webapp +14 -0
- data/more/web-speech-api/speak-easy-synthesis/script.js +87 -0
- data/more/web-speech-api/speak-easy-synthesis/style.css +74 -0
- data/more/web-speech-api/speech-color-changer/img/ws128.png +0 -0
- data/more/web-speech-api/speech-color-changer/img/ws512.png +0 -0
- data/more/web-speech-api/speech-color-changer/index.html +26 -0
- data/more/web-speech-api/speech-color-changer/manifest.webapp +23 -0
- data/more/web-speech-api/speech-color-changer/script.js +58 -0
- data/more/web-speech-api/speech-color-changer/style.css +38 -0
- data/opensrc +68 -0
- data/out +39 -0
- data/playsrc +14 -0
- data/program.c +11 -0
- data/program.prog +568 -0
- data/proj/a +0 -0
- data/proj/a.c +1 -0
- data/proj/a.o +0 -0
- data/proj/a.rs +18 -0
- data/proj/b.rs +22 -0
- data/proj/linker.sh +8 -0
- data/proj/save_last +4 -0
- data/push +16 -0
- data/q.cpp +175 -0
- data/qt/.qmake.stash +23 -0
- data/qt/Qt5Core.dll +0 -0
- data/qt/Qt5Gui.dll +0 -0
- data/qt/Qt5Multimedia.dll +0 -0
- data/qt/Qt5MultimediaWidgets.dll +0 -0
- data/qt/Qt5Network.dll +0 -0
- data/qt/Qt5PrintSupport.dll +0 -0
- data/qt/Qt5Qml.dll +0 -0
- data/qt/Qt5QmlModels.dll +0 -0
- data/qt/Qt5Quick.dll +0 -0
- data/qt/Qt5Sensors.dll +0 -0
- data/qt/Qt5WebChannel.dll +0 -0
- data/qt/Qt5WebKit.dll +0 -0
- data/qt/Qt5WebKitWidgets.dll +0 -0
- data/qt/Qt5Widgets.dll +0 -0
- data/qt/a.cpp +39 -0
- data/qt/a.out +0 -0
- data/qt/a.sh +7 -0
- data/qt/icudt66.dll +0 -0
- data/qt/icuin66.dll +0 -0
- data/qt/icuuc66.dll +0 -0
- data/qt/libbz2.dll +0 -0
- data/qt/libcrypto-1_1-x64.dll +0 -0
- data/qt/libfreetype-6.dll +0 -0
- data/qt/libgcc_s_seh-1.dll +0 -0
- data/qt/libglib-2.0-0.dll +0 -0
- data/qt/libharfbuzz-0.dll +0 -0
- data/qt/libiconv-2.dll +0 -0
- data/qt/libintl-8.dll +0 -0
- data/qt/libjpeg-9.dll +0 -0
- data/qt/liblzma-5.dll +0 -0
- data/qt/libpcre-1.dll +0 -0
- data/qt/libpcre2-16-0.dll +0 -0
- data/qt/libpng16-16.dll +0 -0
- data/qt/libsqlite3-0.dll +0 -0
- data/qt/libssl-1_1-x64.dll +0 -0
- data/qt/libstdc++-6.dll +0 -0
- data/qt/libwebp-7.dll +0 -0
- data/qt/libwinpthread-1.dll +0 -0
- data/qt/libxml2-2.dll +0 -0
- data/qt/libxslt-1.dll +0 -0
- data/qt/libzstd.dll +0 -0
- data/qt/prog +1 -0
- data/qt/qwindows.dll +0 -0
- data/qt/zlib1.dll +0 -0
- data/quickjs/.git/HEAD +1 -0
- data/quickjs/.git/config +11 -0
- data/quickjs/.git/description +1 -0
- data/quickjs/.git/hooks/applypatch-msg.sample +15 -0
- data/quickjs/.git/hooks/commit-msg.sample +24 -0
- data/quickjs/.git/hooks/fsmonitor-watchman.sample +109 -0
- data/quickjs/.git/hooks/post-update.sample +8 -0
- data/quickjs/.git/hooks/pre-applypatch.sample +14 -0
- data/quickjs/.git/hooks/pre-commit.sample +49 -0
- data/quickjs/.git/hooks/pre-merge-commit.sample +13 -0
- data/quickjs/.git/hooks/pre-push.sample +53 -0
- data/quickjs/.git/hooks/pre-rebase.sample +169 -0
- data/quickjs/.git/hooks/pre-receive.sample +24 -0
- data/quickjs/.git/hooks/prepare-commit-msg.sample +42 -0
- data/quickjs/.git/hooks/update.sample +128 -0
- data/quickjs/.git/index +0 -0
- data/quickjs/.git/info/exclude +6 -0
- data/quickjs/.git/logs/HEAD +1 -0
- data/quickjs/.git/logs/refs/heads/master +1 -0
- data/quickjs/.git/logs/refs/remotes/origin/HEAD +1 -0
- data/quickjs/.git/objects/pack/pack-744a13dba8773a756b22372ba65ded3aca50cdeb.idx +0 -0
- data/quickjs/.git/objects/pack/pack-744a13dba8773a756b22372ba65ded3aca50cdeb.pack +0 -0
- data/quickjs/.git/packed-refs +2 -0
- data/quickjs/.git/refs/heads/master +1 -0
- data/quickjs/.git/refs/remotes/origin/HEAD +1 -0
- data/quickjs/.obj/.d +1 -0
- data/quickjs/.obj/cutils.nolto.o +0 -0
- data/quickjs/.obj/cutils.o +0 -0
- data/quickjs/.obj/cutils.o.d +1 -0
- data/quickjs/.obj/hello.o +0 -0
- data/quickjs/.obj/hello.o.d +1 -0
- data/quickjs/.obj/libbf.nolto.o +0 -0
- data/quickjs/.obj/libbf.o +0 -0
- data/quickjs/.obj/libbf.o.d +1 -0
- data/quickjs/.obj/libregexp.nolto.o +0 -0
- data/quickjs/.obj/libregexp.o +0 -0
- data/quickjs/.obj/libregexp.o.d +2 -0
- data/quickjs/.obj/libunicode.nolto.o +0 -0
- data/quickjs/.obj/libunicode.o +0 -0
- data/quickjs/.obj/libunicode.o.d +1 -0
- data/quickjs/.obj/qjs.check.o +0 -0
- data/quickjs/.obj/qjs.check.o.d +1 -0
- data/quickjs/.obj/qjs.o +0 -0
- data/quickjs/.obj/qjs.o.d +1 -0
- data/quickjs/.obj/qjsc.o +0 -0
- data/quickjs/.obj/qjsc.o.d +1 -0
- data/quickjs/.obj/qjscalc.o +0 -0
- data/quickjs/.obj/qjscalc.o.d +1 -0
- data/quickjs/.obj/quickjs-libc.nolto.o +0 -0
- data/quickjs/.obj/quickjs-libc.o +0 -0
- data/quickjs/.obj/quickjs-libc.o.d +2 -0
- data/quickjs/.obj/quickjs.check.o +0 -0
- data/quickjs/.obj/quickjs.check.o.d +2 -0
- data/quickjs/.obj/quickjs.nolto.o +0 -0
- data/quickjs/.obj/quickjs.o +0 -0
- data/quickjs/.obj/quickjs.o.d +2 -0
- data/quickjs/.obj/repl.o +0 -0
- data/quickjs/.obj/repl.o.d +1 -0
- data/quickjs/.obj/run-test262.o +0 -0
- data/quickjs/.obj/run-test262.o.d +2 -0
- data/quickjs/COMPILE_WIN +1 -0
- data/quickjs/Changelog +148 -0
- data/quickjs/LICENSE +22 -0
- data/quickjs/Makefile +470 -0
- data/quickjs/TODO +70 -0
- data/quickjs/VERSION +1 -0
- data/quickjs/a.c +50038 -0
- data/quickjs/a.js +26075 -0
- data/quickjs/a.rb +3 -0
- data/quickjs/cutils.c +631 -0
- data/quickjs/cutils.h +297 -0
- data/quickjs/doc/jsbignum.texi +589 -0
- data/quickjs/doc/quickjs.texi +1097 -0
- data/quickjs/examples/fib.c +72 -0
- data/quickjs/examples/fib_module.js +10 -0
- data/quickjs/examples/hello +0 -0
- data/quickjs/examples/hello.js +1 -0
- data/quickjs/examples/hello_module.js +6 -0
- data/quickjs/examples/pi_bigdecimal.js +68 -0
- data/quickjs/examples/pi_bigfloat.js +66 -0
- data/quickjs/examples/pi_bigint.js +118 -0
- data/quickjs/examples/point.c +151 -0
- data/quickjs/examples/test_fib.js +6 -0
- data/quickjs/examples/test_point.js +40 -0
- data/quickjs/hello.c +44 -0
- data/quickjs/libbf.c +8466 -0
- data/quickjs/libbf.h +535 -0
- data/quickjs/libquickjs.a +0 -0
- data/quickjs/libquickjs.lto.a +0 -0
- data/quickjs/libregexp-opcode.h +58 -0
- data/quickjs/libregexp.c +2610 -0
- data/quickjs/libregexp.h +92 -0
- data/quickjs/libunicode-table.h +4368 -0
- data/quickjs/libunicode.c +1556 -0
- data/quickjs/libunicode.h +124 -0
- data/quickjs/libwinpthread-1.dll +0 -0
- data/quickjs/list.h +100 -0
- data/quickjs/out.c +24 -0
- data/quickjs/out55.c +59 -0
- data/quickjs/out56.c +79 -0
- data/quickjs/out57.c +24 -0
- data/quickjs/out58.c +4 -0
- data/quickjs/p.exe +0 -0
- data/quickjs/qjs +0 -0
- data/quickjs/qjs.c +570 -0
- data/quickjs/qjsc +0 -0
- data/quickjs/qjsc.c +762 -0
- data/quickjs/qjsc.exe +0 -0
- data/quickjs/qjscalc.c +4005 -0
- data/quickjs/qjscalc.js +2657 -0
- data/quickjs/quickjs-atom.h +273 -0
- data/quickjs/quickjs-libc.c +3927 -0
- data/quickjs/quickjs-libc.h +59 -0
- data/quickjs/quickjs-opcode.h +365 -0
- data/quickjs/quickjs.c +54036 -0
- data/quickjs/quickjs.h +1049 -0
- data/quickjs/readme.txt +1 -0
- data/quickjs/release.sh +158 -0
- data/quickjs/repl.c +2020 -0
- data/quickjs/repl.js +1566 -0
- data/quickjs/run-test262 +0 -0
- data/quickjs/run-test262.c +2107 -0
- data/quickjs/test262.conf +199 -0
- data/quickjs/test262_errors.txt +35 -0
- data/quickjs/test262o.conf +410 -0
- data/quickjs/test262o_errors.txt +0 -0
- data/quickjs/tests/bjson.c +96 -0
- data/quickjs/tests/microbench.js +1065 -0
- data/quickjs/tests/test262.patch +71 -0
- data/quickjs/tests/test_bignum.js +326 -0
- data/quickjs/tests/test_bjson.js +191 -0
- data/quickjs/tests/test_builtin.js +685 -0
- data/quickjs/tests/test_closure.js +221 -0
- data/quickjs/tests/test_language.js +547 -0
- data/quickjs/tests/test_loop.js +368 -0
- data/quickjs/tests/test_op_overloading.js +207 -0
- data/quickjs/tests/test_qjscalc.js +256 -0
- data/quickjs/tests/test_std.js +281 -0
- data/quickjs/tests/test_worker.js +62 -0
- data/quickjs/tests/test_worker_module.js +31 -0
- data/quickjs/unicode_download.sh +19 -0
- data/quickjs/unicode_gen.c +3057 -0
- data/quickjs/unicode_gen_def.h +284 -0
- data/readline +3 -0
- data/rm_com +1 -0
- data/run.sh +13 -0
- data/scaling +6 -0
- data/script.js +572 -0
- data/server_creator/__ +307 -0
- data/server_creator/a/a (1).tar.gz +0 -0
- data/server_creator/a/a.out +0 -0
- data/server_creator/a/hello_world +0 -0
- data/server_creator/a/help +57 -0
- data/server_creator/a/main_v1.cpp +83 -0
- data/server_creator/a/my_libs_gregory/.deps +0 -0
- data/server_creator/a/my_libs_gregory/.libs/mod_my_libs_gregory.lai +41 -0
- data/server_creator/a/my_libs_gregory/.libs/mod_my_libs_gregory.o +0 -0
- data/server_creator/a/my_libs_gregory/.libs/mod_my_libs_gregory.so +0 -0
- data/server_creator/a/my_libs_gregory/mod_my_libs_gregory.c +72 -0
- data/server_creator/a/my_libs_gregory/mod_my_libs_gregory.la +41 -0
- data/server_creator/a/my_libs_gregory/mod_my_libs_gregory.lo +12 -0
- data/server_creator/a/my_libs_gregory/mod_my_libs_gregory.slo +0 -0
- data/server_creator/a/nginx.conf +32 -0
- data/server_creator/a/six +1 -0
- data/server_creator/a.out +0 -0
- data/server_creator/all_code.cpp +448 -0
- data/server_creator/all_code.js +27 -0
- data/server_creator/code +510 -0
- data/server_creator/make_application +64 -0
- data/server_creator/prog.cpp +33 -0
- data/server_creator/prog.js +22 -0
- data/server_creator/program.js +745 -0
- data/server_creator/rm_com +1 -0
- data/server_creator/test.sh +82 -0
- data/speakcat.rb +9 -0
- data/string +48 -0
- data/super_trans +83 -0
- data/test.sh +21 -0
- data/todo +8 -0
- data/version_decrement +3 -0
- data/viu_license +21 -0
- data/windows/program.c +21 -0
- data/windows/program.exe +0 -0
- metadata +759 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* QuickJS: Example of C module
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2017-2018 Fabrice Bellard
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in
|
|
14
|
+
* all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
19
|
+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
|
+
* THE SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
#include "../quickjs.h"
|
|
25
|
+
|
|
26
|
+
#define countof(x) (sizeof(x) / sizeof((x)[0]))
|
|
27
|
+
|
|
28
|
+
static int fib(int n)
|
|
29
|
+
{
|
|
30
|
+
if (n <= 0)
|
|
31
|
+
return 0;
|
|
32
|
+
else if (n == 1)
|
|
33
|
+
return 1;
|
|
34
|
+
else
|
|
35
|
+
return fib(n - 1) + fib(n - 2);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
static JSValue js_fib(JSContext *ctx, JSValueConst this_val,
|
|
39
|
+
int argc, JSValueConst *argv)
|
|
40
|
+
{
|
|
41
|
+
int n, res;
|
|
42
|
+
if (JS_ToInt32(ctx, &n, argv[0]))
|
|
43
|
+
return JS_EXCEPTION;
|
|
44
|
+
res = fib(n);
|
|
45
|
+
return JS_NewInt32(ctx, res);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
static const JSCFunctionListEntry js_fib_funcs[] = {
|
|
49
|
+
JS_CFUNC_DEF("fib", 1, js_fib ),
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
static int js_fib_init(JSContext *ctx, JSModuleDef *m)
|
|
53
|
+
{
|
|
54
|
+
return JS_SetModuleExportList(ctx, m, js_fib_funcs,
|
|
55
|
+
countof(js_fib_funcs));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
#ifdef JS_SHARED_LIBRARY
|
|
59
|
+
#define JS_INIT_MODULE js_init_module
|
|
60
|
+
#else
|
|
61
|
+
#define JS_INIT_MODULE js_init_module_fib
|
|
62
|
+
#endif
|
|
63
|
+
|
|
64
|
+
JSModuleDef *JS_INIT_MODULE(JSContext *ctx, const char *module_name)
|
|
65
|
+
{
|
|
66
|
+
JSModuleDef *m;
|
|
67
|
+
m = JS_NewCModule(ctx, module_name, js_fib_init);
|
|
68
|
+
if (!m)
|
|
69
|
+
return NULL;
|
|
70
|
+
JS_AddModuleExportList(ctx, m, js_fib_funcs, countof(js_fib_funcs));
|
|
71
|
+
return m;
|
|
72
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
console.log("Hello World");
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* PI computation in Javascript using the QuickJS bigdecimal type
|
|
3
|
+
* (decimal floating point)
|
|
4
|
+
*/
|
|
5
|
+
"use strict";
|
|
6
|
+
|
|
7
|
+
/* compute PI with a precision of 'prec' digits */
|
|
8
|
+
function calc_pi(prec) {
|
|
9
|
+
const CHUD_A = 13591409m;
|
|
10
|
+
const CHUD_B = 545140134m;
|
|
11
|
+
const CHUD_C = 640320m;
|
|
12
|
+
const CHUD_C3 = 10939058860032000m; /* C^3/24 */
|
|
13
|
+
const CHUD_DIGITS_PER_TERM = 14.18164746272548; /* log10(C/12)*3 */
|
|
14
|
+
|
|
15
|
+
/* return [P, Q, G] */
|
|
16
|
+
function chud_bs(a, b, need_G) {
|
|
17
|
+
var c, P, Q, G, P1, Q1, G1, P2, Q2, G2, b1;
|
|
18
|
+
if (a == (b - 1n)) {
|
|
19
|
+
b1 = BigDecimal(b);
|
|
20
|
+
G = (2m * b1 - 1m) * (6m * b1 - 1m) * (6m * b1 - 5m);
|
|
21
|
+
P = G * (CHUD_B * b1 + CHUD_A);
|
|
22
|
+
if (b & 1n)
|
|
23
|
+
P = -P;
|
|
24
|
+
G = G;
|
|
25
|
+
Q = b1 * b1 * b1 * CHUD_C3;
|
|
26
|
+
} else {
|
|
27
|
+
c = (a + b) >> 1n;
|
|
28
|
+
[P1, Q1, G1] = chud_bs(a, c, true);
|
|
29
|
+
[P2, Q2, G2] = chud_bs(c, b, need_G);
|
|
30
|
+
P = P1 * Q2 + P2 * G1;
|
|
31
|
+
Q = Q1 * Q2;
|
|
32
|
+
if (need_G)
|
|
33
|
+
G = G1 * G2;
|
|
34
|
+
else
|
|
35
|
+
G = 0m;
|
|
36
|
+
}
|
|
37
|
+
return [P, Q, G];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
var n, P, Q, G;
|
|
41
|
+
/* number of serie terms */
|
|
42
|
+
n = BigInt(Math.ceil(prec / CHUD_DIGITS_PER_TERM)) + 10n;
|
|
43
|
+
[P, Q, G] = chud_bs(0n, n, false);
|
|
44
|
+
Q = BigDecimal.div(Q, (P + Q * CHUD_A),
|
|
45
|
+
{ roundingMode: "half-even",
|
|
46
|
+
maximumSignificantDigits: prec });
|
|
47
|
+
G = (CHUD_C / 12m) * BigDecimal.sqrt(CHUD_C,
|
|
48
|
+
{ roundingMode: "half-even",
|
|
49
|
+
maximumSignificantDigits: prec });
|
|
50
|
+
return Q * G;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
(function() {
|
|
54
|
+
var r, n_digits, n_bits;
|
|
55
|
+
if (typeof scriptArgs != "undefined") {
|
|
56
|
+
if (scriptArgs.length < 2) {
|
|
57
|
+
print("usage: pi n_digits");
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
n_digits = scriptArgs[1] | 0;
|
|
61
|
+
} else {
|
|
62
|
+
n_digits = 1000;
|
|
63
|
+
}
|
|
64
|
+
/* we add more digits to reduce the probability of bad rounding for
|
|
65
|
+
the last digits */
|
|
66
|
+
r = calc_pi(n_digits + 20);
|
|
67
|
+
print(r.toFixed(n_digits, "down"));
|
|
68
|
+
})();
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* PI computation in Javascript using the QuickJS bigfloat type
|
|
3
|
+
* (binary floating point)
|
|
4
|
+
*/
|
|
5
|
+
"use strict";
|
|
6
|
+
|
|
7
|
+
/* compute PI with a precision of 'prec' bits */
|
|
8
|
+
function calc_pi() {
|
|
9
|
+
const CHUD_A = 13591409n;
|
|
10
|
+
const CHUD_B = 545140134n;
|
|
11
|
+
const CHUD_C = 640320n;
|
|
12
|
+
const CHUD_C3 = 10939058860032000n; /* C^3/24 */
|
|
13
|
+
const CHUD_BITS_PER_TERM = 47.11041313821584202247; /* log2(C/12)*3 */
|
|
14
|
+
|
|
15
|
+
/* return [P, Q, G] */
|
|
16
|
+
function chud_bs(a, b, need_G) {
|
|
17
|
+
var c, P, Q, G, P1, Q1, G1, P2, Q2, G2;
|
|
18
|
+
if (a == (b - 1n)) {
|
|
19
|
+
G = (2n * b - 1n) * (6n * b - 1n) * (6n * b - 5n);
|
|
20
|
+
P = BigFloat(G * (CHUD_B * b + CHUD_A));
|
|
21
|
+
if (b & 1n)
|
|
22
|
+
P = -P;
|
|
23
|
+
G = BigFloat(G);
|
|
24
|
+
Q = BigFloat(b * b * b * CHUD_C3);
|
|
25
|
+
} else {
|
|
26
|
+
c = (a + b) >> 1n;
|
|
27
|
+
[P1, Q1, G1] = chud_bs(a, c, true);
|
|
28
|
+
[P2, Q2, G2] = chud_bs(c, b, need_G);
|
|
29
|
+
P = P1 * Q2 + P2 * G1;
|
|
30
|
+
Q = Q1 * Q2;
|
|
31
|
+
if (need_G)
|
|
32
|
+
G = G1 * G2;
|
|
33
|
+
else
|
|
34
|
+
G = 0l;
|
|
35
|
+
}
|
|
36
|
+
return [P, Q, G];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
var n, P, Q, G;
|
|
40
|
+
/* number of serie terms */
|
|
41
|
+
n = BigInt(Math.ceil(BigFloatEnv.prec / CHUD_BITS_PER_TERM)) + 10n;
|
|
42
|
+
[P, Q, G] = chud_bs(0n, n, false);
|
|
43
|
+
Q = Q / (P + Q * BigFloat(CHUD_A));
|
|
44
|
+
G = BigFloat((CHUD_C / 12n)) * BigFloat.sqrt(BigFloat(CHUD_C));
|
|
45
|
+
return Q * G;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
(function() {
|
|
49
|
+
var r, n_digits, n_bits;
|
|
50
|
+
if (typeof scriptArgs != "undefined") {
|
|
51
|
+
if (scriptArgs.length < 2) {
|
|
52
|
+
print("usage: pi n_digits");
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
n_digits = scriptArgs[1];
|
|
56
|
+
} else {
|
|
57
|
+
n_digits = 1000;
|
|
58
|
+
}
|
|
59
|
+
n_bits = Math.ceil(n_digits * Math.log2(10));
|
|
60
|
+
/* we add more bits to reduce the probability of bad rounding for
|
|
61
|
+
the last digits */
|
|
62
|
+
BigFloatEnv.setPrec( () => {
|
|
63
|
+
r = calc_pi();
|
|
64
|
+
print(r.toFixed(n_digits, BigFloatEnv.RNDZ));
|
|
65
|
+
}, n_bits + 32);
|
|
66
|
+
})();
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* PI computation in Javascript using the BigInt type
|
|
3
|
+
*/
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
/* return floor(log2(a)) for a > 0 and 0 for a = 0 */
|
|
7
|
+
function floor_log2(a)
|
|
8
|
+
{
|
|
9
|
+
var k_max, a1, k, i;
|
|
10
|
+
k_max = 0n;
|
|
11
|
+
while ((a >> (2n ** k_max)) != 0n) {
|
|
12
|
+
k_max++;
|
|
13
|
+
}
|
|
14
|
+
k = 0n;
|
|
15
|
+
a1 = a;
|
|
16
|
+
for(i = k_max - 1n; i >= 0n; i--) {
|
|
17
|
+
a1 = a >> (2n ** i);
|
|
18
|
+
if (a1 != 0n) {
|
|
19
|
+
a = a1;
|
|
20
|
+
k |= (1n << i);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return k;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* return ceil(log2(a)) for a > 0 */
|
|
27
|
+
function ceil_log2(a)
|
|
28
|
+
{
|
|
29
|
+
return floor_log2(a - 1n) + 1n;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* return floor(sqrt(a)) (not efficient but simple) */
|
|
33
|
+
function int_sqrt(a)
|
|
34
|
+
{
|
|
35
|
+
var l, u, s;
|
|
36
|
+
if (a == 0n)
|
|
37
|
+
return a;
|
|
38
|
+
l = ceil_log2(a);
|
|
39
|
+
u = 1n << ((l + 1n) / 2n);
|
|
40
|
+
/* u >= floor(sqrt(a)) */
|
|
41
|
+
for(;;) {
|
|
42
|
+
s = u;
|
|
43
|
+
u = ((a / s) + s) / 2n;
|
|
44
|
+
if (u >= s)
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
return s;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* return pi * 2**prec */
|
|
51
|
+
function calc_pi(prec) {
|
|
52
|
+
const CHUD_A = 13591409n;
|
|
53
|
+
const CHUD_B = 545140134n;
|
|
54
|
+
const CHUD_C = 640320n;
|
|
55
|
+
const CHUD_C3 = 10939058860032000n; /* C^3/24 */
|
|
56
|
+
const CHUD_BITS_PER_TERM = 47.11041313821584202247; /* log2(C/12)*3 */
|
|
57
|
+
|
|
58
|
+
/* return [P, Q, G] */
|
|
59
|
+
function chud_bs(a, b, need_G) {
|
|
60
|
+
var c, P, Q, G, P1, Q1, G1, P2, Q2, G2;
|
|
61
|
+
if (a == (b - 1n)) {
|
|
62
|
+
G = (2n * b - 1n) * (6n * b - 1n) * (6n * b - 5n);
|
|
63
|
+
P = G * (CHUD_B * b + CHUD_A);
|
|
64
|
+
if (b & 1n)
|
|
65
|
+
P = -P;
|
|
66
|
+
Q = b * b * b * CHUD_C3;
|
|
67
|
+
} else {
|
|
68
|
+
c = (a + b) >> 1n;
|
|
69
|
+
[P1, Q1, G1] = chud_bs(a, c, true);
|
|
70
|
+
[P2, Q2, G2] = chud_bs(c, b, need_G);
|
|
71
|
+
P = P1 * Q2 + P2 * G1;
|
|
72
|
+
Q = Q1 * Q2;
|
|
73
|
+
if (need_G)
|
|
74
|
+
G = G1 * G2;
|
|
75
|
+
else
|
|
76
|
+
G = 0n;
|
|
77
|
+
}
|
|
78
|
+
return [P, Q, G];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
var n, P, Q, G;
|
|
82
|
+
/* number of serie terms */
|
|
83
|
+
n = BigInt(Math.ceil(Number(prec) / CHUD_BITS_PER_TERM)) + 10n;
|
|
84
|
+
[P, Q, G] = chud_bs(0n, n, false);
|
|
85
|
+
Q = (CHUD_C / 12n) * (Q << prec) / (P + Q * CHUD_A);
|
|
86
|
+
G = int_sqrt(CHUD_C << (2n * prec));
|
|
87
|
+
return (Q * G) >> prec;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function main(args) {
|
|
91
|
+
var r, n_digits, n_bits, out;
|
|
92
|
+
if (args.length < 1) {
|
|
93
|
+
print("usage: pi n_digits");
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
n_digits = args[0] | 0;
|
|
97
|
+
|
|
98
|
+
/* we add more bits to reduce the probability of bad rounding for
|
|
99
|
+
the last digits */
|
|
100
|
+
n_bits = BigInt(Math.ceil(n_digits * Math.log2(10))) + 32n;
|
|
101
|
+
r = calc_pi(n_bits);
|
|
102
|
+
r = ((10n ** BigInt(n_digits)) * r) >> n_bits;
|
|
103
|
+
out = r.toString();
|
|
104
|
+
print(out[0] + "." + out.slice(1));
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
var args;
|
|
108
|
+
if (typeof scriptArgs != "undefined") {
|
|
109
|
+
args = scriptArgs;
|
|
110
|
+
args.shift();
|
|
111
|
+
} else if (typeof arguments != "undefined") {
|
|
112
|
+
args = arguments;
|
|
113
|
+
} else {
|
|
114
|
+
/* default: 1000 digits */
|
|
115
|
+
args=[1000];
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
main(args);
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* QuickJS: Example of C module with a class
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2019 Fabrice Bellard
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in
|
|
14
|
+
* all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
19
|
+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
|
+
* THE SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
#include "../quickjs.h"
|
|
25
|
+
#include <math.h>
|
|
26
|
+
|
|
27
|
+
#define countof(x) (sizeof(x) / sizeof((x)[0]))
|
|
28
|
+
|
|
29
|
+
/* Point Class */
|
|
30
|
+
|
|
31
|
+
typedef struct {
|
|
32
|
+
int x;
|
|
33
|
+
int y;
|
|
34
|
+
} JSPointData;
|
|
35
|
+
|
|
36
|
+
static JSClassID js_point_class_id;
|
|
37
|
+
|
|
38
|
+
static void js_point_finalizer(JSRuntime *rt, JSValue val)
|
|
39
|
+
{
|
|
40
|
+
JSPointData *s = JS_GetOpaque(val, js_point_class_id);
|
|
41
|
+
/* Note: 's' can be NULL in case JS_SetOpaque() was not called */
|
|
42
|
+
js_free_rt(rt, s);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
static JSValue js_point_ctor(JSContext *ctx,
|
|
46
|
+
JSValueConst new_target,
|
|
47
|
+
int argc, JSValueConst *argv)
|
|
48
|
+
{
|
|
49
|
+
JSPointData *s;
|
|
50
|
+
JSValue obj = JS_UNDEFINED;
|
|
51
|
+
JSValue proto;
|
|
52
|
+
|
|
53
|
+
s = js_mallocz(ctx, sizeof(*s));
|
|
54
|
+
if (!s)
|
|
55
|
+
return JS_EXCEPTION;
|
|
56
|
+
if (JS_ToInt32(ctx, &s->x, argv[0]))
|
|
57
|
+
goto fail;
|
|
58
|
+
if (JS_ToInt32(ctx, &s->y, argv[1]))
|
|
59
|
+
goto fail;
|
|
60
|
+
/* using new_target to get the prototype is necessary when the
|
|
61
|
+
class is extended. */
|
|
62
|
+
proto = JS_GetPropertyStr(ctx, new_target, "prototype");
|
|
63
|
+
if (JS_IsException(proto))
|
|
64
|
+
goto fail;
|
|
65
|
+
obj = JS_NewObjectProtoClass(ctx, proto, js_point_class_id);
|
|
66
|
+
JS_FreeValue(ctx, proto);
|
|
67
|
+
if (JS_IsException(obj))
|
|
68
|
+
goto fail;
|
|
69
|
+
JS_SetOpaque(obj, s);
|
|
70
|
+
return obj;
|
|
71
|
+
fail:
|
|
72
|
+
js_free(ctx, s);
|
|
73
|
+
JS_FreeValue(ctx, obj);
|
|
74
|
+
return JS_EXCEPTION;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
static JSValue js_point_get_xy(JSContext *ctx, JSValueConst this_val, int magic)
|
|
78
|
+
{
|
|
79
|
+
JSPointData *s = JS_GetOpaque2(ctx, this_val, js_point_class_id);
|
|
80
|
+
if (!s)
|
|
81
|
+
return JS_EXCEPTION;
|
|
82
|
+
if (magic == 0)
|
|
83
|
+
return JS_NewInt32(ctx, s->x);
|
|
84
|
+
else
|
|
85
|
+
return JS_NewInt32(ctx, s->y);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
static JSValue js_point_set_xy(JSContext *ctx, JSValueConst this_val, JSValue val, int magic)
|
|
89
|
+
{
|
|
90
|
+
JSPointData *s = JS_GetOpaque2(ctx, this_val, js_point_class_id);
|
|
91
|
+
int v;
|
|
92
|
+
if (!s)
|
|
93
|
+
return JS_EXCEPTION;
|
|
94
|
+
if (JS_ToInt32(ctx, &v, val))
|
|
95
|
+
return JS_EXCEPTION;
|
|
96
|
+
if (magic == 0)
|
|
97
|
+
s->x = v;
|
|
98
|
+
else
|
|
99
|
+
s->y = v;
|
|
100
|
+
return JS_UNDEFINED;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
static JSValue js_point_norm(JSContext *ctx, JSValueConst this_val,
|
|
104
|
+
int argc, JSValueConst *argv)
|
|
105
|
+
{
|
|
106
|
+
JSPointData *s = JS_GetOpaque2(ctx, this_val, js_point_class_id);
|
|
107
|
+
if (!s)
|
|
108
|
+
return JS_EXCEPTION;
|
|
109
|
+
return JS_NewFloat64(ctx, sqrt((double)s->x * s->x + (double)s->y * s->y));
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
static JSClassDef js_point_class = {
|
|
113
|
+
"Point",
|
|
114
|
+
.finalizer = js_point_finalizer,
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
static const JSCFunctionListEntry js_point_proto_funcs[] = {
|
|
118
|
+
JS_CGETSET_MAGIC_DEF("x", js_point_get_xy, js_point_set_xy, 0),
|
|
119
|
+
JS_CGETSET_MAGIC_DEF("y", js_point_get_xy, js_point_set_xy, 1),
|
|
120
|
+
JS_CFUNC_DEF("norm", 0, js_point_norm),
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
static int js_point_init(JSContext *ctx, JSModuleDef *m)
|
|
124
|
+
{
|
|
125
|
+
JSValue point_proto, point_class;
|
|
126
|
+
|
|
127
|
+
/* create the Point class */
|
|
128
|
+
JS_NewClassID(&js_point_class_id);
|
|
129
|
+
JS_NewClass(JS_GetRuntime(ctx), js_point_class_id, &js_point_class);
|
|
130
|
+
|
|
131
|
+
point_proto = JS_NewObject(ctx);
|
|
132
|
+
JS_SetPropertyFunctionList(ctx, point_proto, js_point_proto_funcs, countof(js_point_proto_funcs));
|
|
133
|
+
|
|
134
|
+
point_class = JS_NewCFunction2(ctx, js_point_ctor, "Point", 2, JS_CFUNC_constructor, 0);
|
|
135
|
+
/* set proto.constructor and ctor.prototype */
|
|
136
|
+
JS_SetConstructor(ctx, point_class, point_proto);
|
|
137
|
+
JS_SetClassProto(ctx, js_point_class_id, point_proto);
|
|
138
|
+
|
|
139
|
+
JS_SetModuleExport(ctx, m, "Point", point_class);
|
|
140
|
+
return 0;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
JSModuleDef *js_init_module(JSContext *ctx, const char *module_name)
|
|
144
|
+
{
|
|
145
|
+
JSModuleDef *m;
|
|
146
|
+
m = JS_NewCModule(ctx, module_name, js_point_init);
|
|
147
|
+
if (!m)
|
|
148
|
+
return NULL;
|
|
149
|
+
JS_AddModuleExport(ctx, m, "Point");
|
|
150
|
+
return m;
|
|
151
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/* example of JS module importing a C module */
|
|
2
|
+
import { Point } from "./point.so";
|
|
3
|
+
|
|
4
|
+
function assert(b, str)
|
|
5
|
+
{
|
|
6
|
+
if (b) {
|
|
7
|
+
return;
|
|
8
|
+
} else {
|
|
9
|
+
throw Error("assertion failed: " + str);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
class ColorPoint extends Point {
|
|
14
|
+
constructor(x, y, color) {
|
|
15
|
+
super(x, y);
|
|
16
|
+
this.color = color;
|
|
17
|
+
}
|
|
18
|
+
get_color() {
|
|
19
|
+
return this.color;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
function main()
|
|
24
|
+
{
|
|
25
|
+
var pt, pt2;
|
|
26
|
+
|
|
27
|
+
pt = new Point(2, 3);
|
|
28
|
+
assert(pt.x === 2);
|
|
29
|
+
assert(pt.y === 3);
|
|
30
|
+
pt.x = 4;
|
|
31
|
+
assert(pt.x === 4);
|
|
32
|
+
assert(pt.norm() == 5);
|
|
33
|
+
|
|
34
|
+
pt2 = new ColorPoint(2, 3, 0xffffff);
|
|
35
|
+
assert(pt2.x === 2);
|
|
36
|
+
assert(pt2.color === 0xffffff);
|
|
37
|
+
assert(pt2.get_color() === 0xffffff);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
main();
|
data/quickjs/hello.c
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/* File generated automatically by the QuickJS compiler. */
|
|
2
|
+
|
|
3
|
+
#include "quickjs-libc.h"
|
|
4
|
+
|
|
5
|
+
const uint32_t qjsc_hello_size = 87;
|
|
6
|
+
|
|
7
|
+
const uint8_t qjsc_hello[87] = {
|
|
8
|
+
0x02, 0x04, 0x0e, 0x63, 0x6f, 0x6e, 0x73, 0x6f,
|
|
9
|
+
0x6c, 0x65, 0x06, 0x6c, 0x6f, 0x67, 0x16, 0x48,
|
|
10
|
+
0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x57, 0x6f, 0x72,
|
|
11
|
+
0x6c, 0x64, 0x22, 0x65, 0x78, 0x61, 0x6d, 0x70,
|
|
12
|
+
0x6c, 0x65, 0x73, 0x2f, 0x68, 0x65, 0x6c, 0x6c,
|
|
13
|
+
0x6f, 0x2e, 0x6a, 0x73, 0x0e, 0x00, 0x06, 0x00,
|
|
14
|
+
0xa0, 0x01, 0x00, 0x01, 0x00, 0x03, 0x00, 0x00,
|
|
15
|
+
0x14, 0x01, 0xa2, 0x01, 0x00, 0x00, 0x00, 0x38,
|
|
16
|
+
0xe1, 0x00, 0x00, 0x00, 0x42, 0xe2, 0x00, 0x00,
|
|
17
|
+
0x00, 0x04, 0xe3, 0x00, 0x00, 0x00, 0x24, 0x01,
|
|
18
|
+
0x00, 0xcd, 0x28, 0xc8, 0x03, 0x01, 0x00,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
static JSContext *JS_NewCustomContext(JSRuntime *rt)
|
|
22
|
+
{
|
|
23
|
+
JSContext *ctx = JS_NewContextRaw(rt);
|
|
24
|
+
if (!ctx)
|
|
25
|
+
return NULL;
|
|
26
|
+
JS_AddIntrinsicBaseObjects(ctx);
|
|
27
|
+
return ctx;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
int main(int argc, char **argv)
|
|
31
|
+
{
|
|
32
|
+
JSRuntime *rt;
|
|
33
|
+
JSContext *ctx;
|
|
34
|
+
rt = JS_NewRuntime();
|
|
35
|
+
js_std_set_worker_new_context_func(JS_NewCustomContext);
|
|
36
|
+
js_std_init_handlers(rt);
|
|
37
|
+
ctx = JS_NewCustomContext(rt);
|
|
38
|
+
js_std_add_helpers(ctx, argc, argv);
|
|
39
|
+
js_std_eval_binary(ctx, qjsc_hello, qjsc_hello_size, 0);
|
|
40
|
+
js_std_loop(ctx);
|
|
41
|
+
JS_FreeContext(ctx);
|
|
42
|
+
JS_FreeRuntime(rt);
|
|
43
|
+
return 0;
|
|
44
|
+
}
|