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
))
15 (with-output-to-string (strm)
17 (process-infix-from-string text
)
19 (process-input-from-string text
)))
20 (when log-calcs
(log-message* "parser replies: ~%~A" text
))
23 ;V URL: /process-prefix
24 (defun receive-and-process-prefix ()
25 (receive-and-process nil
))
27 (defmacro htm-expand-known-if
31 (load-time-value (,@s-expr t
))
32 (load-time-value (,@s-expr nil
)))
35 ;V URL: /calcupage-infix
36 (defun calcupage (&optional
(infixp t
))
37 (with-html-output-to-string
41 (:title
"Calculate things.")
42 (:link
:rel
"stylesheet" :href
"calcupage.css")
43 (jsfile s
"calcupage")
44 (jsfile s
"connects"))
46 (:div
(:a
:href
"/input_matrix" "Create and edit")
47 " vectors and matrices" :br
50 (htm (:a
:href
"/calcupage-prefix" "prefix"))
51 (htm (:a
:href
"/calcupage-infix" "infix")))
52 " notation instead." :br
53 (:a
:href
"/" "Main") " Page")
57 (:th
:rowspan
"2" :class
"linalg-buttons"
59 s infixp
(htm-linalg-buttons)))
60 (:th
:rowspan
"2" :class
"stdmath-buttons"
61 ;V Show operator buttons on left.V
63 s infixp
(htm-standard-math-buttons)))
64 ;V Before variable names, show some easy-access buttons.V
65 (:td
:class
"quick-buttons"
67 s infixp
(memory-buttons))
74 """ "fn1" "\\\"")
77 ;V Show variables on the top.V
80 `(("Numbers: " ,*saved-numbers
*)
81 ("Vectors: " ,*saved-tuples
*)
82 ("Matrices: " ,*saved-matrices
*))))
84 (princ (caar lvpairs-left
) s
)
85 (dolist (k (cadar lvpairs-left
))
86 (princ (simple-input-button k
"varbutton") s
))
87 (unless (setq lvpairs-left
(cdr lvpairs-left
))
91 (:tr
(:td
:colspan
"2"
92 (:textarea
:id
"calcIn" :spellcheck
"false"))))
93 ;V Make a place to show results.V
94 (:pre
:id
"resultPre")
95 (if infixp
(ps-tag s
(setf process-loc
"/process-infix"))
96 (ps-tag s
(setf process-loc
"/process-prefix")))
98 s
(setf calc-in
(.get-element-by-id document
"calcIn")))))))
100 ;V URL: /calcupage-prefix
101 (defun calcupage-prefix ()