Subject: [clisp-list] ext:write-integer

From: "Randolph Udodenko" <[email-masked]>
Date: Wed Jul 21 15:02:01 2004

Hello, All!

(ext:write-integer -1 stream '(signed-byte 32))
writes there integer that was written there previously. it should at least
say something, i think 8-]
it will be great if it work, otherwise one has to use something like

(loop for i from 0 to 24 by 8 do (write-byte (ldb (byte 8 i) -1) s))

8-[

With best regards, Randolph Udodenko.

---

From: Sam Steingold <[email-masked]>
Date: Wed Jul 21 15:29:03 2004

> * Randolph Udodenko <[email-masked]> [2004-07-22 00:47:44 +0300]:
>

Sorry, I do not understand the question.

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.honestreporting.com>
A PC without Windows is like ice cream without ketchup.

---

From: "Randolph Udodenko" <[email-masked]>
Date: Thu Jul 22 07:23:37 2004

hello

hm, look's like previous message is somewhat messy.. 8-]

when i write (ext:write-integer data stream '(unsigned-byte 32)) it works
well.
but i needed to write there negative numbers too.
so i thought that '(signed-byte 32) will work as well.
there was no error raised, but it wrote incorrect data to my file. (that
incorrect data is last one integer that is written with '(unsigned-byte 32)
or some garbage).
so i think it should at least report error - that '(signed-byte 32) is not
acceptable.
or better it should support '(signed-byte 32) - it will increase usefullness
of this function a lot with almost no cost.

by the way, thanks people who develop clisp for clisp. 8-] it's my favourite
Common Lisp implementation under win32..

---

From: Sam Steingold <[email-masked]>
Date: Thu Jul 22 10:30:24 2004

> * Randolph Udodenko <[email-masked]> [2004-07-22 17:22:59 +0300]:
>
> or better it should support '(signed-byte 32) - it will increase
> usefullness of this function a lot with almost no cost.

thanks for the bug report.
patch appended.

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.honestreporting.com>
God had a deadline, so He wrote it all in Lisp.

Index: stream.d
===================================================================
RCS file: /cvsroot/clisp/clisp/src/stream.d,v
retrieving revision 1.438
retrieving revision 1.439
diff -u -w -b -u -b -w -i -B -r1.438 -r1.439
--- stream.d	2 Jun 2004 21:32:30 -0000	1.438
+++ stream.d	22 Jul 2004 17:27:35 -0000	1.439
@@ -4378,8 +4378,7 @@
   # obj is an integer
   # transfer obj into the bitbuffer:
   {
-    var uintB* bitbufferptr =
-      TheSbvector(TheStream(stream)->strm_bitbuffer)->data;
+    var uintB* bitbufferptr = TheSbvector(bitbuffer)->data;
     var uintL count = bytesize;
     var uintL sign = (sintL)R_sign(obj);
     if (fixnump(obj)) {