- (dotimes (i (1- length))
- (let ((weight (ascii-digit char)))
- (cond
- ((and weight (not decimalp)) ;; before decimal point
- (setq before-decimal (+ weight (* 10 before-decimal))))
- ((and weight decimalp) ;; after decimal point
- (setq after-decimal (+ weight (* 10 after-decimal)))
- (incf decimal-count))
- ((and (eql char +char-code-period+) decimalp)
- (setq decimalp t))
- ((or (eql char +char-code-e+) ;; E is for exponent
- (eql char +char-code-upper-e+))
- (multiple-value-bind (num idx)
- (parse-integer string :start (1+ index) :end end
- :radix radix :junk-allowed junk-allowed)
- (setq exponent (or num 0)
- index idx)
- (when (= index end) (return nil))))
+ (block loop
+ (dotimes (i length)
+ (setq char (read-byte socket))
+ ;; (format t "~&len:~D, i:~D, char:~D, minusp:~A, decimalp:~A" length i char minusp decimalp)
+ (let ((weight (ascii-digit char)))
+ (cond
+ ((and weight (not decimalp)) ;; before decimal point
+ (setq before-decimal (+ weight (* 10 before-decimal))))
+ ((and weight decimalp) ;; after decimal point
+ (setq after-decimal (+ weight (* 10 after-decimal)))
+ (incf decimal-count))
+ ((and (= char +char-code-period+))
+ (setq decimalp t))
+ ((or (= char +char-code-lower-e+) ;; E is for exponent
+ (= char +char-code-upper-e+))
+ (setq exponent (read-integer-from-socket socket (- length i 1)))
+ (setq exponent (or exponent 0))
+ (return-from loop))
+ (t
+ (break "Unexpected value"))