2 (in-package :lineal.webui
)
5 ;V Receive user's calculation, return result.V
6 (defun receive-and-process
8 &aux
(text (parameter "text"))
9 (log-calcs (load-time-value
10 (boundp 'lineal.devvars
::log-calcs
))))
11 (when log-calcs
(log-message* "parser receives: ~%~A" text
))
14 (with-output-to-string (strm)
16 (process-input-from-string text infixp
)
18 (when log-calcs
(log-message* "parser replies: ~%~A" text
))
21 ;V URL: /process-prefix
22 (defun receive-and-process-prefix ()
23 (receive-and-process nil
))
25 (defmacro htm-expand-known-if
29 (load-time-value (,@s-expr t
))
30 (load-time-value (,@s-expr nil
)))
33 ;V URL: /calcupage-infix
34 (defun calcupage (&optional
(infixp t
))
35 (with-html-output-to-string
39 (:title
"Calculate things.")
40 (:link
:rel
"stylesheet" :href
"calcupage.css")
41 (jsfile s
"calcupage")
42 (jsfile s
"connects"))
44 (:div
(:a
:href
"/input_matrix" "Create and edit")
45 " vectors and matrices" :br
48 (htm (:a
:href
"/calcupage-prefix" "prefix"))
49 (htm (:a
:href
"/calcupage-infix" "infix")))
50 " notation instead." :br
51 (:a
:href
"/" "Main") " Page")
55 (:th
:rowspan
"2" :class
"linalg-buttons"
57 s infixp
(htm-linalg-buttons)))
58 (:th
:rowspan
"2" :class
"stdmath-buttons"
59 ;V Show operator buttons on left.V
61 s infixp
(htm-standard-math-buttons)))
62 ;V Before variable names, show some easy-access buttons.V
63 (:td
:class
"quick-buttons"
65 s infixp
(memory-buttons))
72 """ "fn1" "\\\"")
75 ;V Show variables on the top.V
78 `(("Numbers: " ,*saved-numbers
*)
79 ("Vectors: " ,*saved-tuples
*)
80 ("Matrices: " ,*saved-matrices
*))))
82 (princ (caar lvpairs-left
) s
)
83 (dolist (k (cadar lvpairs-left
))
84 (princ (simple-input-button k
"varbutton") s
))
85 (unless (setq lvpairs-left
(cdr lvpairs-left
))
89 (:tr
(:td
:colspan
"2"
90 (:textarea
:id
"calcIn" :spellcheck
"false"))))
91 ;V Make a place to show results.V
92 (:pre
:id
"resultPre")
93 (if infixp
(ps-tag s
(setf process-loc
"/process-infix"))
94 (ps-tag s
(setf process-loc
"/process-prefix")))
96 s
(setf calc-in
(.get-element-by-id document
"calcIn")))))))
98 ;V URL: /calcupage-prefix
99 (defun calcupage-prefix ()