├── .gitignore ├── CHANGELOG ├── INSTALL ├── INSTALL.mac ├── LICENSE ├── README.md ├── TODO ├── bin ├── lib │ ├── inbuilts.dart │ ├── pyrandom.dart │ ├── pytime.dart │ ├── slice.dart │ ├── sprintf.dart │ └── src │ │ ├── formatters │ │ ├── Formatter.dart │ │ ├── float_formatter.dart │ │ ├── int_formatter.dart │ │ └── string_formatter.dart │ │ └── sprintf_impl.dart └── transform.py ├── docs ├── About.rst ├── DevDocs.rst ├── Intro.rst ├── License.rst ├── Makefile ├── _build │ ├── doctrees │ │ ├── About.doctree │ │ ├── DevDocs.doctree │ │ ├── DevWorkflow.doctree │ │ ├── Intro.doctree │ │ ├── License.doctree │ │ ├── MedDevTeam.doctree │ │ ├── environment.pickle │ │ ├── index.doctree │ │ ├── indro.doctree │ │ ├── installation.doctree │ │ └── workflow.doctree │ └── html │ │ ├── .buildinfo │ │ ├── About.html │ │ ├── DevDocs.html │ │ ├── DevWorkflow.html │ │ ├── Intro.html │ │ ├── License.html │ │ ├── MedDevTeam.html │ │ ├── _images │ │ └── image1.png │ │ ├── _sources │ │ ├── About.txt │ │ ├── DevDocs.txt │ │ ├── DevWorkflow.txt │ │ ├── Intro.txt │ │ ├── License.txt │ │ ├── MedDevTeam.txt │ │ ├── index.txt │ │ ├── indro.txt │ │ ├── installation.txt │ │ └── workflow.txt │ │ ├── _static │ │ ├── ajax-loader.gif │ │ ├── basic.css │ │ ├── comment-bright.png │ │ ├── comment-close.png │ │ ├── comment.png │ │ ├── default.css │ │ ├── doctools.js │ │ ├── down-pressed.png │ │ ├── down.png │ │ ├── file.png │ │ ├── image1.png │ │ ├── jquery.js │ │ ├── minus.png │ │ ├── plus.png │ │ ├── pygments.css │ │ ├── searchtools.js │ │ ├── sidebar.js │ │ ├── underscore.js │ │ ├── up-pressed.png │ │ ├── up.png │ │ └── websupport.js │ │ ├── genindex.html │ │ ├── index.html │ │ ├── installation.html │ │ ├── objects.inv │ │ ├── search.html │ │ ├── searchindex.js │ │ └── workflow.html ├── _static │ └── image1.png ├── autodoc ├── conf.py ├── index.rst ├── installation.rst └── make.bat ├── icon.jpg ├── icon.png ├── inc ├── cache.h ├── exec.h ├── sha256.h ├── static_data.h └── transform.h ├── medusa.pro └── src ├── cache.cpp ├── exec.cpp ├── main.cpp ├── sha256.cpp └── transform.cpp /.gitignore: -------------------------------------------------------------------------------- 1 | **/.DS_Store 2 | medusavm 3 | .qmake.stash 4 | Makefile 5 | inc/transform_moc.h 6 | -------------------------------------------------------------------------------- /CHANGELOG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lispyclouds/medusa/cf069800eb607fe25d4dafa5332cceda5a7c7c8b/CHANGELOG -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Checking for Qt5 Libs..." 4 | if dpkg -s qtdeclarative5-dev > /dev/null 2>&1 5 | then 6 | echo "Qt5 Libs found, moving on..." 7 | else 8 | echo "Qt5 Libs not found, installing..." 9 | sudo apt-add-repository -y ppa:ubuntu-sdk-team/ppa 10 | sudo apt-get update 11 | sudo apt-get -y install qtdeclarative5-dev 12 | fi 13 | 14 | echo "Checking for Python 2.7 Installation..." 15 | if type "python" > /dev/null 2>&1 16 | then 17 | echo "Python 2.7 found, moving on..." 18 | else 19 | echo "Python 2.7 not found, installing..." 20 | sudo apt-get -y install python 21 | fi 22 | 23 | echo "Checking for Dart SDK Installation..." 24 | if type "dart" > /dev/null 2>&1 25 | then 26 | echo "Dart SDK found, moving on..." 27 | else 28 | echo "Dart SDK not found, installing..." 29 | sudo apt-get update 30 | sudo apt-get install apt-transport-https 31 | sudo sh -c 'curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -' 32 | sudo sh -c 'curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list' 33 | sudo apt-get update 34 | sudo apt-get install dart/stable 35 | fi 36 | 37 | echo "Checking for C++ compilers..." 38 | qmake_opt="" 39 | if type "clang++" > /dev/null 2>&1 40 | then 41 | echo "clang++ found, using it." 42 | qmake_opt="-recursive -spec linux-clang" 43 | elif type "g++" > /dev/null 2>&1 44 | then 45 | echo "g++ found, using it." 46 | else 47 | echo "No C++ compilers found. Installing GNU build tools..." 48 | sudo apt-get -y install build-essential 49 | fi 50 | 51 | echo "All dependencies satisified! We are good to go... :D" 52 | echo "Starting Medusa build..." 53 | 54 | echo "Setting Qt5 build home.." 55 | if [ -d /usr/lib/x86_64-linux-gnu/qt5 ]; 56 | then 57 | qHome="/usr/lib/x86_64-linux-gnu/qt5/bin" 58 | else 59 | qHome="/usr/lib/i686-linux-gnu/qt5/bin" 60 | fi 61 | echo "Qt5 build home set at: " $qHome 62 | 63 | echo "moc'ing transform.h..." 64 | $qHome/moc inc/transform.h > inc/transform_moc.h 65 | echo "Done!" 66 | 67 | echo "Generating Makefile..." 68 | $qHome/qmake -o Makefile medusa.pro $qmake_opt 69 | echo "Done" 70 | 71 | echo "Building and Installing Medusa 2.7.3..." 72 | make -j $(grep -c ^processor /proc/cpuinfo) 73 | sudo make install 74 | make clean 75 | echo "Done!" 76 | 77 | echo "Installing Medusa 2.7.3 Runtime..." 78 | if [ ! -d ~/.medusa ]; 79 | then 80 | echo "Creating Medusa Home Directory" 81 | mkdir ~/.medusa 82 | fi 83 | echo "Installing Dart Libs and FPT Transformer" 84 | cp -a bin/. ~/.medusa 85 | echo "Medusa 2.7.3 Successfully installed Yo! Runnable directly as 'medusavm' from the terminal. Happy Pythoning!" 86 | -------------------------------------------------------------------------------- /INSTALL.mac: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Checking for qmake..." 4 | if type "qmake" > /dev/null 2>&1 5 | then 6 | echo "qmake found, moving on..." 7 | else 8 | echo "qmake not found, Install Qt5 first." 9 | exit 10 | fi 11 | 12 | echo "Checking for moc..." 13 | if type "moc" > /dev/null 2>&1 14 | then 15 | echo "moc found, moving on..." 16 | else 17 | echo "moc not found, Install Qt5 first." 18 | exit 19 | fi 20 | 21 | echo "Checking for Python 2.7..." 22 | if type "python" > /dev/null 2>&1 23 | then 24 | echo "Python 2.7 found, moving on..." 25 | else 26 | echo "Python 2.7 not found, Install Python 2.7.x." 27 | exit 28 | fi 29 | 30 | echo "Checking for dart..." 31 | if type "dart" > /dev/null 2>&1 32 | then 33 | echo "Dart VM found, moving on..." 34 | else 35 | echo "Dart VM not found, Install Dart SDK first." 36 | exit 37 | fi 38 | 39 | echo "Checking for clang++..." 40 | if type "clang++" > /dev/null 2>&1 41 | then 42 | echo "clang++ found, moving on..." 43 | else 44 | echo "clang++ compilers found. Instal XCode first..." 45 | exit 46 | fi 47 | 48 | echo "All dependencies satisified! We are good to go... :D" 49 | echo "Starting Medusa build..." 50 | 51 | echo "moc'ing transform.h..." 52 | moc inc/transform.h > inc/transform_moc.h 53 | echo "Done!" 54 | 55 | echo "Generating Makefile..." 56 | qmake -o Makefile medusa.pro -recursive -spec macx-clang 57 | echo "Done" 58 | 59 | echo "Buliding and Installing Medusa 2.7.3..." 60 | make -j $(sysctl -n hw.ncpu) 61 | sudo make install 62 | make clean 63 | echo "Done!" 64 | 65 | echo "Installing Medusa 2.7.3 Runtime..." 66 | if [ ! -d ~/.medusa ]; 67 | then 68 | echo "Creating Medusa Home Directory" 69 | mkdir ~/.medusa 70 | fi 71 | echo "Installing Dart Libs and FPT Transformer" 72 | cp -a bin/. ~/.medusa 73 | echo "Medusa 2.7.3 Successfully installed Yo! Runnable directly as 'medusavm' from the terminal. Happy Pythoning!" 74 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The BSD 3-Clause License 2 | 3 | Copyright (c) 2013-2014, Rahul De, Apoorv Agarwal and Aakash Giri. VIT University 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 12 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Medusa 2 | 3 | [![Join the chat at https://gitter.im/rahul080327/medusa](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/rahul080327/medusa?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 4 | 5 | ![alt tag](https://raw.github.com/rahul080327/medusa/master/icon.png) 6 | 7 | An attempt at making Python stronger and faster like Medusa herself! 8 | 9 | Python being an interpreted language has its pros and cons and the aim is to fix one of the most obvious cons of Python: its execution speed. 10 | We all love Python for its simplicity and flexibility but when it comes to writing large volumes of code involving complex operations and recursions Python somewhat falls short compared to the other native/JIT languages. 11 | 12 | In late 2012, Google came up with Dart, a language aiming for the unification of server and client side web development and scalable apps. Along with it came The Dart Virtual Machine. A hyper fast VM which builds upon the V8 js engine and even outperforms it. We decided why not let Python have a go on this? 13 | 14 | The main aim behind creating the Medusa project is giving a typless and flexible language like Python a faster execution environment while still maintaining all its flexibility which we all love. Numerous projects such as the ShedSkin project which converts implicitly typed Python to C++ have tried doing it, but have put some or the other restriction on the input Python code. The Medusa project aims at running pre-existing Python code without any or minimal modification at a much faster rates compared to the usual implementations. 15 | 16 | Still in its nascent stages and implemented using Qt/C++, Python and Dart, the project works by compiling Python code to a highly optimized Dart code in real time, persistently caching it and letting it rip on the Dart VM. The Dart VM like V8 compiles the dart code directly to machine code and using its vast array of runtime optimizations runs at a much higher speed compared to the CPython implementation and at times upto a 1000 - 1500% faster while maintaining all the features Python offers. Apart from this Python is further enriched with extra features provided by the Dart VM and you can do more stuff with Python which isn't possible with the vanilla Python. 17 | 18 | ## Installing 19 | 20 | Ubuntu/Ubuntu-derived Linux users: 21 | 22 | Simply run ./INSTALL after cloning this repo on your Ubuntu based Linux distro. Thats it. All dependencies are installed, code compiled and paths setup automatically. 23 | 24 | Mac OSX Users (packaged app): 25 | Coming Soon ;) Thanks for your patience. 26 | 27 | Mac OSX Users (building from source): 28 | * Install Xcode if not installed (Sorry for the bandwidth hogging...) 29 | * Install python 2.7.x if not installed and add it to PATH 30 | * Download and Install latest Qt5 for Mac from [here](http://qt-project.org/downloads) and add qmake and moc to PATH 31 | * Download the latest Dart SDK from [here](https://storage.googleapis.com/dart-archive/channels/stable/release/latest/sdk/dartsdk-macos-ia32-release.zip), unzip and add the dart executable to PATH 32 | * Clone this repo and simply run ./INSTALL.mac 33 | * After a succesful compile medusavm binary is available in /usr/bin/ for use 34 | * For updates and subsequent builds, fetch changes and just run ./INSTALL.mac 35 | 36 | Yeah, I finally have a MacBook! ^_^ 37 | 38 | Others: 39 | * Install C++ compilers and Make tools 40 | * Install Qt5 build tools and libs 41 | * Install Dart SDK 42 | * Install Python 2.7.x 43 | * Rum moc on inc/transform.h to inc/transform_moc.h 44 | * Run qmake on medusa.pro 45 | * Run make 46 | * Use the medusavm executable 47 | 48 | ## Running 49 | 50 | Using Medusa: 51 | * Medusa is available as medusavm after a successful buid and install 52 | * Python programs can be run by passing them as parameters: medusavm hello.py 53 | * Medusa can be stopped after the Dart compile phase by passing a -c switch: medusavm -c hello.py. The Dart code is obtained in hello.dart in the same directory. 54 | * Python files can be globally installed into Medusa for imports by other files: medusavm -install python_file 55 | * Help is at: medusavm --help 56 | 57 | ## Documentation 58 | 59 | The medusa's documentation for developers and users can be accessed [here](http://medusa.readthedocs.org/) 60 | 61 | 62 | ## Contributing 63 | 64 | We'd love to have your help in making Medusa better and Python faster. Any and all contributions are welcome. Frankly speaking there's still a hell lot to do. 65 | 66 | ## License 67 | 68 | The BSD 3-Clause License 69 | 70 | Copyright (c) 2013-2014, Rahul De, Apoorv Agarwal and Aakash Giri. VIT University 71 | All rights reserved. 72 | 73 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 74 | 75 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 76 | 77 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 78 | 79 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 80 | 81 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 82 | 83 | ## Fear and Respect her at the same time! 84 | 85 | ![alt tag](https://raw.github.com/rahul080327/medusa/master/icon.jpg) 86 | 87 | ## Just Kidding, Happy Pythoning Yo! 88 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | 1. Support for native OS functionality 2 | -------------------------------------------------------------------------------- /bin/lib/pyrandom.dart: -------------------------------------------------------------------------------- 1 | import "dart:math"; 2 | import "inbuilts.dart"; 3 | 4 | class $PyRandom { 5 | var _rng; 6 | 7 | $PyRandom([s]) { 8 | seed(s); 9 | } 10 | 11 | seed([value]) { 12 | if (value == null) 13 | _rng = new Random(); 14 | else 15 | _rng = new Random(value.value()); 16 | } 17 | 18 | randrange(start, [stop, step = 1]) { 19 | var space; 20 | 21 | if (stop == null) 22 | space = range(start); 23 | else if (step != 1) 24 | space = range(start, stop, step); 25 | else 26 | space = range(start, stop); 27 | 28 | return space.toList()[_rng.nextInt(space.length - 1)]; 29 | } 30 | 31 | randint(a, b) => new $PyNum(range(a, b).toList()[_rng.nextInt((b - a) - 1)]); 32 | choice(seq) => seq[_rng.nextInt(seq.length - 1)]; 33 | shuffle(x, [rand]) => x.shuffle(); 34 | random() => new $PyNum(_rng.nextDouble()); 35 | } 36 | -------------------------------------------------------------------------------- /bin/lib/pytime.dart: -------------------------------------------------------------------------------- 1 | library PyTime; 2 | 3 | import "inbuilts.dart"; 4 | 5 | class $PyTime { 6 | var _tobj; 7 | 8 | $PyTime() { 9 | _tobj = new DateTime.now(); 10 | } 11 | 12 | time() => new $PyNum(_tobj.millisecondsSinceEpoch); 13 | } -------------------------------------------------------------------------------- /bin/lib/slice.dart: -------------------------------------------------------------------------------- 1 | library slice; 2 | 3 | import "dart:collection"; 4 | import "dart:mirrors"; 5 | 6 | $slice(list, lower, higher, step) { 7 | var c = []; 8 | var i = 0; 9 | 10 | lower = lower.value(); 11 | higher = higher.value(); 12 | step = step.value(); 13 | 14 | if (higher < 0) 15 | higher = list.length.value() + higher; 16 | 17 | if (lower < 0) 18 | lower = list.length.value() + lower; 19 | 20 | if (lower > list.length.value() - 1) 21 | lower = list.length.value() - 1; 22 | 23 | if (higher > list.length.value() - 1) 24 | higher = list.length.value() - 1; 25 | 26 | if (step < 0) { 27 | for (i = lower; i >= higher; i += step) 28 | c.add(list[i]); 29 | } else { 30 | for (i = lower; i < higher; i += step) 31 | c.add(list[i]); 32 | } 33 | 34 | return c; 35 | } -------------------------------------------------------------------------------- /bin/lib/sprintf.dart: -------------------------------------------------------------------------------- 1 | library sprintf; 2 | 3 | import 'dart:math'; 4 | 5 | part 'src/formatters/Formatter.dart'; 6 | part 'src/formatters/int_formatter.dart'; 7 | part 'src/formatters/float_formatter.dart'; 8 | part 'src/formatters/string_formatter.dart'; 9 | part 'src/sprintf_impl.dart'; 10 | 11 | typedef SPrintF(String fmt, var args); 12 | 13 | var $sprintf = new PrintFormat(); 14 | -------------------------------------------------------------------------------- /bin/lib/src/formatters/Formatter.dart: -------------------------------------------------------------------------------- 1 | part of sprintf; 2 | 3 | class Formatter { 4 | 5 | var fmt_type; 6 | var options; 7 | 8 | Formatter(this.fmt_type, this.options); 9 | 10 | static String get_padding(int count, String pad) { 11 | String padding_piece = pad; 12 | StringBuffer padding = new StringBuffer(); 13 | 14 | while (count > 0) { 15 | if ((count & 1) == 1) { padding.write(padding_piece); } 16 | count >>= 1; 17 | padding_piece = "${padding_piece}${padding_piece}"; 18 | } 19 | 20 | return padding.toString(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /bin/lib/src/formatters/float_formatter.dart: -------------------------------------------------------------------------------- 1 | part of sprintf; 2 | 3 | class FloatFormatter extends Formatter { 4 | // TODO: can't rely on '.' being the decimal separator 5 | static final _number_rx = new RegExp(r'^[\-\+]?(\d+)\.(\d+)$'); 6 | static final _expo_rx = new RegExp(r'^[\-\+]?(\d)\.(\d+)e([\-\+]?\d+)$'); 7 | static final _leading_zeroes_rx = new RegExp(r'^(0*)[1-9]+'); 8 | 9 | double _arg; 10 | List _digits = new List(); 11 | int _exponent = 0; 12 | int _decimal = 0; 13 | bool _is_negative = false; 14 | bool _fraction_is_negative = false; 15 | bool _has_init = false; 16 | String _output = null; 17 | 18 | FloatFormatter(this._arg, var fmt_type, var options) : super(fmt_type, options) { 19 | if (_arg < 0) { 20 | this._is_negative = true; 21 | _arg = -_arg; 22 | } 23 | 24 | String arg_str = _arg.toDouble().toString(); 25 | 26 | Match m1 = _number_rx.firstMatch(arg_str); 27 | if (m1 != null) { 28 | String int_part = m1.group(1); 29 | String fraction = m1.group(2); 30 | 31 | /* 32 | * Cases: 33 | * 1.2345 = 1.2345e0 -> [12345] e+0 d1 l5 34 | * 123.45 = 1.2345e2 -> [12345] e+2 d3 l5 35 | * 0.12345 = 1.2345e-1 -> [012345] e-1 d1 l6 36 | * 0.0012345 = 1.2345e-3 -> [00012345] e-3 d1 l8 37 | */ 38 | 39 | _decimal = int_part.length; 40 | _digits.addAll(int_part.split('')); 41 | _digits.addAll(fraction.split('')); 42 | 43 | if (int_part.length == 1) { 44 | if (int_part == '0') { 45 | Match leading_zeroes_match = _leading_zeroes_rx.firstMatch(fraction); 46 | 47 | if (leading_zeroes_match != null) { 48 | int zeroes_count = leading_zeroes_match.group(1).length; 49 | // print("zeroes_count=${zeroes_count}"); 50 | _exponent = zeroes_count > 0 ? -(zeroes_count + 1) : zeroes_count - 1; 51 | } 52 | else { 53 | _exponent = 0; 54 | } 55 | } // else int_part != 0 56 | else { 57 | _exponent = 0; 58 | } 59 | } 60 | else { 61 | _exponent = int_part.length - 1; 62 | } 63 | } 64 | 65 | else { 66 | Match m2 = _expo_rx.firstMatch(arg_str); 67 | if (m2 != null) { 68 | String int_part = m2.group(1); 69 | String fraction = m2.group(2); 70 | _exponent = int.parse(m2.group(3)); 71 | 72 | if (_exponent > 0) { 73 | int diff = _exponent - fraction.length + 1; 74 | _decimal = _exponent + 1; 75 | _digits.addAll(int_part.split('')); 76 | _digits.addAll(fraction.split('')); 77 | _digits.addAll(Formatter.get_padding(diff, '0').split('')); 78 | } 79 | else { 80 | int diff = int_part.length - _exponent - 1; 81 | _decimal = int_part.length; 82 | _digits.addAll(Formatter.get_padding(diff, '0').split('')); 83 | _digits.addAll(int_part.split('')); 84 | _digits.addAll(fraction.split('')); 85 | } 86 | 87 | 88 | } // else something wrong 89 | } 90 | _has_init = true; 91 | //print("arg_str=${arg_str}"); 92 | //print("decimal=${_decimal}, exp=${_exponent}, digits=${_digits}"); 93 | } 94 | 95 | String asString() { 96 | String ret = ''; 97 | 98 | if (!_has_init) { 99 | return ret; 100 | } 101 | 102 | if (_output != null) { 103 | return _output; 104 | } 105 | 106 | if (options['add_space'] && options['sign'] == '' && _arg >= 0) { 107 | options['sign'] = ' '; 108 | } 109 | 110 | if (_arg.isInfinite) { 111 | if (_arg.isNegative) { 112 | options['sign'] = '-'; 113 | } 114 | 115 | ret = 'inf'; 116 | options['padding_char'] = ' '; 117 | } 118 | 119 | if (_arg.isNaN) { 120 | ret = 'nan'; 121 | options['padding_char'] = ' '; 122 | } 123 | 124 | if (options['precision'] == -1) { 125 | options['precision'] = 6; // TODO: make this configurable 126 | } 127 | else if (fmt_type == 'g' && options['precision'] == 0) { 128 | options['precision'] = 1; 129 | } 130 | 131 | if (_arg is num) { 132 | if (_is_negative) { 133 | options['sign'] = '-'; 134 | } 135 | 136 | if (fmt_type == 'e') { 137 | ret = asExponential(options['precision'], remove_trailing_zeros : false); 138 | } 139 | else if (fmt_type == 'f') { 140 | ret = asFixed(options['precision'], remove_trailing_zeros : false); 141 | } 142 | else { // type == g 143 | int _exp = _exponent; 144 | var sig_digs = options['precision']; 145 | // print("${_exp} ${sig_digs}"); 146 | if (-4 <= _exp && _exp < options['precision']) { 147 | sig_digs -= _decimal; 148 | num precision = max(options['precision'] - 1 - _exp, sig_digs); 149 | 150 | ret = asFixed(precision, remove_trailing_zeros : !options['alternate_form']); 151 | } 152 | else { 153 | ret = asExponential(options['precision'] - 1, remove_trailing_zeros : !options['alternate_form']); 154 | } 155 | } 156 | } 157 | 158 | var min_chars = options['width']; 159 | num str_len = ret.length + options['sign'].length; 160 | String padding = ''; 161 | 162 | if (min_chars > str_len) { 163 | if (options['padding_char'] == '0' && !options['left_align']) { 164 | padding = Formatter.get_padding(min_chars - str_len, '0'); 165 | } 166 | else { 167 | padding = Formatter.get_padding(min_chars - str_len, ' '); 168 | } 169 | } 170 | 171 | if (options['left_align']) { 172 | ret ="${options['sign']}${ret}${padding}"; 173 | } 174 | else if (options['padding_char'] == '0') { 175 | ret = "${options['sign']}${padding}${ret}"; 176 | } 177 | else { 178 | ret = "${padding}${options['sign']}${ret}"; 179 | } 180 | 181 | if (options['is_upper']) { 182 | ret = ret.toUpperCase(); 183 | } 184 | 185 | return (_output = ret); 186 | } 187 | 188 | String asFixed(int precision, {bool remove_trailing_zeros : true}) { 189 | String ret = _digits.sublist(0, _decimal).fold('', (i,e) => "${i}${e}"); 190 | int offset = _decimal; 191 | int extra_zeroes = precision - (_digits.length - offset); 192 | int rounding_offset = offset + precision ; 193 | 194 | if (extra_zeroes > 0) { 195 | _digits.addAll(Formatter.get_padding(extra_zeroes, '0').split('')); 196 | } 197 | 198 | _round(rounding_offset, offset); 199 | 200 | List trailing_digits = _digits.sublist(offset, offset + precision); 201 | if (remove_trailing_zeros) { 202 | trailing_digits = _remove_trailing_zeros(trailing_digits); 203 | } 204 | var trailing_zeroes = trailing_digits.fold('', (i,e) => "${i}${e}"); 205 | if (trailing_zeroes.length == 0) { 206 | return ret; 207 | } 208 | ret = "${ret}.${trailing_zeroes}"; 209 | 210 | return ret; 211 | } 212 | 213 | String asExponential(int precision, {bool remove_trailing_zeros : true}) { 214 | int offset = _decimal - _exponent; 215 | String ret = _digits[offset-1]; 216 | 217 | 218 | int extra_zeroes = precision - (_digits.length - offset); 219 | 220 | if (extra_zeroes > 0) { 221 | _digits.addAll(Formatter.get_padding(extra_zeroes, '0').split('')); 222 | } 223 | 224 | _round(offset + precision, offset); 225 | 226 | //print ("(${offset}, ${precision})${_digits}"); 227 | List trailing_digits = _digits.sublist(offset, offset + precision); 228 | // print ("trailing_digits=${trailing_digits}"); 229 | String _exp_str = _exponent.abs().toString(); 230 | 231 | 232 | if (_exponent < 10 && _exponent > -10) { 233 | _exp_str = "0${_exp_str}"; 234 | } 235 | 236 | _exp_str = (_exponent < 0) ? "e-${_exp_str}" : "e+${_exp_str}"; 237 | 238 | if (remove_trailing_zeros) { 239 | trailing_digits = _remove_trailing_zeros(trailing_digits); 240 | } 241 | 242 | if (trailing_digits.length > 0) { 243 | ret += '.'; 244 | } 245 | 246 | ret = trailing_digits.fold(ret, (i, e) => "${i}${e}"); 247 | ret = "${ret}${_exp_str}"; 248 | 249 | return ret; 250 | } 251 | 252 | List _remove_trailing_zeros(List trailing_digits) { 253 | int nzeroes = 0; 254 | for (int i = trailing_digits.length - 1; i >= 0; i--) { 255 | if (trailing_digits[i] == '0') { 256 | nzeroes++; 257 | } 258 | else { 259 | break; 260 | } 261 | } 262 | return trailing_digits.sublist(0, trailing_digits.length - nzeroes); 263 | } 264 | 265 | void _round(var rounding_offset, var offset) { 266 | int carry = 0; 267 | while (rounding_offset > offset && rounding_offset < _digits.length) { 268 | int d = int.parse(_digits[rounding_offset]) + carry; 269 | if (d >= 5) { 270 | int prev = int.parse(_digits[rounding_offset - 1]) + 1; 271 | carry = prev > 9 ? 1 : 0; 272 | if (carry > 0) { 273 | prev = 0; 274 | } 275 | _digits[rounding_offset - 1] = prev.toString(); 276 | if (carry == 0) { 277 | break; 278 | } 279 | } 280 | else { 281 | break; 282 | } 283 | rounding_offset--; 284 | } 285 | } 286 | 287 | } -------------------------------------------------------------------------------- /bin/lib/src/formatters/int_formatter.dart: -------------------------------------------------------------------------------- 1 | part of sprintf; 2 | 3 | class IntFormatter extends Formatter { 4 | int _arg; 5 | static const int MAX_INT = 0xffffffffffffffff; // 64bit 6 | IntFormatter(this._arg, var fmt_type, var options) : super(fmt_type, options); 7 | 8 | String asString() { 9 | String ret = ''; 10 | String prefix = ''; 11 | 12 | int radix = fmt_type == 'x' ? 16 : (fmt_type == 'o' ? 8 : 10); 13 | 14 | if (_arg < 0) { 15 | _arg = _arg.abs(); 16 | if (radix == 10) { 17 | options['sign'] = '-'; 18 | } 19 | else { 20 | _arg = (MAX_INT - (_arg % MAX_INT) + 1) & MAX_INT; 21 | } 22 | } 23 | 24 | ret = _arg.toRadixString(radix); 25 | 26 | if (options['alternate_form']) { 27 | if (radix == 16 && _arg != 0) { 28 | prefix = "0x"; 29 | } 30 | else if (radix == 8 && _arg != 0) { 31 | prefix = "0"; 32 | } 33 | if (options['sign'] == '+' && radix != 10) { 34 | options['sign'] = ''; 35 | } 36 | } 37 | 38 | // space "prefixes non-negative signed numbers with a space" 39 | if ((options['add_space'] && options['sign'] == '' && _arg > -1 && radix == 10)) { 40 | options['sign'] = ' '; 41 | } 42 | 43 | if (radix != 10) { 44 | options['sign'] = ''; 45 | } 46 | 47 | String padding = ''; 48 | var min_digits = options['precision']; 49 | var min_chars = options['width']; 50 | int num_length = ret.length; 51 | var sign_length = options['sign'].length; 52 | num str_len = 0; 53 | 54 | if (radix == 8 && min_chars <= min_digits) { 55 | num_length += prefix.length; 56 | } 57 | 58 | if (min_digits > num_length) { 59 | padding = Formatter.get_padding(min_digits - num_length, '0'); 60 | ret = "${padding}${ret}"; 61 | num_length = ret.length; 62 | padding = ''; 63 | } 64 | 65 | str_len = num_length + sign_length + prefix.length; 66 | if (min_chars > str_len) { 67 | if (options['padding_char'] == '0' && !options['left_align']) { 68 | padding = Formatter.get_padding(min_chars - str_len, '0'); 69 | } 70 | else { 71 | padding = Formatter.get_padding(min_chars - str_len, ' '); 72 | } 73 | } 74 | 75 | if (options['left_align']) { 76 | ret ="${options['sign']}${prefix}${ret}${padding}"; 77 | } 78 | else if (options['padding_char'] == '0') { 79 | ret = "${options['sign']}${prefix}${padding}${ret}"; 80 | } 81 | else { 82 | ret = "${padding}${options['sign']}${prefix}${ret}"; 83 | } 84 | 85 | if (options['is_upper']) { 86 | ret = ret.toUpperCase(); 87 | } 88 | 89 | return ret; 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /bin/lib/src/formatters/string_formatter.dart: -------------------------------------------------------------------------------- 1 | part of sprintf; 2 | 3 | class StringFormatter extends Formatter { 4 | String _arg; 5 | 6 | StringFormatter(this._arg, var fmt_type, var options) : super(fmt_type, options) { 7 | options['padding_char'] = ' '; 8 | } 9 | 10 | String asString() { 11 | String ret = _arg; 12 | 13 | if (options['precision'] > -1 && options['precision'] <= ret.length) { 14 | ret = ret.substring(0, options['precision']); 15 | } 16 | 17 | if (options['width'] > -1) { 18 | int diff = (options['width'] - ret.length); 19 | 20 | if (diff > 0) { 21 | String padding = Formatter.get_padding(diff, options['padding_char']); 22 | if (!options['left_align']) { 23 | ret = "${padding}${ret}"; 24 | } 25 | else { 26 | ret = "${ret}${padding}"; 27 | } 28 | } 29 | } 30 | return ret; 31 | } 32 | } -------------------------------------------------------------------------------- /bin/lib/src/sprintf_impl.dart: -------------------------------------------------------------------------------- 1 | part of sprintf; 2 | 3 | typedef PrintFormatFormatter(arg, options); 4 | 5 | class PrintFormat { 6 | static final RegExp specifier = new RegExp(r'%(?:(\d+)\$)?([\+\-\#0 ]*)(\d+|\*)?(?:\.(\d+|\*))?([a-z%])', caseSensitive : false); 7 | static final RegExp uppercase_rx = new RegExp(r'[A-Z]', caseSensitive: true); 8 | 9 | var _formatters = { 10 | 'i' : (arg, options) => new IntFormatter(arg, 'i', options), 11 | 'd' : (arg, options) => new IntFormatter(arg, 'd', options), 12 | 'x' : (arg, options) => new IntFormatter(arg, 'x', options), 13 | 'X' : (arg, options) => new IntFormatter(arg, 'x', options), 14 | 'o' : (arg, options) => new IntFormatter(arg, 'o', options), 15 | 'O' : (arg, options) => new IntFormatter(arg, 'o', options), 16 | 17 | 'e' : (arg, options) => new FloatFormatter(arg, 'e', options), 18 | 'E' : (arg, options) => new FloatFormatter(arg, 'e', options), 19 | 'f' : (arg, options) => new FloatFormatter(arg, 'f', options), 20 | 'F' : (arg, options) => new FloatFormatter(arg, 'f', options), 21 | 'g' : (arg, options) => new FloatFormatter(arg, 'g', options), 22 | 'G' : (arg, options) => new FloatFormatter(arg, 'g', options), 23 | 24 | 's' : (arg, options) => new StringFormatter(arg, 's', options), 25 | }; 26 | 27 | String call(String fmt, var args) { 28 | String ret = ''; 29 | 30 | 31 | int offset = 0; 32 | int arg_offset = 0; 33 | 34 | if (args is! List) { 35 | throw new ArgumentError('Expecting list as second argument'); 36 | } 37 | 38 | for (Match m in specifier.allMatches(fmt)) { 39 | String _parameter = m[1]; 40 | String _flags = m[2]; 41 | String _width = m[3]; 42 | String _precision = m[4]; 43 | String _type = m[5]; 44 | 45 | String _arg_str = ''; 46 | Map _options = { 47 | 'is_upper' : false, 48 | 'width' : -1, 49 | 'precision' : -1, 50 | 'length' : -1, 51 | 'radix' : 10, 52 | 'sign' : '', 53 | 'specifier_type' : _type, 54 | }; 55 | 56 | _parse_flags(_flags).forEach((var K, var V) { _options[K] = V; }); 57 | 58 | // The argument we want to deal with 59 | var _arg = _parameter == null ? null : args[int.parse(_parameter)]; 60 | 61 | // parse width 62 | if (_width != null) { 63 | _options['width'] = (_width == '*' ? args[arg_offset++] : int.parse(_width)); 64 | } 65 | 66 | // parse precision 67 | if (_precision != null) { 68 | _options['precision'] = (_precision == '*' ? args[arg_offset++] : int.parse(_precision)); 69 | } 70 | 71 | // grab the argument we'll be dealing with 72 | if (_arg == null && _type != '%') { 73 | _arg = args[arg_offset++]; 74 | } 75 | 76 | _options['is_upper'] = uppercase_rx.hasMatch(_type); 77 | 78 | if (_type == '%') { 79 | if (_flags.length > 0 || _width != null || _precision != null) { 80 | throw new Exception('"%" does not take any flags'); 81 | } 82 | _arg_str = '%'; 83 | } 84 | else if (this._formatters.containsKey(_type)) { 85 | _arg_str = _formatters[_type](_arg, _options).asString(); 86 | } 87 | else { 88 | throw new ArgumentError("Unknown format type ${_type}"); 89 | } 90 | 91 | // Add the pre-format string to the return 92 | ret += fmt.substring(offset, m.start); 93 | offset = m.end; 94 | 95 | ret += _arg_str; 96 | } 97 | 98 | return ret += fmt.substring(offset); 99 | } 100 | 101 | register_specifier(String specifier, PrintFormatFormatter formatter) { 102 | this._formatters[specifier] = formatter; 103 | } 104 | 105 | unregistier_specifier(String specifier) { 106 | this._formatters.remove(specifier); 107 | } 108 | 109 | Map _parse_flags(String flags) { 110 | return { 111 | 'sign' : flags.indexOf('+') > -1 ? '+' : '', 112 | 'padding_char' : flags.indexOf('0') > -1 ? '0' : ' ', 113 | 'add_space' : flags.indexOf(' ') > -1, 114 | 'left_align' : flags.indexOf('-') > -1, 115 | 'alternate_form' : flags.indexOf('#') > -1, 116 | }; 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /docs/About.rst: -------------------------------------------------------------------------------- 1 | ===== 2 | About 3 | ===== 4 | Development Team 5 | ================ 6 | 7 | This project was started by `Rahul De' `_, Apoorv Agarwal and Akash Giri in the spring of 2014. 8 | 9 | Everyone who has contributed towards this project are: 10 | 11 | 1. `Rahul De' `_ 12 | 2. `Apoorv Agarwal `_ 13 | 3. `Akash Giri `_ 14 | 4. Pratik Shah 15 | 5. `Mayuresh Waykole `_ 16 | 6. `Aditi Mahajan `_ 17 | -------------------------------------------------------------------------------- /docs/DevDocs.rst: -------------------------------------------------------------------------------- 1 | ================= 2 | Developers Corner 3 | ================= 4 | 5 | We'd love to have your help in making Medusa better and Python faster. Any and all contributions are welcome. Frankly speaking there's still a hell lot to do. 6 | 7 | How Medusa works 8 | ================ 9 | 10 | Python is one of the most widely used scripting languages and has immense deployment 11 | and brought with it the joy of flexibility and simpler prototyping.One place where it falls short is development of very large scale software implementations primarily because the implementation is not fast enough. 12 | | 13 | What Medusa intends to do is run the same python code you wrote a lot faster. 14 | 15 | The Concept 16 | ----------- 17 | Medusa follows a six step procedure: 18 | 1. Breaks the python source file into tokens 19 | 2. Parse these tokens into an Abstract Syntax Tree while checking for errors 20 | 3. Walk the tree and emit the equivalent Dart code at each node while optimizing it 21 | 4. Cache the code in persistent SQLite3 Database 22 | 5. Invoke the Dart virtual machine with Dart code 23 | 6. Cache the generated machine code and provide output 24 | 25 | .. image:: /_static/image1.png 26 | 27 | Development Workflow 28 | ==================== 29 | Introduction 30 | ------------ 31 | Medusa encourages everyone to join and implement new features, fix some bugs, 32 | review pull requests and suggest ideas, take part in general discussions etc. 33 | 34 | Creating the environment 35 | ------------------------ 36 | Before you start contributing, you will have to follow the steps below to make 37 | sure that there are no hiccups when you are working. 38 | 39 | Install git 40 | ^^^^^^^^^^^ 41 | Installing git on linux-like systems can be done using the native package management systems. 42 | :: 43 | $ sudo apt-get install git 44 | 45 | or. 46 | :: 47 | $ yum install git 48 | 49 | Windows users may download the installer from 50 | :: 51 | http://python.org/download/ 52 | 53 | Then do not forget to add Python to the $PATH environment. 54 | 55 | On Windows and Mac OS X, the easiest way to get git is to download GitHub’s 56 | software, which will install git, and also provide a nice GUI (this tutorial 57 | will be based on the command line interface). Note, you may need to go into the 58 | GitHub preferences and choose the “Install Command Line Tools” option to get git 59 | installed into the terminal. 60 | If you do decide to use the GitHub GUI, you should make sure that any 61 | “sync does rebase” option is disabled in the settings. 62 | 63 | Cloning Medusa 64 | ^^^^^^^^^^^^^^ 65 | Clone medusa's repository on your machine to browse and work on the code locally. 66 | :: 67 | $ git clone https://github.com/rahul080327/medusa 68 | $ cd medusa 69 | 70 | How to submit a patch 71 | ^^^^^^^^^^^^^^^^^^^^^ 72 | Currently we follow a very simple system. 73 | 1. Fork this `repo `_ 74 | 2. Clone it to your machine 75 | 3. Make the changes locally 76 | 4. Rebase the local repository with upstream 77 | 5. Commit changes with valid verbose comments 78 | 6. Push to your repository 79 | 7. Compare and send a pull request 80 | -------------------------------------------------------------------------------- /docs/Intro.rst: -------------------------------------------------------------------------------- 1 | Introduction 2 | ============ 3 | 4 | Medusa 5 | 6 | Medusa in a glance 7 | ------------------- 8 | In 2011 google released `Dart `_ and with it came the Dart VM. 9 | The power of Medusa lies in running the python code on the DartVM . Python runs about 1000% 10 | faster on Medusa as compared to cpython. 11 | -------------------------------------------------------------------------------- /docs/License.rst: -------------------------------------------------------------------------------- 1 | License 2 | ======== 3 | 4 | The BSD 3-Clause License 5 | 6 | Copyright (c) 2013-2014, Rahul De, Apoorv Agarwal and Aakash Giri. VIT University All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 9 | 10 | Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 11 | 12 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 13 | 14 | Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 17 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | PAPER = 8 | BUILDDIR = _build 9 | 10 | # User-friendly check for sphinx-build 11 | ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) 12 | $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) 13 | endif 14 | 15 | # Internal variables. 16 | PAPEROPT_a4 = -D latex_paper_size=a4 17 | PAPEROPT_letter = -D latex_paper_size=letter 18 | ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 19 | # the i18n builder cannot share the environment and doctrees with the others 20 | I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 21 | 22 | .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext 23 | 24 | help: 25 | @echo "Please use \`make ' where is one of" 26 | @echo " html to make standalone HTML files" 27 | @echo " dirhtml to make HTML files named index.html in directories" 28 | @echo " singlehtml to make a single large HTML file" 29 | @echo " pickle to make pickle files" 30 | @echo " json to make JSON files" 31 | @echo " htmlhelp to make HTML files and a HTML help project" 32 | @echo " qthelp to make HTML files and a qthelp project" 33 | @echo " devhelp to make HTML files and a Devhelp project" 34 | @echo " epub to make an epub" 35 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" 36 | @echo " latexpdf to make LaTeX files and run them through pdflatex" 37 | @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" 38 | @echo " text to make text files" 39 | @echo " man to make manual pages" 40 | @echo " texinfo to make Texinfo files" 41 | @echo " info to make Texinfo files and run them through makeinfo" 42 | @echo " gettext to make PO message catalogs" 43 | @echo " changes to make an overview of all changed/added/deprecated items" 44 | @echo " xml to make Docutils-native XML files" 45 | @echo " pseudoxml to make pseudoxml-XML files for display purposes" 46 | @echo " linkcheck to check all external links for integrity" 47 | @echo " doctest to run all doctests embedded in the documentation (if enabled)" 48 | 49 | clean: 50 | rm -rf $(BUILDDIR)/* 51 | 52 | html: 53 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 54 | @echo 55 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." 56 | 57 | dirhtml: 58 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml 59 | @echo 60 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." 61 | 62 | singlehtml: 63 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml 64 | @echo 65 | @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." 66 | 67 | pickle: 68 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle 69 | @echo 70 | @echo "Build finished; now you can process the pickle files." 71 | 72 | json: 73 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json 74 | @echo 75 | @echo "Build finished; now you can process the JSON files." 76 | 77 | htmlhelp: 78 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp 79 | @echo 80 | @echo "Build finished; now you can run HTML Help Workshop with the" \ 81 | ".hhp project file in $(BUILDDIR)/htmlhelp." 82 | 83 | qthelp: 84 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp 85 | @echo 86 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \ 87 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:" 88 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/medusa.qhcp" 89 | @echo "To view the help file:" 90 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/medusa.qhc" 91 | 92 | devhelp: 93 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp 94 | @echo 95 | @echo "Build finished." 96 | @echo "To view the help file:" 97 | @echo "# mkdir -p $$HOME/.local/share/devhelp/medusa" 98 | @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/medusa" 99 | @echo "# devhelp" 100 | 101 | epub: 102 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub 103 | @echo 104 | @echo "Build finished. The epub file is in $(BUILDDIR)/epub." 105 | 106 | latex: 107 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 108 | @echo 109 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." 110 | @echo "Run \`make' in that directory to run these through (pdf)latex" \ 111 | "(use \`make latexpdf' here to do that automatically)." 112 | 113 | latexpdf: 114 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 115 | @echo "Running LaTeX files through pdflatex..." 116 | $(MAKE) -C $(BUILDDIR)/latex all-pdf 117 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 118 | 119 | latexpdfja: 120 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 121 | @echo "Running LaTeX files through platex and dvipdfmx..." 122 | $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja 123 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 124 | 125 | text: 126 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text 127 | @echo 128 | @echo "Build finished. The text files are in $(BUILDDIR)/text." 129 | 130 | man: 131 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man 132 | @echo 133 | @echo "Build finished. The manual pages are in $(BUILDDIR)/man." 134 | 135 | texinfo: 136 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 137 | @echo 138 | @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." 139 | @echo "Run \`make' in that directory to run these through makeinfo" \ 140 | "(use \`make info' here to do that automatically)." 141 | 142 | info: 143 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 144 | @echo "Running Texinfo files through makeinfo..." 145 | make -C $(BUILDDIR)/texinfo info 146 | @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." 147 | 148 | gettext: 149 | $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale 150 | @echo 151 | @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." 152 | 153 | changes: 154 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes 155 | @echo 156 | @echo "The overview file is in $(BUILDDIR)/changes." 157 | 158 | linkcheck: 159 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck 160 | @echo 161 | @echo "Link check complete; look for any errors in the above output " \ 162 | "or in $(BUILDDIR)/linkcheck/output.txt." 163 | 164 | doctest: 165 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest 166 | @echo "Testing of doctests in the sources finished, look at the " \ 167 | "results in $(BUILDDIR)/doctest/output.txt." 168 | 169 | xml: 170 | $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml 171 | @echo 172 | @echo "Build finished. The XML files are in $(BUILDDIR)/xml." 173 | 174 | pseudoxml: 175 | $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml 176 | @echo 177 | @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." 178 | -------------------------------------------------------------------------------- /docs/_build/doctrees/About.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lispyclouds/medusa/cf069800eb607fe25d4dafa5332cceda5a7c7c8b/docs/_build/doctrees/About.doctree -------------------------------------------------------------------------------- /docs/_build/doctrees/DevDocs.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lispyclouds/medusa/cf069800eb607fe25d4dafa5332cceda5a7c7c8b/docs/_build/doctrees/DevDocs.doctree -------------------------------------------------------------------------------- /docs/_build/doctrees/DevWorkflow.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lispyclouds/medusa/cf069800eb607fe25d4dafa5332cceda5a7c7c8b/docs/_build/doctrees/DevWorkflow.doctree -------------------------------------------------------------------------------- /docs/_build/doctrees/Intro.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lispyclouds/medusa/cf069800eb607fe25d4dafa5332cceda5a7c7c8b/docs/_build/doctrees/Intro.doctree -------------------------------------------------------------------------------- /docs/_build/doctrees/License.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lispyclouds/medusa/cf069800eb607fe25d4dafa5332cceda5a7c7c8b/docs/_build/doctrees/License.doctree -------------------------------------------------------------------------------- /docs/_build/doctrees/MedDevTeam.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lispyclouds/medusa/cf069800eb607fe25d4dafa5332cceda5a7c7c8b/docs/_build/doctrees/MedDevTeam.doctree -------------------------------------------------------------------------------- /docs/_build/doctrees/environment.pickle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lispyclouds/medusa/cf069800eb607fe25d4dafa5332cceda5a7c7c8b/docs/_build/doctrees/environment.pickle -------------------------------------------------------------------------------- /docs/_build/doctrees/index.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lispyclouds/medusa/cf069800eb607fe25d4dafa5332cceda5a7c7c8b/docs/_build/doctrees/index.doctree -------------------------------------------------------------------------------- /docs/_build/doctrees/indro.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lispyclouds/medusa/cf069800eb607fe25d4dafa5332cceda5a7c7c8b/docs/_build/doctrees/indro.doctree -------------------------------------------------------------------------------- /docs/_build/doctrees/installation.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lispyclouds/medusa/cf069800eb607fe25d4dafa5332cceda5a7c7c8b/docs/_build/doctrees/installation.doctree -------------------------------------------------------------------------------- /docs/_build/doctrees/workflow.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lispyclouds/medusa/cf069800eb607fe25d4dafa5332cceda5a7c7c8b/docs/_build/doctrees/workflow.doctree -------------------------------------------------------------------------------- /docs/_build/html/.buildinfo: -------------------------------------------------------------------------------- 1 | # Sphinx build info version 1 2 | # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. 3 | config: f9afcf3f2136cbaa3d91781f8e1c236b 4 | tags: 645f666f9bcd5a90fca523b33c5a78b7 5 | -------------------------------------------------------------------------------- /docs/_build/html/About.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | About — medusa 2.7.3 documentation 10 | 11 | 12 | 13 | 14 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 47 | 48 |
49 |
50 |
51 |
52 | 53 |
54 |

About

55 |
56 |

Development Team

57 |

This project was started by Rahul De’, Apoorv Agarwal and Akash Giri in the spring of 2014.

58 |

Everyone who has contributed towards this project are:

59 |
    60 |
  1. Rahul De'
  2. 61 |
  3. Apoorv Agarwal
  4. 62 |
  5. Akash Giri
  6. 63 |
  7. Pratik Shah
  8. 64 |
  9. Mayuresh Waykole
  10. 65 |
  11. Aditi Mahajan
  12. 66 |
67 |
68 |
69 | 70 | 71 |
72 |
73 |
74 |
75 |
76 |

Table Of Contents

77 | 83 | 84 |

Previous topic

85 |

Developers Corner

87 |

Next topic

88 |

License

90 |

This Page

91 | 95 | 107 | 108 |
109 |
110 |
111 |
112 | 127 | 131 | 132 | -------------------------------------------------------------------------------- /docs/_build/html/DevDocs.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Developers Corner — medusa 2.7.3 documentation 10 | 11 | 12 | 13 | 14 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 47 | 48 |
49 |
50 |
51 |
52 | 53 |
54 |

Developers Corner

55 |

We’d love to have your help in making Medusa better and Python faster. Any and all contributions are welcome. Frankly speaking there’s still a hell lot to do.

56 |
57 |

How Medusa works

58 |

Python is one of the most widely used scripting languages and has immense deployment 59 | and brought with it the joy of flexibility and simpler prototyping.One place where it falls short is development of very large scale software implementations primarily because the implementation is not fast enough. 60 | | 61 | What Medusa intends to do is run the same python code you wrote a lot faster.

62 |
63 |

The Concept

64 |
65 |
Medusa follows a six step procedure:
66 |
    67 |
  1. Breaks the python source file into tokens
  2. 68 |
  3. Parse these tokens into an Abstract Syntax Tree while checking for errors
  4. 69 |
  5. Walk the tree and emit the equivalent Dart code at each node while optimizing it
  6. 70 |
  7. Cache the code in persistent SQLite3 Database
  8. 71 |
  9. Invoke the Dart virtual machine with Dart code
  10. 72 |
  11. Cache the generated machine code and provide output
  12. 73 |
74 |
75 |
76 | _images/image1.png 77 |
78 |
79 |
80 |

Development Workflow

81 |
82 |

Introduction

83 |

Medusa encourages everyone to join and implement new features, fix some bugs, 84 | review pull requests and suggest ideas, take part in general discussions etc.

85 |
86 |
87 |

Creating the environment

88 |

Before you start contributing, you will have to follow the steps below to make 89 | sure that there are no hiccups when you are working.

90 |
91 |

Install git

92 |

Installing git on linux-like systems can be done using the native package management systems.

93 |
$ sudo apt-get install git
 94 | 
95 |
96 |

or.

97 |
$ yum install git
 98 | 
99 |
100 |

Windows users may download the installer from

101 |
http://python.org/download/
102 | 
103 |
104 |

Then do not forget to add Python to the $PATH environment.

105 |

On Windows and Mac OS X, the easiest way to get git is to download GitHub’s 106 | software, which will install git, and also provide a nice GUI (this tutorial 107 | will be based on the command line interface). Note, you may need to go into the 108 | GitHub preferences and choose the “Install Command Line Tools” option to get git 109 | installed into the terminal. 110 | If you do decide to use the GitHub GUI, you should make sure that any 111 | “sync does rebase” option is disabled in the settings.

112 |
113 |
114 |

Cloning Medusa

115 |

Clone medusa’s repository on your machine to browse and work on the code locally.

116 |
$ git clone https://github.com/rahul080327/medusa
117 | $ cd medusa
118 | 
119 |
120 |
121 |
122 |

How to submit a patch

123 |
124 |
Currently we follow a very simple system.
125 |
    126 |
  1. Fork this repo
  2. 127 |
  3. Clone it to your machine
  4. 128 |
  5. Make the changes locally
  6. 129 |
  7. Rebase the local repository with upstream
  8. 130 |
  9. Commit changes with valid verbose comments
  10. 131 |
  11. Push to your repository
  12. 132 |
  13. Compare and send a pull request
  14. 133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 | 141 | 142 |
143 |
144 |
145 |
146 |
147 |

Table Of Contents

148 | 167 | 168 |

Previous topic

169 |

Installation

171 |

Next topic

172 |

About

174 |

This Page

175 | 179 | 191 | 192 |
193 |
194 |
195 |
196 | 211 | 215 | 216 | -------------------------------------------------------------------------------- /docs/_build/html/DevWorkflow.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Development Workflow — medusa 0.01 documentation 10 | 11 | 12 | 13 | 14 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 39 | 40 |
41 |
42 |
43 |
44 | 45 |
46 |

Development Workflow

47 |
48 |
    49 |
  • Creating the environment
  • 50 |
  • Workflow process
  • 51 |
  • How to submit a patch
  • 52 |
  • Coding Conventions
  • 53 |
54 |
55 |
56 | 57 | 58 |
59 |
60 |
61 |
62 |
63 |

This Page

64 | 68 | 80 | 81 |
82 |
83 |
84 |
85 | 94 | 98 | 99 | -------------------------------------------------------------------------------- /docs/_build/html/Intro.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Introduction — medusa 2.7.3 documentation 10 | 11 | 12 | 13 | 14 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 47 | 48 |
49 |
50 |
51 |
52 | 53 |
54 |

Introduction

55 |

Medusa

56 |
57 |

Medusa in a glance

58 |

In 2011 google released Dart and with it came the Dart VM. 59 | The power of Medusa lies in running the python code on the DartVM . Python runs about 1000% 60 | faster on Medusa as compared to cpython.

61 |
62 |
63 | 64 | 65 |
66 |
67 |
68 |
69 |
70 |

Table Of Contents

71 | 77 | 78 |

Previous topic

79 |

Welcome to medusa’s documentation!

81 |

Next topic

82 |

Installation

84 |

This Page

85 | 89 | 101 | 102 |
103 |
104 |
105 |
106 | 121 | 125 | 126 | -------------------------------------------------------------------------------- /docs/_build/html/License.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | License — medusa 2.7.3 documentation 10 | 11 | 12 | 13 | 14 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 39 | 40 |
41 |
42 |
43 |
44 | 45 |
46 |

License

47 |

The BSD 3-Clause License

48 |

Copyright (c) 2013-2014, Rahul De, Apoorv Agarwal and Aakash Giri. VIT University All rights reserved.

49 |

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

50 |

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

51 |

Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

52 |

Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

53 |

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

54 |
55 | 56 | 57 |
58 |
59 |
60 |
61 |
62 |

This Page

63 | 67 | 79 | 80 |
81 |
82 |
83 |
84 | 93 | 97 | 98 | -------------------------------------------------------------------------------- /docs/_build/html/MedDevTeam.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Medusa Development Team — medusa 0.01 documentation 10 | 11 | 12 | 13 | 14 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 39 | 40 |
41 |
42 |
43 |
44 | 45 |
46 |

Medusa Development Team

47 |

This project was started by Rahul De’ in the spring of 2014.

48 |

Rahul De’ is an alumni of VIT University and currently working in Hyderabad,India.

49 |
50 | 51 | 52 |
53 |
54 |
55 |
56 |
57 |

This Page

58 | 62 | 74 | 75 |
76 |
77 |
78 |
79 | 88 | 92 | 93 | -------------------------------------------------------------------------------- /docs/_build/html/_images/image1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lispyclouds/medusa/cf069800eb607fe25d4dafa5332cceda5a7c7c8b/docs/_build/html/_images/image1.png -------------------------------------------------------------------------------- /docs/_build/html/_sources/About.txt: -------------------------------------------------------------------------------- 1 | ===== 2 | About 3 | ===== 4 | Development Team 5 | ================ 6 | 7 | This project was started by `Rahul De' `_, Apoorv Agarwal and Akash Giri in the spring of 2014. 8 | 9 | Everyone who has contributed towards this project are: 10 | 11 | 1. `Rahul De' `_ 12 | 2. `Apoorv Agarwal `_ 13 | 3. `Akash Giri `_ 14 | 4. Pratik Shah 15 | 5. `Mayuresh Waykole `_ 16 | 6. `Aditi Mahajan `_ 17 | -------------------------------------------------------------------------------- /docs/_build/html/_sources/DevDocs.txt: -------------------------------------------------------------------------------- 1 | ================= 2 | Developers Corner 3 | ================= 4 | 5 | We'd love to have your help in making Medusa better and Python faster. Any and all contributions are welcome. Frankly speaking there's still a hell lot to do. 6 | 7 | How Medusa works 8 | ================ 9 | 10 | Python is one of the most widely used scripting languages and has immense deployment 11 | and brought with it the joy of flexibility and simpler prototyping.One place where it falls short is development of very large scale software implementations primarily because the implementation is not fast enough. 12 | | 13 | What Medusa intends to do is run the same python code you wrote a lot faster. 14 | 15 | The Concept 16 | ----------- 17 | Medusa follows a six step procedure: 18 | 1. Breaks the python source file into tokens 19 | 2. Parse these tokens into an Abstract Syntax Tree while checking for errors 20 | 3. Walk the tree and emit the equivalent Dart code at each node while optimizing it 21 | 4. Cache the code in persistent SQLite3 Database 22 | 5. Invoke the Dart virtual machine with Dart code 23 | 6. Cache the generated machine code and provide output 24 | 25 | .. image:: /_static/image1.png 26 | 27 | Development Workflow 28 | ==================== 29 | Introduction 30 | ------------ 31 | Medusa encourages everyone to join and implement new features, fix some bugs, 32 | review pull requests and suggest ideas, take part in general discussions etc. 33 | 34 | Creating the environment 35 | ------------------------ 36 | Before you start contributing, you will have to follow the steps below to make 37 | sure that there are no hiccups when you are working. 38 | 39 | Install git 40 | ^^^^^^^^^^^ 41 | Installing git on linux-like systems can be done using the native package management systems. 42 | :: 43 | $ sudo apt-get install git 44 | 45 | or. 46 | :: 47 | $ yum install git 48 | 49 | Windows users may download the installer from 50 | :: 51 | http://python.org/download/ 52 | 53 | Then do not forget to add Python to the $PATH environment. 54 | 55 | On Windows and Mac OS X, the easiest way to get git is to download GitHub’s 56 | software, which will install git, and also provide a nice GUI (this tutorial 57 | will be based on the command line interface). Note, you may need to go into the 58 | GitHub preferences and choose the “Install Command Line Tools” option to get git 59 | installed into the terminal. 60 | If you do decide to use the GitHub GUI, you should make sure that any 61 | “sync does rebase” option is disabled in the settings. 62 | 63 | Cloning Medusa 64 | ^^^^^^^^^^^^^^ 65 | Clone medusa's repository on your machine to browse and work on the code locally. 66 | :: 67 | $ git clone https://github.com/rahul080327/medusa 68 | $ cd medusa 69 | 70 | How to submit a patch 71 | ^^^^^^^^^^^^^^^^^^^^^ 72 | Currently we follow a very simple system. 73 | 1. Fork this `repo `_ 74 | 2. Clone it to your machine 75 | 3. Make the changes locally 76 | 4. Rebase the local repository with upstream 77 | 5. Commit changes with valid verbose comments 78 | 6. Push to your repository 79 | 7. Compare and send a pull request 80 | -------------------------------------------------------------------------------- /docs/_build/html/_sources/DevWorkflow.txt: -------------------------------------------------------------------------------- 1 | Development Workflow 2 | ===================== 3 | * :ref:`Creating the environment` 4 | * :ref:`Workflow process` 5 | * :ref:`How to submit a patch` 6 | * :ref:`Coding Conventions` 7 | -------------------------------------------------------------------------------- /docs/_build/html/_sources/Intro.txt: -------------------------------------------------------------------------------- 1 | Introduction 2 | ============ 3 | 4 | Medusa 5 | 6 | Medusa in a glance 7 | ------------------- 8 | In 2011 google released `Dart `_ and with it came the Dart VM. 9 | The power of Medusa lies in running the python code on the DartVM . Python runs about 1000% 10 | faster on Medusa as compared to cpython. 11 | -------------------------------------------------------------------------------- /docs/_build/html/_sources/License.txt: -------------------------------------------------------------------------------- 1 | License 2 | ======== 3 | 4 | The BSD 3-Clause License 5 | 6 | Copyright (c) 2013-2014, Rahul De, Apoorv Agarwal and Aakash Giri. VIT University All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 9 | 10 | Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 11 | 12 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 13 | 14 | Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 17 | -------------------------------------------------------------------------------- /docs/_build/html/_sources/MedDevTeam.txt: -------------------------------------------------------------------------------- 1 | Medusa Development Team 2 | ======================= 3 | 4 | This project was started by Rahul De' in the spring of 2014. 5 | 6 | Rahul De' is an alumni of VIT University and currently working in Hyderabad,India. 7 | -------------------------------------------------------------------------------- /docs/_build/html/_sources/index.txt: -------------------------------------------------------------------------------- 1 | .. medusa documentation master file, created by 2 | sphinx-quickstart on Mon Sep 1 22:57:23 2014. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to medusa's documentation! 7 | ================================== 8 | 9 | Contents: 10 | 11 | .. toctree:: 12 | :maxdepth: 2 13 | 14 | Intro.rst 15 | installation.rst 16 | DevDocs.rst 17 | About.rst 18 | License.rst 19 | 20 | 21 | 22 | Indices and tables 23 | ================== 24 | 25 | * :ref:`genindex` 26 | * :ref:`modindex` 27 | * :ref:`search` 28 | -------------------------------------------------------------------------------- /docs/_build/html/_sources/indro.txt: -------------------------------------------------------------------------------- 1 | Introduction 2 | ==== 3 | 4 | Medusa 5 | 6 | What is medusa ? 7 | ----------------- 8 | In 2011 google released `https://www.Dartlang.org` and with it came the Dart VM. 9 | The power of medusa lies in running the python code on the DartVM . Python runs about 1000% 10 | faster on medusa as compared to cpython. 11 | -------------------------------------------------------------------------------- /docs/_build/html/_sources/installation.txt: -------------------------------------------------------------------------------- 1 | ============= 2 | Installation 3 | ============= 4 | 5 | Medusa is currently supported only on debian. Windows and Mac builds will soon be available 6 | 7 | Debian Users 8 | ============ 9 | 10 | Simply run ./INSTALL after cloning this `repo `_ on your Debian 11 | based Linux distro. 12 | Thats it. All dependencies are installed, code compiled and paths setup automatically. 13 | 14 | Mac OSX Users (building from source) 15 | ==================================== 16 | 17 | * Install XCode if not installed (Sorry for the bandwidth hogging...) 18 | * Install python 2.7.x if not installed and add it to PATH 19 | * Download and Install latest Qt5 for Mac from `here `_ and add qmake and moc to PATH 20 | * Download the latest Dart SDK from `here `_, unzip and add the dart executable to PATH 21 | * Clone this repo and simply run ./INSTALL.mac 22 | * After a successful compile medusavm binary is available in /usr/bin/ for use 23 | * For updates and subsequent builds, fetch changes and just run ./INSTALL.mac 24 | 25 | Others 26 | ====== 27 | * Install C++ compilers and Make tools 28 | * Install Qt5 build tools and libs 29 | * Install Dart SDK 30 | * Install Python 2.7.x 31 | * Rum moc on inc/transform.h to inc/transform_moc.h 32 | * Run qmake on medusa.pro 33 | * Run make 34 | * Use the medusavm executable 35 | 36 | Using Medusa 37 | ============ 38 | * Medusa is available as medusavm after a successful buid and install 39 | * Python programs can be run by passing them as parameters: medusavm hello.py 40 | * Medusa can be stopped after the Dart compile phase by passing a -c switch: medusavm -c hello.py. The Dart code is obtained in hello.dart in the same directory. 41 | * Python files can be globally installed into Medusa for imports by other files: medusavm -install python_file 42 | * Help is at: medusavm --help 43 | -------------------------------------------------------------------------------- /docs/_build/html/_sources/workflow.txt: -------------------------------------------------------------------------------- 1 | ======================== 2 | Development Introduction 3 | ======================== 4 | -------------------------------------------------------------------------------- /docs/_build/html/_static/ajax-loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lispyclouds/medusa/cf069800eb607fe25d4dafa5332cceda5a7c7c8b/docs/_build/html/_static/ajax-loader.gif -------------------------------------------------------------------------------- /docs/_build/html/_static/basic.css: -------------------------------------------------------------------------------- 1 | /* 2 | * basic.css 3 | * ~~~~~~~~~ 4 | * 5 | * Sphinx stylesheet -- basic theme. 6 | * 7 | * :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS. 8 | * :license: BSD, see LICENSE for details. 9 | * 10 | */ 11 | 12 | /* -- main layout ----------------------------------------------------------- */ 13 | 14 | div.clearer { 15 | clear: both; 16 | } 17 | 18 | /* -- relbar ---------------------------------------------------------------- */ 19 | 20 | div.related { 21 | width: 100%; 22 | font-size: 90%; 23 | } 24 | 25 | div.related h3 { 26 | display: none; 27 | } 28 | 29 | div.related ul { 30 | margin: 0; 31 | padding: 0 0 0 10px; 32 | list-style: none; 33 | } 34 | 35 | div.related li { 36 | display: inline; 37 | } 38 | 39 | div.related li.right { 40 | float: right; 41 | margin-right: 5px; 42 | } 43 | 44 | /* -- sidebar --------------------------------------------------------------- */ 45 | 46 | div.sphinxsidebarwrapper { 47 | padding: 10px 5px 0 10px; 48 | } 49 | 50 | div.sphinxsidebar { 51 | float: left; 52 | width: 230px; 53 | margin-left: -100%; 54 | font-size: 90%; 55 | } 56 | 57 | div.sphinxsidebar ul { 58 | list-style: none; 59 | } 60 | 61 | div.sphinxsidebar ul ul, 62 | div.sphinxsidebar ul.want-points { 63 | margin-left: 20px; 64 | list-style: square; 65 | } 66 | 67 | div.sphinxsidebar ul ul { 68 | margin-top: 0; 69 | margin-bottom: 0; 70 | } 71 | 72 | div.sphinxsidebar form { 73 | margin-top: 10px; 74 | } 75 | 76 | div.sphinxsidebar input { 77 | border: 1px solid #98dbcc; 78 | font-family: sans-serif; 79 | font-size: 1em; 80 | } 81 | 82 | div.sphinxsidebar #searchbox input[type="text"] { 83 | width: 170px; 84 | } 85 | 86 | div.sphinxsidebar #searchbox input[type="submit"] { 87 | width: 30px; 88 | } 89 | 90 | img { 91 | border: 0; 92 | max-width: 100%; 93 | } 94 | 95 | /* -- search page ----------------------------------------------------------- */ 96 | 97 | ul.search { 98 | margin: 10px 0 0 20px; 99 | padding: 0; 100 | } 101 | 102 | ul.search li { 103 | padding: 5px 0 5px 20px; 104 | background-image: url(file.png); 105 | background-repeat: no-repeat; 106 | background-position: 0 7px; 107 | } 108 | 109 | ul.search li a { 110 | font-weight: bold; 111 | } 112 | 113 | ul.search li div.context { 114 | color: #888; 115 | margin: 2px 0 0 30px; 116 | text-align: left; 117 | } 118 | 119 | ul.keywordmatches li.goodmatch a { 120 | font-weight: bold; 121 | } 122 | 123 | /* -- index page ------------------------------------------------------------ */ 124 | 125 | table.contentstable { 126 | width: 90%; 127 | } 128 | 129 | table.contentstable p.biglink { 130 | line-height: 150%; 131 | } 132 | 133 | a.biglink { 134 | font-size: 1.3em; 135 | } 136 | 137 | span.linkdescr { 138 | font-style: italic; 139 | padding-top: 5px; 140 | font-size: 90%; 141 | } 142 | 143 | /* -- general index --------------------------------------------------------- */ 144 | 145 | table.indextable { 146 | width: 100%; 147 | } 148 | 149 | table.indextable td { 150 | text-align: left; 151 | vertical-align: top; 152 | } 153 | 154 | table.indextable dl, table.indextable dd { 155 | margin-top: 0; 156 | margin-bottom: 0; 157 | } 158 | 159 | table.indextable tr.pcap { 160 | height: 10px; 161 | } 162 | 163 | table.indextable tr.cap { 164 | margin-top: 10px; 165 | background-color: #f2f2f2; 166 | } 167 | 168 | img.toggler { 169 | margin-right: 3px; 170 | margin-top: 3px; 171 | cursor: pointer; 172 | } 173 | 174 | div.modindex-jumpbox { 175 | border-top: 1px solid #ddd; 176 | border-bottom: 1px solid #ddd; 177 | margin: 1em 0 1em 0; 178 | padding: 0.4em; 179 | } 180 | 181 | div.genindex-jumpbox { 182 | border-top: 1px solid #ddd; 183 | border-bottom: 1px solid #ddd; 184 | margin: 1em 0 1em 0; 185 | padding: 0.4em; 186 | } 187 | 188 | /* -- general body styles --------------------------------------------------- */ 189 | 190 | a.headerlink { 191 | visibility: hidden; 192 | } 193 | 194 | h1:hover > a.headerlink, 195 | h2:hover > a.headerlink, 196 | h3:hover > a.headerlink, 197 | h4:hover > a.headerlink, 198 | h5:hover > a.headerlink, 199 | h6:hover > a.headerlink, 200 | dt:hover > a.headerlink { 201 | visibility: visible; 202 | } 203 | 204 | div.body p.caption { 205 | text-align: inherit; 206 | } 207 | 208 | div.body td { 209 | text-align: left; 210 | } 211 | 212 | .field-list ul { 213 | padding-left: 1em; 214 | } 215 | 216 | .first { 217 | margin-top: 0 !important; 218 | } 219 | 220 | p.rubric { 221 | margin-top: 30px; 222 | font-weight: bold; 223 | } 224 | 225 | img.align-left, .figure.align-left, object.align-left { 226 | clear: left; 227 | float: left; 228 | margin-right: 1em; 229 | } 230 | 231 | img.align-right, .figure.align-right, object.align-right { 232 | clear: right; 233 | float: right; 234 | margin-left: 1em; 235 | } 236 | 237 | img.align-center, .figure.align-center, object.align-center { 238 | display: block; 239 | margin-left: auto; 240 | margin-right: auto; 241 | } 242 | 243 | .align-left { 244 | text-align: left; 245 | } 246 | 247 | .align-center { 248 | text-align: center; 249 | } 250 | 251 | .align-right { 252 | text-align: right; 253 | } 254 | 255 | /* -- sidebars -------------------------------------------------------------- */ 256 | 257 | div.sidebar { 258 | margin: 0 0 0.5em 1em; 259 | border: 1px solid #ddb; 260 | padding: 7px 7px 0 7px; 261 | background-color: #ffe; 262 | width: 40%; 263 | float: right; 264 | } 265 | 266 | p.sidebar-title { 267 | font-weight: bold; 268 | } 269 | 270 | /* -- topics ---------------------------------------------------------------- */ 271 | 272 | div.topic { 273 | border: 1px solid #ccc; 274 | padding: 7px 7px 0 7px; 275 | margin: 10px 0 10px 0; 276 | } 277 | 278 | p.topic-title { 279 | font-size: 1.1em; 280 | font-weight: bold; 281 | margin-top: 10px; 282 | } 283 | 284 | /* -- admonitions ----------------------------------------------------------- */ 285 | 286 | div.admonition { 287 | margin-top: 10px; 288 | margin-bottom: 10px; 289 | padding: 7px; 290 | } 291 | 292 | div.admonition dt { 293 | font-weight: bold; 294 | } 295 | 296 | div.admonition dl { 297 | margin-bottom: 0; 298 | } 299 | 300 | p.admonition-title { 301 | margin: 0px 10px 5px 0px; 302 | font-weight: bold; 303 | } 304 | 305 | div.body p.centered { 306 | text-align: center; 307 | margin-top: 25px; 308 | } 309 | 310 | /* -- tables ---------------------------------------------------------------- */ 311 | 312 | table.docutils { 313 | border: 0; 314 | border-collapse: collapse; 315 | } 316 | 317 | table.docutils td, table.docutils th { 318 | padding: 1px 8px 1px 5px; 319 | border-top: 0; 320 | border-left: 0; 321 | border-right: 0; 322 | border-bottom: 1px solid #aaa; 323 | } 324 | 325 | table.field-list td, table.field-list th { 326 | border: 0 !important; 327 | } 328 | 329 | table.footnote td, table.footnote th { 330 | border: 0 !important; 331 | } 332 | 333 | th { 334 | text-align: left; 335 | padding-right: 5px; 336 | } 337 | 338 | table.citation { 339 | border-left: solid 1px gray; 340 | margin-left: 1px; 341 | } 342 | 343 | table.citation td { 344 | border-bottom: none; 345 | } 346 | 347 | /* -- other body styles ----------------------------------------------------- */ 348 | 349 | ol.arabic { 350 | list-style: decimal; 351 | } 352 | 353 | ol.loweralpha { 354 | list-style: lower-alpha; 355 | } 356 | 357 | ol.upperalpha { 358 | list-style: upper-alpha; 359 | } 360 | 361 | ol.lowerroman { 362 | list-style: lower-roman; 363 | } 364 | 365 | ol.upperroman { 366 | list-style: upper-roman; 367 | } 368 | 369 | dl { 370 | margin-bottom: 15px; 371 | } 372 | 373 | dd p { 374 | margin-top: 0px; 375 | } 376 | 377 | dd ul, dd table { 378 | margin-bottom: 10px; 379 | } 380 | 381 | dd { 382 | margin-top: 3px; 383 | margin-bottom: 10px; 384 | margin-left: 30px; 385 | } 386 | 387 | dt:target, .highlighted { 388 | background-color: #fbe54e; 389 | } 390 | 391 | dl.glossary dt { 392 | font-weight: bold; 393 | font-size: 1.1em; 394 | } 395 | 396 | .field-list ul { 397 | margin: 0; 398 | padding-left: 1em; 399 | } 400 | 401 | .field-list p { 402 | margin: 0; 403 | } 404 | 405 | .optional { 406 | font-size: 1.3em; 407 | } 408 | 409 | .versionmodified { 410 | font-style: italic; 411 | } 412 | 413 | .system-message { 414 | background-color: #fda; 415 | padding: 5px; 416 | border: 3px solid red; 417 | } 418 | 419 | .footnote:target { 420 | background-color: #ffa; 421 | } 422 | 423 | .line-block { 424 | display: block; 425 | margin-top: 1em; 426 | margin-bottom: 1em; 427 | } 428 | 429 | .line-block .line-block { 430 | margin-top: 0; 431 | margin-bottom: 0; 432 | margin-left: 1.5em; 433 | } 434 | 435 | .guilabel, .menuselection { 436 | font-family: sans-serif; 437 | } 438 | 439 | .accelerator { 440 | text-decoration: underline; 441 | } 442 | 443 | .classifier { 444 | font-style: oblique; 445 | } 446 | 447 | abbr, acronym { 448 | border-bottom: dotted 1px; 449 | cursor: help; 450 | } 451 | 452 | /* -- code displays --------------------------------------------------------- */ 453 | 454 | pre { 455 | overflow: auto; 456 | overflow-y: hidden; /* fixes display issues on Chrome browsers */ 457 | } 458 | 459 | td.linenos pre { 460 | padding: 5px 0px; 461 | border: 0; 462 | background-color: transparent; 463 | color: #aaa; 464 | } 465 | 466 | table.highlighttable { 467 | margin-left: 0.5em; 468 | } 469 | 470 | table.highlighttable td { 471 | padding: 0 0.5em 0 0.5em; 472 | } 473 | 474 | tt.descname { 475 | background-color: transparent; 476 | font-weight: bold; 477 | font-size: 1.2em; 478 | } 479 | 480 | tt.descclassname { 481 | background-color: transparent; 482 | } 483 | 484 | tt.xref, a tt { 485 | background-color: transparent; 486 | font-weight: bold; 487 | } 488 | 489 | h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt { 490 | background-color: transparent; 491 | } 492 | 493 | .viewcode-link { 494 | float: right; 495 | } 496 | 497 | .viewcode-back { 498 | float: right; 499 | font-family: sans-serif; 500 | } 501 | 502 | div.viewcode-block:target { 503 | margin: -1px -10px; 504 | padding: 0 10px; 505 | } 506 | 507 | /* -- math display ---------------------------------------------------------- */ 508 | 509 | img.math { 510 | vertical-align: middle; 511 | } 512 | 513 | div.body div.math p { 514 | text-align: center; 515 | } 516 | 517 | span.eqno { 518 | float: right; 519 | } 520 | 521 | /* -- printout stylesheet --------------------------------------------------- */ 522 | 523 | @media print { 524 | div.document, 525 | div.documentwrapper, 526 | div.bodywrapper { 527 | margin: 0 !important; 528 | width: 100%; 529 | } 530 | 531 | div.sphinxsidebar, 532 | div.related, 533 | div.footer, 534 | #top-link { 535 | display: none; 536 | } 537 | } -------------------------------------------------------------------------------- /docs/_build/html/_static/comment-bright.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lispyclouds/medusa/cf069800eb607fe25d4dafa5332cceda5a7c7c8b/docs/_build/html/_static/comment-bright.png -------------------------------------------------------------------------------- /docs/_build/html/_static/comment-close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lispyclouds/medusa/cf069800eb607fe25d4dafa5332cceda5a7c7c8b/docs/_build/html/_static/comment-close.png -------------------------------------------------------------------------------- /docs/_build/html/_static/comment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lispyclouds/medusa/cf069800eb607fe25d4dafa5332cceda5a7c7c8b/docs/_build/html/_static/comment.png -------------------------------------------------------------------------------- /docs/_build/html/_static/default.css: -------------------------------------------------------------------------------- 1 | /* 2 | * default.css_t 3 | * ~~~~~~~~~~~~~ 4 | * 5 | * Sphinx stylesheet -- default theme. 6 | * 7 | * :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS. 8 | * :license: BSD, see LICENSE for details. 9 | * 10 | */ 11 | 12 | @import url("basic.css"); 13 | 14 | /* -- page layout ----------------------------------------------------------- */ 15 | 16 | body { 17 | font-family: sans-serif; 18 | font-size: 100%; 19 | background-color: #11303d; 20 | color: #000; 21 | margin: 0; 22 | padding: 0; 23 | } 24 | 25 | div.document { 26 | background-color: #1c4e63; 27 | } 28 | 29 | div.documentwrapper { 30 | float: left; 31 | width: 100%; 32 | } 33 | 34 | div.bodywrapper { 35 | margin: 0 0 0 230px; 36 | } 37 | 38 | div.body { 39 | background-color: #ffffff; 40 | color: #000000; 41 | padding: 0 20px 30px 20px; 42 | } 43 | 44 | div.footer { 45 | color: #ffffff; 46 | width: 100%; 47 | padding: 9px 0 9px 0; 48 | text-align: center; 49 | font-size: 75%; 50 | } 51 | 52 | div.footer a { 53 | color: #ffffff; 54 | text-decoration: underline; 55 | } 56 | 57 | div.related { 58 | background-color: #133f52; 59 | line-height: 30px; 60 | color: #ffffff; 61 | } 62 | 63 | div.related a { 64 | color: #ffffff; 65 | } 66 | 67 | div.sphinxsidebar { 68 | } 69 | 70 | div.sphinxsidebar h3 { 71 | font-family: 'Trebuchet MS', sans-serif; 72 | color: #ffffff; 73 | font-size: 1.4em; 74 | font-weight: normal; 75 | margin: 0; 76 | padding: 0; 77 | } 78 | 79 | div.sphinxsidebar h3 a { 80 | color: #ffffff; 81 | } 82 | 83 | div.sphinxsidebar h4 { 84 | font-family: 'Trebuchet MS', sans-serif; 85 | color: #ffffff; 86 | font-size: 1.3em; 87 | font-weight: normal; 88 | margin: 5px 0 0 0; 89 | padding: 0; 90 | } 91 | 92 | div.sphinxsidebar p { 93 | color: #ffffff; 94 | } 95 | 96 | div.sphinxsidebar p.topless { 97 | margin: 5px 10px 10px 10px; 98 | } 99 | 100 | div.sphinxsidebar ul { 101 | margin: 10px; 102 | padding: 0; 103 | color: #ffffff; 104 | } 105 | 106 | div.sphinxsidebar a { 107 | color: #98dbcc; 108 | } 109 | 110 | div.sphinxsidebar input { 111 | border: 1px solid #98dbcc; 112 | font-family: sans-serif; 113 | font-size: 1em; 114 | } 115 | 116 | 117 | 118 | /* -- hyperlink styles ------------------------------------------------------ */ 119 | 120 | a { 121 | color: #355f7c; 122 | text-decoration: none; 123 | } 124 | 125 | a:visited { 126 | color: #355f7c; 127 | text-decoration: none; 128 | } 129 | 130 | a:hover { 131 | text-decoration: underline; 132 | } 133 | 134 | 135 | 136 | /* -- body styles ----------------------------------------------------------- */ 137 | 138 | div.body h1, 139 | div.body h2, 140 | div.body h3, 141 | div.body h4, 142 | div.body h5, 143 | div.body h6 { 144 | font-family: 'Trebuchet MS', sans-serif; 145 | background-color: #f2f2f2; 146 | font-weight: normal; 147 | color: #20435c; 148 | border-bottom: 1px solid #ccc; 149 | margin: 20px -20px 10px -20px; 150 | padding: 3px 0 3px 10px; 151 | } 152 | 153 | div.body h1 { margin-top: 0; font-size: 200%; } 154 | div.body h2 { font-size: 160%; } 155 | div.body h3 { font-size: 140%; } 156 | div.body h4 { font-size: 120%; } 157 | div.body h5 { font-size: 110%; } 158 | div.body h6 { font-size: 100%; } 159 | 160 | a.headerlink { 161 | color: #c60f0f; 162 | font-size: 0.8em; 163 | padding: 0 4px 0 4px; 164 | text-decoration: none; 165 | } 166 | 167 | a.headerlink:hover { 168 | background-color: #c60f0f; 169 | color: white; 170 | } 171 | 172 | div.body p, div.body dd, div.body li { 173 | text-align: justify; 174 | line-height: 130%; 175 | } 176 | 177 | div.admonition p.admonition-title + p { 178 | display: inline; 179 | } 180 | 181 | div.admonition p { 182 | margin-bottom: 5px; 183 | } 184 | 185 | div.admonition pre { 186 | margin-bottom: 5px; 187 | } 188 | 189 | div.admonition ul, div.admonition ol { 190 | margin-bottom: 5px; 191 | } 192 | 193 | div.note { 194 | background-color: #eee; 195 | border: 1px solid #ccc; 196 | } 197 | 198 | div.seealso { 199 | background-color: #ffc; 200 | border: 1px solid #ff6; 201 | } 202 | 203 | div.topic { 204 | background-color: #eee; 205 | } 206 | 207 | div.warning { 208 | background-color: #ffe4e4; 209 | border: 1px solid #f66; 210 | } 211 | 212 | p.admonition-title { 213 | display: inline; 214 | } 215 | 216 | p.admonition-title:after { 217 | content: ":"; 218 | } 219 | 220 | pre { 221 | padding: 5px; 222 | background-color: #eeffcc; 223 | color: #333333; 224 | line-height: 120%; 225 | border: 1px solid #ac9; 226 | border-left: none; 227 | border-right: none; 228 | } 229 | 230 | tt { 231 | background-color: #ecf0f3; 232 | padding: 0 1px 0 1px; 233 | font-size: 0.95em; 234 | } 235 | 236 | th { 237 | background-color: #ede; 238 | } 239 | 240 | .warning tt { 241 | background: #efc2c2; 242 | } 243 | 244 | .note tt { 245 | background: #d6d6d6; 246 | } 247 | 248 | .viewcode-back { 249 | font-family: sans-serif; 250 | } 251 | 252 | div.viewcode-block:target { 253 | background-color: #f4debf; 254 | border-top: 1px solid #ac9; 255 | border-bottom: 1px solid #ac9; 256 | } -------------------------------------------------------------------------------- /docs/_build/html/_static/doctools.js: -------------------------------------------------------------------------------- 1 | /* 2 | * doctools.js 3 | * ~~~~~~~~~~~ 4 | * 5 | * Sphinx JavaScript utilities for all documentation. 6 | * 7 | * :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS. 8 | * :license: BSD, see LICENSE for details. 9 | * 10 | */ 11 | 12 | /** 13 | * select a different prefix for underscore 14 | */ 15 | $u = _.noConflict(); 16 | 17 | /** 18 | * make the code below compatible with browsers without 19 | * an installed firebug like debugger 20 | if (!window.console || !console.firebug) { 21 | var names = ["log", "debug", "info", "warn", "error", "assert", "dir", 22 | "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", 23 | "profile", "profileEnd"]; 24 | window.console = {}; 25 | for (var i = 0; i < names.length; ++i) 26 | window.console[names[i]] = function() {}; 27 | } 28 | */ 29 | 30 | /** 31 | * small helper function to urldecode strings 32 | */ 33 | jQuery.urldecode = function(x) { 34 | return decodeURIComponent(x).replace(/\+/g, ' '); 35 | }; 36 | 37 | /** 38 | * small helper function to urlencode strings 39 | */ 40 | jQuery.urlencode = encodeURIComponent; 41 | 42 | /** 43 | * This function returns the parsed url parameters of the 44 | * current request. Multiple values per key are supported, 45 | * it will always return arrays of strings for the value parts. 46 | */ 47 | jQuery.getQueryParameters = function(s) { 48 | if (typeof s == 'undefined') 49 | s = document.location.search; 50 | var parts = s.substr(s.indexOf('?') + 1).split('&'); 51 | var result = {}; 52 | for (var i = 0; i < parts.length; i++) { 53 | var tmp = parts[i].split('=', 2); 54 | var key = jQuery.urldecode(tmp[0]); 55 | var value = jQuery.urldecode(tmp[1]); 56 | if (key in result) 57 | result[key].push(value); 58 | else 59 | result[key] = [value]; 60 | } 61 | return result; 62 | }; 63 | 64 | /** 65 | * highlight a given string on a jquery object by wrapping it in 66 | * span elements with the given class name. 67 | */ 68 | jQuery.fn.highlightText = function(text, className) { 69 | function highlight(node) { 70 | if (node.nodeType == 3) { 71 | var val = node.nodeValue; 72 | var pos = val.toLowerCase().indexOf(text); 73 | if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) { 74 | var span = document.createElement("span"); 75 | span.className = className; 76 | span.appendChild(document.createTextNode(val.substr(pos, text.length))); 77 | node.parentNode.insertBefore(span, node.parentNode.insertBefore( 78 | document.createTextNode(val.substr(pos + text.length)), 79 | node.nextSibling)); 80 | node.nodeValue = val.substr(0, pos); 81 | } 82 | } 83 | else if (!jQuery(node).is("button, select, textarea")) { 84 | jQuery.each(node.childNodes, function() { 85 | highlight(this); 86 | }); 87 | } 88 | } 89 | return this.each(function() { 90 | highlight(this); 91 | }); 92 | }; 93 | 94 | /** 95 | * Small JavaScript module for the documentation. 96 | */ 97 | var Documentation = { 98 | 99 | init : function() { 100 | this.fixFirefoxAnchorBug(); 101 | this.highlightSearchWords(); 102 | this.initIndexTable(); 103 | }, 104 | 105 | /** 106 | * i18n support 107 | */ 108 | TRANSLATIONS : {}, 109 | PLURAL_EXPR : function(n) { return n == 1 ? 0 : 1; }, 110 | LOCALE : 'unknown', 111 | 112 | // gettext and ngettext don't access this so that the functions 113 | // can safely bound to a different name (_ = Documentation.gettext) 114 | gettext : function(string) { 115 | var translated = Documentation.TRANSLATIONS[string]; 116 | if (typeof translated == 'undefined') 117 | return string; 118 | return (typeof translated == 'string') ? translated : translated[0]; 119 | }, 120 | 121 | ngettext : function(singular, plural, n) { 122 | var translated = Documentation.TRANSLATIONS[singular]; 123 | if (typeof translated == 'undefined') 124 | return (n == 1) ? singular : plural; 125 | return translated[Documentation.PLURALEXPR(n)]; 126 | }, 127 | 128 | addTranslations : function(catalog) { 129 | for (var key in catalog.messages) 130 | this.TRANSLATIONS[key] = catalog.messages[key]; 131 | this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')'); 132 | this.LOCALE = catalog.locale; 133 | }, 134 | 135 | /** 136 | * add context elements like header anchor links 137 | */ 138 | addContextElements : function() { 139 | $('div[id] > :header:first').each(function() { 140 | $('\u00B6'). 141 | attr('href', '#' + this.id). 142 | attr('title', _('Permalink to this headline')). 143 | appendTo(this); 144 | }); 145 | $('dt[id]').each(function() { 146 | $('\u00B6'). 147 | attr('href', '#' + this.id). 148 | attr('title', _('Permalink to this definition')). 149 | appendTo(this); 150 | }); 151 | }, 152 | 153 | /** 154 | * workaround a firefox stupidity 155 | */ 156 | fixFirefoxAnchorBug : function() { 157 | if (document.location.hash && $.browser.mozilla) 158 | window.setTimeout(function() { 159 | document.location.href += ''; 160 | }, 10); 161 | }, 162 | 163 | /** 164 | * highlight the search words provided in the url in the text 165 | */ 166 | highlightSearchWords : function() { 167 | var params = $.getQueryParameters(); 168 | var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : []; 169 | if (terms.length) { 170 | var body = $('div.body'); 171 | if (!body.length) { 172 | body = $('body'); 173 | } 174 | window.setTimeout(function() { 175 | $.each(terms, function() { 176 | body.highlightText(this.toLowerCase(), 'highlighted'); 177 | }); 178 | }, 10); 179 | $('') 181 | .appendTo($('#searchbox')); 182 | } 183 | }, 184 | 185 | /** 186 | * init the domain index toggle buttons 187 | */ 188 | initIndexTable : function() { 189 | var togglers = $('img.toggler').click(function() { 190 | var src = $(this).attr('src'); 191 | var idnum = $(this).attr('id').substr(7); 192 | $('tr.cg-' + idnum).toggle(); 193 | if (src.substr(-9) == 'minus.png') 194 | $(this).attr('src', src.substr(0, src.length-9) + 'plus.png'); 195 | else 196 | $(this).attr('src', src.substr(0, src.length-8) + 'minus.png'); 197 | }).css('display', ''); 198 | if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) { 199 | togglers.click(); 200 | } 201 | }, 202 | 203 | /** 204 | * helper function to hide the search marks again 205 | */ 206 | hideSearchWords : function() { 207 | $('#searchbox .highlight-link').fadeOut(300); 208 | $('span.highlighted').removeClass('highlighted'); 209 | }, 210 | 211 | /** 212 | * make the url absolute 213 | */ 214 | makeURL : function(relativeURL) { 215 | return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL; 216 | }, 217 | 218 | /** 219 | * get the current relative url 220 | */ 221 | getCurrentURL : function() { 222 | var path = document.location.pathname; 223 | var parts = path.split(/\//); 224 | $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() { 225 | if (this == '..') 226 | parts.pop(); 227 | }); 228 | var url = parts.join('/'); 229 | return path.substring(url.lastIndexOf('/') + 1, path.length - 1); 230 | } 231 | }; 232 | 233 | // quick alias for translations 234 | _ = Documentation.gettext; 235 | 236 | $(document).ready(function() { 237 | Documentation.init(); 238 | }); 239 | -------------------------------------------------------------------------------- /docs/_build/html/_static/down-pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lispyclouds/medusa/cf069800eb607fe25d4dafa5332cceda5a7c7c8b/docs/_build/html/_static/down-pressed.png -------------------------------------------------------------------------------- /docs/_build/html/_static/down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lispyclouds/medusa/cf069800eb607fe25d4dafa5332cceda5a7c7c8b/docs/_build/html/_static/down.png -------------------------------------------------------------------------------- /docs/_build/html/_static/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lispyclouds/medusa/cf069800eb607fe25d4dafa5332cceda5a7c7c8b/docs/_build/html/_static/file.png -------------------------------------------------------------------------------- /docs/_build/html/_static/image1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lispyclouds/medusa/cf069800eb607fe25d4dafa5332cceda5a7c7c8b/docs/_build/html/_static/image1.png -------------------------------------------------------------------------------- /docs/_build/html/_static/minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lispyclouds/medusa/cf069800eb607fe25d4dafa5332cceda5a7c7c8b/docs/_build/html/_static/minus.png -------------------------------------------------------------------------------- /docs/_build/html/_static/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lispyclouds/medusa/cf069800eb607fe25d4dafa5332cceda5a7c7c8b/docs/_build/html/_static/plus.png -------------------------------------------------------------------------------- /docs/_build/html/_static/pygments.css: -------------------------------------------------------------------------------- 1 | .highlight .hll { background-color: #ffffcc } 2 | .highlight { background: #eeffcc; } 3 | .highlight .c { color: #408090; font-style: italic } /* Comment */ 4 | .highlight .err { border: 1px solid #FF0000 } /* Error */ 5 | .highlight .k { color: #007020; font-weight: bold } /* Keyword */ 6 | .highlight .o { color: #666666 } /* Operator */ 7 | .highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */ 8 | .highlight .cp { color: #007020 } /* Comment.Preproc */ 9 | .highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */ 10 | .highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */ 11 | .highlight .gd { color: #A00000 } /* Generic.Deleted */ 12 | .highlight .ge { font-style: italic } /* Generic.Emph */ 13 | .highlight .gr { color: #FF0000 } /* Generic.Error */ 14 | .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ 15 | .highlight .gi { color: #00A000 } /* Generic.Inserted */ 16 | .highlight .go { color: #333333 } /* Generic.Output */ 17 | .highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ 18 | .highlight .gs { font-weight: bold } /* Generic.Strong */ 19 | .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ 20 | .highlight .gt { color: #0044DD } /* Generic.Traceback */ 21 | .highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */ 22 | .highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */ 23 | .highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */ 24 | .highlight .kp { color: #007020 } /* Keyword.Pseudo */ 25 | .highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */ 26 | .highlight .kt { color: #902000 } /* Keyword.Type */ 27 | .highlight .m { color: #208050 } /* Literal.Number */ 28 | .highlight .s { color: #4070a0 } /* Literal.String */ 29 | .highlight .na { color: #4070a0 } /* Name.Attribute */ 30 | .highlight .nb { color: #007020 } /* Name.Builtin */ 31 | .highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */ 32 | .highlight .no { color: #60add5 } /* Name.Constant */ 33 | .highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */ 34 | .highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */ 35 | .highlight .ne { color: #007020 } /* Name.Exception */ 36 | .highlight .nf { color: #06287e } /* Name.Function */ 37 | .highlight .nl { color: #002070; font-weight: bold } /* Name.Label */ 38 | .highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */ 39 | .highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */ 40 | .highlight .nv { color: #bb60d5 } /* Name.Variable */ 41 | .highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */ 42 | .highlight .w { color: #bbbbbb } /* Text.Whitespace */ 43 | .highlight .mf { color: #208050 } /* Literal.Number.Float */ 44 | .highlight .mh { color: #208050 } /* Literal.Number.Hex */ 45 | .highlight .mi { color: #208050 } /* Literal.Number.Integer */ 46 | .highlight .mo { color: #208050 } /* Literal.Number.Oct */ 47 | .highlight .sb { color: #4070a0 } /* Literal.String.Backtick */ 48 | .highlight .sc { color: #4070a0 } /* Literal.String.Char */ 49 | .highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */ 50 | .highlight .s2 { color: #4070a0 } /* Literal.String.Double */ 51 | .highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */ 52 | .highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */ 53 | .highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */ 54 | .highlight .sx { color: #c65d09 } /* Literal.String.Other */ 55 | .highlight .sr { color: #235388 } /* Literal.String.Regex */ 56 | .highlight .s1 { color: #4070a0 } /* Literal.String.Single */ 57 | .highlight .ss { color: #517918 } /* Literal.String.Symbol */ 58 | .highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */ 59 | .highlight .vc { color: #bb60d5 } /* Name.Variable.Class */ 60 | .highlight .vg { color: #bb60d5 } /* Name.Variable.Global */ 61 | .highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */ 62 | .highlight .il { color: #208050 } /* Literal.Number.Integer.Long */ -------------------------------------------------------------------------------- /docs/_build/html/_static/searchtools.js: -------------------------------------------------------------------------------- 1 | /* 2 | * searchtools.js_t 3 | * ~~~~~~~~~~~~~~~~ 4 | * 5 | * Sphinx JavaScript utilties for the full-text search. 6 | * 7 | * :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS. 8 | * :license: BSD, see LICENSE for details. 9 | * 10 | */ 11 | 12 | 13 | /** 14 | * Porter Stemmer 15 | */ 16 | var Stemmer = function() { 17 | 18 | var step2list = { 19 | ational: 'ate', 20 | tional: 'tion', 21 | enci: 'ence', 22 | anci: 'ance', 23 | izer: 'ize', 24 | bli: 'ble', 25 | alli: 'al', 26 | entli: 'ent', 27 | eli: 'e', 28 | ousli: 'ous', 29 | ization: 'ize', 30 | ation: 'ate', 31 | ator: 'ate', 32 | alism: 'al', 33 | iveness: 'ive', 34 | fulness: 'ful', 35 | ousness: 'ous', 36 | aliti: 'al', 37 | iviti: 'ive', 38 | biliti: 'ble', 39 | logi: 'log' 40 | }; 41 | 42 | var step3list = { 43 | icate: 'ic', 44 | ative: '', 45 | alize: 'al', 46 | iciti: 'ic', 47 | ical: 'ic', 48 | ful: '', 49 | ness: '' 50 | }; 51 | 52 | var c = "[^aeiou]"; // consonant 53 | var v = "[aeiouy]"; // vowel 54 | var C = c + "[^aeiouy]*"; // consonant sequence 55 | var V = v + "[aeiou]*"; // vowel sequence 56 | 57 | var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0 58 | var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1 59 | var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1 60 | var s_v = "^(" + C + ")?" + v; // vowel in stem 61 | 62 | this.stemWord = function (w) { 63 | var stem; 64 | var suffix; 65 | var firstch; 66 | var origword = w; 67 | 68 | if (w.length < 3) 69 | return w; 70 | 71 | var re; 72 | var re2; 73 | var re3; 74 | var re4; 75 | 76 | firstch = w.substr(0,1); 77 | if (firstch == "y") 78 | w = firstch.toUpperCase() + w.substr(1); 79 | 80 | // Step 1a 81 | re = /^(.+?)(ss|i)es$/; 82 | re2 = /^(.+?)([^s])s$/; 83 | 84 | if (re.test(w)) 85 | w = w.replace(re,"$1$2"); 86 | else if (re2.test(w)) 87 | w = w.replace(re2,"$1$2"); 88 | 89 | // Step 1b 90 | re = /^(.+?)eed$/; 91 | re2 = /^(.+?)(ed|ing)$/; 92 | if (re.test(w)) { 93 | var fp = re.exec(w); 94 | re = new RegExp(mgr0); 95 | if (re.test(fp[1])) { 96 | re = /.$/; 97 | w = w.replace(re,""); 98 | } 99 | } 100 | else if (re2.test(w)) { 101 | var fp = re2.exec(w); 102 | stem = fp[1]; 103 | re2 = new RegExp(s_v); 104 | if (re2.test(stem)) { 105 | w = stem; 106 | re2 = /(at|bl|iz)$/; 107 | re3 = new RegExp("([^aeiouylsz])\\1$"); 108 | re4 = new RegExp("^" + C + v + "[^aeiouwxy]$"); 109 | if (re2.test(w)) 110 | w = w + "e"; 111 | else if (re3.test(w)) { 112 | re = /.$/; 113 | w = w.replace(re,""); 114 | } 115 | else if (re4.test(w)) 116 | w = w + "e"; 117 | } 118 | } 119 | 120 | // Step 1c 121 | re = /^(.+?)y$/; 122 | if (re.test(w)) { 123 | var fp = re.exec(w); 124 | stem = fp[1]; 125 | re = new RegExp(s_v); 126 | if (re.test(stem)) 127 | w = stem + "i"; 128 | } 129 | 130 | // Step 2 131 | re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/; 132 | if (re.test(w)) { 133 | var fp = re.exec(w); 134 | stem = fp[1]; 135 | suffix = fp[2]; 136 | re = new RegExp(mgr0); 137 | if (re.test(stem)) 138 | w = stem + step2list[suffix]; 139 | } 140 | 141 | // Step 3 142 | re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/; 143 | if (re.test(w)) { 144 | var fp = re.exec(w); 145 | stem = fp[1]; 146 | suffix = fp[2]; 147 | re = new RegExp(mgr0); 148 | if (re.test(stem)) 149 | w = stem + step3list[suffix]; 150 | } 151 | 152 | // Step 4 153 | re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/; 154 | re2 = /^(.+?)(s|t)(ion)$/; 155 | if (re.test(w)) { 156 | var fp = re.exec(w); 157 | stem = fp[1]; 158 | re = new RegExp(mgr1); 159 | if (re.test(stem)) 160 | w = stem; 161 | } 162 | else if (re2.test(w)) { 163 | var fp = re2.exec(w); 164 | stem = fp[1] + fp[2]; 165 | re2 = new RegExp(mgr1); 166 | if (re2.test(stem)) 167 | w = stem; 168 | } 169 | 170 | // Step 5 171 | re = /^(.+?)e$/; 172 | if (re.test(w)) { 173 | var fp = re.exec(w); 174 | stem = fp[1]; 175 | re = new RegExp(mgr1); 176 | re2 = new RegExp(meq1); 177 | re3 = new RegExp("^" + C + v + "[^aeiouwxy]$"); 178 | if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) 179 | w = stem; 180 | } 181 | re = /ll$/; 182 | re2 = new RegExp(mgr1); 183 | if (re.test(w) && re2.test(w)) { 184 | re = /.$/; 185 | w = w.replace(re,""); 186 | } 187 | 188 | // and turn initial Y back to y 189 | if (firstch == "y") 190 | w = firstch.toLowerCase() + w.substr(1); 191 | return w; 192 | } 193 | } 194 | 195 | 196 | 197 | /** 198 | * Simple result scoring code. 199 | */ 200 | var Scorer = { 201 | // Implement the following function to further tweak the score for each result 202 | // The function takes a result array [filename, title, anchor, descr, score] 203 | // and returns the new score. 204 | /* 205 | score: function(result) { 206 | return result[4]; 207 | }, 208 | */ 209 | 210 | // query matches the full name of an object 211 | objNameMatch: 11, 212 | // or matches in the last dotted part of the object name 213 | objPartialMatch: 6, 214 | // Additive scores depending on the priority of the object 215 | objPrio: {0: 15, // used to be importantResults 216 | 1: 5, // used to be objectResults 217 | 2: -5}, // used to be unimportantResults 218 | // Used when the priority is not in the mapping. 219 | objPrioDefault: 0, 220 | 221 | // query found in title 222 | title: 15, 223 | // query found in terms 224 | term: 5 225 | }; 226 | 227 | 228 | /** 229 | * Search Module 230 | */ 231 | var Search = { 232 | 233 | _index : null, 234 | _queued_query : null, 235 | _pulse_status : -1, 236 | 237 | init : function() { 238 | var params = $.getQueryParameters(); 239 | if (params.q) { 240 | var query = params.q[0]; 241 | $('input[name="q"]')[0].value = query; 242 | this.performSearch(query); 243 | } 244 | }, 245 | 246 | loadIndex : function(url) { 247 | $.ajax({type: "GET", url: url, data: null, 248 | dataType: "script", cache: true, 249 | complete: function(jqxhr, textstatus) { 250 | if (textstatus != "success") { 251 | document.getElementById("searchindexloader").src = url; 252 | } 253 | }}); 254 | }, 255 | 256 | setIndex : function(index) { 257 | var q; 258 | this._index = index; 259 | if ((q = this._queued_query) !== null) { 260 | this._queued_query = null; 261 | Search.query(q); 262 | } 263 | }, 264 | 265 | hasIndex : function() { 266 | return this._index !== null; 267 | }, 268 | 269 | deferQuery : function(query) { 270 | this._queued_query = query; 271 | }, 272 | 273 | stopPulse : function() { 274 | this._pulse_status = 0; 275 | }, 276 | 277 | startPulse : function() { 278 | if (this._pulse_status >= 0) 279 | return; 280 | function pulse() { 281 | var i; 282 | Search._pulse_status = (Search._pulse_status + 1) % 4; 283 | var dotString = ''; 284 | for (i = 0; i < Search._pulse_status; i++) 285 | dotString += '.'; 286 | Search.dots.text(dotString); 287 | if (Search._pulse_status > -1) 288 | window.setTimeout(pulse, 500); 289 | } 290 | pulse(); 291 | }, 292 | 293 | /** 294 | * perform a search for something (or wait until index is loaded) 295 | */ 296 | performSearch : function(query) { 297 | // create the required interface elements 298 | this.out = $('#search-results'); 299 | this.title = $('

' + _('Searching') + '

').appendTo(this.out); 300 | this.dots = $('').appendTo(this.title); 301 | this.status = $('

').appendTo(this.out); 302 | this.output = $('