Skip to content

Commit

Permalink
Fixed extra newlines on clisp.
Browse files Browse the repository at this point in the history
When calling princ on clisp with a string that contains embedded
newlines, it seems to print an extra newline before printing the
string.
  • Loading branch information
njm64 committed Feb 20, 2023
1 parent 2468418 commit b90dcfa
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions op.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@
(write-var var (1- (read-signed-var var))))

(def-op (:1op #x07 "print-addr") (addr)
(princ (decode-text addr)))
(let ((s (decode-text addr)))
(write-sequence s *standard-output*)))

(def-op (:1op #x09 "remove-obj") (obj)
(obj-remove obj))
Expand All @@ -148,7 +149,8 @@
(incf *pc* (- (u16->s16 offset) 2)))

(def-op (:1op #x0d "print-paddr") (addr)
(princ (decode-text (* addr 2))))
(let ((s (decode-text (* addr 2))))
(write-sequence s *standard-output*)))

(def-op (:1op #x0e "load" :store t) (var)
(when (zerop var)
Expand All @@ -170,7 +172,7 @@

(def-op (:0op #x02 "print") ()
(multiple-value-bind (s byte-len) (decode-text *pc*)
(princ s)
(write-sequence s *standard-output*)
(incf *pc* byte-len)))

(def-op (:0op #x03 "print-ret") ()
Expand Down

0 comments on commit b90dcfa

Please sign in to comment.