Warning, /education/cantor/src/backends/maxima/DESIGN is written in an unsupported language. File is not indexed.
0001 This backend allows Cantor to use the Maxima Computer Algebra System. 0002 0003 It works by starting a Tcp Server on an open port (it just tries some, until one is 0004 open), and then letting maxima connect to it(see setup-client command of maxima). 0005 Once maxima has connected, the backend sends the commands through the socket, and 0006 parses the delivered output. 0007 The parsing itself is a bit tricky, as Maxima output can have different formattings. 0008 1) it contains an output prompt. 0009 2) no prompt: this means that either maxima has asked a question, or there has happened an 0010 error. To determine which of the two it is, Cantor uses a timer, if for more than 100ms 0011 no new output arrives it assumes that it's a question. This works fairly well, as this 0012 case is rather seldom, and when an error occurs, maxima will soon deliver a new input prompt. 0013 3) it contains a new input prompt: This means the computation is finished. If running the timer 0014 from 2) is stopped, and the read output is prepared to be put into a Result. 0015 0016 To allow embedding of plots, the backend watches if the commands contain a plot command 0017 (using some regexp magic), sets a flag, and sends a slightly altered plot command to 0018 maxima that contains a temporary target file. 0019 0020 SyntaxHighlighting and TabCompletion are implemented in a very simplistic way, 0021 by just using a static list of known functions/keywords. 0022 0023 To allow SyntaxHelp and Typesetting, it launches a separate maxima process, that 0024 then evaluates "? command" or "tex(expr)", and then the output is parsed. 0025