emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating a coding system


From: David Kastrup
Subject: Re: Creating a coding system
Date: Sat, 20 Dec 2014 15:19:18 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Andreas Schwab <address@hidden> writes:

> David Kastrup <address@hidden> writes:
>
>> Ok, what am I doing wrong here?  Why does decode-coding-string not do
>> anything here?
>>
>> (define-translation-table 'midi-decode-table
>>   (make-translation-table-from-alist
>>    (mapcar
>>     (lambda (p)
>>       (cons (car p) (string-to-vector (cdr p))))
>>     '(([144 0] . "c,,,,")
>
> The translation table operates on the decoded contents.

Why would something be decoded twice in a row?

>> (prin1 (decode-coding-string "\220\040" 'midi))

> (aref (string-make-multibyte "\220\040") 0) => 4194192

(aref "\220\040" 0) => 144

But admittedly,

    (decode-coding-string (string 144 64) 'midi) => "e'"

which does not make a whole lot of sense to me since my use case

(make-serial-process :port "/dev/snd/midiC1D0"
                     :speed nil
                     :coding 'midi
                     :noquery t)

does absolutely nothing, and that should be decoding from _bytes_ to
_characters_ rather than _characters_ (including some raw-character code
page) to _characters_.

I am missing the big picture here in some manner.  Does decoding not
start from a byte stream but rather from an emacs-utf-8 encoded version
of a byte stream?  That does not seem to make sense to me.

-- 
David Kastrup



reply via email to

[Prev in Thread] Current Thread [Next in Thread]