Commit 83997ca7 authored by David Byers's avatar David Byers
Browse files

Catch all errors reading user area

Skip newlines between strings in the user area
parent e8c97a05
1999-12-02 David Byers <davby@sen2.ida.liu.se>
* flags.el (lyskom-read-options-eval-get-holerith): Skip newlines
too.
(lyskom-read-options-eval): Surround everything with a catch-all
error handler or we won't be able to log in if the user area is
broken.
1999-12-01 David Byers <davby@ida.liu.se> 1999-12-01 David Byers <davby@ida.liu.se>
* compatibility.el (decode-coding-string, encode-coding-string): * compatibility.el (decode-coding-string, encode-coding-string):
......
...@@ -351,96 +351,99 @@ If successful then set the buffer not-modified. Else print a warning." ...@@ -351,96 +351,99 @@ If successful then set the buffer not-modified. Else print a warning."
(defun lyskom-read-options-eval (text) (defun lyskom-read-options-eval (text)
"Handles the call from where we have the text." "Handles the call from where we have the text."
(if text ;+++ Other error handler (condition-case nil
(let* ((lyskom-options-text (text->text-mass text)) (if text ;+++ Other error handler
(pointers (lyskom-read-options-eval-get-holerith t)) (let* ((lyskom-options-text (text->text-mass text))
common-no elisp-no (pointers (lyskom-read-options-eval-get-holerith t))
(rest lyskom-options-text) common-no elisp-no
working (rest lyskom-options-text)
(r 1)) working
(let* ((lyskom-options-text pointers) (r 1))
word (let* ((lyskom-options-text pointers)
(r 1)) word
(while (> (length lyskom-options-text) 2) (r 1))
(setq word (lyskom-read-options-eval-get-holerith t))
(cond
((lyskom-string= word "common")
(setq common-no r))
((lyskom-string= word "elisp")
(setq elisp-no r))
(t
;; Build up lyskom-other-clients-user-areas so that it
;; contains a list of pairs: (name . number). (string, int).
(setq lyskom-other-clients-user-areas
(cons (cons word r) lyskom-other-clients-user-areas))))
(++ r)))
(setq lyskom-other-clients-user-areas
(nreverse lyskom-other-clients-user-areas))
(setq lyskom-options-text rest)
(while (> (length lyskom-options-text) 2)
(setq working (lyskom-read-options-eval-get-holerith t))
(cond
;; Note that common-no may be nil here, so the comparison
;; cannot be performed with '=.
((equal r common-no)
(let ((lyskom-options-text working)
name gname value)
(while (> (length lyskom-options-text) 2) (while (> (length lyskom-options-text) 2)
(setq gname (lyskom-read-options-eval-get-holerith)) (setq word (lyskom-read-options-eval-get-holerith t))
(setq value (lyskom-read-options-eval-get-holerith)) (cond
(setq name (concat "kom-" gname)) ((lyskom-string= word "common")
(if (memq (intern-soft name) lyskom-global-boolean-variables) (setq common-no r))
(if (string= value "1") ((lyskom-string= word "elisp")
(setq value "t") (setq elisp-no r))
(setq value "nil")) (t
(if (memq (intern-soft name) ;; Build up lyskom-other-clients-user-areas so that it
lyskom-global-non-boolean-variables) ;; contains a list of pairs: (name . number). (string, int).
nil (setq lyskom-other-clients-user-areas
(setq name (concat "UNK-" gname)) (cons (cons word r) lyskom-other-clients-user-areas))))
(setq lyskom-global-non-boolean-variables (++ r)))
(cons name lyskom-global-non-boolean-variables)))) (setq lyskom-other-clients-user-areas
(lyskom-maybe-set-var-from-string name value)))) (nreverse lyskom-other-clients-user-areas))
;; Note that elisp-no may be nil here, so the comparison (setq lyskom-options-text rest)
;; cannot be performed with '=. (while (> (length lyskom-options-text) 2)
((equal r elisp-no) (setq working (lyskom-read-options-eval-get-holerith t))
(let ((lyskom-options-text working) (cond
name value) ;; Note that common-no may be nil here, so the comparison
(while (> (length lyskom-options-text) 2) ;; cannot be performed with '=.
(setq name (lyskom-read-options-eval-get-holerith)) ((equal r common-no)
(setq value (lyskom-read-options-eval-get-holerith)) (let ((lyskom-options-text working)
(lyskom-maybe-set-var-from-string name value)))) name gname value)
(t (while (> (length lyskom-options-text) 2)
(setq gname (lyskom-read-options-eval-get-holerith))
(setq value (lyskom-read-options-eval-get-holerith))
(setq name (concat "kom-" gname))
(if (memq (intern-soft name) lyskom-global-boolean-variables)
(if (string= value "1")
(setq value "t")
(setq value "nil"))
(if (memq (intern-soft name)
lyskom-global-non-boolean-variables)
nil
(setq name (concat "UNK-" gname))
(setq lyskom-global-non-boolean-variables
(cons name lyskom-global-non-boolean-variables))))
(lyskom-maybe-set-var-from-string name value))))
;; Note that elisp-no may be nil here, so the comparison
;; cannot be performed with '=.
((equal r elisp-no)
(let ((lyskom-options-text working)
name value)
(while (> (length lyskom-options-text) 2)
(setq name (lyskom-read-options-eval-get-holerith))
(setq value (lyskom-read-options-eval-get-holerith))
(lyskom-maybe-set-var-from-string name value))))
(t
(let ((pos lyskom-other-clients-user-areas))
(while (and pos
(not (equal
(cdr (car pos)) ;The position or the string.
r)))
(setq pos (cdr pos)))
(if pos
(setcdr (car pos) working))))) ;Insert the string
;where the position
;was stored.
(++ r))
(mapcar 'lyskom-recompile-filter kom-permanent-filter-list)
(mapcar 'lyskom-recompile-filter kom-session-filter-list)
(setq lyskom-filter-list (append kom-permanent-filter-list
kom-session-filter-list))
(setq lyskom-do-when-done (cons kom-do-when-done kom-do-when-done))
;; Remove not found user-areas
(let ((pos lyskom-other-clients-user-areas)) (let ((pos lyskom-other-clients-user-areas))
(while (and pos
(not (equal
(cdr (car pos)) ;The position or the string.
r)))
(setq pos (cdr pos)))
(if pos (if pos
(setcdr (car pos) working))))) ;Insert the string (progn
;where the position (while (stringp (cdr (car (cdr pos))))
;was stored. (setq pos (cdr pos)))
(++ r)) (setcdr pos nil))))))
(error (lyskom-message (lyskom-get-string 'error-in-options)
(mapcar 'lyskom-recompile-filter kom-permanent-filter-list) (lyskom-get-string 'cancelled))))
(mapcar 'lyskom-recompile-filter kom-session-filter-list)
(setq lyskom-filter-list (append kom-permanent-filter-list
kom-session-filter-list))
(setq lyskom-do-when-done (cons kom-do-when-done kom-do-when-done))
;; Remove not found user-areas
(let ((pos lyskom-other-clients-user-areas))
(if pos
(progn
(while (stringp (cdr (car (cdr pos))))
(setq pos (cdr pos)))
(setcdr pos nil))))))
(setq lyskom-options-done t)) (setq lyskom-options-done t))
(defun lyskom-read-options-eval-get-holerith (&optional no-coding) (defun lyskom-read-options-eval-get-holerith (&optional no-coding)
(let ((coding (if no-coding 'raw-text lyskom-server-coding-system))) (let ((coding (if no-coding 'raw-text lyskom-server-coding-system)))
(while (string-match "\\s-" (substring lyskom-options-text 0 1)) (while (string-match "\\(\\s-\\|[\n\r]\\)" (substring lyskom-options-text 0 1))
(setq lyskom-options-text (substring lyskom-options-text 1))) (setq lyskom-options-text (substring lyskom-options-text 1)))
;; Read the explicit coding, if any ;; Read the explicit coding, if any
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment