; calc.pretty.lsp (maxout 18) ;Set precision of rational math package (de myputs (str) (write 1 str (strlen str))) (de "stdin.QUERY_REMOTE" (lline) (myputs "Rz 405 300\n")) ;keyboard names and colors (qsetq MAXDISP 24 gdispstr "" kbd (("Off" 2628095) ("C" 2628095) (" (strlen gdispstr) 0) (cond ((eqv (strlen gdispstr) 1) (dispstr "0" 6052991) ) ) (setq gdispstr (strsub gdispstr 0 (- (strlen gdispstr) 1))) ) ) ) (de "rowcol.18" () (cond ((> (strlen gdispstr) 0) (cond ((strncmp gdispstr "-" 1) (setq gdispstr (strsub gdispstr 1 (- (strlen gdispstr) 1))) ) (t (setq gdispstr (strcat "-" gdispstr)) ) ) (dispstr gdispstr 6052991) ) ) ) (de ops () (setq gbinop (eval (string_to_atom (caar (cndr rowcol kbd)))) gax (strtoinf gdispstr) gdispstr "" gfnumenting nil)) (de "rowcol.19" () (cond (gfnumenting (setq gbx (strtoinf gdispstr) gfnumenting nil) ) ) (setq gax (gbinop gax gbx) gdispstr (inftostr gax)) (dispstr gdispstr 6052991) ) (de "stdin.1" (lline x y row col rowcol) (setq x (strtol (cdar lline) 10) y (strtol (cddar lline) 10) row (/ (- y 1200) 1200) col (/ (- x 200) 2000) rowcol (+ (* row 4) col)) ((eval (strcat "rowcol." (ltoa rowcol 10)))) ) (for '("4" "5" "6" "8" "9" "10" "12" "13" "14" "16" "17") (lambda (rowcolstr) (set (strcat "rowcol." rowcolstr) numbers) ) ) (for '("3" "7" "11" "15") (lambda (rowcolstr) (set (strcat "rowcol." rowcolstr) ops) ) ) (myputs "Fo 0 611 3\nFo 2 140 3\n") (dispstr "0" 6052991) (while t (setq lline (strtok (fgets stdin) " \t")) (cond ((eqv (car lline) "drawapp") ("stdin.drawapp")) ((eqv (car lline) "QUERY_REMOTE") ("stdin.QUERY_REMOTE")) ((== (strtol (car lline) 10) 1) ("stdin.1" lline)) ((< (setq x (strtol (cdar lline) 10)) 0) (setq button (strtol (car lline) 10)) (setq y (strtol (cddar lline) 10)) (cond ((eqv x -2) (cond ((|| (eqv button 111) (eqv button 79)) (setq rowcol 0) ("rowcol.0")) ((|| (eqv button 99) (eqv button 67)) (setq rowcol 1) ("rowcol.1")) ((eqv button 8) (setq rowcol 2) ("rowcol.2")) ((eqv button 42) (setq rowcol 3) ("rowcol.3")) ((eqv button 55) (setq rowcol 4) ("rowcol.4")) ((eqv button 56) (setq rowcol 5) ("rowcol.5")) ((eqv button 57) (setq rowcol 6) ("rowcol.6")) ((eqv button 47) (setq rowcol 7) ("rowcol.7")) ((eqv button 52) (setq rowcol 8) ("rowcol.8")) ((eqv button 53) (setq rowcol 9) ("rowcol.9")) ((eqv button 54) (setq rowcol 10) ("rowcol.10")) ((eqv button 43) (setq rowcol 11) ("rowcol.11")) ((eqv button 49) (setq rowcol 12) ("rowcol.12")) ((eqv button 50) (setq rowcol 13) ("rowcol.13")) ((eqv button 51) (setq rowcol 14) ("rowcol.14")) ((eqv button 45) (setq rowcol 15) ("rowcol.15")) ((eqv button 48) (setq rowcol 16) ("rowcol.16")) ((eqv button 46) (setq rowcol 17) ("rowcol.17")) ((|| (eqv button 105) (eqv button 73)) (setq rowcol 18) ("rowcol.18")) ((eqv button 61) (setq rowcol 19) ("rowcol.19")) ) ) ((eqv x -4) (myputs (strcat "Rz " (ltoa button 10) " " (ltoa y 10))) ) ((eqv x -5) (myputs (strcat "Mv " (ltoa button 10) " " (ltoa y 10))) ) ) ) ) )