3 ;V Receive user's calculation, return result.V
4 (defun receive-and-process
6 &aux
(text (parameter "text"))
7 (log-calcs (load-time-value
8 (boundp 'lineal.devvars
::log-calcs
))))
9 (when log-calcs
(log-message* "parser receives: ~%~A" text
))
12 (with-output-to-string (strm)
14 (process-input-from-string text infixp
)
16 (when log-calcs
(log-message* "parser replies: ~%~A" text
))
19 ;V URL: /process-prefix
20 (defun receive-and-process-prefix ()
21 (receive-and-process nil
))
23 (defmacro htm-expand-known-if
27 (load-time-value (,@s-expr t
))
28 (load-time-value (,@s-expr nil
)))
31 ;V URL: /calcupage-infix
32 (defun calcupage (&optional
(infixp t
))
33 (with-html-output-to-string
37 (:title
"Calculate things.")
38 (:link
:rel
"stylesheet" :href
"calcupage.css")
39 (jsfile s
"calcupage")
40 (jsfile s
"connects"))
42 (:div
(:a
:href
"/input_matrix" "Create and edit")
43 " vectors and matrices" :br
46 (htm (:a
:href
"/calcupage-prefix" "prefix"))
47 (htm (:a
:href
"/calcupage-infix" "infix")))
48 " notation instead." :br
49 (:a
:href
"/" "Main") " Page")
53 (:th
:rowspan
"2" :class
"linalg-buttons"
55 s infixp
(htm-linalg-buttons)))
56 (:th
:rowspan
"2" :class
"stdmath-buttons"
57 ;V Show operator buttons on left.V
59 s infixp
(htm-standard-math-buttons)))
60 ;V Before variable names, show some easy-access buttons.V
61 (:td
:class
"quick-buttons"
63 s infixp
(memory-buttons))
70 """ "fn1" "\\\"")
73 ;V Show variables on the top.V
76 `(("Numbers: " ,*saved-numbers
*)
77 ("Vectors: " ,*saved-tuples
*)
78 ("Matrices: " ,*saved-matrices
*))))
80 (princ (caar lvpairs-left
) s
)
81 (dolist (k (cadar lvpairs-left
))
82 (princ (simple-input-button k
"varbutton") s
))
83 (unless (setq lvpairs-left
(cdr lvpairs-left
))
87 (:tr
(:td
:colspan
"2"
88 (:textarea
:id
"calcIn" :spellcheck
"false"))))
89 ;V Make a place to show results.V
90 (:pre
:id
"resultPre")
91 (if infixp
(ps-tag s
(setf process-loc
"/process-infix"))
92 (ps-tag s
(setf process-loc
"/process-prefix")))
94 s
(setf calc-in
(.get-element-by-id document
"calcIn")))))))
96 ;V URL: /calcupage-prefix
97 (defun calcupage-prefix ()