scripts-edit.scm (TeXmacs-2.1.1-src) | : | scripts-edit.scm (TeXmacs-2.1.2-src) | ||
---|---|---|---|---|
skipping to change at line 112 | skipping to change at line 112 | |||
(tm-define (kbd-enter t forwards?) | (tm-define (kbd-enter t forwards?) | |||
(:require (and (tree-is? t 'script-eval) | (:require (and (tree-is? t 'script-eval) | |||
(xor (not forwards?) | (xor (not forwards?) | |||
(tree-is? t 1 'document)))) | (tree-is? t 1 'document)))) | |||
(script-modified-eval noop)) | (script-modified-eval noop)) | |||
(tm-define (evaluate-context? t) | (tm-define (evaluate-context? t) | |||
(tree-in? t '(script-input script-output))) | (tree-in? t '(script-input script-output))) | |||
(tm-define (make-script lan ses) | (tm-define (make-script-input* lan ses) | |||
(if (url-exists? (url-unix "$TEXMACS_STYLE_PATH" | (if (url-exists? (url-unix "$TEXMACS_STYLE_PATH" | |||
(string-append lan ".ts"))) | (string-append lan ".ts"))) | |||
(add-style-package lan)) | (add-style-package lan)) | |||
(insert-go-to `(script-input ,lan ,ses "" "") '(2 0))) | (insert-go-to `(script-input ,lan ,ses "" "") '(2 0))) | |||
(tm-define (make-script-input) | (tm-define (make-script-input) | |||
(let* ((lan (get-env "prog-scripts")) | (let* ((lan (get-env "prog-scripts")) | |||
(session (get-env "prog-session"))) | (ses (get-env "prog-session"))) | |||
(insert-go-to `(script-input ,lan ,session "" "") | (make-script-input* lan ses))) | |||
'(2 0)))) | ||||
(tm-define (alternate-toggle t) | (tm-define (alternate-toggle t) | |||
(:require (tree-is? t 'script-input)) | (:require (tree-is? t 'script-input)) | |||
(let* ((lan (tree->string (tree-ref t 0))) | (let* ((lan (tree->string (tree-ref t 0))) | |||
(session (tree->string (tree-ref t 1))) | (session (tree->string (tree-ref t 1))) | |||
(in (tree->stree (tree-ref t 2))) | (in (tree->stree (tree-ref t 2))) | |||
(out (tree-ref t 3))) | (out (tree-ref t 3))) | |||
(script-eval-at out lan session in :math-input :simplify-output) | (script-eval-at out lan session in :math-input :simplify-output) | |||
(tree-assign-node! t 'script-output) | (tree-assign-node! t 'script-output) | |||
(tree-go-to t 3 :end))) | (tree-go-to t 3 :end))) | |||
skipping to change at line 280 | skipping to change at line 279 | |||
(script-widget-eval id cas-expr :math-input :simplify-output)) | (script-widget-eval id cas-expr :math-input :simplify-output)) | |||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |||
;; Plots | ;; Plots | |||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |||
(tm-define (plot-context? t) | (tm-define (plot-context? t) | |||
(tree-in? t '(plot-curve plot-curve* plot-surface plot-surface*))) | (tree-in? t '(plot-curve plot-curve* plot-surface plot-surface*))) | |||
(tm-define (script-plot-command lan t) | (tm-define (script-plot-command lan t) | |||
(cond ((== (car t) 'plot-curve) | (cond | |||
`(concat "set samples 1000 ~ " | ((== (car t) 'plot-curve) | |||
"set xrange [" ,(tm-ref t 1) ":" ,(tm-ref t 2) "] ~ " | `(concat "set samples 1000 \n" | |||
"plot " ,(tm-ref t 0))) | "set xrange [" ,(tm-ref t 1) ":" ,(tm-ref t 2) "] \n" | |||
((== (car t) 'plot-curve*) | "plot " ,(tm-ref t 0))) | |||
`(concat "set samples 1000 ~ " | ((== (car t) 'plot-curve*) | |||
"set parametric ~ " | `(concat "set samples 1000 \n" | |||
"set trange [" ,(tm-ref t 2) ":" ,(tm-ref t 3) "] ~ " | "set parametric \n" | |||
"plot " ,(tm-ref t 0) ", " ,(tm-ref t 1))) | "set trange [" ,(tm-ref t 2) ":" ,(tm-ref t 3) "] \n" | |||
((== (car t) 'plot-surface) | "plot " ,(tm-ref t 0) ", " ,(tm-ref t 1))) | |||
`(concat "set samples 50 ~ set isosamples 50 ~ set hidden3d ~" | ((== (car t) 'plot-surface) | |||
"set pm3d ~ " | `(concat "set samples 50 \n set isosamples 50 \n set hidden3d \n" | |||
"set xrange [" ,(tm-ref t 1) ":" ,(tm-ref t 2) "] ~ " | "set pm3d \n" | |||
"set yrange [" ,(tm-ref t 3) ":" ,(tm-ref t 4) "] ~ " | "set xrange [" ,(tm-ref t 1) ":" ,(tm-ref t 2) "] \n" | |||
"splot " ,(tm-ref t 0))) | "set yrange [" ,(tm-ref t 3) ":" ,(tm-ref t 4) "] \n" | |||
((== (car t) 'plot-surface*) | "splot " ,(tm-ref t 0))) | |||
`(concat "set samples 50 ~ set isosamples 50 ~ set hidden3d ~" | ((== (car t) 'plot-surface*) | |||
"set parametric ~ " | `(concat "set samples 50 \n set isosamples 50 \n set hidden3d \n" | |||
"set pm3d ~ " | "set parametric \n" | |||
"set urange [" ,(tm-ref t 3) ":" ,(tm-ref t 4) "] ~ " | "set pm3d \n" | |||
"set vrange [" ,(tm-ref t 5) ":" ,(tm-ref t 6) "] ~ " | "set urange [" ,(tm-ref t 3) ":" ,(tm-ref t 4) "] \n" | |||
"splot " ,(tm-ref t 0) | "set vrange [" ,(tm-ref t 5) ":" ,(tm-ref t 6) "] \n" | |||
", " ,(tm-ref t 1) | "splot " ,(tm-ref t 0) | |||
", " ,(tm-ref t 2))))) | ", " ,(tm-ref t 1) | |||
", " ,(tm-ref t 2))))) | ||||
(define (activate-plot t) | (define (activate-plot t) | |||
(let* ((lan "gnuplot") | (let* ((lan "gnuplot") | |||
(session "default") | (session "default") | |||
(in (script-plot-command lan (tree->stree t)))) | (in (script-plot-command lan (tree->stree t)))) | |||
(tree-set! t `(plot-output ,t "")) | (tree-set! t `(plot-output ,t "")) | |||
(script-eval-at (tree-ref t 1) lan session in :math-correct :math-input) | (script-eval-at (tree-ref t 1) lan session in :math-correct :math-input) | |||
(tree-go-to t 1 :end))) | (tree-go-to t 1 :end))) | |||
(tm-define (alternate-toggle t) | (tm-define (alternate-toggle t) | |||
End of changes. 4 change blocks. | ||||
30 lines changed or deleted | 30 lines changed or added |