2 (in-package :lineal.webui
)
5 ;V Receive user's calculation, return result.V
6 (defun receive-and-process
7 (&aux
(text (parameter "text"))
8 (log-calcs (load-time-value
9 (boundp 'lineal.devvars
::log-calcs
))))
10 (when log-calcs
(log-message* "parser receives: ~%~A" text
))
11 (setq text
(process-input-from-string text
))
12 (when log-calcs
(log-message* "parser replies: ~%~A" text
))
16 ;V Display the calculator page at server/calcupage V
18 (with-html-output-to-string
22 (:title
"Calculate things.")
30 " font-family: Serif;"
34 (jsfile s
"calcupage-buttons")
35 (jsfile s
"connects"))
37 (:div
(:a
:href
"/input_matrix" "Create and edit")
38 " vectors and matrices" :br
39 (:a
:href
"/" "Main") " Page")
43 (:th
:rowspan
"2" :width
"110"
44 ;V Show operator buttons on left.V
46 (ps-tag s
(show-standops (.get-element-by-id document
"opdiv")))))
47 (:th
:rowspan
"2" :width
"170"
49 (ps-tag s
(show-linops (.get-element-by-id document
"linopdiv"))))
50 ;V Before variable names, show some easy-access buttons.V
52 (:div
:id
"leftvardiv"
53 (ps-tag s
(defvar leftvardiv
(.get-element-by-id document
"leftvardiv"))
54 (memory-buttons leftvardiv
)
55 (.append-child leftvardiv
(.create-element document
"br"))
56 (clear-button leftvardiv
)
57 (ok-button leftvardiv
))))
58 ;V Show variables on the top.V
59 (:td
(:div
:id
"vardiv"
64 "~{<button onclick=\"uinput('~A')\">~:*~A</button>~}"
66 `(("Numbers" ,*saved-numbers
*)
67 ("Vectors" ,*saved-tuples
*)
68 ("Matrices" ,*saved-matrices
*))))))
70 (:tr
(:td
:colspan
"2"
71 (:textarea
:style
"font-family: monospace; width: 100%" :rows
"12"
72 :wrap
"hard" :id
"calcIn" :spellcheck
"false"))))
73 ;V Make a place to show results.V
74 (:pre
:id
"resultPre")
76 s
(setf calc-in
(.get-element-by-id document
"calcIn")))))))