Warning, /education/cantor/src/backends/sage/DESIGN is written in an unsupported language. File is not indexed.
0001 This backend creates a bridge between Cantor and the Sage mathematical software. 0002 0003 To accomplish this, it launches a sage session using KPtyProcess. 0004 It sends the input to the process, and tries to parse the output. 0005 (NOTE: KPtyProcess is used instead of a regular KProcess, because 0006 when using KProcess, some weird errors showed up. e.g. when running 0007 sage.misc.latex.pretty_print_default) 0008 0009 The backend basically works by comparing the number of lines, 0010 fed to the process, and the number of prompts read from it to 0011 determine when a process is finished. To find out if a computation 0012 has returned an image(e.g. whe plotting) it monitors the tmp directory 0013 used by sage using KDirWatch, and returns an ImageResult if a new 0014 file was created there while the computation was in progress. 0015 0016 Sage offers the pretty_print_default option to automatically return latex code 0017 for the results. This is used when Typesetting is enabled. 0018 0019 TabCompletion is implemented by calling sage.interfaces.tab_completion.completions in the Session and parsing the 0020 output. To make sure it doesn't mess with the history, some tricks are used. (see the code) 0021 0022 Highlighting uses a simple list of known keywords and some regular expressions. (so no magic here)