[CM] SDIF/lisp question
padovani
josepadovani at yahoo.com.br
Wed Apr 2 08:15:52 PDT 2008
Hi...
I'm trying to deal with sdif files with common lisp functions and, as
composer who tries to deal with code, I have a question that migth be
stupid...
The file that I want to deal begins with these HEX (SDIF header), that
I could read with a standard Hex editor:
53 44 49 46 00 00 00 08 00 00 00 03 00 00 00 01
31 4e 56 54 00 00 00 78 ff ef ff ff ff ff ff ff
00 00 00 00 00 00 00 01 31 4e 56 54 00 00 03 01
00 00 00 57 00 00 00 01 .....
So, I tried to open it on a stream
(setq in-stream (open "mongombi.trc.sdif" :direction :input))
worked.
Then I tried to spell the bytes...
(read-byte in-stream)
and read the bytes... And got:
>>> Error: #<SB-SYS:FD-STREAM for "file
/Users/ze/Documents/documentos/meus/codigos/grace/sdifnovo/mongombi.trc.sdif"
{12B08011}> is not a binary input stream.
so I tried with (read-char ...) as the first bytes represent "SDIF"
chars and then I could spell the first 24 bytes:
(read-char in-stream)
#\S
#\D
#\I
#\F
#\Nul
#\Nul
#\Nul
#\Backspace
#\Nul
#\Nul
#\Nul
#\Etx
#\Nul
#\Nul
#\Nul
#\Soh
#\1
#\N
#\V
#\T
#\Nul
#\Nul
#\Nul
#\x
But when I try to spell the 25th byte, I get:
>>> Error: decoding error on stream
#<SB-SYS:FD-STREAM for "file
/Users/ze/Documents/documentos/meus/codigos/grace/sdifnovo/mongombi.trc.sdif"
{116A67B1}>
(:EXTERNAL-FORMAT :UTF-8):
the octet sequence (255 239 255 255) cannot be decoded.
This is the "ff ef ff ff ff ff ff ff" part of the HEX transcription of
the file...
It seems I'm not getting something related to streams, but really can't
understand...
If anyone can give some ligth sbout how to deal with this on common-lisp
or how to use the sdif library in common lisp it wold be really nice...
Thanks,
José H. Padovani
More information about the Cmdist
mailing list