From: Andy Reiter
Subject: bit-manipulation and Win32 FFI help needed.
Date: 
Message-ID: <d4b78695.0210181445.3f3911a9@posting.google.com>
Hi,

I have two problems with my newbie lisping:

1)(with-open-file (input "C:/windows/intel/file.exe" :direction :input
		       :element-type 'unsigned-byte)
		(do ( .. )
		    ..
		    (let ((byte (read-byte input)))
		      (format t "not ~X = ~X" byte (bit-not byte)))))

Gives me an error, saying 'byte' is a fixnum and not a bit array. How do I
convert the read symbol into a bit-vector? COERCE is telling me to make 'byte'
a sequence. Actually, I know how to go about the conversation (thanks to mod,
shift and a carry-flag variable ;-) but there ought to be an standard way.


2) Is there any way to call C from Clisp or vice versa, on Windows? Both the
impnotes and the sample code in $CLISP/modules are documenting the Unix module
facility, and they all use the "clisp-link" utility which is nowhere in Win32.
Also, the examples and the documentation talk about "clisp.a" and "clisp.h"
which are nowhere in my system (I am using Clisp 2.30 on Win98)

If someone can show me an example, I would really appreciate it.

From: Wade Humeniuk
Subject: Re: bit-manipulation and Win32 FFI help needed.
Date: 
Message-ID: <M01s9.22133$wU3.2111508@news0.telusplanet.net>
"Andy Reiter" <·······@flop.co.uk> wrote in message
·································@posting.google.com...
> Hi,
>
> I have two problems with my newbie lisping:
>
> 1)(with-open-file (input "C:/windows/intel/file.exe" :direction :input
>        :element-type 'unsigned-byte)
> (do ( .. )
>     ..
>     (let ((byte (read-byte input)))
>       (format t "not ~X = ~X" byte (bit-not byte)))))
>
> Gives me an error, saying 'byte' is a fixnum and not a bit array. How do I
> convert the read symbol into a bit-vector? COERCE is telling me to make 'byte'
> a sequence. Actually, I know how to go about the conversation (thanks to mod,
> shift and a carry-flag variable ;-) but there ought to be an standard way.
>

Take a look at the function boole

http://www.lispworks.com/reference/HyperSpec/Body/f_boole.htm

something like

CL-USER 5 > (boole boole-xor #xff #xff)
0

CL-USER 6 > (boole boole-xor #x00 #xff)
255

CL-USER 7 >



>
> 2) Is there any way to call C from Clisp or vice versa, on Windows? Both the
> impnotes and the sample code in $CLISP/modules are documenting the Unix module
> facility, and they all use the "clisp-link" utility which is nowhere in Win32.
> Also, the examples and the documentation talk about "clisp.a" and "clisp.h"
> which are nowhere in my system (I am using Clisp 2.30 on Win98)
>
> If someone can show me an example, I would really appreciate it.

Don't know.


--
Wade

Email: (format nil ···@~A.~A" "whumeniu" "telus" "net")
From: Frode Vatvedt Fjeld
Subject: Re: bit-manipulation and Win32 FFI help needed.
Date: 
Message-ID: <2hbs5qzuyg.fsf@vserver.cs.uit.no>
·······@flop.co.uk (Andy Reiter) writes:

> [..] Gives me an error, saying 'byte' is a fixnum and not a bit
> array. How do I convert the read symbol into a bit-vector?

Maybe the question whose answer you really seek is "how do I perform
the bit-wise not operation on integers?" If so, the answer is to use
the function lognot.

-- 
Frode Vatvedt Fjeld